
Codecanvas
io.github.donggyun112由 GitHub 帳號 donggyun112 發布v0.1.20更新於 Oct 24, 2026
Python code intelligence for coding agents: call paths, control flow, and change impact.
概覽
針對 Python 的本地靜態分析 MCP 伺服器,可回答呼叫路徑、控制流、副作用與變更影響等問題。
- 可以做什麼
- 了解專案:檢視目前分析根目錄、檔案數量、快取與巢狀專案候選,並列出 FastAPI 路由、腳本與公開匯出。
- 定位程式碼:以精確、語意或混合名稱搜尋函式、方法與類別。
- 解釋行為:呈現函式的分支、帶條件的回傳與拋出、下游呼叫與副作用,或結構化分支樹。
- 追蹤呼叫:向上走訪直接或間接呼叫者,向下走訪專案內部被呼叫者並標註副作用。
- 核對主張與變更:保守驗證某來源是否可達目標,並把 diff 或 git 參照對應到變更的函式與受影響入口。
- 重現狀態類缺陷:將函式的狀態讀寫與呼叫端提供的 schema 比對,並執行聚焦的狀態轉換案例。
- 適用情境
- 適合程式碼助理在不逐檔閱讀的情況下理解陌生或大型 Python 專案,例如找出誰呼叫某函式、副作用發生在哪裡、在哪些條件下會拋出例外,或某次變更影響哪些路由。它補充而非取代 grep 與語言伺服器。
- 執行需求
- 透過 stdio 在本機執行,以 uvx 從 PyPI 套件 codecanvas-mcp 啟動,因此需先安裝 uv。需要 Python 3.10 或更新版本,且被分析的專案必須是 Python。第一次呼叫工具時需傳入絕對路徑 project_path。可用 CODECANVAS_MAX_FILES、CODECANVAS_BATCH_SIZE、CODECANVAS_THROTTLE_MS 調整大型專案行為。不需帳號、API 金鑰或遠端服務。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Codecanvas,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[CodeCanvas MCP — Trace the truth]
CodeCanvas MCP
[PyPI] [Python] [License: MIT]
Understand an unfamiliar Python system before spending thousands of tokens reading it file by file.
CodeCanvas is a local static-analysis Model Context Protocol server for Python. It turns project-wide call paths and control flow into compact, citation-ready answers about branches, callers, callees, side effects, and change impact.
The benchmark now spans pinned revisions of Google ADK, LangGraph, and
FastAPI. On an Apple M4 Pro, measured cold analysis ranged from 4.38s to
61.62s, and median warm find_symbols latency ranged from 48.264ms to
293.778ms across those repositories. In a controlled 54-session agent suite,
both conditions kept the same built-in code-search tools; the treatment added
only logic_flow. That single addition used a median 22.95% fewer total
tokens across three paired repetitions, demonstrating meaningful incremental
value on top of ordinary code exploration. Uncached tokens increased by 0.78%,
and the answers are not yet blind-graded. See the methodology, full tables, and
limitations.
Use it to answer questions such as:
- Who calls this function, directly or transitively?
- What can this function reach, and where do side effects happen?
- Under which guards can this return or exception occur?
- Does this source really reach that target in the requested mode?
- Which API routes, scripts, or public exports are affected by a diff?
CodeCanvas is Python-only and requires Python 3.10 or newer.
See the difference
Ask one question:
Excerpt from the actual response on the included FastAPI sample:
That single response exposes the early return, success path, downstream database work, exact source locations, and how cautiously the agent may summarize the result.
Quick start
Install uv if uvx is not already available.
The repository includes one shared plugin package with native manifests for
both Claude Code and Codex. Install it from the CodeCanvas marketplace:
Both plugins start uvx codecanvas-mcp and expose the complete tool catalog.
See the plugin package for local-checkout testing
and validation commands.
If your client does not support plugins, register the server directly. For Claude Code:
That command exposes the complete tool catalog. Keep the full catalog enabled when your MCP client supports on-demand tool discovery or tool search: the client can load the relevant schemas only when they are needed, so the other CodeCanvas tools remain available without paying their schema cost on every model request.
If your client eagerly injects every enabled tool schema into every model request, use this compatibility profile instead:
The three-tool allow-list is a fallback for eager-schema clients, not a recommendation to discard the rest of CodeCanvas. For another MCP client, use the equivalent stdio configuration:
Pass an absolute project_path on the first tool call. CodeCanvas remembers the
last explicitly selected project for the rest of the server session.
With the complete catalog enabled, project_status reports candidate analysis
roots for nested Python projects. Compact-profile users should pass the intended
nested root explicitly.
Teach your agent when to use it
Adding tools does not guarantee that an agent will choose them at the right
time. Put a short instruction like this in AGENTS.md, CLAUDE.md, or the
equivalent file used by your coding agent:
Then ask your agent naturally:
With the complete catalog enabled, CodeCanvas can also answer:
Why not just grep or an LSP?
CodeCanvas complements both. It is for behavioral questions that otherwise require repeated searches and manual reconstruction.
What makes the answers trustworthy
Static analysis is not runtime truth, so CodeCanvas makes uncertainty visible instead of hiding it.
Every successful MCP response identifies the selected analysis_root and
includes metadata that helps an agent decide how strongly it may state the
result:
evidence_gradedescribes the strength of the resolved evidence.inferred_edge_countandambiguous_callsexpose uncertain call edges.truncatedsays whether the bounded response omitted results.safe_to_summarizesays whether the result supports an unconditional claim.response_guidanceexplains how to qualify a result when it does not.
verify_claim goes further by combining candidate call paths with branch and
return/raise guards. It returns true, false, or uncertain; unsupported
qualifiers and inferred-only paths cannot silently become a definite true.
Tools
Discover and understand
Follow behavior and assess change
Reproduce state-shaped bugs
Large result sets are capped. Use each tool's filter, kind, path, depth,
or pagination arguments to narrow the answer before treating it as complete.
How it works
- Select a project. CodeCanvas resolves and remembers an explicit Python project root. Ambiguous nested roots must be selected rather than guessed.
- Build structural indexes. Python AST analysis builds a project-wide call
graph and per-function control-flow data. Extractors add FastAPI routes and
Depends()chains, scripts, generic function entrypoints, and package exports. - Reuse compatible analysis. The call graph and entrypoints are cached in
<project>/.codecanvas/; an in-process builder is reused during the MCP session. - Project compact answers. Each MCP tool queries the shared analysis and returns bounded results with origin, evidence, ambiguity, and truncation metadata.
The default analysis limit is 5,000 Python files. Tune large-project behavior with:
Safety and limitations
- CodeCanvas analyzes Python source; it does not model every possible dynamic import, monkey patch, reflection path, or runtime value.
- Inferred and ambiguous edges are reported as qualifications, not promoted to definite evidence.
- Static-analysis tools read project files and write the local
.codecanvas/cache. No remote CodeCanvas service is required. simulate_state_transitionis different: it imports and executes trusted project code in a separate process. It is isolation for focused repros, not a security sandbox. Project code may still access the filesystem, network, or subprocesses and may have import-time side effects.- The simulator prefers
<project>/.venvorvenv, then the same directories in the parent project. Usepython_executableto choose explicitly and check the returnedworkermetadata when imports fail.
Evidence
The measured local latency suite covers three pinned projects with 148–1,650 Python files and 4,468–16,960 indexed functions. It reports cold analysis, first and warm search latency, and eight-worker throughput; the raw result is committed with the benchmark artifacts.
The model-backed evaluation covers frozen tasks and hidden rubrics for Google
ADK, LangGraph, and FastAPI. It compares built-in code exploration plus
logic_flow against the same built-in exploration alone. Across 54 isolated
sessions, three paired repetitions produced a suite-wide median of 22.95% fewer
server-reported total tokens. All 27 treatment sessions completed the required
tool call, providing direct evidence that one CodeCanvas tool adds meaningful
value without replacing the agent's existing search tools. Uncached input plus
output increased by a median 0.78%, and the answers are not yet blind-graded,
so this is not yet an efficiency-at-equal-quality or billing-cost claim.
See the full methodology, result tables, reproduction commands, and audit artifacts.
Development
The package source lives under core/. The root test configuration runs both
the product tests in tests/ and the package-level tests in core/tests/.
Issues and focused reproduction cases are welcome: https://github.com/donggyun112/codecanvas/issues.
License
CodeCanvas MCP is open-source software licensed under the MIT License.
來源:README.md,提交 e427af4
工具
0版本歷史
1- v0.1.20最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分