
Codelens Mcp
io.github.segentic-lab由 GitHub 帳號 segentic-lab 發布v0.2.0更新於 Oct 24, 2026
Deterministic code maps for AI agents: 7 tree-sitter tools for TS/JS/Py — map, find, function_body
概覽
一個本機 stdio MCP 伺服器,為助理提供 TypeScript、JavaScript 與 Python 程式碼的確定性結構地圖,讓它不必讀取整個檔案就能定位程式碼。
- 可以做什麼
- 一次呼叫即可產生整個目錄樹中每個檔案的結構概覽,並略過 node_modules、dist 與隱藏目錄。概述單一檔案的匯入、匯出、類別與函式,並附上行號範圍。列出所有可定址的函式及其簽章、型別與父層作用域,並依名稱讀取某個函式的原始原始碼。在目錄中尋找函式、方法或類別的定義位置,並列出帶有 TODO/FIXME 類標記的註解。回報伺服器版本、沙箱根目錄、支援的語言與各項上限。
- 適用情境
- 當助理在 TypeScript、JavaScript 或 Python 專案中工作,需要快速掌握專案結構、定位定義,或只取單一函式主體而不把整個檔案讀進上下文時適用。請注意 README 說明此專案已被後繼伺服器取代,不再繼續開發。
- 執行需求
- 本機 Node.js 18+ 執行環境;README 的安裝步驟以 npm 從原始碼建置,並以 stdio 執行編譯後的進入點。需從要分析的專案目錄啟動,因為它只讀取工作目錄下的檔案。未宣告任何帳號、金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Codelens Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
codelens-mcp
⚠️ Superseded by lens-mcp
codelens has merged into
lens-mcp— one MCP server that maps both code and markdown docs. It carries every codelens tool (map,overview,functions,function_body,comments,find,info) unchanged, plus doc tools (outline,heading,links,search) and a unifiedmapthat returns a whole project's code structure and doc outlines in one call.Use lens-mcp instead —
git clone https://github.com/segentic-lab/lens-mcp. This repo remains only so existing links resolve; it is no longer developed.(The description below is retained for reference.)
Deterministic structural code maps for AI agents. An MCP server (stdio) that gives agents the shape of a codebase — imports, exports, classes, functions, signatures, comments, TODO-markers — without reading whole files into context. Powered by tree-sitter WASM grammars: no native build step, installs anywhere Node 18+ runs.
The contract: codelens is a navigation map. Use it to locate code, then
Read the actual source before judging or modifying it. A signature is not
the body; an outline is not the section.
Tools
7 read-only tools. Every list in every response is capped, and every cap is
reported with an explicit truncated flag — no silent cutoffs.
overview, functions, and comments accept a single path or an array of up
to 20 paths per call.
Languages
Path sandbox
The server only reads files under its own working directory (the directory
it was launched from). Relative paths resolve against it; absolute paths are
accepted only if they point inside it; symlinks that escape it are rejected.
The info tool reports the root, and every rejection names it. Launch the
server from the project you want mapped.
Honesty guarantees
- A file with syntax errors is never reported as a clean success:
hasErrors: trueplusparseErrorsline ranges, because tree-sitter error-recovery can drop code near the error. - Errors set
isErroron the MCP result and return{error, path, hint}— the hint says how to fix the call. - Batch calls return per-file results plus an honest
{requested, succeeded, failed}summary;isErroronly when every file failed. - Every cap is visible:
truncatedflags carry the true totals.
Install & run
MCP client config:
For agent authors
AGENTS.md in this repo is a paste-ready guide for teaching an agent to use
these tools well — core model, per-tool tips, and the pitfalls (path sandbox,
language coverage, the map-vs-territory rule).
License
AGPL-3.0 — see LICENSE.
來源:README.md,提交 9c05ee5
工具
0版本歷史
1- v0.2.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分