code-atlas-mcp
██████╗ ██████╗ ██████╗ ███████╗ █████╗ ████████╗██╗ █████╗ ███████╗
██╔════╝██╔═══██╗██╔══██╗██╔════╝ ██╔══██╗╚══██╔══╝██║ ██╔══██╗██╔════╝
██║ ██║ ██║██║ ██║█████╗ █████╗███████║ ██║ ██║ ███████║███████╗
██║ ██║ ██║██║ ██║██╔══╝ ╚════╝██╔══██║ ██║ ██║ ██╔══██║╚════██║
╚██████╗╚██████╔╝██████╔╝███████╗ ██║ ██║ ██║ ███████╗██║ ██║███████║
╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝
[ M C P ]高性能 AST 感知的 Model Context Protocol 服务器
将 Claude Code、Claude Desktop 和自主 AI 代理直接连接到结构化 AST 代码映射、令牌高效的代码骨架和 PR 爆炸半径影响分析。
📖 概述
现代 LLM 编码代理花费高达 70% 的上下文窗口来摄取原始文件树和冗余文件内容。在修改大型代码库时,AI 助手通常缺乏对以下方面的可见性:
下游调用者与依赖者:修改导出的函数签名会破坏 5 个目录之外的调用者。
令牌膨胀:完整文件转储将上下文浪费在实现体上,而不是类型定义和签名上。
PR 回归爆炸半径:缺乏对哪些单元和集成测试套件覆盖了修改的 AST 节点的认知。
code-atlas-mcp 解决了这个问题,通过标准 Model Context Protocol (MCP) 暴露一个 AST 感知的智能层。它将源文件解析为结构化符号树,将函数体修剪为令牌高效的代码骨架,在 git 差异中隔离修改的 AST 节点,并计算传递性回归爆炸半径。
Related MCP server: MCP Filesystem Server
🏛️ 架构
┌────────────────────────────────────────────────────────────────────────┐
│ AI Coding Clients │
│ (Claude Code CLI / Claude Desktop / Cursor / Custom Agents) │
└──────────────────────────────────┬─────────────────────────────────────┘
│ MCP Protocol (JSON-RPC over stdio)
▼
┌────────────────────────────────────────────────────────────────────────┐
│ code-atlas-mcp │
│ ┌───────────────────────────────┬──────────────────────────────────┐ │
│ │ MCP Request Router │ Tool Schema Validators │ │
│ │ (ListTools / CallTool Handler)│ (Zod Runtime) │ │
│ └───────────────┬───────────────┴──────────────────┬───────────────┘ │
│ ▼ ▼ │
│ ┌───────────────────────────────┐ ┌───────────────────────────────┐ │
│ │ AST Engine │ │ Git Engine │ │
│ │ • TypeScript Compiler API │ │ • Unified Diff Parser │ │
│ │ • Symbol & Hierarchy Extr. │ │ • Line-to-AST Correlation │ │
│ │ • Token-Efficient Skeletons │ │ • Working Tree / Ref Diffs │ │
│ └───────────────┬───────────────┘ └───────────────┬───────────────┘ │
│ └───────────────┬──────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ Impact Analyzer │ │
│ │ • Downstream Callers Graph • Transitive Dependency BFS │ │
│ │ • Test Suite Coverage Map • Risk Scoring & Assessment Engine │ │
│ └──────────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────┬─────────────────────────────────────┘
▼
┌────────────────────────────────────────────────────────────────────────┐
│ Local Codebase │
│ Filesystem (.ts, .tsx, .js, .jsx) & .git │
└────────────────────────────────────────────────────────────────────────┘⚡ 核心 MCP 工具
1. get_repo_structure
返回仓库的分层、AST 修剪的结构映射,可选包含令牌高效的代码骨架。剥离函数体,同时保留完整的签名、导出的接口、类型和文档字符串。
参数
参数 | 类型 | 必填 | 描述 | 默认值 |
|
| 否 | 目标仓库目录。 | 当前工作目录 |
|
| 否 | 生成剥离函数体的令牌高效代码骨架。 |
|
|
| 否 | 最大目录遍历深度(1-20)。 |
|
|
| 否 | 要忽略的文件夹/文件 glob 模式数组。 |
|
|
| 否 | 允许的扩展名数组(例如 | 标准 TS/JS |
示例工具输出
{
"rootDir": "/workspace/my-app",
"totalFiles": 42,
"totalSymbols": 318,
"fileTree": {
"name": "src",
"type": "directory",
"children": [
{
"name": "auth.ts",
"type": "file",
"symbolsCount": 4,
"summary": {
"language": "typescript",
"linesOfCode": 120,
"symbols": [
{
"name": "verifyJwt",
"kind": "function",
"signature": "export function verifyJwt(token: string): Promise<JwtPayload>",
"startLine": 15,
"endLine": 42,
"isExported": true
}
],
"astSkeleton": "import { JwtPayload } from \"./types.js\";\n\nexport function verifyJwt(token: string): Promise<JwtPayload>;"
}
}
]
}
}2. analyze_diff_impact
分析分支、提交或未提交工作树之间修改的 AST 节点,以确定受影响的下游函数、类和组件。
参数
参数 | 类型 | 必填 | 描述 | 默认值 |
|
| 否 | 基础 git 修订版本或分支(例如 | 未提交的工作树 |
|
| 否 | 目标 git 修订版本或分支(例如 | 工作树状态 |
|
| 否 | git 仓库根目录的路径。 | 当前工作目录 |
示例工具输出
{
"baseRef": "main",
"headRef": "HEAD",
"changedFilesCount": 2,
"modifiedFiles": ["src/auth/jwt.ts"],
"modifiedAstNodes": [
{
"filePath": "src/auth/jwt.ts",
"symbol": {
"name": "verifyJwt",
"kind": "function",
"signature": "export function verifyJwt(token: string, options?: VerifyOptions): Promise<JwtPayload>",
"startLine": 12,
"endLine": 35,
"isExported": true
},
"changeType": "modified",
"modifiedLines": [12, 13, 14]
}
],
"affectedDownstream": [
{
"symbolName": "verifyJwt",
"sourceFile": "src/auth/jwt.ts",
"dependentFile": "src/middleware/auth.ts",
"impactType": "direct_import",
"reason": "File 'src/middleware/auth.ts' directly imports symbol 'verifyJwt' modified in 'src/auth/jwt.ts'"
}
],
"summary": "Diff Impact Analysis: 1 file(s) modified across 1 distinct AST symbol(s). Identified 1 downstream dependent reference(s) that require verification."
}3. inspect_blast_radius
识别目标文件更改的潜在回归点、传递性下游依赖者(BFS 遍历)和损坏的测试套件。计算 0-100 的风险评分及关键因素。
参数
参数 | 类型 | 必填 | 描述 | 默认值 |
|
| 是 | 目标源文件的路径(例如 | — |
|
| 否 | 仓库根目录的路径。 | 当前工作目录 |
示例工具输出
{
"targetFile": "src/services/user.ts",
"targetSymbols": [ /* AST Symbols */ ],
"directDependents": [
{
"filePath": "src/controllers/auth.ts",
"importedSymbols": ["getUserById", "updateUser"]
}
],
"transitiveDependents": [
{
"filePath": "src/routes/api.ts",
"depth": 2,
"chain": ["src/services/user.ts", "src/controllers/auth.ts", "src/routes/api.ts"]
}
],
"affectedSuites": [
{
"testFile": "tests/auth.test.ts",
"reliesOn": ["src/services/user.ts", "src/controllers/auth.ts"],
"riskLevel": "HIGH",
"potentialFailures": ["getUserById", "updateUser"]
}
],
"riskAssessment": {
"score": 65,
"level": "HIGH",
"factors": [
"Exports 4 symbol(s)",
"High direct coupling: 3 direct dependent files",
"Moderate cascade: 5 transitive dependents",
"1 test suite(s) actively verify dependent code"
]
}
}🚀 安装与快速开始
全局 CLI 安装
npm install -g code-atlas-mcp通过 NPX 直接运行
npx code-atlas-mcp --root /path/to/your/project🤖 Claude 集成配置
Claude Desktop 配置
将 code-atlas-mcp 添加到你的 claude_desktop_config.json:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"code-atlas": {
"command": "npx",
"args": [
"-y",
"code-atlas-mcp"
]
}
}
}如果你想固定特定的仓库目录:
{
"mcpServers": {
"code-atlas": {
"command": "npx",
"args": [
"-y",
"code-atlas-mcp",
"--root",
"/absolute/path/to/your/repository"
]
}
}
}Claude Code CLI 配置
启动 claude 并附加 MCP 服务器:
claude --mcp-server "npx -y code-atlas-mcp"🛠️ 开发与测试
前置要求
Node.js >= 18.0.0
npm >= 9.0.0
Git CLI
设置
# Clone the repository
git clone https://github.com/GeorgeTsakonas/code-atlas-mcp.git
cd code-atlas-mcp
# Install dependencies
npm install
# Build TypeScript to dist/
npm run build
# Run unit and integration tests with Vitest
npm test
# Run tests in watch mode
npm run test:watch
# Type check
npm run lint🗺️ 路线图
TypeScript Compiler API AST 提取
令牌高效的骨架生成(剥离函数体)
Git 差异行到 AST 节点的关联
下游依赖图与调用点影响分析
传递性爆炸半径检查与测试套件识别
MCP Standard stdio 传输
Python AST 解析器引擎支持(
ast/ Tree-sitter)Rust 和 Go AST 解析模块
基于 AST 符号的语义向量搜索
🤝 贡献
欢迎贡献!请随时提交 Pull Request。
Fork 该项目
创建你的功能分支(
git checkout -b feature/AmazingFeature)提交你的更改(
git commit -m 'Add some AmazingFeature')推送到分支(
git push origin feature/AmazingFeature)打开一个 Pull Request
📄 许可证
根据 MIT 许可证分发。有关更多信息,请参阅 LICENSE。
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 Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to understand and navigate codebases through structural analysis. Provides code mapping, symbol search, and impact analysis using ast-grep for accurate parsing of Python, JavaScript, TypeScript, and Go projects.452MIT
- AlicenseNot gradedqualityDmaintenanceProvides LLM-optimized tools for advanced code analysis, repository complexity evaluation, and call graph generation. It enables users to visualize directory structures, detect code patterns, and build semantic context with significant token savings.11MIT
- AlicenseAqualityCmaintenanceStructural graph map of any codebase. Scans entities, relationships, and feature flows across 13 languages so LLMs navigate by structure instead of reading everything.614MIT
- AlicenseBqualityAmaintenanceEnables LLMs to efficiently read, write, and refactor code using precise AST-based operations, reducing token usage and context window waste.25573MIT
Related MCP Connectors
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
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/GeorgeTsakonas/code-atlas-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server