Skip to main content
Glama
codegraph-ast-mcp

codegraph-ast-mcp

by DjohnHK

codegraph-ast-mcp

Python 3.10+ License: MIT MCP 2024-11-05 Code Style: Ruff

Polyglot Native C Tree-sitter Call-Graph, Cross-Stack HTTP Route Linker, Reverse BFS Blast-Radius Analyzer, and Surgical AST Context Slicing MCP Server for AI Coding Agents.


The Problem

When AI coding agents (Claude Code, Cursor, Windsurf, custom MCP agents) navigate large full-stack or embedded monorepos, they typically burn tens of thousands of context tokens reading entire 1,500-line files and running blind regex searches—while still missing cross-stack dependencies (for example, a backend Python function whose response contract is consumed via axios.post("/api/invoices/checkout") inside a Vue/TypeScript component).

codegraph-ast-mcp solves both problems with deterministic native C Tree-sitter parsing backed by an incremental SQLite WAL graph ((mtime_ns, size_bytes) delta indexing in milliseconds):

  1. 75%–92% Context Token Compression (surgical_ast_slice): Extracts only the exact AST symbol lines (start_line..end_line) instead of loading whole files.

  2. Cross-Stack Frontend ↔ Backend Route Graph: Links fetch() / axios / $http calls in .vue, .ts, .tsx, and .js directly to Django urls.py and FastAPI @router.get/post route handlers.

  3. Multi-Hop Reverse BFS Blast Radius (codegraph_blast_radius): Computes upstream impact across functions, classes, HTTP endpoints, and UI views before an agent refactors a symbol.


Related MCP server: codegraph-mcp

Quickstart with Claude Code

pip install "git+https://github.com/DjohnHK/codegraph-ast-mcp.git"

# Register with Claude Code CLI:
claude mcp add codegraph -- codegraph-ast-mcp

Or use directly from the command line:

codegraph-cli sync --root .
codegraph-cli callers compute_invoice_tax --root .
codegraph-cli blast compute_invoice_tax --root . --depth 3
codegraph-cli slice compute_invoice_tax --root .

Exposed MCP Tools

Tool

Description

codegraph_sync

Incrementally indexes Python, TypeScript, JavaScript, Vue SFCs, Go, PHP, C, and C++ files into SQLite WAL

codegraph_callers

Finds symbol definitions and all upstream callers, importers, subclasses, and HTTP consumers

codegraph_callees

Resolves all downstream symbols and endpoints invoked inside a function, class, or component

codegraph_blast_radius

Computes N-hop reverse BFS blast radius across backend logic, HTTP routes, and frontend views

surgical_ast_slice

Extracts exact AST line ranges with token-savings telemetry


License

Released under the MIT License.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables 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.
      4
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables cross-repository architecture discovery and dependency routing across multi-service codebases, with automated scanning and batch AST indexing for AI agents to trace request lifecycles and navigate service boundaries.
      7
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI coding agents to query a local semantic code graph for surgical context, cross-file resolution, framework-aware routes, and code intelligence while keeping indexes automatically up to date.
      MIT