codelens-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@codelens-mcpshow me the overview of src/utils.ts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
codelens-mcp
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.
Tool | What it does |
| Per-file structural overview of a whole directory tree in one call. Skips |
| One file's top-level structure: imports, exports, classes (with method names), functions — all with 1-based |
| Every addressable function in a file — nested functions, methods, getters/setters, class-field arrows, object-literal properties, default exports — with reconstructed signatures, param types, return type, |
| All comments with line ranges, kind ( |
| Verbatim source of one function (with decorators) by bare or dotted name ( |
| "Where is X defined?" — locate function/method/class definitions by name across a directory. Definitions only, not call sites. |
| Server self-description: version, working directory (the path sandbox root), languages, caps. |
overview, functions, and comments accept a single path or an array of up
to 20 paths per call.
Related MCP server: code-analyze-mcp
Languages
Extension | Language | Grammar |
| TypeScript | tree-sitter-typescript |
| TypeScript + JSX | tree-sitter-tsx (dedicated grammar — JSX parses correctly) |
| JavaScript | tree-sitter-javascript |
| Python | tree-sitter-python |
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
npm install
npm run build # tsc → dist/
npm test # build + 62 tests (51 unit, 11 stdio e2e)
node dist/index.js # stdio MCP server (launch from the project to analyze)MCP client config:
{
"mcpServers": {
"codelens": {
"command": "node",
"args": ["/path/to/codelens-mcp/dist/index.js"],
"cwd": "/path/to/project-to-analyze"
}
}
}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.
This server cannot be installed
Maintenance
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/segentic-lab/codelens-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server