LayerMap
Click on "Deploy 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., "@LayerMapwhat calls createUser in src/api/users.ts, traced up to entry points?"
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.
LayerMap
English · 中文
A layered map of your codebase for coding agents. LayerMap gives Claude Code, Codex, DeepSeek Harness and other MCP clients three read-only tools that answer, in one call, what an agent otherwise works out with dozens of searches:
What calls this, and what does changing it affect? Callers traced up to 8 levels, to the HTTP routes, handlers, jobs and commands they start from.
What does it call? Callees down to 8 levels.
What is here? Modules, each file's declarations, and every usage of a symbol.
It maps TypeScript, JavaScript, Go, Python and Java with each language's own compiler, so calls through interfaces, base classes, templates and decorators resolve as the compiler resolves them, including the ones text search misses.
Example
In Miniflux, one call on Storage.MarkFeedAsRead finds all four
ways a request reaches it, each with its route:
DECLARATION internal/storage/entry.go: Storage.MarkFeedAsRead m656-680 exported
← called by internal/api/feed.go: handler.markFeedAsRead m140-155 @149
← called by internal/fever/handler.go: handler.handleWriteFeeds m492-519 @508
← called by internal/googlereader/handler.go: handler.markAllAsReadHandler m1261-1338 @1311
← called by internal/ui/feed_mark_as_read.go: handler.markFeedAsRead m14-30 @24
[1] internal/api/feed.go: handler.markFeedAsRead m140-155
← used as value by internal/api/api.go: Serve f25-84 @61 "/feeds/{feedID}/mark-all-as-read"
[1] internal/googlereader/handler.go: handler.markAllAsReadHandler m1261-1338
← used as value by internal/googlereader/handler.go: Serve f44-64 @62 "/mark-all-as-read"
[1] internal/ui/feed_mark_as_read.go: handler.markFeedAsRead m14-30
← used as value by internal/ui/ui.go: Serve f18-180 @77 "/feed/{feedID}/mark-all-as-read"
… (the Fever API, then on down to main.go: main)m and f mark methods and functions with their lines; @ is the line of the call, and the quoted
path is the route it is registered under.
Related MCP server: PrecisionContextEngine
Results
Impact questions ("which HTTP endpoints does changing this affect?") on public Go, Python and Java projects, graded blind against truth sets cross-checked with each language's own toolchain:
With LayerMap | Without | |
Endpoints found, at most 15 requests ( | 97.9% | 58.8% |
Used unprompted by Claude Code / Codex (plugin installed) | 6 of 6 / 6 of 6 | — |
Endpoints found, no request limit (Claude Code / Codex) | 99.3% / 98.0% | 99.0% / 98.6% |
Cost, no request limit (Claude Code in USD / Codex in input tokens) | −32% / −55% | |
Time, no request limit | +24% / +17% |
With a tight budget, the map finds far more of the affected code, at about 24% more tokens. With no limit, both agents get there either way. The map makes the run cheaper, and the agents explore more widely, which takes longer. These are small samples on tasks written by LayerMap's authors. The report has the setup, the published tasks and the limitations.
How LayerMap differs
Other tools give agents part of this. LayerMap combines compiler accuracy with whole-chain traces in one local map:
Tree-sitter code graphs (codegraph, GitNexus, …) | Language servers and IDEs (Claude Code's LSP tool, Serena, JetBrains) | Embedding search (Claude Context, Augment) | LayerMap | |
How calls are linked | Matched by names, imports and framework rules, often with confidence scores | The compiler's own resolution | Not linked; similar code is retrieved | Resolved by each language's compiler or type checker |
Callers traced to routes and handlers | In several tools, at varying depth | One level per request (JetBrains: 5 by default) | — | Up to 8 levels in one call |
Kept as a map | Yes, with file watching | No, answered live by a running server | An index of code chunks | Yes, brought up to date on every call |
Runs on your machine | Yes; some send anonymous telemetry | Yes | Usually with cloud embeddings | Yes, and sends nothing |
Another tool fits better if you need:
more languages, since tree-sitter graphs cover 30 or more;
Windows;
renaming and refactoring, from language servers;
search by meaning, from embedding search;
search across many repositories, with Sourcegraph.
Install
Claude Code
/plugin marketplace add coffeecoproject/layermap
/plugin install layermap@layermapCodex
codex plugin marketplace add coffeecoproject/layermap
codex plugin add layermap@layermapDeepSeek Harness
npx layermap setup dshThis adds LayerMap to every dsh profile. Each session maps the project dsh was started in, and
npx layermap remove dsh undoes it.
In every agent, start a new session in a Git repository and ask as usual. LayerMap tells the agent
when the map helps. On first launch, npx downloads the pinned layermap package from npm.
Claude Code asks once before each map tool runs in a project. Choose "don't ask again", or run
npx layermap allow claude to allow the plugin's read-only tools everywhere.
Without plugins: run npx layermap setup claude or npx layermap setup codex. Setup does three
things:
registers the server;
lets its read-only tools run without a prompt;
adds one marked sentence to the agent's instructions file.
Use --scope project to set it up for a whole team, and npx layermap remove … to undo it. For any
other MCP client, run npx -y layermap mcp as a stdio server in the repository.
Requirements:
Node.js 22.22 or later.
macOS or Linux (x64 or arm64).
A Git repository.
For Java projects, a JDK 21 or later.
How it works
The first call in a repository builds its map: seconds for a small project, a few minutes for a large one. Later calls re-analyze only what changed, so the map always matches the working tree.
Maps stay in your user cache (~/Library/Caches/layermap, ~/.cache/layermap or
LAYERMAP_CACHE), never in the repository. LayerMap runs entirely on your machine and sends
nothing anywhere (privacy,
security).
Tool | Use |
| A directory, a file, or a declaration's callers and callees ( |
| Find declarations by words in their names, paths or documentation. |
| Every usage of a declaration, compiled from current source. |
The same from the command line:
npx layermap explore src/api/users.ts --name createUser --direction INCOMING --depth 8
npx layermap search "invoice total"
npx layermap refs src/billing/tax.ts calculateTaxFAQ
How long does the first map take? On a recent Mac:
Miniflux (400 Go files): about 3 s.
Polar's server (1,900 Python files): about a minute.
Conductor (1,500 Java and 1,300 TypeScript files): under two minutes.
What can't it see? Calls the compiler cannot resolve statically: dependency injection, unknown framework routing, reflection and computed names. The tools say where a trace stops, and a missing relationship does not prove absence.
Windows? Not yet.
How do I remove it?
Claude Code:
/plugin uninstall layermap@layermap.Codex:
codex plugin remove layermap@layermap.Then delete the cache directory.
Development
You need pnpm, Go 1.24 and a JDK 21+. A missing toolchain leaves its language unanalyzed.
Run pnpm install. On the first install pnpm asks which dependencies may run build scripts; allow
esbuild only, since the SQLite package ships prebuilt binaries:
pnpm approve-builds esbuild '!@photostructure/sqlite'Then run pnpm test, pnpm typecheck or pnpm lint.
pnpm package builds the npm package.
License
Available Tools
3 toolsproject_explore_mapCallers, callees and impact of a change (LayerMap)ARead-onlyIdempotent
Use this before grep or reading files to answer what calls a function or method, what changing it affects (callers traced up to entry points such as HTTP routes, handlers, jobs and commands), what it calls, and what a directory or file contains: one call returns the callers or callees up to 8 levels deep, with file paths and line numbers, for TypeScript, JavaScript, Go, Python and Java. Read the static project map, zooming from the whole project to one declaration. path "." or a directory lists modules, module imports, external packages and its files: with exported declarations when the listing is small, as file names and line counts by directory when larger, and as modules only when very large. Start here to see what exists before searching or reading. A file path lists its declarations and members, imports, importers and top-level statements. A file path with name (or Container.member), optionally narrowed by its start line, or with a line alone, shows that declaration's calls, callers (including uses as a value), writes, heritage, decorators and members, aggregated per related declaration with @line sites; closures and locals are folded into their named container. depth also expands the related declarations hop by hop: up to 8 in one direction, which traces callers up to entry points (INCOMING) or callees down (OUTGOING), and up to 3 for BOTH. To find what a change affects, select the declaration with direction INCOMING and a depth up to 8, continue from any NOT EXPANDED declarations the view names, then confirm the entry points in source. Test files and standard-library call targets are hidden and counted by default; includeTests and includeUnresolved show them. Read source at the printed line ranges. The map is static: calls through an interface, type or base member continue to the members it links as implementations (dispatches to, dispatched from), while trace stops, possible callers by name (calls of a same-named member on a receiver of unknown type), framework wiring and unresolved targets need source reading, and a missing relationship does not prove absence. When a page reports more entries, continue with offset and otherwise unchanged arguments.
| Name | Required | Description | Default |
|---|---|---|---|
| line | No | Start line of a same-named declaration; without name, the declaration containing this line. | |
| name | No | Declaration name or Container.member in the file, as printed by the map. | |
| path | No | "." or a directory for an overview, or a file for its declarations. | . |
| depth | No | Relationship hops for a declaration: up to 8 for INCOMING or OUTGOING (for example callers up to entry points), up to 3 for BOTH. | |
| offset | No | ||
| direction | No | BOTH | |
| includeTests | No | ||
| includeUnresolved | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations only cover the safe-read profile (readOnly, idempotent, non-destructive, closed-world), while the description discloses substantial behavior beyond that: depth caps (8 INCOMING/OUTGOING, 3 BOTH), test files and stdlib targets hidden and counted by default, pagination via offset, and a precise static-analysis limitation model (traces stop, possible callers by name, framework wiring and unresolved targets need source reading, absence is not proof). This is exactly the extra context the annotations cannot supply.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The purpose and starting guidance are front-loaded, but the body is one very long, dense paragraph mixing invocation syntax, output formats, analysis workflow and caveats, with repetition ('before searching or reading' recurs). For a tool this complex some length is warranted, yet several clauses could be split or trimmed without loss.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With 8 parameters, no output schema and no required fields, the description carries the return-shape burden itself and does so: it describes file paths and line numbers, per-declaration aggregation with @line sites, and how listing detail degrades from exported declarations to file names/line counts to modules-only. Edge cases, defaults and continuation are all covered.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Despite only 50% schema description coverage, the description supplies meaning for effectively every parameter: path '.'/directory/file semantics, name as Container.member, line as the containing-or-disambiguating declaration, depth directional caps, direction INCOMING/OUTGOING/BOTH, includeTests/includeUnresolved, and offset used with otherwise unchanged arguments. It materially exceeds the schema text.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description gives a precise set of verbs and resources: it returns callers, callees, impact, directory/module contents and per-declaration detail, with language coverage and line/file output named. The scope (static project map, zooming from project to a single declaration) is unmistakable. What it does not do is name or differentiate itself from the sibling tools it overlaps with (project_find_references, project_search_map), so the agent must infer the boundary itself.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Strong when-to-use guidance: 'Use this before grep or reading files', 'Start here to see what exists before searching or reading', plus a concrete impact-analysis workflow (INCOMING + depth up to 8, continue from NOT EXPANDED declarations, confirm entry points in source). The gap is that the alternatives named (grep) are external, not the actual sibling MCP tools whose overlap with this one is the real routing risk.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
project_find_referencesAll usages of a declaration (LayerMap)ARead-onlyIdempotent
Use this to list every place a declaration is used (calls, imports, re-exports, reads and writes), compiled from current source: more complete than searching for its name. Compute usages of a mapped declaration from current source, including aliases, re-exports and non-call references. Select it with symbol {path,name,line?} as printed by project_explore_map or project_search_map (line is its start line when names repeat), or with an entityRef or locator {path,start,kind}. Broader and more expensive than the cached callers in project_explore_map; file or unsupported declarations may lack a reference target. path and kinds filter usage locations before paging. objects contains compact declarations; targetRef and reference ownerRef identify them. Read a reference at its line range. A file that several compiler contexts read (such as packages of one workspace) lists its references once per context, each with that context's configPath. Continue with nextCursor and unchanged conditions, including after an empty partial page. Filtered exhaustion and missing results do not prove absence.
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Filter usage locations; compiler inputs and declarations may lie elsewhere in the project. | . |
| kinds | No | ||
| cursor | No | ||
| symbol | No | Declaration as printed by the map: file path, name or Container.member, and start line when names repeat. | |
| locator | No | Declaration location: path and UTF-16 start offset; include kind to distinguish declarations at the same offset. | |
| entityRef | No | ||
| maxResults | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the readOnly/idempotent annotations it discloses real behavioral traits: results are compiled from current source, a file read by several compiler contexts lists references once per context with that context's configPath, pagination continues via nextCursor even after an empty partial page, and 'filtered exhaustion and missing results do not prove absence.' That is substantial context the annotations cannot convey.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Purpose is front-loaded and every sentence earns its place, but the content is packed into a single dense paragraph mixing usage, selectors, paging, and output notes. Bullets or a short structure would make it easier to scan for a 7-parameter tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex tool with no output schema and 43% schema coverage, the description covers the critical ground: output shape (objects contains declarations, targetRef/ownerRef identify them), reading a reference at its line range, per-context duplication, and paging. A couple of edge behaviors (e.g., maxResults limits, error modes) are left implicit.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is only 43%, so the description must carry weight, and it does: it explains that path and kinds filter usage locations before paging, defines the symbol {path,name,line?} and locator {path,start,kind} selector shapes, and connects cursor to nextCursor. maxResults is only implied through paging language, leaving one minor gap.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a precise verb and resource ('list every place a declaration is used' enumerating calls, imports, re-exports, reads and writes) and explicitly separates itself from name-search and from the cached callers in project_explore_map. An agent can distinguish it from both siblings without opening a schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives explicit when-to-use ('Use this to list every place a declaration is used') and names the alternatives: preferring search-by-name is discouraged because this is 'more complete', and project_explore_map is called out as the cheaper cached option. It also states the selector entry points (symbol, entityRef, locator) and the caveat that file/unsupported declarations may lack a reference target.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
project_search_mapFind a declaration (LayerMap)ARead-onlyIdempotent
Use this to find where a function, method, class or type is declared, by name or by words in its name, path or documentation, before exploring its callers with project_explore_map. Find declarations and files whose names, paths or source documentation match query terms. ANY (default) matches any term, ALL requires every term, LITERAL matches the exact text. Results are ranked by relevance and grouped by file with the declaration name, kind, 1-based line range and matched fields. Zoom into a result with project_explore_map({path,name}) or read its line range in the file. This is not a full-text search and does not prove absence; search the source text itself for exact text. Continue with offset and unchanged conditions.
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | . | |
| kinds | No | ||
| query | Yes | ||
| offset | No | ||
| matchMode | No | ANY matches one or more query terms; ALL requires every term; LITERAL matches the complete text literally. | ANY |
| maxResults | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint/idempotentHint/destructiveHint=false, so the safety profile is covered. The description adds genuinely new behavior: results are relevance-ranked, grouped by file, expose declaration name/kind/1-based line range/matched fields, and continuation is via offset with unchanged conditions. The only gap is that no output schema exists to cross-check the described result shape.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Dense and front-loaded: purpose, then matching modes, then result shape, then next-step, then limitation. Mild redundancy in restating the ANY/ALL/LITERAL modes that the schema already defines verbatim, and the run of sentences is long, but every sentence carries usable information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With six parameters and no output schema, the description does the heavy lifting by describing ranked, file-grouped results with declaration metadata and by warning about the absence-proof limitation. It is largely complete, falling short only on the semantics of 'kinds' and 'maxResults'.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is only 17% (matchMode alone), so the description must carry the rest. It does explain matchMode semantics and offset-based continuation, and implies the query matches name/path/documentation, but 'kinds', 'maxResults' (default 20, max 200) and the 'path' scope default remain undocumented. Partial compensation, not full.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('find where a function, method, class or type is declared') and the search surface (name, path, documentation). It explicitly contrasts itself with project_explore_map (callers) and with full-text search, so an agent can pick it correctly without opening the schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives the ordering rule ('before exploring its callers with project_explore_map'), the follow-up step ('Zoom into a result with project_explore_map({path,name})'), and an explicit when-not ('This is not a full-text search and does not prove absence; search the source text itself for exact text'). Alternatives and exclusions are both named.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.0- First observed
project_explore_map - First observed
project_find_references - First observed
project_search_map
TDQS
Scored across 3 tools
Three tools map to distinct phases—locate declarations (search), map structure/callers (explore), and enumerate all usages (find_references)—but explore_map is a broad multi-modal tool whose cached caller tracing overlaps with find_references. Descriptions explicitly differentiate cached vs. computed references and search vs. exploration, so confusion is limited.
All names use snake_case with a consistent project_ prefix and a clear verb_noun structure (explore_map, search_map, find_references). There are no mixed conventions or vague names.
Three tools is compact yet covers the core navigation operations of search, exploration, and reference lookup. The count is on the low end because explore_map is overloaded, but it is not too thin for the purpose.
The surface covers declaration search, structural/call exploration, and reference enumeration, with no major lifecycle gaps for a static code map. Direct source retrieval and exact full-text search are intentionally out of scope and left to external tools, which agents can work around.
Related MCP Connectors
Codebase graphs, caller impact analysis, and recorded project context for AI coding agents.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables querying and analyzing code relationships by building a lightweight graph of TypeScript and Python symbols. Supports symbol lookup, reference tracking, impact analysis from diffs, and code snippet retrieval through natural language.-
- AlicenseAqualityDmaintenanceEnables AI coding agents to efficiently navigate and understand large codebases by providing tools for entry point location, call chain analysis, and impact assessment, reducing context consumption and model costs.53GPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables LLM agents to efficiently understand and navigate a codebase by providing semantic search over symbols and a reference graph, replacing expensive grep/glob calls with structured tools like definition lookup, caller/callee queries, and change-impact analysis.3MIT
- FlicenseNot gradedqualityAmaintenanceProvides efficient code navigation and graph-based analysis for AI agents, enabling symbol resolution, callers, implementations, and type schemas with minimal token usage.-