
Graph-Mem
io.github.Sathvik-1007由 GitHub 帳號 Sathvik-1007 發布v1.0.0更新於 Oct 24, 2026
Persistent knowledge-graph memory for AI agents, with local semantic search. No API keys.
概覽
Graph-Mem 是一個本機 MCP 伺服器,為 AI 助理提供依專案持久化的知識圖譜,支援語意搜尋與多跳遍歷。
- 可以做什麼
- 在知識圖譜中建立、更新、合併與刪除實體、關係和觀察記錄,三類物件都支援完整的新增、讀取、修改、刪除,批次寫入時依名稱衝突自動合併。以語意加全文的混合排序搜尋圖譜,或直接對觀察文字做語意搜尋。透過多跳遍歷、最短路徑、鄰域子圖、實體與關係清單以及圖譜統計來探索結構。執行健康統計、品質稽核、連結建議與觀察壓縮等維護檢查。管理以獨立 SQLite 檔案儲存的多個具名圖譜,並啟動本機互動式儀表板進行視覺化瀏覽與編輯。
- 適用情境
- 適合希望助理跨工作階段記住專案脈絡、避免重複讀檔和重蹈錯誤的情況,也適合需要結構化關聯知識而非單純向量相似度的需求。同樣適用於建置需要記憶層的自訂代理,或為不同專案維護各自獨立的知識圖譜。
- 執行需求
- 以 Python 套件(graphmem-mcp)形式透過 stdio 在本機執行,可用 pip 安裝或以 uvx 直接執行。選用附加元件提供本機嵌入、ONNX 推論與儀表板介面。嵌入模型(預設 all-MiniLM-L6-v2)首次使用時下載,屆時需要網路存取。選用環境變數:GRAPHMEM_DB_PATH、GRAPHMEM_EMBEDDING_MODEL、GRAPHMEM_LOG_LEVEL、GRAPHMEM_TRAVERSAL_NODE_BUDGET。不需要 API 金鑰。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Graph-Mem,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Graph-Mem MCP
Persistent knowledge graph memory for AI agents and IDEs
[PyPI] [CI] [License: MIT] [Python 3.10+] [MCP]
Graph-Mem MCP is a universal MCP server that gives any agent or IDE persistent, structured memory through a knowledge graph. It combines graph storage, semantic vector search, and multi-hop traversal in a single package — install it, add it to your MCP config, and your agent gains memory that survives across sessions. It works everywhere MCP does.
Built To Be Trusted With Your Data
Works With
graph-mem is a standard MCP server, so it works with any MCP-compatible
agent, IDE, or framework. graph-mem install additionally writes the skill
file straight into the right place for these 13, each at a path cited against
the vendor's own documentation:
Using something else? The MCP config below is all you need; the skill file is a convenience, not a requirement. Adding your agent to the installer takes a documented path and about ten lines — see Adding an Agent.
What is this?
AI agents forget everything between sessions. They re-read files, re-discover architecture, and repeat mistakes. Graph-Mem MCP solves this by providing persistent, per-project knowledge graphs that any MCP-compatible agent can read and write to. The graph builds organically as the agent works — extracting entities, decisions, and relationships from every conversation. It runs as a standard MCP server with 28 tools that plug into any agent, IDE, or framework that supports the Model Context Protocol.
Why a graph, not just a vector store?
Vector search finds similar things. Graphs find connected things. When an agent asks "what depends on the auth service?", a vector store returns text that mentions auth. A knowledge graph traverses the actual dependency edges and returns every upstream consumer — even ones that never mention "auth" in their description. Graph-Mem gives you both: vector similarity for fuzzy discovery, graph traversal for structural queries.
Use Cases
- Agent memory — Give any AI coding agent persistent context across sessions
- IDE integration — Add knowledge graph tools to Cursor, Windsurf, Copilot, or any MCP-enabled IDE
- Agent building — Use as the memory layer when building custom AI agents and workflows
- Research & knowledge management — Build structured knowledge bases with semantic search
- Multi-project context — Maintain separate knowledge graphs per project with multi-graph support
Quick Start
1. Install:
Or run it without installing — uvx fetches and isolates it the way npx
does for Node:
Listed in the official MCP Registry
as io.github.Sathvik-1007/graphmem-mcp, so MCP-aware clients can discover and
install it directly.
2. Install the skill for your agent:
This writes a skill file that teaches your agent how to use all 28 MCP tools — when to search, when to add entities, naming conventions, and common workflows.
3. Configure MCP by adding this to your agent's MCP config:
With full customization:
That's it. Your agent now has persistent memory. Verify by asking it to run read_graph().
One-Prompt Setup
Paste this into your agent's chat to get started immediately:
Installation
Option 1: pip (Recommended)
Option 2: uvx (zero pre-install)
uvx downloads the package into an isolated environment and runs it in one command. Nothing to pre-install beyond uv.
Option 3: From source
Optional extras
Tools
Graph-Mem exposes 28 MCP tools — ten for writing, nine for reading, four for maintenance, four for multi-graph management, and one utility. Full CRUD on every primitive: entities, relationships, and observations can all be created, read, updated, and deleted.
Write Tools (10)
Read Tools (9)
Maintenance Tools (4)
Visualization (1)
Multi-Graph Tools (4)
Multi-graph storage: Each named graph is a separate SQLite database in
.graphmem/. The default graph isgraph.db. Use--graph <name>on CLI commands to target a specific graph.
Architecture
Everything lives in a single SQLite database per project. The server communicates over MCP's standard stdio transport (SSE and streamable-http also supported) and stores all data in .graphmem/graph.db at your project root. The database file is portable — copy it between machines, check it into version control, or back it up like any other file.
Further reading
MCP Integration
Graph-Mem MCP is a standard MCP server. It communicates with your agent over the Model Context Protocol (stdio by default, SSE and streamable-http also supported) and exposes 28 tools that the agent calls directly — the same way it calls any other MCP tool. It works with every MCP-compatible agent, IDE, and framework out of the box.
To verify it's working, ask your agent to run read_graph() — it should return the current graph statistics.
Graph Visualisation
The URL printed by graph-mem ui contains a session token — treat it as a
password. The dashboard reads and writes the graph, so the API requires that
token in a custom header, and rejects requests whose Origin or Host is not
the interface it bound. Without those checks any website you visited while the
UI was running could rewrite your knowledge graph. See
SECURITY.md for the details.
The open_dashboard MCP tool also starts this UI server and returns the URL to
your agent. It always binds localhost: the bind address is deliberately not a
tool parameter, so a prompt-injected agent cannot publish your graph to the
network.
Dashboard features:
- Force-directed graph canvas with real-time physics simulation
- Entity type filtering — toggle visibility of entity types via sidebar checkboxes
- Click-to-focus — click a node on the graph or sidebar to instantly center and zoom to it
- Inline entity editing — click any field (name, type, description) in the detail panel to edit it in-place
- Property management — add, edit, and delete individual properties per entity with per-row controls
- Observation management — add, edit, and delete observations with confirmation dialogs and inline editing
- Relationship navigation — click related entities to navigate the graph
- Entity creation and deletion — create new entities from the sidebar, delete with confirmation from the detail panel danger zone
- Hybrid search — semantic + keyword search across all entities
- Graph picker — switch between named graphs without restarting the server
- Physics controls — adjust spring, repulsion, damping, and gravity in real-time
- Keyboard shortcuts — Space (reheat), F (fit to view), Escape (deselect)
Data Storage
By default, Graph-Mem stores its database at .graphmem/graph.db relative to the current working directory. You can control this with:
Priority order: --db > --project-dir > GRAPHMEM_DB_PATH env var > default.
The .graphmem/ directory is automatically created if it doesn't exist. Add .graphmem/ to your .gitignore if you don't want to track the database in version control.
CLI Reference
Server
All server options:
Skill Installation
Where the skill is installed
Every path below is cited against the vendor's current documentation. An agent whose install location cannot be cited is not listed here — a guessed path reports success, writes a file, and the agent never reads it, which is worse than no support. Six agents were removed on exactly those grounds.
Agents whose target file is shared — AGENTS.md, GEMINI.md,
.github/copilot-instructions.md, Windsurf's global rules — get a delimited
section written into it. Anything you already have in the file survives, and
re-installing replaces the section instead of appending a second copy.
Want another agent supported? See Adding an Agent — it takes a documented path and about ten lines.
Graph Management
All management commands accept --db, --project-dir, and --graph for targeting a specific database.
Multi-graph support: Use --graph <name> to work with named graphs stored as .graphmem/<name>.db. Without --graph, commands target the default graph.db. The MCP tools list_graphs, create_graph, switch_graph, and delete_graph provide runtime graph management for agents.
Configuration
All settings are optional. Defaults work out of the box. Every setting can be controlled via CLI flags (see graph-mem server --help), environment variables, or both. CLI flags take precedence over environment variables, which take precedence over defaults.
Performance
Measured numbers, not adjectives. Reproduce the traversal figures with
python benchmarks/bench_traversal.py; the full table is in
docs/ARCHITECTURE.md.
Traversal — breadth-first with a global visited set, one indexed adjacency query per hop. A dense 60-node graph traverses to depth 6 in 5 ms. The obvious recursive-CTE formulation enumerates every simple path instead: on a 14-node graph it materialised 1,409,006 intermediate rows in 6.4 seconds to return the same 13 entities that BFS returns in 1 ms.
Graph canvas — Barnes-Hut force simulation (θ = 0.9). 2000 nodes run at 215 fps; 5000 nodes, the API's own cap, at 80 fps. The previous all-pairs implementation managed 30 fps and 3.7 fps respectively. Approximation error against the exact sum is 1.30% RMS, and settled layouts are equivalent.
Storage
- WAL journal with PRAGMA tuning — concurrent reads, memory-mapped I/O, so a large database does not consume proportional RAM
- One connection with a write lock held for the outermost transaction, and
BEGIN IMMEDIATEso a read-to-write upgrade cannot fail unretryably - Batched bulk operations, and every
IN (...)chunked below SQLite's bound-variable limit
Embeddings
- Content-hash cache keyed by
(hash, model), so two models coexist instead of clobbering each other; LRU eviction, batched reads and writes - Model loads lazily in a background thread at startup, and inference runs in a worker thread — neither blocks the event loop
- Optional ONNX backend when
optimum[onnxruntime]is installed and--use-onnxis set, falling back to PyTorch. Off by default; this project publishes no benchmark for it, so no speedup is claimed here.
Bounds — every traversal, search, and list response is capped by a named, configurable limit, and a capped response says so rather than returning a silent subset.
Development
Running Tests
Star History
[Star History Chart]License
來源:README.md,提交 7d4d385
工具
0版本歷史
1- v1.0.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分