codenav-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CODENAV_MCP_WORKSPACE | No | Pins the project root (never overridden). Default: unset: follows the client's MCP roots when they name a worktree of the same git repository, else CLAUDE_PROJECT_DIR, else the working directory. | |
| CODENAV_MCP_SOURCE_ROOT | No | Directory scanned for `implementations` candidates and used to derive dotted import paths (e.g. `src`). Default: whole workspace. | |
| CODENAV_MCP_EXTRA_SOURCE_ROOTS | No | Comma-separated directories (e.g. `tests`) that `implementations` also scans; matches (test doubles) are listed under a separate heading. Default: none. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Code navigation for this Python codebase, backed by ty (Astral's type checker/language server). Prefer this over grepping for symbol definitions/usages: it resolves through type inference (imports, dependency-injected parameters, dataclass fields, etc.), not just text matching. Python files only (.py/.pyi) — other extensions are rejected. Start with symbol_info (what is X, where is it used) or outline (what's in this file) rather than chaining search_symbol → hover → definition → references by hand; drop to the position tools (hover/definition/references) once you have a specific line to inspect. To change code, prefer the write tools over hand edits where one fits: edit (text), edit_symbol (replace/insert/delete a definition by name), rename_symbol, change_signature, move (a symbol or a module), quick_fix. They type-check the edit before writing and write it when it adds no errors (max_new_errors=0; apply=false only previews); verify_changes shows what the working tree broke, undo_edit reverts. To read or change several files or symbols, send them as one batch(calls=[{tool, args}, ...]) instead of many separate calls. Positions are 1-indexed. column is a UTF-16 character offset on the line (not a visual/display column): a leading tab counts as one character, so after a single tab the next character starts at column 2.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| workspaceA | Which directory is codenav navigating, and why? Also shows the source root, the write mode, the ty command and any configuration warnings. Use when results look like they come from the wrong checkout/worktree. |
| hoverA | Get type/documentation info for the symbol at a position.
|
| definitionA | Go to the definition of the symbol at a position.
Resolves through ty's type inference, so this works even when the call
site only has a typed parameter/attribute (e.g. |
| referencesA | Find all usages of the symbol at a position across the workspace.
The first line is the exact total ( |
| search_symbolA | Search the whole workspace for a symbol by name (class, function, method, etc.). Use this to find a symbol's file/position first, then pass that position
to definition/references/hover for precise, type-resolved navigation.
Returned positions point at the identifier name (not the |
| diagnosticsA | Get ty's type-check diagnostics (errors/warnings) for a single file. Each line starts with the file's workspace-relative path, then line:column. |
| symbol_infoA | What is X and where is it used? Example: One-call summary for a name: header, hover text, definition, and references grouped by file — the usual first lookup instead of chaining search_symbol → hover → definition → references by hand.
|
| outlineA | What's in this file? Example: Indented outline (classes, methods, functions, with line numbers) of a
Python file, so you can navigate a large file without reading it in full.
|
| callersA | Who calls this function? Example: Narrower than references, since it leaves out imports and type-only usages and only lists actual call sites.
|
| implementationsA | Find concrete classes that structurally satisfy a Many hexagonal codebases define ports as |
| rename_symbolA | Rename a symbol everywhere it is used, type-checking the result before writing it. Example: Built on ty's rename (imports, aliases, keyword arguments) plus what ty
misses: with Writing: |
| verify_changesA | What did the edits since a git revision break? Compares ty diagnostics now against Run it after editing with any tool (your own Edit/Write included) to see the type errors the working tree has gained or lost relative to the last commit: the changed Python files and the files importing them are checked with the committed versions of the changed files substituted in for the "before" side. Read-only. A changed pyproject.toml, ty.toml or .ty.toml changes the rules for every file: then the whole project is checked and every current diagnostic is listed, because the old configuration cannot be re-checked. |
| apply_editA | Write a previewed edit (the id comes from a write tool's preview). The applied edit keeps that id, so undo_edit(id) reverts it. Fails if any file changed since the preview. |
| undo_editA | Revert an edit applied by the write tools (the latest one by default). The undo history keeps the last 20 edits of this server session; older ones, and ids that were already undone, cannot be reverted. Refuses when any of its files was changed after the edit, so later work is never overwritten. An edit blocked by a newer one names that edit, which must be undone first. |
| quick_fixA | Apply ty's own fixes for a file's diagnostics (today: add the missing import). Example: Looks at the file's diagnostics (narrow with |
| change_signatureA | Add, remove or reorder a function's parameters and update every call site. Example:
Call sites come from the type checker's references, so calls through injected
dependencies and typed attributes are found, not just textual matches. Overriding
methods get the same change ( |
| editA | Edit text in a Python file, type-checked: Use this for changes that are not a whole definition (a few lines, an import, a
module-level statement) or for rewriting a whole file ( Give either |
| edit_symbolA | Replace, add or delete a function, method or class by name. Examples:
|
| moveA | Move a function/class to another file, or a whole module file, and fix every import. Examples:
With Without Writes when the new errors stay within |
| batchA | Run several codenav tool calls in ONE request (saves round-trips and tokens). Example: Each call takes the same arguments as the tool called alone (
Annotated as possibly destructive because a batch may contain write calls; a batch made only of read tools (outline, symbol_info, hover, ...) writes nothing. Not atomic: calls that already ran stay applied (each has its own undo id). Line/column positions you computed before the batch may be stale after an earlier edit in it, so prefer name-based calls (symbol_info, edit_symbol, rename_symbol) after writes. A preview id is invalid once a later call changes the same file. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 20 tools
The tools mostly have distinct scopes: positional navigation, name search, symbol summaries, usage analysis, diagnostics, and type-checked editing. Minor overlap remains between edit and edit_symbol, and between symbol_info/search_symbol/references, but the descriptions give clear guidance on when to use each.
All names use lowercase snake_case, but the set mixes verb_noun forms (edit_symbol, rename_symbol, verify_changes), noun-only forms (hover, definition, references, callers), and noun_noun forms (symbol_info). It is readable, but there is no single predictable naming pattern across the 20 tools.
20 tools is on the heavy side, but the server covers several coherent areas: navigation, diagnostics, refactoring, undo/preview, and batching. Most tools earn their place, though some aggregator/tool pairs could potentially be consolidated.
The surface is very complete for type-aware navigation and refactoring: search, outline, hover, definition, references, callers, implementations, diagnostics, edits, rename, signature changes, move, quick fix, undo, and verify. Minor gaps include no explicit read-file/list-files or textual-search tool, which may be expected from the client rather than this server.