ast-outline-mcp
The ast-outline-mcp server provides AST-powered code exploration tools for LLMs and AI agents to efficiently analyze codebases without reading entire files.
digest— Generate a compact one-page module map of a directory, showing each file with a size label, token estimate, and type headers with inheritance and decorators — ideal for an initial codebase overview.outline— Get a structural outline of a file or directory showing signatures with line ranges (no bodies), with options to include/exclude imports, private members, fields, documentation comments, and attributes/decorators.show— Extract the full source body of one or more named symbols from a file (supports suffix matching likeFoo.Bar), with an option to return only the header/signature instead of the full body.grep— Perform AST-aware structural search across files or directories, with results grouped by enclosing class/function, and filtering options including kind (def,call,ref,import), whole-word matching, case-insensitivity, file-only listing, and match count limits.explore-codebase— A prompt template guiding LLMs to efficiently explore codebases using the above tools.
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., "@ast-outline-mcp outline the src directory"
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.
ast-outline-mcp
An MCP (Model Context Protocol) server for ast-outline — a tree-sitter-based CLI that lets AI coding agents pull exactly what they need from a codebase: structural outlines, module digests, symbol bodies, and AST-aware grep.
Why
LLM coding agents explore codebases by reading files directly. A 1200-line file costs 1200 lines of context just to answer "what methods are in here?" — ast-outline provides the file's shape in 60–100 lines, and this MCP server exposes that functionality to any MCP-compatible client.
Related MCP server: MCP Codebase Server
Prerequisites
Node.js >= 18
ast-outlineCLI installed and available on PATH (installation guide)
uv tool install ast-outlineInstallation
Run via npx (no install needed)
npx ast-outline-mcpInstall globally
npm install -g ast-outline-mcp
ast-outline-mcpMCP Client Configuration
Add to your MCP client config (e.g., Claude Desktop):
{
"mcpServers": {
"ast-outline": {
"command": "npx",
"args": ["ast-outline-mcp"]
}
}
}Tools
digest
Get a compact one-page module map of a directory. Each file gets a size label and token estimate. Recommended for initial overview of a codebase.
Parameters:
path(string, required) — Directory path to digest
outline
Get a structural outline of one or more files or directories. Returns signatures with line ranges (no bodies).
Parameters:
path(string, required) — File or directory path to outlineimports(boolean) — Include import/use/using statementsnoPrivate(boolean) — Exclude private membersnoFields(boolean) — Exclude fields/propertiesnoDocs(boolean) — Exclude documentation commentsnoAttrs(boolean) — Exclude attributes/decorators
show
Extract the full source body of one or more symbols from a file.
Parameters:
file(string, required) — File path to extract symbols fromsymbols(string[], required) — Symbol names to extractsignature(boolean) — Return header/signature only, no body
grep
AST-aware structural search across files. Matches grouped by enclosing class/function.
Parameters:
pattern(string, required) — Search pattern (literal or regex, auto-detected)path(string, required) — File or directory path to searchkind(enum: def|call|ref|import) — Narrow results by classification kindwordMatch(boolean) — Match whole words onlycaseInsensitive(boolean) — Case-insensitive matchingfilesOnly(boolean) — List matching files onlycount(boolean) — Show match counts per filemaxCount(number) — Maximum number of matches per file
Prompts
explore-codebase
A prompt that guides an LLM to efficiently explore a codebase using ast-outline tools.
Development
npm install
npm test
npm run buildSupported Languages
ast-outline supports 20+ languages including TypeScript, Python, Go, Rust, C#, Java, Kotlin, Ruby, PHP, and more. See the full list.
License
MIT
Available Tools
4 toolsdigestA
Get a compact one-page module map of a directory. Each file gets a size label and token estimate. Type headers carry inheritance and decorators.
Inputs: path (required).
grepA
AST-aware structural search across a file or directory. Matches are grouped by enclosing class/function, with kind tags [def]/[import]. Comment/string noise is filtered by default. Regex is auto-detected.
Inputs: path (required), pattern (required), kind, count, +4 more.
outlineA
Get a structural outline of a file or directory. Returns signatures with line ranges (no bodies).
Inputs: path (required), noDocs, imports, noAttrs, +2 more.
showA
Extract the full source body of one or more symbols from a file. Supports suffix matching (e.g., 'Foo.Bar' matches '*.Foo.Bar'). Use --signature to get header only.
Inputs: file (required), symbols (required), signature.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clear and distinct purpose: digest for module overview, grep for structured search, outline for structural listing, and show for code extraction. No overlap in functionality.
All tool names are single-word lowercase verbs (digest, grep, outline, show), following a consistent and predictable pattern.
With 4 tools, the set is well-scoped for an AST server. Each tool covers a core operation without redundancy or excess.
The tools cover key AST reading operations: overview, search, structure, and extraction. Minor gaps like documentation retrieval are acceptable for the domain.
Maintenance
Related MCP Connectors
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Ask a codebase what calls what: search, blast radius, paths between symbols, and diffs.
Shared context for your codebase: a hosted code knowledge graph over MCP. Free plan, OAuth sign-up.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables LLM agents to query a codebase's structural knowledge (symbols, imports, call graphs, etc.) via MCP, reducing tokens and improving correctness compared to raw file access.29 npm7MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for semantic codebase navigation that builds an AST index of symbols, imports, and exports, providing AI agents with tools to search, explore, and understand code.MIT
- FlicenseNot gradedqualityCmaintenanceProvides a local-first code indexing and search engine for coding agents via MCP, enabling precise codebase queries, symbol lookup, and freshness-aware retrieval.-
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to query code structure efficiently through 16 MCP tools, including symbol lookup, full-text search, dependency analysis, and refactor planning, powered by tree-sitter parsing and index-backed code intelligence.3MIT