
让你的AI代理能够即时API查找,而不是昂贵的源文件读取。支持C#、Go、Java、Python和TypeScript的MCP服务器。
概览
解析源文件,提取公共类/方法/属性/字段/事件,并通过5个MCP工具提供。支持Claude Code、Cursor、Windsurf或任何兼容MCP的AI工具。 C#(.cs)、C++ 头部(.h、.hpp、.hxx、.h++)、Go (.go)、Java (.java)、Python(.py)、TypeScript/JavaScript(.ts、.tsx、.js、.jsx) 将 --project 指向包含支持源文件的任意目录(Unity Assets/Scripts 文件夹、Spring Boot 项目、.NET src/tree、Node.js/React 项目、Python 包等)。语言是自动检测的。 重启你的AI工具,问自己:“MyService有哪些方法?” 把它添加到你项目的 CLAUDE.md(或等效的指令文件)。没有它,AI虽然有工具,但不知道什么时候该用。 搜索、get_signature和get_class接受两个可选过滤器: - file_path:作用域结果为目录前缀或精确文件(例如“src/services/” 或 “src/services/MergeService”。
概述(AI 翻译)
MCP服务器在启动时索引你代码库的公共API,并通过简洁工具响应提供,节省令牌而非读取源文件。
解析源文件,提取公共类/方法/属性/字段/事件,并通过5个MCP工具提供。支持Claude Code、Cursor、Windsurf或任何兼容MCP的AI工具。
支持的语言: C# ([.cs)、C++ 头部(.h、.hpp、.hxx、.h++)、Go (.go)、Java (.java)、Python (.py)、TypeScript/JavaScript (.ts、.tsx、.js、.jsx)
快速启动
补充你的.mcp.json:
将--project指向包含支持源文件的任意目录(Unity的Assets/Scripts文件夹、Spring Boot项目、.NET src/树、Node.js/React项目、Python包等)。语言会自动检测。
重启你的AI工具,问:“MyService有哪些方法?”*
CLAUDE.md 片段
将此添加到你的项目的CLAUDE.md(或等效指令文件)中。**这一步很重要。**没有它,AI拥有工具,但不会知道何时使用它们。
`
工具
| 工具 | 目的 | 示例 |
|---|
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
codesurface
MCP server that indexes your codebase’s public API at startup and serves it via compact tool responses, saving tokens vs reading source files.
Parses source files, extracts public classes/methods/properties/fields/events, and serves them through 5 MCP tools. Works with Claude Code, Cursor, Windsurf, or any MCP-compatible AI tool.
Supported languages: C# (.cs), C++ headers (.h, .hpp, .hxx, .h++), Go (.go), Java (.java), Python (.py), TypeScript/JavaScript (.ts, .tsx, .js, .jsx)
Quick Start
Add to your .mcp.json:
{
"mcpServers": {
"codesurface": {
"command": "uvx",
"args": ["codesurface", "--project", "/path/to/your/src"]
}
}
}
Point --project at any directory containing supported source files (a Unity Assets/Scripts folder, a Spring Boot project, a .NET src/ tree, a Node.js/React project, a Python package, etc.). Languages are auto-detected.
Restart your AI tool and ask: “What methods does MyService have?”
CLAUDE.md Snippet
Add this to your project’s CLAUDE.md (or equivalent instructions file). This step is important. Without it, the AI has the tools but won’t know when to reach for them.
## Codebase API Lookup (codesurface MCP)
Use codesurface MCP tools BEFORE Grep, Glob, Read, or Task (subagents) for any class/method/field lookup. This applies to you AND any subagents you spawn.
| Tool | Use when | Example |
|------|----------|---------|
| `search` | Find APIs by keyword | `search("MergeService")` |
| `get_signature` | Need exact signature | `get_signature("TryMerge")` |
| `get_class` | See all members on a class | `get_class("BlastBoardModel")` |
| `get_stats` | Codebase overview | `get_stats()` |
安装
uvx codesurface --project /path/to/your/src配置
{
"mcpServers": {
"codesurface": {
"command": "uvx",
"args": ["codesurface", "--project", "/path/to/your/src"]
}
}
}