{
  "markdown": "# Graph-Mem MCP\n\n<!-- mcp-name: io.github.Sathvik-1007/graphmem-mcp -->\n\n> Persistent knowledge graph memory for AI agents and IDEs\n\n[![PyPI](https://img.shields.io/pypi/v/graphmem-mcp.svg)](https://pypi.org/project/graphmem-mcp/)\n[![CI](https://github.com/Sathvik-1007/GraphMem-MCP/actions/workflows/ci.yml/badge.svg)](https://github.com/Sathvik-1007/GraphMem-MCP/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org)\n[![MCP](https://img.shields.io/badge/MCP-server-purple.svg)](https://modelcontextprotocol.io)\n\nGraph-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.\n\n### Built To Be Trusted With Your Data\n\n| | |\n|---|---|\n| **1055 tests** | Property-based against a brute-force reference, plus fuzzing on every parser |\n| **mypy strict** | Clean, enforced in CI — not just configured |\n| **Authenticated UI** | Host + Origin allow-lists and a session token; a cross-origin write is a `403`, verified against a running server |\n| **Bounded** | Every traversal, search, and list response has a named, configurable cap and reports truncation |\n| **Honest docs** | Performance claims come with measurements and a reproducible benchmark; [known gaps](docs/ARCHITECTURE.md#known-gaps) are written down |\n\n### Works With\n\ngraph-mem is a standard MCP server, so it works with **any** MCP-compatible\nagent, IDE, or framework. `graph-mem install` additionally writes the skill\nfile straight into the right place for these 13, each at a path cited against\nthe vendor's own documentation:\n\n<table>\n<tr>\n<td><b>Claude Code</b></td>\n<td><b>OpenCode</b></td>\n<td><b>Cursor</b></td>\n<td><b>Windsurf</b></td>\n<td><b>Codex CLI</b></td>\n</tr>\n<tr>\n<td><b>Gemini CLI</b></td>\n<td><b>GitHub Copilot</b></td>\n<td><b>Amp</b></td>\n<td><b>Kiro</b></td>\n<td><b>Roo Code</b></td>\n</tr>\n<tr>\n<td><b>Continue</b></td>\n<td><b>Antigravity</b></td>\n<td><b>Droid (Factory)</b></td>\n<td colspan=\"2\"><a href=\"CONTRIBUTING.md#adding-an-agent\">add yours →</a></td>\n</tr>\n</table>\n\nUsing something else? The MCP config below is all you need; the skill file is a\nconvenience, not a requirement. Adding your agent to the installer takes a\ndocumented path and about ten lines — see\n[Adding an Agent](CONTRIBUTING.md#adding-an-agent).\n\n---\n\n## What is this?\n\nAI 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.\n\n### Why a graph, not just a vector store?\n\nVector 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.\n\n### Use Cases\n\n- **Agent memory** — Give any AI coding agent persistent context across sessions\n- **IDE integration** — Add knowledge graph tools to Cursor, Windsurf, Copilot, or any MCP-enabled IDE\n- **Agent building** — Use as the memory layer when building custom AI agents and workflows\n- **Research & knowledge management** — Build structured knowledge bases with semantic search\n- **Multi-project context** — Maintain separate knowledge graphs per project with multi-graph support\n\n---\n\n## Quick Start\n\n**1. Install:**\n\n```bash\npip install graphmem-mcp\n```\n\nOr run it without installing — `uvx` fetches and isolates it the way `npx`\ndoes for Node:\n\n```bash\nuvx --from graphmem-mcp graph-mem server\n```\n\nListed in the [official MCP Registry](https://github.com/modelcontextprotocol/registry)\nas `io.github.Sathvik-1007/graphmem-mcp`, so MCP-aware clients can discover and\ninstall it directly.\n\n**2. Install the skill for your agent:**\n\n```bash\ngraph-mem install claude       # Claude Code\ngraph-mem install opencode     # OpenCode\ngraph-mem install codex        # Codex CLI\ngraph-mem install gemini       # Gemini CLI\ngraph-mem install cursor       # Cursor\ngraph-mem install windsurf     # Windsurf\ngraph-mem install amp          # Amp\ngraph-mem install antigravity  # Antigravity\ngraph-mem install copilot      # GitHub Copilot\ngraph-mem install kiro         # Kiro\ngraph-mem install roocode      # Roo Code\ngraph-mem install continue     # Continue\ngraph-mem install droid        # Droid (Factory)\n```\n\nThis 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.\n\n**3. Configure MCP** by adding this to your agent's MCP config:\n\n```json\n{\n  \"mcpServers\": {\n    \"graph-mem\": {\n      \"command\": \"graph-mem\",\n      \"args\": [\"server\"]\n    }\n  }\n}\n```\n\nWith full customization:\n\n```json\n{\n  \"mcpServers\": {\n    \"graph-mem\": {\n      \"command\": \"graph-mem\",\n      \"args\": [\n        \"server\",\n        \"--project-dir\", \"/path/to/my/project\",\n        \"--embedding-model\", \"sentence-transformers/all-mpnet-base-v2\",\n        \"--use-onnx\",\n        \"--cache-size\", \"20000\",\n        \"--log-level\", \"INFO\"\n      ]\n    }\n  }\n}\n```\n\nThat's it. Your agent now has persistent memory. Verify by asking it to run `read_graph()`.\n\n---\n\n## One-Prompt Setup\n\nPaste this into your agent's chat to get started immediately:\n\n```\nI want you to give yourself persistent memory using graph-mem. Run the following:\n\npip install graphmem-mcp\ngraph-mem install claude    # or: opencode, codex, gemini, cursor, windsurf, amp,\n                            #     antigravity, copilot, kiro, roocode, continue, droid\n\nThis installs a skill file that teaches you how to use all 28 MCP tools.\nThe server should already be configured in your MCP config. If not, add it:\n\n{\n  \"mcpServers\": {\n    \"graph-mem\": {\n      \"command\": \"graph-mem\",\n      \"args\": [\"server\", \"--project-dir\", \"/path/to/your/project\"]\n    }\n  }\n}\n\nNow start using the knowledge graph:\n\n1. read_graph() to see current state\n2. search_nodes(\"relevant topic\") to find existing knowledge\n3. add_entities, add_relationships, add_observations as you learn things\n4. update_observation / update_relationship to fix mistakes in-place\n5. open_dashboard() to explore the graph visually in your browser\n6. At session end, capture anything important you discovered\n\nYour goal: build a rich knowledge graph of this project so future sessions\nstart with full context instead of from zero. Search before adding to avoid\nduplicates. Be specific with entity names and types.\n```\n\n---\n\n## Installation\n\n### Option 1: pip (Recommended)\n\n```bash\npip install graphmem-mcp\ngraph-mem server\n```\n\n### Option 2: uvx (zero pre-install)\n\n```bash\nuvx --from graphmem-mcp graph-mem server\n```\n\n`uvx` downloads the package into an isolated environment and runs it in one command. Nothing to pre-install beyond [uv](https://docs.astral.sh/uv/).\n\n### Option 3: From source\n\n```bash\ngit clone https://github.com/Sathvik-1007/GraphMem-MCP\ncd graph-mem\npip install -e \".[full,dev]\"\ngraph-mem server\n```\n\n### Optional extras\n\n```bash\npip install \"graphmem-mcp[embeddings]\"   # sentence-transformers for local embeddings\npip install \"graphmem-mcp[onnx]\"         # ONNX runtime for embedding inference\npip install \"graphmem-mcp[ui]\"           # aiohttp for interactive graph visualisation\npip install \"graphmem-mcp[full]\"         # all of the above\n```\n\n---\n\n## Tools\n\nGraph-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.\n\n### Write Tools (10)\n\n| Tool | Description |\n|------|-------------|\n| `add_entities` | Batch-create entities with optional observations; auto-merges on name conflict; returns quality screening hints |\n| `add_relationships` | Create typed, directed edges between entities; merges duplicates by max weight |\n| `add_observations` | Attach factual statements to entities with optional source provenance |\n| `update_entity` | Modify entity name, description, properties, or type in-place (rename with collision check) |\n| `update_relationship` | Change weight, type, or properties of an existing edge without delete+re-create |\n| `update_observation` | Edit observation text content in-place with automatic embedding recompute |\n| `delete_entities` | Remove entities with cascade to relationships, observations, and embeddings |\n| `delete_relationships` | Remove specific edges between entities, optionally filtered by type |\n| `delete_observations` | Remove specific observations by ID with ownership validation |\n| `merge_entities` | Combine duplicate entities: moves observations and relationships, deduplicates edges |\n\n### Read Tools (9)\n\n| Tool | Description |\n|------|-------------|\n| `search_nodes` | Hybrid semantic + full-text search with RRF fusion ranking |\n| `search_observations` | Semantic search directly over observation text content |\n| `find_connections` | Multi-hop BFS graph traversal with direction and type filters |\n| `get_entity` | Full entity details with all observations and relationships |\n| `list_entities` | Browse/paginate all entities with optional type filter |\n| `list_relationships` | Browse/paginate relationships with entity, type, or combined filters |\n| `read_graph` | Graph statistics: counts, type distributions, most-connected entities |\n| `get_subgraph` | Extract neighborhood subgraph around seed entities |\n| `find_paths` | Find shortest paths between two entities via BFS |\n\n### Maintenance Tools (4)\n\n| Tool | Description |\n|------|-------------|\n| `graph_health` | Health stats: counts, hotspots, missing descriptions, suggested actions |\n| `compact_observations` | Atomic observation compaction — delete old and add merged summaries in one step |\n| `suggest_connections` | Find semantically similar entities for a node to connect to |\n| `audit_graph` | Full quality screening — disconnected nodes, missing data, weak links. Returns structured findings plus a rendered `report` field |\n\n### Visualization (1)\n\n| Tool | Description |\n|------|-------------|\n| `open_dashboard` | Launch interactive graph visualisation UI and return its URL |\n\n### Multi-Graph Tools (4)\n\n| Tool | Description |\n|------|-------------|\n| `list_graphs` | List all named graphs in the `.graphmem/` directory with entity/relationship/observation counts |\n| `create_graph` | Create a new named graph (`.graphmem/<name>.db`) |\n| `switch_graph` | Switch the active graph — hot-swaps storage, search, and graph engines |\n| `delete_graph` | Delete a named graph (cannot delete the currently active graph) |\n\n> **Multi-graph storage**: Each named graph is a separate SQLite database in `.graphmem/`. The default graph is `graph.db`. Use `--graph <name>` on CLI commands to target a specific graph.\n\n---\n\n## Architecture\n\n```mermaid\ngraph TD\n    Agent[Any MCP-Compatible Agent or IDE] --> Transport\n\n    subgraph Transport\n        STDIO[stdio]\n        SSE[SSE]\n        HTTP[streamable-http]\n    end\n\n    Transport --> Tools\n\n    subgraph Tools[Graph-Mem MCP Server — 28 MCP Tools]\n        Write[Write · 10 tools]\n        Read[Read · 9 tools]\n        Maint[Maintenance · 4 tools]\n        Graph[Multi-Graph · 4 tools]\n        UI[Dashboard · 1 tool]\n    end\n\n    Write --> Engines\n    Read --> Engines\n    Maint --> Engines\n\n    subgraph Engines\n        GE[GraphEngine]\n        SE[HybridSearch]\n        EE[EmbeddingEngine]\n        GT[GraphTraversal]\n        EM[EntityMerger]\n    end\n\n    Engines --> Storage\n\n    subgraph Storage[SQLite Storage]\n        DB[SQLite WAL]\n        VEC[sqlite-vec]\n        FTS[FTS5]\n    end\n\n    UI --> Dashboard[React SPA + aiohttp]\n    Dashboard --> DB\n```\n\nEverything 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.\n\n### Further reading\n\n| Document | What is in it |\n|----------|---------------|\n| **[How It Works](how-it-works.md)** | Data model, search pipeline, traversal, entity resolution, storage layout, request flow |\n| **[Architecture](docs/ARCHITECTURE.md)** | Why the design is what it is — the load-bearing decisions, their costs, and the measured baselines |\n| **[Security](SECURITY.md)** | Threat model, the MCP and browser trust boundaries, and what is deliberately out of scope |\n| **[Contributing](CONTRIBUTING.md)** | Local setup and the gates CI enforces |\n\n---\n\n## MCP Integration\n\nGraph-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.\n\nTo verify it's working, ask your agent to run `read_graph()` — it should return the current graph statistics.\n\n---\n\n## Graph Visualisation\n\n```bash\ngraph-mem ui                              # open interactive graph explorer\ngraph-mem ui --no-open                    # start server without opening browser\ngraph-mem ui --port 9090                  # use a specific port\ngraph-mem ui --graph harry-potter         # open a specific named graph\n```\n\nThe URL printed by `graph-mem ui` contains a **session token** — treat it as a\npassword. The dashboard reads *and writes* the graph, so the API requires that\ntoken in a custom header, and rejects requests whose `Origin` or `Host` is not\nthe interface it bound. Without those checks any website you visited while the\nUI was running could rewrite your knowledge graph. See\n[SECURITY.md](SECURITY.md) for the details.\n\nThe `open_dashboard` MCP tool also starts this UI server and returns the URL to\nyour agent. It always binds localhost: the bind address is deliberately not a\ntool parameter, so a prompt-injected agent cannot publish your graph to the\nnetwork.\n\n**Dashboard features:**\n- **Force-directed graph canvas** with real-time physics simulation\n- **Entity type filtering** — toggle visibility of entity types via sidebar checkboxes\n- **Click-to-focus** — click a node on the graph or sidebar to instantly center and zoom to it\n- **Inline entity editing** — click any field (name, type, description) in the detail panel to edit it in-place\n- **Property management** — add, edit, and delete individual properties per entity with per-row controls\n- **Observation management** — add, edit, and delete observations with confirmation dialogs and inline editing\n- **Relationship navigation** — click related entities to navigate the graph\n- **Entity creation and deletion** — create new entities from the sidebar, delete with confirmation from the detail panel danger zone\n- **Hybrid search** — semantic + keyword search across all entities\n- **Graph picker** — switch between named graphs without restarting the server\n- **Physics controls** — adjust spring, repulsion, damping, and gravity in real-time\n- **Keyboard shortcuts** — Space (reheat), F (fit to view), Escape (deselect)\n\n---\n\n## Data Storage\n\nBy default, Graph-Mem stores its database at `.graphmem/graph.db` relative to the current working directory. You can control this with:\n\n| Method | Example | Result |\n|--------|---------|--------|\n| `--project-dir` | `--project-dir /home/user/myproject` | Stores at `/home/user/myproject/.graphmem/graph.db` |\n| `--db` | `--db /custom/path/memory.db` | Stores at exactly that path |\n| `GRAPHMEM_DB_PATH` env | `export GRAPHMEM_DB_PATH=/tmp/test.db` | Stores at that path |\n| Default | (nothing) | `.graphmem/graph.db` relative to CWD |\n\n**Priority order:** `--db` > `--project-dir` > `GRAPHMEM_DB_PATH` env var > default.\n\nThe `.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.\n\n---\n\n## CLI Reference\n\n### Server\n\n```bash\ngraph-mem server                          # stdio transport (default)\ngraph-mem server --transport sse          # SSE transport\ngraph-mem server --db /path/to/graph.db   # custom database path\ngraph-mem server --project-dir /my/project  # store memory in <dir>/.graphmem/\ngraph-mem server --project-dir /my/project --graph harry-potter  # use named graph\n\n# Embedding customization\ngraph-mem server --embedding-model sentence-transformers/all-mpnet-base-v2\ngraph-mem server --no-onnx --embedding-device cuda\ngraph-mem server --cache-size 50000\n\n# Tuning\ngraph-mem server --search-limit 20 --max-hops 6\ngraph-mem server --log-level DEBUG\n```\n\nAll server options:\n\n| Flag | Description | Default |\n|------|-------------|---------|\n| `--transport` | `stdio`, `sse`, or `streamable-http` | `stdio` |\n| `--db` | Path to SQLite database file | `.graphmem/graph.db` |\n| `--project-dir` | Project root; DB at `<dir>/.graphmem/graph.db` | CWD |\n| `--graph` | Named graph (resolves to `<dir>/.graphmem/<name>.db`) | `graph` |\n| `--host` | Bind address (SSE/HTTP only) | `127.0.0.1` |\n| `--port` | Port (SSE/HTTP only) | `8080` |\n| `--embedding-model` | HuggingFace model ID for embeddings | `all-MiniLM-L6-v2` |\n| `--use-onnx / --no-onnx` | Use the ONNX embedding backend (needs `optimum[onnxruntime]`) | off |\n| `--embedding-device` | `cpu` or `cuda` | `cpu` |\n| `--cache-size` | Embedding LRU cache max entries | `10000` |\n| `--search-limit` | Default max results for `search_nodes` | `10` |\n| `--max-hops` | Default max depth for `find_connections` | `4` |\n| `--log-level` | `DEBUG` / `INFO` / `WARNING` / `ERROR` / `CRITICAL` | `WARNING` |\n\n### Skill Installation\n\n```bash\ngraph-mem install <agent>                 # project-level install\ngraph-mem install <agent> --global        # global/user-level install\ngraph-mem install <agent> --domain code   # use domain overlay (code, research, general)\n```\n\n#### Where the skill is installed\n\nEvery path below is cited against the vendor's current documentation. An agent\nwhose install location cannot be cited is not listed here — a guessed path\nreports success, writes a file, and the agent never reads it, which is worse\nthan no support. Six agents were removed on exactly those grounds.\n\n| Agent | Project path | User-level path | Written as | Source |\n|-------|--------------|-----------------|------------|--------|\n| `claude` | `.claude/skills/graph-mem/SKILL.md` | `~/.claude/skills/graph-mem/SKILL.md` | own file | [docs](https://code.claude.com/docs/en/skills) |\n| `opencode` | `.opencode/skills/graph-mem/SKILL.md` | `~/.config/opencode/skills/graph-mem/SKILL.md` | own file | [docs](https://opencode.ai/docs/skills/) |\n| `codex` | `AGENTS.md` | `~/.codex/AGENTS.md` | section | [docs](https://learn.chatgpt.com/codex/agent-configuration/agents-md) |\n| `gemini` | `GEMINI.md` | `~/.gemini/GEMINI.md` | section | [docs](https://geminicli.com/docs/cli/gemini-md/) |\n| `cursor` | `.cursor/rules/graph-mem.mdc` | — | own file | [docs](https://cursor.com/docs/rules) |\n| `windsurf` | `.windsurf/rules/graph-mem.md` | `~/.codeium/windsurf/memories/global_rules.md` | own file | [docs](https://docs.windsurf.com/windsurf/cascade/memories) |\n| `amp` | `.agents/skills/graph-mem/SKILL.md` | `~/.config/agents/skills/graph-mem/SKILL.md` | own file | [docs](https://ampcode.com/manual) |\n| `antigravity` | `AGENTS.md` | `~/.gemini/AGENTS.md` | section | [docs](https://codelabs.developers.google.com/autonomous-ai-developer-pipelines-antigravity) |\n| `copilot` | `.github/copilot-instructions.md` | — | section | [docs](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions) |\n| `kiro` | `.kiro/steering/graph-mem.md` | `~/.kiro/steering/graph-mem.md` | own file | [docs](https://kiro.dev/docs/steering/) |\n| `roocode` | `.roo/rules/graph-mem.md` | `~/.roo/rules/graph-mem.md` | own file | [docs](https://docs.roocode.com/features/custom-instructions) |\n| `continue` | `.continue/rules/graph-mem.md` | — | own file | [docs](https://docs.continue.dev/customize/deep-dives/rules) |\n| `droid` | `AGENTS.md` | `~/.factory/AGENTS.md` | section | [docs](https://docs.factory.ai/cli/configuration/agents-md) |\n\nAgents whose target file is shared — `AGENTS.md`, `GEMINI.md`,\n`.github/copilot-instructions.md`, Windsurf's global rules — get a delimited\nsection written into it. Anything you already have in the file survives, and\nre-installing replaces the section instead of appending a second copy.\n\nWant another agent supported? See\n[Adding an Agent](CONTRIBUTING.md#adding-an-agent) — it takes a documented\npath and about ten lines.\n\n### Graph Management\n\n```bash\ngraph-mem init                            # create .graphmem/ directory\ngraph-mem init --project-dir /my/project  # create in specific directory\ngraph-mem init --graph research           # create a named graph\ngraph-mem status                          # print graph statistics\ngraph-mem status --json                   # graph statistics as JSON\ngraph-mem status --graph research         # status of a named graph\ngraph-mem export --format json            # export entire graph\ngraph-mem export --output backup.json     # export to file\ngraph-mem import graph.json               # import graph from file\ngraph-mem validate                        # run integrity checks\n```\n\nAll management commands accept `--db`, `--project-dir`, and `--graph` for targeting a specific database.\n\n**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.\n\n---\n\n## Configuration\n\nAll 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.\n\n| Environment Variable | CLI Flag | Default | Description |\n|---------------------|----------|---------|-------------|\n| `GRAPHMEM_DB_PATH` | `--db` | `.graphmem/graph.db` | Database file path |\n| `GRAPHMEM_BACKEND_TYPE` | -- | `sqlite` | Storage backend |\n| `GRAPHMEM_EMBEDDING_MODEL` | `--embedding-model` | `all-MiniLM-L6-v2` | HuggingFace model ID |\n| `GRAPHMEM_USE_ONNX` | `--use-onnx / --no-onnx` | `false` | Use ONNX runtime if available |\n| `GRAPHMEM_EMBEDDING_DEVICE` | `--embedding-device` | `cpu` | Inference device (`cpu` or `cuda`) |\n| `GRAPHMEM_CACHE_SIZE` | `--cache-size` | `10000` | Embedding cache max entries |\n| `GRAPHMEM_SEARCH_LIMIT` | `--search-limit` | `10` | Default search result limit |\n| `GRAPHMEM_MAX_HOPS` | `--max-hops` | `4` | Default max traversal depth |\n| `GRAPHMEM_LOG_LEVEL` | `--log-level` | `WARNING` | Logging verbosity |\n| `GRAPHMEM_TRANSPORT` | `--transport` | `stdio` | MCP transport protocol |\n\n---\n\n## Performance\n\nMeasured numbers, not adjectives. Reproduce the traversal figures with\n`python benchmarks/bench_traversal.py`; the full table is in\n[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).\n\n**Traversal** — breadth-first with a global visited set, one indexed adjacency\nquery per hop. A dense 60-node graph traverses to depth 6 in 5 ms. The obvious\nrecursive-CTE formulation enumerates every simple path instead: on a 14-node\ngraph it materialised 1,409,006 intermediate rows in 6.4 seconds to return the\nsame 13 entities that BFS returns in 1 ms.\n\n**Graph canvas** — Barnes-Hut force simulation (θ = 0.9). 2000 nodes run at\n215 fps; 5000 nodes, the API's own cap, at 80 fps. The previous all-pairs\nimplementation managed 30 fps and 3.7 fps respectively. Approximation error\nagainst the exact sum is 1.30% RMS, and settled layouts are equivalent.\n\n**Storage**\n- WAL journal with PRAGMA tuning — concurrent reads, memory-mapped I/O, so a\n  large database does not consume proportional RAM\n- One connection with a write lock held for the outermost transaction, and\n  `BEGIN IMMEDIATE` so a read-to-write upgrade cannot fail unretryably\n- Batched bulk operations, and every `IN (...)` chunked below SQLite's\n  bound-variable limit\n\n**Embeddings**\n- Content-hash cache keyed by `(hash, model)`, so two models coexist instead of\n  clobbering each other; LRU eviction, batched reads and writes\n- Model loads lazily in a background thread at startup, and inference runs in a\n  worker thread — neither blocks the event loop\n- Optional ONNX backend when `optimum[onnxruntime]` is installed and\n  `--use-onnx` is set, falling back to PyTorch. Off by default; this project\n  publishes no benchmark for it, so no speedup is claimed here.\n\n**Bounds** — every traversal, search, and list response is capped by a named,\nconfigurable limit, and a capped response says so rather than returning a\nsilent subset.\n\n---\n\n## Development\n\n```bash\ngit clone https://github.com/Sathvik-1007/GraphMem-MCP\ncd graph-mem\n\n# Using uv (recommended)\nuv venv\nuv pip install -e \".[full,dev]\"\n\n# Or using pip\npython -m venv .venv\nsource .venv/bin/activate\npip install -e \".[full,dev]\"\n```\n\n### Running Tests\n\n```bash\npytest                            # all tests\npytest tests/test_graph/          # graph engine tests\npytest tests/test_server/         # MCP server tool tests (all 28 tools)\npytest tests/test_cli/            # CLI command tests\npytest tests/test_models/         # data model tests\npytest tests/test_semantic/       # search + vector tests\npytest tests/test_storage/        # storage backend tests\npytest tests/test_db/             # database + migration tests\npytest tests/test_utils/          # config, logging, ID generation tests\npytest -x -q                      # stop on first failure, quiet output\n```\n\n---\n\n## Star History\n\n<a href=\"https://www.star-history.com/?repos=Sathvik-1007%2FGraphMem-MCP&type=date&legend=top-left\">\n <picture>\n   <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/image?repos=Sathvik-1007/GraphMem-MCP&type=date&theme=dark&legend=top-left\" />\n   <source media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/image?repos=Sathvik-1007/GraphMem-MCP&type=date&legend=top-left\" />\n   <img alt=\"Star History Chart\" src=\"https://api.star-history.com/image?repos=Sathvik-1007/GraphMem-MCP&type=date&legend=top-left\" />\n </picture>\n</a>\n\n---\n\n## License\n\n[MIT](LICENSE)\n",
  "bytes": 27182,
  "sha": "54ab6d8ad8b52e1350a0a4d8e1a6aaa4418a844731fe87e86c244863d194a15a",
  "repo_slug": "sathvik-1007/graphmem-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_sathvik_1007_graphmem_mcp_8319484c/readme"
}