code-analyze-mcp
Native agent tools (regex search, path matching, file reading) handle targeted lookups well.aptu-coder handles the mechanical, non-AI work: mapping directory structure, extracting symbols, and tracing call graphs. Offloading this to a dedicated tool reduces token usage and speeds up coding with better accuracy.
Benchmarks
Auth migration task on Claude Code against Django (Python) source tree. Full methodology.
Mode | Sonnet 4.6 | Haiku 4.5 |
MCP | 112k tokens, $0.39 | 406k tokens, $0.42 |
Native | 276k tokens, $0.95 | 473k tokens, $0.53 |
Savings | 59% fewer tokens, 59% cheaper | 14% fewer tokens, 21% cheaper |
AeroDyn integration audit task on Claude Code against OpenFAST (Fortran) source tree. Full methodology.
Mode | Sonnet 4.6 | Haiku 4.5 |
MCP | 472k tokens, $1.65 | 687k tokens, $0.72 |
Native | 877k tokens, $2.85 | 2162k tokens, $2.21 |
Savings | 46% fewer tokens, 42% cheaper | 68% fewer tokens, 68% cheaper |
Related MCP server: CodeGraphMCPServer
Overview
aptu-coder is a Model Context Protocol server that gives AI agents precise structural context about a codebase: directory trees, symbol definitions, and call graphs, without reading raw files. It supports Rust, Python, Go, Java, Kotlin, TypeScript, TSX, Fortran, JavaScript, C/C++, and C#, and integrates with any MCP-compatible orchestrator.
Supported Languages
All languages are enabled by default. Disable individual languages at compile time via Cargo feature flags.
Language | Extensions | Feature flag |
Rust |
|
|
Python |
|
|
TypeScript |
|
|
TSX |
|
|
Go |
|
|
Java |
|
|
Kotlin |
|
|
Fortran |
|
|
JavaScript |
|
|
C |
|
|
C++ |
|
|
C# |
|
|
To build with a subset of languages, disable default features and opt in:
[dependencies]
aptu-coder-core = { version = "*", default-features = false, features = ["lang-rust", "lang-python"] }The current version is published on crates.io. Replace "*" with the latest version string if you prefer a pinned dependency.
Installation
Homebrew (macOS and Linux)
brew install clouatre-labs/tap/aptu-coderUpdate: brew upgrade aptu-coder
cargo-binstall (no Rust required)
cargo binstall aptu-codercargo install (requires Rust toolchain)
cargo install aptu-coderQuick Start
Build from source
cargo build --releaseThe binary is at target/release/aptu-coder.
Configure MCP Client
After installation via brew or cargo, register with the Claude Code CLI:
claude mcp add --transport stdio aptu-coder -- aptu-coderIf you built from source, use the binary path directly:
claude mcp add --transport stdio aptu-coder -- /path/to/repo/target/release/aptu-coderstdio is intentional: this server runs locally and processes files directly on disk. The low-latency, zero-network-overhead transport matches the use case. Streamable HTTP adds a network hop with no benefit for a local tool.
Or add manually to .mcp.json at your project root (shared with your team via version control):
{
"mcpServers": {
"aptu-coder": {
"command": "aptu-coder",
"args": []
}
}
}Tools
All optional parameters may be omitted. Shared optional parameters for analyze_directory, analyze_file, and analyze_symbol:
Parameter | Type | Default | Description |
| boolean | auto | Compact output; auto-triggers above 50K chars |
| string | -- | Pagination cursor from a previous response's |
| integer | 100 | Items per page |
| boolean | false | Bypass output size warning |
| boolean | false | Full output with section headers and imports |
summary=true and cursor are mutually exclusive. Passing both returns an error.
Tool | Purpose | Languages |
| Directory tree with LOC, function, and class counts; respects | all |
| Functions, classes, and imports with signatures and line ranges | all |
| Lightweight function and import index (~75% smaller than | all |
| Call graph for a named symbol across a directory; callers, callees, call depth | all |
| Create or overwrite a file; creates parent directories | any file |
| Replace a unique exact text block; errors if zero or multiple matches | all |
| Run a shell command; returns stdout, stderr, exit code, and timeout status; supports progress notifications | any |
Tool parameters, constraints, and examples are available via your MCP client's tool inspector or tools/list response.
Output Management
For large codebases, two mechanisms prevent context overflow:
Pagination
analyze_file and analyze_symbol append a NEXT_CURSOR: line when output is truncated. Pass the token back as cursor to fetch the next page. summary=true and cursor are mutually exclusive; passing both returns an error.
# Response ends with:
NEXT_CURSOR: eyJvZmZzZXQiOjUwfQ==
# Fetch next page:
analyze_symbol path: /my/project symbol: my_function cursor: eyJvZmZzZXQiOjUwfQ==Summary Mode
When output exceeds 50K chars, the server auto-compacts results using aggregate statistics. Override with summary: true (force compact) or summary: false (disable).
# Force summary for large project
analyze_directory path: /huge/codebase summary: true
# Disable summary (get full details, may be large)
analyze_directory path: /project summary: falseNon-Interactive Pipelines
In single-pass subagent sessions, prompt caches are written but never reused. Benchmarks showed MCP responses writing ~2x more to cache than native-only workflows, adding cost with no quality gain. Set DISABLE_PROMPT_CACHING=1 (or DISABLE_PROMPT_CACHING_HAIKU=1 for Haiku-specific pipelines) to avoid this overhead.
The server's own instructions expose a 4-step recommended workflow for unknown repositories: survey the repo root with analyze_directory at max_depth=2, drill into the source package, run analyze_module on key files for a function/import index (or analyze_file when signatures and types are needed), then use analyze_symbol to trace call graphs. MCP clients that surface server instructions will present this workflow automatically to the agent.
Environment Variables
Variable | Default | Description |
|
| Maximum number of file-analysis results held in the in-process LRU cache. Increase for large repos where many files are queried repeatedly. |
|
| Maximum number of directory-analysis results held in the in-process LRU cache. |
| unset | Set to |
| unset | Set to |
| unset | Shell used by |
| unset | Tool subset profile. |
|
| TTL in seconds for |
|
| Maximum number of cached |
| unset | Absolute path for a one-shot JSONL metrics export written on server shutdown. Relative paths are ignored. |
Observability
All seven tools emit metrics to daily-rotated JSONL files at $XDG_DATA_HOME/aptu-coder/ (fallback: ~/.local/share/aptu-coder/). Each record captures tool name, duration, output size, and result status. Files are retained for 30 days. See docs/OBSERVABILITY.md for the full schema.
Documentation
ARCHITECTURE.md - Design goals, module map, data flow, language handler system, caching strategy
MCP Best Practices - Best practices for agentic loops, orchestration patterns, MCP tool design, memory management, and safety controls
OBSERVABILITY.md - Metrics schema, JSONL format, and retention policy
ROADMAP.md - Development history and future direction
DESIGN-GUIDE.md - Design decisions, rationale, and replication guide for building high-performance MCP servers
CONTRIBUTING.md - Development workflow, commit conventions, PR checklist
SECURITY.md - Security policy and vulnerability reporting
License
Apache-2.0. See LICENSE for details.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Repository knowledge graph MCP server for codebase understanding and debugging.
Shared context for your codebase: a hosted code knowledge graph over MCP. Free plan, OAuth sign-up.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA lightning-fast, language-agnostic code analysis MCP (Model Context Protocol) server built in Rust9-
- AlicenseNot gradedqualityCmaintenanceA lightweight, zero-configuration MCP server for source code analysis with GraphRAG capabilities, enabling structural understanding and efficient code completion from MCP-compatible AI tools.24 PyPI14MIT
- AlicenseNot gradedqualityCmaintenanceA persistent, tree-sitter-backed code knowledge cache MCP server that reduces token usage by storing parsed structure and enabling fast symbol lookup, inheritance graph, call graph, and semantic search.1MIT
- AlicenseAqualityDmaintenanceUniversal MCP server that analyzes any codebase and provides structured context to AI assistants. Dynamic, accurate, and token-efficient.18MIT