codememory
🧠 CodeMemory
面向代码库的持久智能层
本地优先、注重隐私的 CLI 工具和面向 AI 代理的 Model Context Protocol (MCP) 服务器。
🌐 官方网站与文档:https://codemem.vercel.app/
⚡ 核心亮点
🔒 100% 本地与私密:零遥测、零外部网络调用。所有智能数据均以 SQLite WAL 模式存储在本地。
🌐 交互式 Web 架构浏览器:本地可视化流程图与内存仪表板,支持时间轴拖动和实时动态更新。
⚡ Token 效率:通过提供精准的上下文切片和调用者图谱而非原始文件转储,最大限度减少 AI 提示词 token 消耗。
🔍 多语言 AST 分析:跨 TypeScript/JavaScript、Python、Rust、Go、SQL 等语言提取函数、类、接口、结构体和导入。
👀 实时监听器:以 100ms 防抖和
.gitignore集成即时检测代码变更。🤖 原生 MCP 服务器:可随时连接 Antigravity、Claude Desktop、Cursor、Copilot 及自定义 AI 代理。
📊 架构可视化器:生成实时 Mermaid 图表、Markdown 文档和 JSON 映射。
Related MCP server: ContextAtlas
🚀 快速开始
1. 安装
# Clone the repository
git clone https://github.com/EldrexDelosReyesBula/CodeMemory.git
cd CodeMemory
# Install dependencies
npm install
# Build TypeScript
npm run build2. 基本命令
# Initialize CodeMemory in your repository
npm run dev -- init
# Scan the current codebase and index all symbols
npm run dev -- scan
# Search for any function, class, or symbol
npm run dev -- query authenticateUser
# Extract token-budgeted AI context
npm run dev -- context AuthService --budget 2000
# Start the live background file watcher
npm run dev -- watch
# Export Mermaid architecture diagram
npm run dev -- export --format mermaid
# Check repository health and statistics
npm run dev -- status🤖 通过 MCP 连接 AI 代理
CodeMemory 提供完整的 Model Context Protocol (MCP) stdio 服务器。
可用的 MCP 工具
工具 | 描述 |
| 搜索代码符号、签名和函数 |
| 带 token 预算的上下文,包含依赖和调用者 |
| 上游导入和下游依赖 |
| 最近的文件修改和 Git 提交日志 |
| 生成实时 Mermaid 架构图表 |
| 整体代码库统计和语言分布 |
Antigravity 与 Claude Desktop 配置
将以下内容添加到您的 MCP 配置(mcp_config.json 或 claude_desktop_config.json)中:
{
"mcpServers": {
"codememory": {
"command": "node",
"args": ["c:/Users/Eldrex/Downloads/classhost/Needs/CodeMemory/dist/cli.js", "mcp"],
"env": {}
}
}
}🏗️ 架构
CodeMemory/
├── src/
│ ├── types/ # Domain data types & contracts
│ ├── db/ # SQLite engine with WAL mode & indexes
│ ├── parser/ # Multi-language AST symbol & dependency extractor
│ ├── watcher/ # Real-time debounced file watcher with .gitignore
│ ├── git/ # Git commit and diff history monitor
│ ├── generator/ # Mermaid diagram & Markdown/JSON exporters
│ ├── context/ # Token-budgeted context assembly & symbol ranker
│ ├── mcp/ # Model Context Protocol stdio server
│ └── cli.ts # CLI commands router
└── tests/ # Complete Vitest test suite📜 许可证
MIT License - 版权所有 (c) 2026 Eldrex Delos Reyes Bula.
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
shared AI-context layer for teams — persistent memory your agents search and update over MCP
Search GitHub, npm, PyPI, StackOverflow, ArXiv from one MCP — built for coding agents.
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
Related MCP Servers
- AlicenseBqualityDmaintenanceLocal-first codebase context engine that parses code into a ranked dependency graph and serves it to AI tools via MCP for deep structural understanding.54 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI coding agents to retrieve and manage code context with hybrid search, project memory, and observability via MCP tools.29MIT
- AlicenseNot gradedqualityDmaintenanceServes structured code context via MCP, enabling AI agents to understand codebases with dependency graphs and significantly reduce token usage.14 npm1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to query a codebase as a knowledge graph, providing token-budgeted context, search, and impact analysis via MCP tools.MIT