mcp-sqlite-graph-memory
mcp-sqlite-graph-memory
通用模型上下文协议(MCP)服务器,为 AI 编码助手和自主代理提供基于 SQLite 的动态代码知识图谱内存。
自动检测活动工作区,将多语言 AST 和结构依赖解析为隔离的本地 SQLite 知识图谱,并通过精确的 MCP 工具来检查符号、计算最短调用/导入路径以及导航代码拓扑。
🌟 核心能力
零运行时依赖:完全使用 Python 标准库编写(
ast、sqlite3、json、re、hashlib、threading)。动态多工作区隔离:为每个工作区根目录生成确定性 SHA-256 哈希;将隔离的 SQLite 数据库存储在
~/.mcp-graph-memory/storage/graph_<hash>.db中。增量统计缓存:通过校验文件
mtime和size,在重新索引时实现亚毫秒级跳过未变更文件。多语言 AST 与结构解析器:
Python:类、方法、函数、异步函数、装饰器、导入(
from x import y、import z)、继承层次、调用点。TypeScript / JavaScript:类、接口、类型、函数、箭头函数、ES6 导入/导出、CommonJS
require()。Go:包、导入、结构体、接口、函数、方法。
Rust:模块、枚举、结构体、trait、
impl块、fn签名。C / C++ / Java / PHP / Ruby / Kotlin / Swift / Shell:结构体、类、定义。
冻结与 CPU 饥饿保护:
非阻塞异步守护进程初始化。
非忙等 stdio 传输(
for raw_line in sys.stdin:)。对
node_modules/、.git/、.venv/、二进制权重文件和缓存 blob 的严格忽略列表。
🛠️ MCP 工具规范
工具 | 参数 | 描述 |
|
| 增量或强制扫描并更新工作区图谱内存。 |
|
| 按精确文件路径、行范围、签名和关系查找符号。 |
|
| 计算两个文件或符号之间的最短依赖/导入/调用路径。 |
|
| 检查直接调用者、被调用者、包含和继承边。 |
|
| 返回架构指标、枢纽模块和目录树。 |
|
| 按路径模式、扩展名或包含的符号查找工作区文件。 |
🚀 安装
git clone https://github.com/Luiguard/mcp-sqlite-graph-memory.git ~/.mcp-graph-memory
chmod +x ~/.mcp-graph-memory/server.py🔌 集成指南
1. Google Antigravity 集成
选项 A:全局配置(推荐)
将 graph-memory 添加到位于 ~/.gemini/config/mcp_config.json 的全局 Antigravity MCP 配置文件中:
{
"mcpServers": {
"graph-memory": {
"command": "python3",
"args": [
"/home/YOUR_USER/.mcp-graph-memory/server.py"
]
}
}
}(将 /home/YOUR_USER 替换为你的实际 $HOME 目录路径,或使用绝对路径)。
选项 B:工作区级配置
对于按项目激活,请将 mcp_config.json 放置在工作区根目录下的 .agents/mcp_config.json 中:
{
"mcpServers": {
"graph-memory": {
"command": "python3",
"args": [
"${workspaceFolder}/.mcp-graph-memory/server.py"
]
}
}
}2. Claude Desktop 集成
找到你的 Claude 配置文件:
Linux:
~/.config/Claude/claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
添加服务器定义:
{
"mcpServers": {
"graph-memory": {
"command": "python3",
"args": [
"/path/to/mcp-sqlite-graph-memory/server.py"
]
}
}
}3. Cursor / VSCode / Windsurf 集成
在 .cursor/mcp.json 或 .vscode/mcp.json 中:
{
"mcpServers": {
"graph-memory": {
"command": "python3",
"args": [
"/path/to/mcp-sqlite-graph-memory/server.py"
]
}
}
}🔧 环境变量
变量 | 默认值 | 描述 |
|
| SQLite 数据库( |
|
| 当客户端在 |
🧪 验证与测试
执行自动化集成测试套件:
python3 test_server.py📄 许可证
MIT 许可证 — 版权所有(c)2026 Benjamin Leimer。详见 LICENSE。
This server cannot be installed
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 Connectors
Your memory, everywhere AI goes. Build knowledge once, access it via MCP anywhere.
Package intelligence MCP for AI agents — 22 tools, 19 ecosystems, AGPL SDK, free.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
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/Luiguard/mcp-sqlite-graph-memory'
If you have feedback or need assistance with the MCP directory API, please join our Discord server