MCP AST Explorer

io.github.LovRanRan由 GitHub 账号 LovRanRan 发布v0.1.0更新于 Oct 24, 2026

Python symbol exploration for codebase onboarding agents.

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,用 LibCST 索引 Python 源码,让助手查询定义、签名、引用、调用方和子类。

可以做什么
查找 Python 文件中模块、类、函数和方法的定义,并返回签名和同模块内的名称引用。追踪函数或方法的直接调用方,列出类的直接子类。对缺失符号或不支持的语言返回结构化结果,而不是编造答案。提供健康检查用于冒烟测试。
适用场景
适合助手在熟悉 Python 代码库时使用,需要基于符号回答某处如何定义、被谁调用或谁继承了它。也适合与仓库结构映射、测试运行类服务器搭配用于代码库入门工作流。
运行要求
作为本地 stdio 进程运行,从 PyPI 包 mcp-ast-explorer 安装,文档中的安装步骤使用 uv。仅解析 Python 文件;未声明账号、API 密钥或环境变量。
安装前请注意
v1 仅支持 Python,TypeScript 只是占位、尚未实现。不解析跨文件导入、别名、星号导入、限定引用和动态属性访问,调用链和类层级只返回直接关系,结果可能不完整。它会读取本地源码文件,请只指向愿意让助手看到的代码。

安装

在 SourceWeft 中

  1. 打开 控制台中的 MCP AST Explorer,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

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-mapper maps repository structure, languages, entry points, framework evidence, and Python dependency edges.
  • mcp-ast-explorer provides symbol-grounded Python definition, signature, reference, call-chain, and class-hierarchy lookups.
  • mcp-test-runner runs 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

ToolPurpose
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_chain currently returns direct callers only; recursive multi-hop expansion is not implemented.
  • class_hierarchy currently returns direct subclasses only and handles simple base names.
  • TypeScript is intentionally unsupported in v1.

Local Development

Install dependencies:

bash
uv sync --extra dev

Run the MCP server:

bash
uv run mcp-ast-explorer

Run verification:

bash
uv run ruff check .uv run mypyuv run pytest

License

MIT

来源:README.md,提交 8126b9f

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分