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 "Install 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-mcpoutline 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: Lore MCP 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.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to directory |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It describes the output convincingly but does not disclose any behavioral traits such as read-only nature, side effects, performance implications, or required permissions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three short sentences, no superfluous words, front-loaded with purpose. Every sentence adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter tool with no output schema, the description adequately covers what the tool does and what the output contains. Slightly lacking in behavioral context but complete for its simplicity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% (one parameter 'path' with description). The description adds no extra meaning beyond the schema's own description, meeting the baseline but not exceeding it.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Get') and concrete resource ('compact one-page module map of a directory'), details output elements (size label, token estimate, inheritance and decorators), and clearly distinguishes from siblings (grep, outline, show) by focusing on a summarized overview with metrics.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for obtaining a directory summary but does not explicitly state when to use or avoid this tool versus siblings, nor provide prerequisites or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | Narrow results by classification kind | |
| path | Yes | Absolute path to search | |
| count | No | Show match counts per file (-c) | |
| pattern | Yes | Search pattern (literal or regex, auto-detected) | |
| maxCount | No | Maximum number of matches per file (-m) | |
| filesOnly | No | List matching files only (-l) | |
| wordMatch | No | Match whole words only (-w) | |
| caseInsensitive | No | Case-insensitive matching (-i) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. It discloses AST-awareness, grouping, kind tags, noise filtering, and regex auto-detection. However, it omits return format, permissions, or side effects, which are important for a search tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with no fluff. Front-loaded with key functionality. Every word adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 8 parameters and no output schema, description covers essential behavioral traits (AST, grouping, filtering) and pattern detection. Missing return format, but otherwise adequate for a search tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. Description adds context (AST-awareness, grouping, noise filtering) that enhances understanding but does not elaborate on individual parameters beyond schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states 'AST-aware structural search across a file or directory', specifying verb (search) and resource (file/directory). It distinguishes from siblings (digest, outline, show) by emphasizing AST-awareness and structural grouping.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Description implies when to use (structural search, with filtering) but does not explicitly state when not to use or alternatives. It provides context but lacks exclusion criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
outlineA
Get a structural outline of a file or directory. Returns signatures with line ranges (no bodies).
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path | |
| noDocs | No | Exclude documentation comments | |
| imports | No | Include import/use/using statements | |
| noAttrs | No | Exclude attributes/decorators | |
| noFields | No | Exclude fields/properties | |
| noPrivate | No | Exclude private members |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It discloses that the tool returns signatures with line ranges and excludes bodies. However, it does not mention read-only behavior, error handling, or performance implications. Acceptable but minimal.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One sentence that front-loads the purpose ('Get a structural outline of a file or directory') followed by a brief behavioral note. No wasted words; every part is informative.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, the description explains the return format (signatures with line ranges, no bodies). For a tool with 6 boolean filters, it provides a clear output concept. Lacks details like whether the outline is flat or nested, but sufficient for typical use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
All 6 parameters have schema descriptions (100% coverage), so the schema already explains their meanings. The description adds no additional parameter details beyond restating 'no bodies' in the output context. Baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool gets a 'structural outline' (verb+resource) and specifies it returns 'signatures with line ranges (no bodies)'. This is distinct from siblings like 'grep' (search), 'show' (display content), and 'digest' (summary).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool vs alternatives like 'digest', 'grep', or 'show'. The description does not mention when to prefer outline over other tools or what prerequisites exist.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | Absolute path to the file | |
| symbols | Yes | Symbol names to extract | |
| signature | No | Return header/signature only, no body |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions suffix matching and the --signature option, but does not disclose whether the operation is read-only, permission requirements, or other side effects. Adequate but not rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, front-loaded with the main purpose. Every sentence adds value without unnecessary words. Excellent conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the main behavior, parameter semantics, and a usage tip. It does not explain the return format, but given the tool's simplicity and lack of output schema, it is fairly complete for an agent to use correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so baseline is 3. The description adds value by explaining suffix matching behavior (e.g., 'Foo.Bar' matches '*.Foo.Bar') and the function of the --signature flag, which goes beyond the schema's basic descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('extract') and the resource ('full source body of one or more symbols from a file'). It effectively distinguishes from sibling tools like grep (text search) and outline (structure) by specifying symbol extraction.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for extracting symbol bodies and mentions suffix matching and the --signature flag, but does not explicitly state when to use this tool over alternatives or when not to use it. Usage context is implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
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
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
Search GitHub, npm, PyPI, StackOverflow, ArXiv from one MCP — built for coding 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.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceProvides structural code intelligence via 26 MCP tools, enabling AI assistants to query code symbols, dependencies, and call graphs accurately without file-pasting.
- AlicenseNot gradedqualityCmaintenanceEnables 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.266MIT
- AlicenseNot gradedqualityCmaintenanceMCP 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 gradedqualityAmaintenanceProvides a local-first code indexing and search engine for coding agents via MCP, enabling precise codebase queries, symbol lookup, and freshness-aware retrieval.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Xayan/ast-outline-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server