giauphan/codeatlas-mcp

GitHub: giauphan/codeatlas-mcp

为 AI 助手构建代码库的深度理解与持久化上下文记忆,提升架构探索与审查效率。

Stars: 1 | Forks: 0

# 🗺️ CodeAtlas MCP 服务器 **为您的 AI 助手提供对代码库的深度理解** [![npm](https://img.shields.io/npm/v/@giauphan/codeatlas-mcp?logo=npm)](https://www.npmjs.com/package/@giauphan/codeatlas-mcp) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/f3806fa30c053601.svg)](https://github.com/giauphan/codeatlas-mcp/actions) [![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![Node](https://img.shields.io/badge/Node-%3E%3D18-brightgreen?logo=node.js)](https://nodejs.org/) ## ✨ 它能做什么? ``` 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 盲目 grep,每次对话都会忘记项目。 **使用 CodeAtlas 之后:** AI 瞬间了解你的架构、依赖关系,并记住上下文。 ## 🚀 快速上手(1 分钟) ### 1. 分析你的项目 安装 [CodeAtlas 扩展](https://github.com/giauphan/CodeAtlas),然后运行: ``` Ctrl+Shift+P → CodeAtlas: Analyze Project ``` ### 2. 添加 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 Desktopclaude_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"] } } } ```
## 🛠️ 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 内存 — 持久化上下文 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 规则 当你运行“分析项目”时,CodeAtlas 会为你的 AI IDE 自动创建规则文件: | 生成的文件 | 用途 | |---|---| | `.agents/rules/codeatlas-mcp.md` | 所有 AI 助手 | | `.cursor/rules/codeatlas.mdc` | Cursor | | `CLAUDE.md` | Claude Code | | `.windsurfrules` | Windsurf | 这些规则会告诉你的 AI: 1. 在每次对话开始时读取 `.agents/memory/` 2. 在修改代码前使用 MCP 工具 3. 完成更改后调用 `sync_system_memory` ## 🌍 支持的语言 | 语言 | 特性 | |----------|----------| | **TypeScript / JavaScript** | 完整的 AST:导入、类、函数、变量、调用、实现 | | **Python** | 类、函数、变量、导入、调用 | | **PHP** | 类、接口、特性、枚举、函数、属性 | | **Blade 模板** | `@extends`、`@include`、`@component`、`` | ## 📦 替代方案:全局安装 ``` npm install -g @giauphan/codeatlas-mcp ``` 然后在 MCP 配置中使用 `"command": "codeatlas-mcp"`(无需 `args`)。 ## 🔧 环境变量 | 变量 | 描述 | |----------|-------------| | `CODEATLAS_PROJECT_DIR` | 强制指定项目目录 | ## 🧑‍💻 开发 ``` 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 扩展](https://github.com/giauphan/CodeAtlas) — 带交互式代码图谱的 VS Code 扩展 - [MCP 协议](https://modelcontextprotocol.io/) — 模型上下文协议标准 ## 许可证 [MIT](LICENSE) — 自由用于个人和商业用途。
标签:AI助手集成, AI编程辅助, Claude, CMS安全, Copilot, Cursor, CVE检测, Gemini, GNU通用公共许可证, JavaScript, MCP服务器, MITM代理, Node.js, npm包, SEO: AI代码助手, SEO: MCP服务器, SEO: 代码理解工具, SOC Prime, TypeScript, VS Code, WebSocket, Windsurf, 上下文记忆, 代码分析, 代码导航, 代码库分析, 代码库理解, 代码理解, 依赖分析, 凭证管理, 函数搜索, 功能流追踪, 后端开发, 威胁情报, 安全插件, 开发工具, 开发者工具, 持久化内存, 数据可视化, 架构可视化, 架构图生成, 类搜索, 逆向工具, 项目结构分析