ast-mcp
Production-grade structural AST analysis MCP server. Exposes 54 ast_* tools over stdio JSON-RPC 2.0, backed by Tree-sitter parsers for TypeScript, TSX, JavaScript, JSX, Python, Go, and Rust.
Power your agent
Install from the publisher. Not a PlugMCP endpoint.
Host a copy with our keys and logs.
No packaged release in the registry yet. Follow the repository README.
Remote URL or a command on your machine? How the two installs differ
Run on PlugMCP
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
LaunchFrom the publisher
Production-grade structural AST analysis MCP server. Exposes 54 ast_* tools over stdio JSON-RPC 2.0, backed by Tree-sitter parsers for TypeScript, TSX, JavaScript, JSX, Python, Go, and Rust.
A Rust-based Model Context Protocol server that exposes structural code intelligence from Tree-sitter, including AST parsing, code outlines, imports, functions, chunking, queries, and safe rewrite previews.
MCP Client ── stdio ── JSON-RPC 2.0 ── ServerContext ── Tool Dispatch ── Safety Layer ── Tree-sitter
V5 introduces layered, in-memory runtime configuration. Precedence:
defaults → AST_* environment variables → ast_update_runtime_config overrides
Runtime config updates via ast_update_runtime_config are in-memory only and cannot change workspace_path, parser registry, or language grammar paths.
Results exceeding limits are truncated; responses include "truncated": true.
cargo build --release
# Binary: target/release/ast-mcp
{
"mcpServers": {
"ast": {
"command": "/path/to/target/release/ast-mcp",
"env": {
"WORKSPACE_PATH": "/absolute/path/to/your/project"
}
}
}
}
If WORKSPACE_PATH is not set, the server uses the current working directory. All file_path arguments are workspace-relative — absolute paths and .. are rejected.
Complexity summary:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ast_complexity_summary",
"arguments": { "glob": "src/**/*.ts", "max_files": 200 }
}
}
Runtime config update:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "ast_update_runtime_config",
"arguments": {
"limits": { "max_workspace_files": 1000 },
"scans": { "max_parallelism": 12 }
}
}
}
Check cache health:
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "ast_cache_status",
"arguments": {}
}
}
cargo build --release # Release build
cargo test # All 162 tests across 19 binaries
cargo clippy --all-targets -- -D warnings
cargo fmt --check
src/
├── main.rs # Entry point — workspace + transport loop
├── lib.rs # Crate root
├── config/ # Workspace, runtime config, env parsing, validation
├── mcp/ # JSON-RPC transport, tool registry, ServerContext
├── parser/ # Tree-sitter wrappers, line index, query runner
├── extractors/ # Language-agnostic AST extractors (V1)
├── context/ # Scope chain, node-at-range, context pack (V2)
├── extraction/ # Calls, literals, member access, templates (V2)
├── metrics/ # File and function metrics, nesting depth (V2)
├── frameworks/ # Routes, React, schemas, decorators, tests, deps (V3)
├── rewrite/ # Rewrite engine — diff, overlap, parse-after (V4)
├── rewrite_tools/ # Import merge, rename, wrap, decorator, signature (V4)
├── analysis/ # Complexity, large nodes, duplicate shapes (V5)
├── cache/ # TTL caches — parse tree, query, framework results (V5)
├── observability/ # Request log ring buffer, request tracker (V5)
├── ops/ # Readiness, liveness, parser status, rebuild (V5)
├── scan/ # Scan registry, cooperative cancellation (V5)
├── tools/ # One module per tool — 54 handlers total
├── languages/ # Language-specific node kinds (TS, JS, Python, Go, Rust)
├── safety/ # Path resolution, range validation, limits, violations
├── text/ # Position encoding, UTF-16, indentation, byte budget
├── workspace/ # File scanner, glob matching, ignore rules
└── shared/ # Position, Range, errors, AST node, V2–V5 types
AST MCP is structural only. It does not own semantic compiler truth.
For semantic analysis, use LSP MCP. For cross-service workflows, use Agent Skills.
All tools return structured errors with a code and message. Example:
{
"error": {
"code": "path_outside_workspace",
"message": "path outside workspace: ../outside.ts"
}
}
V5 adds 16 new error codes for cache operations, config validation, scan lifecycle, and analysis failures.
A Rust-based Model Context Protocol server that exposes structural code intelligence from Tree-sitter, including AST parsing, code outlines, imports, functions, chunking, queries, and safe rewrite pre
Overview
A Rust-based Model Context Protocol server that exposes structural code intelligence from Tree-sitter, including AST parsing, code outlines, imports, functions, chunking, queries, and safe rewrite previews.
Tools
No tool list yet. Remote servers get one after the first health check.
FAQ
Copy the stdio config for Cursor, Claude Desktop, Claude Code, or VS Code on this page. It uses the publisher's install, not a PlugMCP proxy.
No required environment variable is listed on this record.
Ast runs locally over stdio.
Last checked 2026-10-28. A Rust-based Model Context Protocol server that exposes structural code intelligence from Tree-sitter, including AST parsing, code outlines, imports, functions, chunking, queries, and safe rewrite previews.