MegaMemory

Per-project knowledge graph a coding agent writes to and searches so it keeps context between sessions

By Kevin (individual) TypeScript Local · stdio Knowledge and memoryDeveloper tools

59 popularity score ★ 734 ↓ 173/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

FirstTerminal
npm install -g megamemory
Claude CodeTerminal
claude mcp add megamemory -- megamemory
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "megamemory": {
      "command": "megamemory",
      "args": []
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "megamemory": {
      "command": "megamemory",
      "args": []
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "megamemory": {
      "type": "stdio",
      "command": "megamemory",
      "args": []
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.megamemory]
command = "megamemory"
args = []
Gemini CLITerminal
gemini mcp add --scope user megamemory megamemory

Settings 1

MEGAMEMORY_DB_PATH Optional: Path of the SQLite graph file; defaults to .megamemory/knowledge.db under the working directory.

What it does

MegaMemory is a local stdio MCP server that keeps a graph of what a coding agent has learned about one project: features, modules, patterns, config, decisions and components, joined by typed links such as depends_on, implements or calls. It does not parse code itself. The agent reads the code, writes each concept in its own words with optional file references, and searches the graph at the start of later tasks. The intended rhythm is to list the top-level concepts when a session opens, search before a task, and add or update concepts afterwards.

The graph lives in a SQLite file at .megamemory/knowledge.db under the directory the server is started from, or wherever MEGAMEMORY_DB_PATH points. Search is semantic: each concept is embedded on your machine with the all-MiniLM-L6-v2 model and compared by cosine similarity, so no API key is needed. In v1.6.2 the understand tool returns 10 matches by default and accepts top_k up to 50 (src/index.ts). Removals are soft deletes that keep the reason in history, and every tool call is also written to a timeline log in the same database, which the browser explorer can replay.

The same package carries a CLI: megamemory install writes the server entry and workflow instructions into opencode, Claude Code, Antigravity or Codex config; megamemory serve opens a graph viewer in the browser; and megamemory merge, conflicts and resolve reconcile two knowledge.db files from diverging git branches, with two tools that let the agent settle merge conflicts against the current code.

What it needs

RuntimeNode.js 18+

Node.js 18 or later and the megamemory npm package installed globally (npm install -g megamemory), since clients launch the plain megamemory command. On first use it downloads an embedding model of about 23 MB, so that first run needs network access. The client must start it in the project directory, or MEGAMEMORY_DB_PATH must be set, for the graph to land in the right project.

Limits

It indexes nothing by itself: the graph only holds what the agent chooses to write, so its quality depends on the agent and the instructions it follows. Search compares against every concept one by one, which its README calls fast enough for graphs under 10,000 nodes. understand returns at most 50 results per call. SQLite files cannot be merged by git, so branches that both change knowledge.db need the megamemory merge command. The generic client example in the README is opencode-style JSON (type "local", command as an array); other clients need their own format with command megamemory and no arguments.

Who it suits

Suits developers who use a coding agent on the same codebase across many sessions and want it to keep architecture notes and decisions in a file that sits in the repository and stays on their machine, with no account or API key. It fits teams that commit the graph alongside code, given its merge tooling. It is less suited to memory that spans many unrelated projects or that must be shared live between machines, since each graph is one SQLite file per project, and to anyone wanting automatic code indexing: the agent has to write every entry.

Tools 9

understand
Semantic search of the graph; returns matching concepts with children, links and parent (top_k, default 10, max 50)
get_concept
Fetch one concept by exact ID with its children, outgoing and incoming links and parent
create_concept
Add a concept of a given kind, with optional parent, links and file references
update_concept
Change fields on an existing concept and recompute its embedding
link
Add a typed relationship between two concepts
remove_concept
Soft-delete a concept, recording the reason in history
list_roots
List top-level concepts with their direct children for a project overview
list_conflicts
Show unresolved merge conflicts grouped by merge group
resolve_conflict
Settle a merge conflict with corrected content and a stated reason

Similar servers