MegaMemory
Integrates with OpenAI Codex, configuring the MCP server and workflow instructions for persistent project knowledge graph across sessions.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MegaMemoryunderstand the payment system architecture"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
An MCP server that lets your coding agent build and query a graph of concepts, architecture, and decisions — so it remembers across sessions.
The LLM is the indexer. No AST parsing. No static analysis. Your agent reads code, writes concepts in its own words, and queries them before future tasks. The graph stores concepts — features, modules, patterns, decisions — not code symbols.
The Loop
understand → work → update
Session start — agent calls
list_rootsto orient itselfBefore a task — agent calls
understandwith a natural language query (orget_conceptfor exact ID lookup)After a task — agent calls
create_conceptorupdate_conceptto record what it built
Everything persists in a per-project SQLite database at .megamemory/knowledge.db.
Installation
npm install -g megamemoryRequires Node.js >= 18. The embedding model (~23MB) downloads automatically on first use.
Quick Start
megamemory installRun the interactive installer and choose your editor:
The installer only updates config files after a successful read/merge, and it will not overwrite existing plugin/command files unless they are already marked as MegaMemory-managed.
With opencode
megamemory install --target opencodeOne command configures:
MCP server in
~/.config/opencode/opencode.jsonWorkflow instructions in
~/.config/opencode/AGENTS.mdSkill tool plugin at
~/.config/opencode/tool/megamemory.tsBootstrap command
/user:bootstrap-memoryfor initial graph populationSave command
/user:save-memoryto persist session knowledge
Restart opencode after running install.
With Claude Code
megamemory install --target claudecodeConfigures:
MCP server in
~/.claude.jsonWorkflow instructions in
~/.claude/CLAUDE.mdCommands in
~/.claude/commands/
With Antigravity
megamemory install --target antigravityConfigures:
MCP server in
./mcp_config.json(workspace-level)
With Codex
megamemory install --target codexConfigures:
MCP server in
~/.codex/config.tomlWorkflow instructions in
~/.codex/AGENTS.md
With other MCP clients
Add megamemory as a stdio MCP server. The command is just megamemory (no arguments). It reads/writes .megamemory/knowledge.db relative to the working directory, or set MEGAMEMORY_DB_PATH to override.
{
"megamemory": {
"type": "local",
"command": ["megamemory"],
"enabled": true
}
}MCP Tools
Tool | Description |
| Semantic search over the knowledge graph. Returns matched concepts with children, edges, and parent context. |
| Look up a concept by its exact ID. Returns full context including children, edges, incoming edges, and parent. |
| Add a new concept with optional edges and file references. |
| Update fields on an existing concept. Regenerates embeddings automatically. |
| Create a typed relationship between two concepts. |
| Soft-delete a concept with a reason. History preserved. |
| List all top-level concepts with direct children. |
| List unresolved merge conflicts grouped by merge group. |
| Resolve a merge conflict by providing verified, correct content based on the current codebase. |
Concept kinds: feature · module · pattern · config · decision · component
Relationship types: connects_to · depends_on · implements · calls · configured_by
Knowledge Graph
Web Explorer
Visualize the knowledge graph in your browser:
megamemory serveNodes are colored by kind and sized by edge count
Dashed edges show parent-child links; solid edges show relationships
Click any node to inspect summary, files, and edges
Search supports highlight/dim filtering
If port
4321is taken, you'll be prompted to pick another
megamemory serve --port 8080 # custom portHow It Works
src/
index.ts CLI entry + MCP server (9 tools)
tools.ts Tool handlers (understand, get_concept, create, update, link, remove, list_conflicts, resolve_conflict)
db.ts SQLite persistence (libsql, WAL mode, schema v3)
embeddings.ts In-process embeddings (all-MiniLM-L6-v2, 384 dims)
merge.ts Two-way merge engine for knowledge.db files
merge-cli.ts CLI handlers for merge, conflicts, resolve commands
types.ts TypeScript types
cli-utils.ts Colored output + interactive prompts
install.ts multi-target installer (opencode, Claude Code, Antigravity, Codex)
web.ts HTTP server for graph explorer
plugin/
megamemory.ts Opencode skill tool plugin
commands/
bootstrap-memory.md /user command for initial population
save-memory.md /user command to save session knowledge
web/
index.html Single-file graph visualization (d3-force + Canvas)Embeddings — In-process via Xenova/all-MiniLM-L6-v2 (ONNX, quantized). No API keys, and no network calls after the first model download.
Storage — SQLite with WAL mode, soft-delete history, and schema migrations (currently v3).
Search — Brute-force cosine similarity over node embeddings; fast enough for graphs with <10k nodes.
Merge — Two-way merge with conflict detection by concept ID, with AI-assisted conflict resolution via MCP tools.
CLI Commands
Command | Description |
| Start the MCP stdio server |
| Configure editor/agent integration |
| Launch the web graph explorer |
| Merge two knowledge.db files |
| List unresolved merge conflicts |
| Resolve a merge conflict |
| Show help |
| Show version |
Merging Knowledge Graphs
When branches diverge, each may update .megamemory/knowledge.db independently. Since SQLite files cannot be auto-merged by git, megamemory provides dedicated merge commands.
Merge two databases
megamemory merge main.db feature.db --into merged.dbConcepts are compared by ID: identical nodes are deduplicated, and conflicting nodes are kept as ::left/::right variants under one merge group UUID. Use --left-label and --right-label to replace default side labels with branch names.
megamemory merge main.db feature.db --into merged.db --left-label main --right-label feature-xyzView conflicts
megamemory conflicts # human-readable summary
megamemory conflicts --json # machine-readable output
megamemory conflicts --db path # specify database pathResolve conflicts manually
megamemory resolve <merge-group-uuid> --keep left # keep the left version
megamemory resolve <merge-group-uuid> --keep right # keep the right version
megamemory resolve <merge-group-uuid> --keep both # keep both as separate conceptsAI-assisted resolution
When an AI agent runs /merge, it calls list_conflicts, verifies both versions against current source files, then calls resolve_conflict with resolved: {summary, why?, file_refs?} plus a verification reason. It does not pick a side blindly; it resolves to what the codebase currently reflects.
License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/0xK3vin/MegaMemory'
If you have feedback or need assistance with the MCP directory API, please join our Discord server