Give AI coding agents less code and more understanding. AST MCP Server
Give AI coding agents less code and more understanding.
AST MCP Server gives coding agents compact, compiler-aware access to TypeScript and JavaScript projects. Retrieve exact symbols, references and diagnostics without loading entire files into the model context.
Structural reads. Compiler-resolved references. Reviewed AST edits.
Fewer model round-trips
Less serialized context
Fewer model-facing TOON tokens
Results from reproducible local benchmark scenarios included in the project. These measurements are not universal token, billing, cache, latency or cost guarantees. Actual results depend on the project and workflow.
AI coding agents often read far more code than they need.
Too much context
An agent may load hundreds of source lines when it only needs one method signature or implementation. That consumes valuable context without necessarily improving the answer.
Fragile text-based edits
Plain-text patches do not inherently understand declarations, scopes, overloads or TypeScript diagnostics.
Weak cross-file reasoning
Text search can find matching words, but it cannot reliably determine whether identically named symbols are actually related.
Read code structurally, not as undifferentiated text.
AST MCP Server uses the TypeScript compiler project model to expose declarations, references, diagnostics and source selections as structured, bounded tools for AI coding agents.
Compact structural reads
Return an outline, an exact declaration or a bounded file section instead of loading the complete file by default.
Compiler-resolved references
Find project-wide symbol usages using compiler resolution rather than matching identifier text with grep.
Exact symbol inspection
Retrieve the precise source of a function, method, class, interface or type using reusable structural selectors.
Reviewed AST edits
Prepare renames, implementation replacements and class scaffolds before anything is written to disk.
Diagnostic guards
Compare TypeScript diagnostics before and after a proposed change to reveal new compiler errors before applying it.
Freshness and completeness metadata
Every bounded result reports whether the project evidence is fresh, incomplete, truncated or unresolved.
Batch workflows
Combine known structural read operations into a single bounded CLI pipeline and reduce agent round-trips.
Prepare → Review → Apply
A controlled workflow that keeps humans and agents in the loop before any change touches your codebase.
Prepare
The agent requests a structural change. AST MCP Server prepares it without writing to disk.
prepare_rename({ symbol: "UserService", newName: "AccountService" })Review
The prepared change is displayed with compiler evidence. Humans or agents verify it.
review_change({ id: "chg_abc123", showDiff: true })Apply
After explicit approval, the change is written. Immutable hashes prevent silent modifications.
apply_change({ id: "chg_abc123", hash: "sha256:..." })Get started in seconds.
Install via npm and add to your MCP client configuration.
npm install --global ast-mcp-server --ignore-scripts
ast-tool setup{
"mcpServers": {
"ast-mcp": {
"command": "ast-mcp-server"
}
}
}