MCP server for Python AST/CST symbol exploration.
Project description
mcp-ast-explorer
MCP server for deterministic Python codebase symbol exploration.
mcp-ast-explorer indexes Python source files with LibCST and exposes focused MCP tools for codebase onboarding: definition lookup, function signatures, local references, direct call chains, and simple class hierarchy queries.
Codebase Onboarding Stack
mcp-ast-explorer is the semantic symbol layer in a three-server MCP tool stack for Project 6 wayfinder, a codebase onboarding agent.
mcp-repo-mappermaps repository structure, languages, entry points, framework evidence, and Python dependency edges.mcp-ast-explorerprovides symbol-grounded Python definition, signature, reference, call-chain, and class-hierarchy lookups.mcp-test-runnerruns local pytest/Jest checks and coverage summaries so agent claims can be verified against execution.
In wayfinder, this server feeds entry-point and symbol explanation while refusing to invent missing symbols.
Status
This is a Python-only v1. TypeScript is registered as an unsupported backend placeholder so the server has an explicit extension point, but TypeScript analysis is not implemented yet.
The server does not use an LLM for symbol lookup. If a requested symbol or class is not present in the parsed index, tools return a structured not-found result instead of inventing an answer.
Tools
| Tool | Purpose |
|---|---|
health() |
Returns ok for smoke checks. |
find_definition(path, symbol, language="python") |
Finds a module, class, function, or method definition. |
function_signature(path, symbol, language="python") |
Returns the signature for a function or method symbol. |
find_references(path, symbol, language="python") |
Returns same-module CST name references for an existing symbol. |
call_chain(path, from_symbol, depth=2, language="python") |
Returns direct callers detected from local references. |
class_hierarchy(path, class_name, language="python") |
Returns direct subclasses detected from simple base-class names. |
Supported Scope
- Python files parsed by LibCST.
- Symbol kinds: modules, classes, functions, and methods.
- Same-module reference lookup for simple names.
- Direct caller detection from function or method containers.
- Direct subclass detection for simple
class Child(Base):inheritance. - Structured error responses for unsupported languages and missing symbols.
Current Limitations
- Cross-file imports and package-wide resolution are out of scope for v1.
- Aliases, star imports, dynamic attribute access, and qualified references are not resolved.
call_chaincurrently returns direct callers only; recursive multi-hop expansion is not implemented.class_hierarchycurrently returns direct subclasses only and handles simple base names.- TypeScript is intentionally unsupported in v1.
Local Development
Install dependencies:
uv sync --extra dev
Run the MCP server:
uv run mcp-ast-explorer
Run verification:
uv run ruff check .
uv run mypy
uv run pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_ast_explorer-0.1.0.tar.gz.
File metadata
- Download URL: mcp_ast_explorer-0.1.0.tar.gz
- Upload date:
- Size: 103.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15e55142c08bac682987bd26f92b2a6f3b5a9d80fb1d627a6313dc31bc6380d1
|
|
| MD5 |
a1f318a5770e177dc0cda754a01a087b
|
|
| BLAKE2b-256 |
28d0f530d157edc956cd3ce2d44817ffd2a15da56b28738877d049cd9e109644
|
File details
Details for the file mcp_ast_explorer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_ast_explorer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1465b87b9022e97a64510fd02cd1eeb946b4c8a051b56f1da5ca35467fbc6e2a
|
|
| MD5 |
baa47f7119ac557da6a5b020e08a1670
|
|
| BLAKE2b-256 |
76931baaea4d69b8c6c1f8a9f607433558c7da1c56acc3a3205316d3ed7bc7af
|