
Codesurface
io.github.Codeturion由 GitHub 帳號 Codeturion 發布v0.8.0更新於 Nov 10, 2026
Indexes your codebase's public API and serves it via compact MCP tool responses.
概覽
為本機程式碼庫的公開 API 建立索引,向 AI 助理提供精簡的類別、方法與簽章查詢結果。
- 可以做什麼
- 啟動時解析原始碼檔案,擷取公開的類別、方法、屬性、欄位與事件並建立本機索引。提供五個工具:search 依關鍵字尋找 API,get_signature 取得精確簽章,get_class 取得含所有公開成員的類別參考卡,get_stats 查看索引概況,reindex 執行增量更新。結果包含檔案路徑與行號,讓助理只讀取相關片段而非整個檔案。支援 C#、C++ 標頭檔、Go、Java、Python 以及 TypeScript/JavaScript。
- 適用情境
- 當助理需要反覆用 grep 與讀取大型檔案來回答程式碼庫 API 相關問題時,可減少讀取檔案所耗用的 token。適合使用支援語言、且助理主要需要類別與方法查詢而非實作細節的專案。
- 執行需求
- 以本機 stdio 程序執行,通常透過 uvx 或 pip install 啟動,需要 Python 3.10 以上版本以及 mcp[cli] 套件。必須以 --project 指定含支援原始碼檔案的目錄,語言會自動偵測。未宣告需要帳號、API 金鑰或網路存取。僅支援桌面端,不提供網頁可執行版本。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Codesurface,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
codesurface
[PyPI Version] [PyPI Downloads] [MCP Registry] [GitHub Stars] [GitHub Last Commit] [Languages] [License: MIT] [Python 3.10+] [Blog Post]
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:
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.
Tools
search, get_signature, and get_class accept two optional filters:
file_path: scope results to a directory prefix or exact file (e.g."src/services/"or"src/services/MergeService.ts")include_tests: include test files in results (defaultfalse). Detects__tests__/,tests/,test/,*.test.*,*.spec.*,*_test.*,test_*
Tested On
Line Numbers for Targeted Reads
Every record includes line_start and line_end (1-indexed). Multi-line declarations span the full signature:
This lets AI agents do targeted reads instead of reading full files:
Benchmarks
Measured across 5 real-world projects in 5 languages, each using a 10-step cross-cutting research workflow.
[Total Tokens, Cross-Language Comparison]
Even with follow-up reads for implementation detail, the hybrid MCP + targeted Read approach uses 44% fewer tokens than a skilled Grep+Read agent and 87% fewer than a naive agent:
Per-question breakdown
See workflow-benchmark.md for the full step-by-step analysis across all languages.
Filtering What Gets Indexed
By default, codesurface skips common vendored, build, and VCS directories: node_modules, vendor, bin, obj, dist, build, target, .git, .venv, __pycache__, and a few dozen others. Git worktrees and submodules are also skipped.
To exclude additional paths:
Project-level (committed): create a .codesurfaceignore file at your project root with one glob per line.
Per-instance (CLI): pass --exclude with comma-separated globs.
Other indexing flags:
--include-submodules: index git submodules (skipped by default)--language <name>: pin to a single parser (e.g.--language cpp) instead of auto-detecting
Multiple Projects
Each --project flag indexes one directory. To index multiple codebases, run separate instances with different server names:
Each instance gets its own in-memory index and tools. The AI agent sees both and can query across projects.
Setup Details
Alternative installation methods
Using pip install:
Project structure
Troubleshooting
"No codebase indexed"
- Ensure
--projectpoints to a directory containing supported source files (.cs,.h,.hpp,.go,.java,.py,.ts,.tsx,.js,.jsx) - The server indexes at startup. Check stderr for
[codesurface] scanning N files...and[codesurface] done:lines
Server won't start
- Check Python version:
python --version(needs 3.10+) - Check
mcp[cli]is installed:pip install mcp[cli]
Stale results after editing source files
- The index auto-refreshes on query misses. If you add a new class and query it, the server reindexes and retries automatically
- You can also call
reindex()manually to force an incremental update
Contact
License
來源:README.md,提交 3845446
工具
0版本歷史
1- v0.8.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分