Skip to main content
Glama

🧠 memory_graph_mcp

An MCP server that gives your AI agent a persistent knowledge graph of your project.

TypeScript MCP Tests License Node

AST dependencies · DB-schema links · debugging sessions · side effects


💡 Why

When a feature is requested, the agent receives a dependency subgraph, not a list of similar files — protecting adjacent modules from breaking changes.

graph_query_context("src/api/users.ts")

┌─────────────────┐     imports      ┌─────────────────┐
│  src/db/users.ts │ ◄────────────── │ src/api/users.ts │
└────────┬────────┘                  └─────────────────┘
         │ writes_table
         ▼
   [table: users]   ◄── also touched by 2 other files

Instead of "here are 5 files matching users" the agent learns: changing this file affects two other modules, writes to the users table, and a past debug session recorded a missing await bug here.

Related MCP server: hive-memory

🛠 Tools

Tool

Purpose

graph_query_context

file/symbol → dependency subgraph + adjacent modules + related sessions

graph_impact_analysis

planned change → affected nodes, tables, and risk level

graph_get_side_effects

implicit module effects: table reads/writes, calls

graph_record_session

record a discussion/debug session with decisions and bugs, linked to files

graph_stats

index state: nodes, edges, files, last update time

📦 Installation

Requires Node.js ≥ 18

Prebuilt JavaScript is committed to the repo — no TypeScript toolchain needed on install:

npm install -g git+ssh://git@github.com/FuryCow/memory_graph_mcp.git#v0.1.1

(or git+https://... if you don't have SSH keys set up)

Pin the tag (#v0.1.1) so npm doesn't resolve the package from a stale tarball cache. If a previous install failed halfway, clear the cache first: npm cache clean --force.

⚠️ npm ≥ 11.8 on Windows: git deps install as dangling junctions

npm 11.8 has a bug where a git dependency is installed as a junction into the npm cache (...\npm-cache\_cacache\tmp\git-cloneXXXX), and the cache temp dir is deleted afterwards — leaving a broken install that fails with TAR_ENTRY_ERROR ENOENT storms and spawn cmd.exe ENOENT during lifecycle scripts. Install from a packed tarball instead:

npm pack git+ssh://git@github.com/FuryCow/memory_graph_mcp.git#v0.1.1
npm install -g .\memory_graph_mcp-0.1.1.tgz

This extracts the package normally (no junction) and runs fine on Windows.

Option B: clone and build manually

git clone git@github.com:FuryCow/memory_graph_mcp.git
cd memory_graph_mcp
npm install
npm run build

🔌 Connecting

The server communicates over stdio. Set the root of the project you want to index as the working directory (cwd) in your MCP client config — the index is built from process.cwd() and stored in .memory-graph/graph.db.

Claude Desktop / Cursor

The configuration is identical for both clients; only the config file location differs:

  • Claude Desktop: claude_desktop_config.json (menu → Settings → Developer → Edit Config)

  • Cursor: ~/.cursor/mcp.json

{
  "mcpServers": {
    "memory-graph": {
      "command": "memory-graph-mcp",
      "cwd": "/absolute/path/to/your/project"
    }
  }
}

With Option B, point command at node and the entry file instead:

"command": "node",
"args": ["/absolute/path/to/memory_graph_mcp/dist/src/index.js"],
"cwd": "/absolute/path/to/your/project"

💡 On Windows, escape paths (C:\\path\\to\\...) or use forward slashes (C:/path/to/...).

🗺 Graph model

Nodes

File, Symbol, Table — journal: Session, Decision, Bug

Edges

imports, calls, contains, reads_table, writes_table

The indexer (tree-sitter) extracts imports, function definitions and calls, and database access from SQL strings (SELECT/INSERT/UPDATE/DELETE) and ORM patterns (Prisma, drizzle). A watcher (chokidar) incrementally re-indexes the graph on file changes — typically under a second.

🧰 Stack

Layer

Technology

Server

@modelcontextprotocol/sdk (stdio)

Parsing

tree-sitter (TypeScript / TSX / JavaScript)

Storage

better-sqlite3 (WAL) in .memory-graph/graph.db

Watching

chokidar (mtime-based incremental re-index)

🚀 Development

npm run build   # tsc
npm test        # node --test dist/test/*.test.js
npm run lint    # tsc --noEmit

📄 License

MIT

Available Tools

5 tools
graph_get_side_effectsB

Return implicit side effects of a module (DB writes, external calls, etc.).

Inputs: path (required).

graph_impact_analysisB

Given a planned change, return affected nodes and risks.

Inputs: path (required), change (required).

graph_query_contextB

Return the dependency subgraph for a file or symbol, plus adjacent modules.

Inputs: path (required), depth, symbol.

graph_record_sessionA

Record a discussion/debug session with decisions and bugs, linked to related files.

Inputs: topic (required), bugs, decisions, related_paths.

graph_statsA

Return index state: node/edge counts, files indexed, last update time.

Inputs: no named parameters.

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 5 tools

    Disambiguation5/5

    Each tool targets a distinct operation: recording a session, querying context, analyzing impact, inspecting side effects, and viewing stats. There is no meaningful overlap, so an agent can reliably pick the right tool.

    Naming Consistency4/5

    All tools share the graph_ prefix and most follow a verb_noun pattern, but graph_impact_analysis and graph_stats are noun-style names and only graph_get_side_effects uses 'get_'. The overall pattern is still predictable and readable.

    Tool Count5/5

    Five tools is a tight, well-scoped set that covers the server's apparent purpose without redundancy or bloat. Each tool earns its place.

    Completeness4/5

    The set covers the core workflows: recording new knowledge, querying relationships, assessing change impact, inspecting side effects, and checking index health. Minor gaps like updating or deleting sessions are absent but not critical to the primary graph-based workflow.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides AI coding agents with persistent, graph-connected memory across projects, enabling cross-project context retrieval via synaptic connections and hybrid search.
      3 npm
      8
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides AI coding agents with persistent memory by recording sessions and normalizing them into a searchable knowledge graph, then delivering relevant context at the start of the next session.
      MIT