🗺️ CodeAtlas MCP服务器
让你的AI助手深入了解任何代码库
](https://www.npmjs.com/package/@giauphan/codeatlas-mcp)   ](https://nodejs.org/)
独立 主控程序 向以下对象公开代码分析数据的服务器 双子座,克劳德,光标,风帆,VS代码复制品 --在对话之间具有持久的AI记忆。
______________________________________________________________________
✨ 它有什么作用?
Your Code → CodeAtlas Analyze → MCP Server → AI Understands Everything
│
10 powerful tools:
• Search functions & classes
• Trace feature flows
• Generate architecture diagrams
• Persistent memory across conversations在CodeAtlas之前: AI盲目地前进,每次对话都会忘记你的项目。 CodeAtlas之后: AI会立即知道你的架构、依赖关系,并记住上下文。
______________________________________________________________________
🚀 设置(1分钟)
1.分析你的项目
安装 CodeAtlas扩展那么:
Ctrl+Shift+P → CodeAtlas: Analyze Project2.将MCP配置添加到您的AI中
🟢 Gemini / Antigravity — .gemini/settings.json
{
"mcpServers": {
"codeatlas": {
"command": "npx",
"args": ["-y", "@giauphan/codeatlas-mcp"]
}
}
}⚫ Cursor — .cursor/mcp.json
{
"mcpServers": {
"codeatlas": {
"command": "npx",
"args": ["-y", "@giauphan/codeatlas-mcp"]
}
}
}🔵 VS Code Copilot — .vscode/settings.json
{
"mcp": {
"servers": {
"codeatlas": {
"command": "npx",
"args": ["-y", "@giauphan/codeatlas-mcp"]
}
}
}
}🟣 Claude Desktop — claude_desktop_config.json
{
"mcpServers": {
"codeatlas": {
"command": "npx",
"args": ["-y", "@giauphan/codeatlas-mcp"]
}
}
}🟣 Claude Code CLI
claude mcp add codeatlas -- npx -y @giauphan/codeatlas-mcp🔴 Windsurf — .windsurf/mcp.json
{
"mcpServers": {
"codeatlas": {
"command": "npx",
"args": ["-y", "@giauphan/codeatlas-mcp"]
}
}
}完成! 您的AI现在可以使用所有10个CodeAtlas工具。
______________________________________________________________________
🛠️ 10个MCP工具
代码分析(6个工具)
| 工具 | 说明 | 示例使用 |
|---|---|---|
list_projects | 列出所有已分析的项目 | “我有哪些项目?” |
get_project_structure | 获取模块、类、函数 | “显示所有类” |
get_dependencies | 导入/调用/包含关系 | “UserService依赖于什么?” |
get_insights | 代码质量和安全分析 | “有任何安全问题吗?” |
search_entities | 按名称模糊搜索实体 | “查找登录功能” |
get_file_entities | 特定文件中的所有实体 | “auth.ts中有什么?” |
架构可视化(2个工具)
| 工具 | 说明 | 示例使用 |
|---|---|---|
generate_system_flow | Mermaid架构图(模块导入) | “显示系统架构” |
generate_feature_flow_diagram ⭐ | Mermaid执行流程图(调用链) | “支付功能是如何工作的?” |
AI内存(2个工具)
| 工具 | 说明 | 示例使用 |
|---|---|---|
sync_system_memory | 将上下文保存到 .agents/memory/ | “记住我们改变了什么” |
trace_feature_flow | 通过代码库跟踪功能 | “身份验证涉及哪些文件?” |
______________________________________________________________________
🧠 AI记忆——持久上下文
人工智能助手在对话之间会忘记一切。CodeAtlas修复了这个问题:
Conversation 1 → AI analyzes code → sync_system_memory
│
.agents/memory/
├── system-map.md ← Architecture diagram
├── modules.json ← All entities
├── conventions.md ← Code patterns
├── business-rules.json ← Domain logic
├── feature-flows.json ← Feature traces
└── change-log.json ← Change history
│
Conversation 2 → AI reads memory → full context restored instantly ✨自动生成的IDE规则
当你奔跑时 Analyze Project,CodeAtlas自动为您的AI IDE创建规则文件:
| 生成的文件 | 用于 |
|---|---|
.agents/rules/codeatlas-mcp.md | 所有AI助手 |
.cursor/rules/codeatlas.mdc | 光标 |
CLAUDE.md | 克劳德代码 |
.windsurfrules | 风帆冲浪 |
这些告诉你的AI:
- 阅读
.agents/memory/每次谈话开始时 - 更改前使用MCP工具
- 呼叫
sync_system_memory完成更改后
______________________________________________________________________
🌍 支持的语言
| 语言 | 功能 |
|---|---|
| Types/JavaScript | 完整AST:导入、类、函数、变量、调用、实现 |
| python | 类、函数、变量、导入、调用 |
| PHP | 类、接口、特征、枚举、函数、属性 |
| 刀片模板 | @extends, @include, @component, `` |
______________________________________________________________________
📦 替代方案:全局安装
npm install -g @giauphan/codeatlas-mcp然后使用 "command": "codeatlas-mcp" 在MCP配置中(否 args 需要)。
______________________________________________________________________
🔧 环境变量
| 变量 | 描述 |
|---|---|
CODEATLAS_PROJECT_DIR | 强制指定特定的项目目录 |
默认情况下,服务器会自动发现所有项目.codeatlas/analysis.json在...之下~/.
______________________________________________________________________
🧑💻 发展
git clone https://github.com/giauphan/codeatlas-mcp.git
cd codeatlas-mcp
npm install
npm run build
npm test # 6 tests
npm start # Start MCP server______________________________________________________________________
🔗 相关
- CodeAtlas扩展 --带有交互式代码图的VS代码扩展
- MCP协议 --模型上下文协议标准
许可证
麻省理工学院 --个人和商业用途免费。
