Precision-MCP
Precision-MCP provides AST-based codebase indexing and surgical code navigation/mutation over MCP.
Index a workspace and cache symbols for fast search.
Find functions, classes, or methods with exact line bounds, signatures, and docstrings.
Get a file's structural outline without reading the whole file.
Extract the exact source slice for a named symbol.
Find direct callers of a symbol.
Analyze cascading impact/blast radius up to a configurable depth.
Replace a symbol's code with AST/syntax validation and automatic rollback on invalid edits.
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., "@Precision-MCP trace all callers of authenticate_user and show me the blast radius"
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.
Cursor-style AST Codebase Indexing & Surgical Slicing MCP Server for AI Coding Agents
Stop dumping 500-line files into your LLM context window. Give any AI agent Cursor-grade AST symbol navigation in <15ms.
π The Problem
Modern coding agents (Claude Code, Gemini CLI, Cursor, Windsurf, OpenCode) suffer from context rot:
Whole-File Dumping: Reading entire files to inspect a single 20-line method floods the context window with boilerplate, increasing API costs by 10x.
Context Window Degradation: Large codebases cause fast models to lose instruction adherence, skip edge cases, or crash on token limits.
Slow Brute-Force Regex: Scanning with regex fails to distinguish between declarations, call sites, and comments.
Indentation & Syntax Drift: Blind search-and-replace mutates line numbers, corrupting codebases.
Precision-MCP solves this by providing a lightweight, high-performance AST indexing engine over the Model Context Protocol (MCP). It indexes your workspace in milliseconds, lets agents retrieve exact symbol slices, analyzes cascading blast radius, and guarantees zero syntax errors via AST-safe mutations.
Related MCP server: CodeMind
β‘ Performance Benchmarks
Live benchmarks measured across real-world codebases:
Metric | Brute-Force File Read | Standard Ripgrep | Precision-MCP |
Cold Index Speed | N/A (no index) | N/A | ~70-120 ms (Initial scan) |
Warm Re-Index Speed | N/A | N/A | <8.5 ms (Incremental |
Query Latency | ~45 ms (full read) | ~25 ms (text search) | <1.0 ms (Indexed AST) |
Token Usage per Query | 800 - 1,500+ tokens | Snippet only (no body) | 35 - 150 tokens (96.4% saved) |
Cascading Blast Radius | Manual search | Incomplete regex | Automated multi-level call graph |
Code Mutation Safety | Fragile text replace | None | Cross-Language AST/Syntax Gate with Auto-Rollback |
Memory Footprint | Process memory bloat | Variable | <12 MB (Zero dependencies) |
Run the visual benchmark demo on your own machine:
python -m precision_mcp.demoπ οΈ Architecture
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI Coding Agent (Claude Code / Cursor / Gemini CLI) β
ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β JSON-RPC 2.0 (stdio)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Precision-MCP β
β β
β ββββββββββββββββββββ βββββββββββββββββββββ β
β β MCP Server β β AST Parser β β
β β (stdio driver) β βββββββββΊ β (Python AST + β β
β ββββββββββ¬ββββββββββ β Regex TS/Go/Rs) β β
β β βββββββββββ¬ββββββββββ β
β βΌ βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β CodebaseIndexer (.precision_index.json) β β
β β - Symbol graph (Classes, Methods, Funcs) β β
β β - Exact [start_line, end_line] slices β β
β β - Call-site graph & caller tracing β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββπ¦ Installation & Setup
Option 1: Run instantly with uvx (No installation needed)
uvx precision-mcpOption 2: Install via pip
pip install -e .
precision-mcpβοΈ Configuration in Agents
1. Claude Desktop / Claude Code (claude_desktop_config.json)
{
"mcpServers": {
"precision-mcp": {
"command": "python",
"args": ["-m", "precision_mcp.server", "--root", "/path/to/your/project"]
}
}
}2. Cursor IDE (settings.json)
{
"mcp": {
"servers": {
"precision-mcp": {
"command": "precision-mcp",
"args": ["--root", "."]
}
}
}
}3. Antigravity IDE / Gemini CLI (mcp_config.json)
{
"mcpServers": {
"precision-mcp": {
"command": "python",
"args": ["-m", "precision_mcp.server", "--root", "."]
}
}
}π§© Exposed MCP Tools
Tool | Parameters | Description |
|
| Scans workspace with incremental |
|
| Locates functions, classes, or methods with exact line boundaries |
|
| Generates structural skeleton of any file without reading its entire body. |
|
| Extracts the exact source code block of a single function or class. |
|
| Identifies all direct callers of a given symbol across the codebase. |
|
| Blast Radius Analyzer: Traces cascading multi-level callers and affected files before refactoring. |
|
| Syntax-Safe Surgical Mutator: Replaces symbol block with cross-language syntax verification (Python, TS/JS, Go, Rust) and automatic rollback. |
π§ͺ Testing
Run 20 unit tests across parser, indexer, and MCP protocol handlers:
python -m unittest discover -s tests -vπ License
MIT Β© Rohit Kumar Khamrai
Available Tools
7 toolsfind_callersB
Find all functions and methods in the codebase that invoke a given function or method.
Inputs: symbol_name (required).
find_symbolA
Locate classes, functions, or methods by name. Returns file paths, exact line bounds [start_line, end_line], parameter signatures, and docstrings.
Inputs: query (required).
get_impact_radiusA
Analyze cascading downstream blast radius before refactoring. Identifies all callers, affected files, and risk level across the codebase.
Inputs: symbol_name (required), max_depth.
get_outlineA
Get the structural skeleton (all classes, functions, line bounds) of a file without reading its entire contents into context.
Inputs: file_path (required).
get_symbol_sliceB
Extract the exact source code block of a single function or class by symbol name without reading the surrounding file.
Inputs: file_path (required), symbol_name (required).
index_codebaseB
Scan and index all classes, functions, and methods across the workspace for sub-millisecond symbol search.
Inputs: force, workspace_path.
patch_symbolA
Surgically replace a function or class block by symbol name. Automatically validates AST syntax and rolls back if invalid, guaranteeing zero malformed edits.
Inputs: new_code (required), file_path (required), symbol_name (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 7 tools
Most tools target distinct actions: indexing, symbol lookup, file outline, source slicing, caller search, impact analysis, and patching. Find_callers and get_impact_radius overlap since impact_radius includes caller discovery, but the descriptions distinguish direct callers from broader blast-radius analysis.
All tool names use consistent snake_case with a verb-first pattern: index_, find_, get_, and patch_. The convention is predictable despite a mix of verbs, and each name clearly signals the operation and target.
Seven tools is well-scoped for a code-intelligence and refactoring server. Each tool covers a distinct step in the workflow, from indexing to patching, without obvious redundancy.
The surface covers discovery, navigation, slicing, caller analysis, impact analysis, and safe patching. It lacks explicit create, delete, rename, or move-symbol operations, but agents can work around these via patch_symbol and impact analysis.
Related MCP Connectors
Ask a codebase what calls what: search, blast radius, paths between symbols, and diffs.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
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
- AlicenseNot gradedqualityDmaintenanceEnables 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.19 PyPI4MIT
- FlicenseNot gradedqualityDmaintenanceProvides persistent codebase memory and semantic context for AI agents via AST-aware chunking and symbol graph indexing.1-
- FlicenseNot gradedqualityBmaintenanceProvides efficient code navigation and graph-based analysis for AI agents, enabling symbol resolution, callers, implementations, and type schemas with minimal token usage.-
- AlicenseNot gradedqualityBmaintenanceExposes a codebase's symbol graph and symbol-aware editing tools to AI agents, enabling targeted symbol lookup, impact analysis, and atomic multi-file edits with reduced context tokens.12 npmMIT