Skip to main content

codenav-mcp

An MCP server that gives AI agents type-resolved Python navigation, backed by ty's language server. Definitions, references and call sites go through real type inference (imports, dependency-injected parameters, dataclass fields), not text grep.

Quick start

ty is installed with the package, so all you need is uv (or pipx):

uvx codenav-mcp

Register it with your MCP host. For Claude Code, from the project root:

claude mcp add codenav -- uvx codenav-mcp

Or add it to a project .mcp.json (Claude Code) or .cursor/mcp.json (Cursor):

{
	"mcpServers": {
		"codenav": {
			"command": "uvx",
			"args": ["codenav-mcp"],
			"env": {
				"CODENAV_MCP_SOURCE_ROOT": "src"
			}
		}
	}
}

In Cursor, also set "CODENAV_MCP_WORKSPACE": "${workspaceFolder}", because Cursor may start MCP servers with your home directory as the working directory.

Tools

Start with the name-based tools:

Tool Answers
symbol_info What is this? Header, hover, definition and references in one call
outline What's in this file? (classes, methods, functions)
callers Who actually calls this function? (call hierarchy, not imports)
implementations Which classes structurally implement this Protocol? (type-checked)
search_symbol Workspace symbol search by name (ranked, capped; optional kind= / path= filters; production code before tests; fuzzy-only hits summarised unless fuzzy=true)
workspace Which directory is being navigated, and why

Then use the position tools once you have a path:line:col:

Tool Answers
hover Type and docs at a position
definition Go to definition (resolves through injected parameters)
references All usages across the workspace
diagnostics ty type-check diagnostics for one file

name and query are accepted as aliases on the name-based tools (port_name / name / query on implementations). A missing or wrong parameter gets a short hint back instead of a validation error. Dotted names may nest (Outer.Inner.method). implementations also takes file_path to pick one port when the name exists in several files, and counts inherited members and dataclass/self.x fields toward a port's required names.

Positions are 1-indexed. column is a UTF-16 character offset (a leading tab counts as one character).

Python only (.py / .pyi).

Which ty runs

  1. The project's own .venv/bin/ty (.venv\Scripts\ty.exe on Windows), so the ty version matches the project's pin and config.
  2. The ty installed alongside codenav-mcp.
  3. ty on PATH.
  4. uvx ty server as a last resort.

Environment

Variable Default Purpose
CODENAV_MCP_WORKSPACE 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 Pins the project root (never overridden). See the workspace tool
CODENAV_MCP_SOURCE_ROOT whole workspace Directory scanned for implementations candidates and used to derive dotted import paths (e.g. src)
CODENAV_MCP_EXTRA_SOURCE_ROOTS none Comma-separated directories (e.g. tests) that implementations also scans; matches (test doubles) are listed under a separate heading

Requirements

  • webnav-mcp: the same kind of navigation for JS/TS/HTML/CSS.
  • Design notes (Protocol conformance probe, positioning, output formats): docs/agent-tooling.md.

Development

Source: github.com/illescasDaniel/codenav-mcp. From a checkout: uv sync --group dev, then uv run codenav-mcp.

License

MIT. See LICENSE.

Release files for codenav-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codenav-mcp 0.1.1
File Size Uploaded
codenav_mcp-0.1.1.tar.gz 16.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for codenav-mcp 0.1.1
File Interpreter ABI Platform
codenav_mcp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 33.7 kB

Release files / codenav_mcp-0.1.1.tar.gz

Download URL codenav_mcp-0.1.1.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
764c87e4afb27c5404baacc5b7339af6cdd1a054ba35eb0f72df20ec3bee02c3
BLAKE2b-256 checksum
How to use checksums
c321bf7b75fdcb7b390d102f38bb56bd1bdb6ee00ce9da494f404bd0fc13805b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / codenav_mcp-0.1.1-py3-none-any.whl

Download URL codenav_mcp-0.1.1-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fe264bd584e740e2a5f50000df9b238b1947e17a4d8a24df57007fc3ad91631
BLAKE2b-256 checksum
How to use checksums
a7b3de7da6da4be88a2051d30f5a976a6178e66df74c44f0704b03fd6ebc9dd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page