MegaMemory
Persistent project knowledge graph for coding agents. MCP server with semantic search, in-process embeddings, and web explorer.
claude mcp add --transport stdio 0xk3vin-megamemory megamemory
How to use
MegaMemory is an MCP server that builds and queries a persistent knowledge graph of concepts, modules, features, patterns, decisions, and components. It indexes incoming code in natural language terms (not symbols) and lets your agent understand, create, and update concepts with edges to express relationships. The available MCP tools include understand (semantic search over the knowledge graph), create_concept (add a new concept with optional edges and references), update_concept (modify an existing concept and regenerate embeddings), link (create typed relationships), remove_concept (soft-delete with history), list_roots (discover top-level concepts), list_conflicts and resolve_conflict (for merge conflict workflows). You can run the server as a local stdio MCP server via the megamemory CLI and connect with any MCP client or workflow that supports stdio. To visualize the graph in a browser, use the web explorer via megamemory serve, which renders the graph and allows interactive inspection of nodes and edges.
How to install
Prerequisites:
- Node.js >= 18
- npm (comes with Node.js)
- Internet access to install the package
- Install MegaMemory globally:
npm install -g megamemory
- Optional: verify installation
megamemory --version
- Prepare the database path if you want to override the default location:
export MEGAMEMORY_DB_PATH=./mydb/megamemory.db
-
Start or configure the MCP server as needed (see mcp_config in this document for how to wire up with clients).
-
If you plan to use the web explorer, you can launch the explorer after starting the server:
megamemory serve
Prerequisites note: The embedding model downloads on first use. Node.js >= 18 is required because the package depends on modern Node features.
Additional notes
Tips and common issues:
- The knowledge database is stored in a local SQLite file (.megamemory/knowledge.db by default). Use MEGAMEMORY_DB_PATH to override.
- The web explorer port defaults to 4321; if it's in use, you’ll be prompted to choose another port when starting megamemory serve.
- When wiring with other MCP clients, the server is exposed as a stdio MCP server via the megamemory CLI (no extra server process to manage).
- If you need to prune or merge graphs, MegaMemory provides dedicated merge and conflict resolution commands (megamemory merge, megamemory conflicts, megamemory resolve).
- The embedding model is loaded in-process and avoids network calls after the initial download, but the first run may download model assets (~tens of MB).
- Environment variable MEGAMEMORY_DB_PATH is useful for CI or multi-workspace setups to keep databases isolated.
Related MCP Servers
mcp-agent
Build effective agents using Model Context Protocol and simple workflow patterns
code-graph-rag
The ultimate RAG for your monorepo. Query, understand, and edit multi-language codebases with the power of AI and knowledge graphs
ai-dev-tools-zoomcamp
AI Dev Tools Zoomcamp is a free course that helps you use AI tools to write better code, faster. We're starting the first cohort of this course on November 18, 2025! Sign up here to join us 👇🏼
dexto
A coding agent and general agent harness for building and orchestrating agentic applications.
deepcontext
DeepContext is an MCP server that adds symbol-aware semantic search to Claude Code, Codex CLI, and other agents for faster, smarter context on large codebases.
sandboxed.sh
Self-hosted orchestrator for AI autonomous agents. Run Claude Code & Open Code in isolated linux workspaces. Manage your skills, configs and encrypted secrets with a git repo.