Skip to main content
Glama

🗺️ CodeAtlas MCP 服务器

让你的 AI 助手深入理解任何代码库

npm CI License Node

一个独立的 MCP 服务器,可将代码分析数据公开给 Gemini、Claude、Cursor、Windsurf、VS Code Copilot — 并在对话之间提供持久化的 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 盲目地进行 grep 搜索,在每次对话中都会忘记你的项目。 使用 CodeAtlas 后: AI 可以立即了解你的架构、依赖关系,并记住上下文。


Related MCP server: code-intel MCP Server

🚀 设置(1 分钟)

1. 分析你的项目

安装 CodeAtlas 扩展,然后:

Ctrl+Shift+P → CodeAtlas: Analyze Project

2. 将 MCP 配置添加到你的 AI 中

{
  "mcpServers": {
    "codeatlas": {
      "command": "npx",
      "args": ["-y", "@giauphan/codeatlas-mcp"]
    }
  }
}
{
  "mcpServers": {
    "codeatlas": {
      "command": "npx",
      "args": ["-y", "@giauphan/codeatlas-mcp"]
    }
  }
}
{
  "mcp": {
    "servers": {
      "codeatlas": {
        "command": "npx",
        "args": ["-y", "@giauphan/codeatlas-mcp"]
      }
    }
  }
}
{
  "mcpServers": {
    "codeatlas": {
      "command": "npx",
      "args": ["-y", "@giauphan/codeatlas-mcp"]
    }
  }
}
claude mcp add codeatlas -- npx -y @giauphan/codeatlas-mcp
{
  "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 记忆 — 持久化上下文

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

Cursor

CLAUDE.md

Claude Code

.windsurfrules

Windsurf

这些文件会告诉你的 AI:

  1. 在每次对话开始时读取 .agents/memory/

  2. 在进行更改前使用 MCP 工具

  3. 在完成更改后调用 sync_system_memory


🌍 支持的语言

语言

特性

TypeScript / JavaScript

完整 AST:导入、类、函数、变量、调用、实现

Python

类、函数、变量、导入、调用

PHP

类、接口、特性 (traits)、枚举、函数、属性

Blade Templates

@extends, @include, @component, <x-component>


📦 替代方案:全局安装

npm install -g @giauphan/codeatlas-mcp

然后在你的 MCP 配置中使用 "command": "codeatlas-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

🔗 相关链接

许可证

MIT — 个人和商业用途免费。

Available Tools

10 tools
generate_feature_flow_diagramA

Generate a Mermaid diagram showing the EXECUTION FLOW of a feature. Unlike generate_system_flow (which shows module imports), this traces the actual call chain: entry point → controller → service → model → database. Given a keyword, it finds all related functions and classes, then builds a flowchart or sequence diagram showing how they call each other at runtime. This is the best tool for understanding HOW a feature works step-by-step.

Inputs: keyword (required), project, diagramType, depth, +1 more.

generate_system_flowB

Auto-generate a Mermaid flowchart diagram showing how modules, classes, and functions connect in the system. Returns a Mermaid diagram string that AI can read to understand the full system flow without reading every file.

Inputs: project, scope, feature, maxNodes.

get_dependenciesB

Get import/call/containment/implements relationships between entities. Shows how modules, classes, and functions are connected.

Inputs: project, source, target, relationship, +1 more.

get_file_entitiesC

Get all entities (classes, functions, variables) defined in a specific file.

Inputs: filePath (required), project.

get_insightsA

Get AI-generated code insights including refactoring suggestions, security issues, and maintainability analysis.

Inputs: no named parameters.

get_project_structureA

Get all modules, classes, functions, and variables in the analyzed project. Returns entity type, name, file path, and line number.

Inputs: project, type, limit.

list_projectsA

List all projects that have been analyzed by CodeAtlas. Returns project names, paths, and last analysis time.

Inputs: no named parameters.

search_entitiesB

Search for functions, classes, modules, or variables by name. Supports fuzzy matching.

Inputs: query (required), project, type.

sync_system_memoryA

Create or update the .agents/memory/ folder with auto-generated system documentation. This folder serves as AI's 'long-term memory' — it persists between conversations. After calling this, AI in any future conversation can read these files to understand the full system flow without re-analyzing. Call this after completing any code changes.

Inputs: project, businessRule, changeDescription.

trace_feature_flowA

Trace the complete flow of a feature through the codebase. Given a keyword (e.g. 'login', 'payment', 'crawl'), finds all related files, classes, and functions, then orders them by dependency chain to show the execution flow. This helps AI understand which files to read when working on a feature.

Inputs: keyword (required), project, depth.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools have distinct purposes. However, `generate_feature_flow_diagram` and `trace_feature_flow` both trace feature flow by keyword, differing only in output format (diagram vs. ordered list). Descriptions help differentiate, but an agent might still select the wrong one for a given need.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (e.g., `generate_feature_flow_diagram`, `get_dependencies`, `list_projects`). No mixed conventions or vague verbs.

    Tool Count5/5

    With 10 tools, the set covers the domain of code analysis and documentation well. Each tool serves a distinct, necessary function without redundancy or bloat.

    Completeness4/5

    The tool surface covers core CRUD-like operations for projects and entities, plus advanced analysis (flows, insights, memory sync). Minor gaps exist, such as no tool for editing entities or comparing versions, but core workflows are supported.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers