Avoid adding GraphQL dependencies.
claim: "API is REST-only"
confidence: 0.95
evidence: [msg_001]
query: "API architecture style"
architecture (confidence: 0.95).
Evidence from Monday's session.
Claude never saw Monday's session. It retrieved the belief from Mnemebrain's persistent graph — stored outside the context window.
How it all fits together
Architecture in 2 minutesClaude Code is a terminal-based AI coding assistant. It can read and edit your files, run commands, and reason about your codebase. But by default, it forgets everything when you close the session — your project conventions, architectural decisions, resolved issues, all gone.
Mnemebrain solves this through MCP — the Model Context Protocol, an open standard that lets Claude Code connect to external tools and services. Once connected, Claude Code can call Mnemebrain's 13 memory tools directly, mid-session, to store and retrieve beliefs without any extra prompting from you.
- Mnemebrain backend — a local FastAPI server running at
localhost:8000. It stores the belief graph in a Kuzu database on your machine. - Mnemebrain MCP server — a lightweight bridge (stdio process) that translates MCP tool calls from Claude Code into HTTP requests to the backend.
- Claude Code CLI — your coding assistant. It connects to the MCP server on startup and gains 13 new memory tools.
All of this runs entirely on your machine. Nothing leaves your computer unless you configure it to.
Install and start the Mnemebrain backend
The belief memory store — keep it runningThe backend is Mnemebrain Lite — the open-source belief memory engine. Install it with pip:
pip install mnemebrain-lite
Once installed, start the server:
mnemebrain-lite serve
You'll see:
INFO MnemeBrain Lite starting... INFO Storage: ./mnemebrain.db INFO Uvicorn running on http://localhost:8000
Leave this terminal open. The Mnemebrain backend must be running whenever you use Claude Code with memory. Open a second terminal for all the following steps.
http://localhost:8000/docs in your browser. You should see the interactive API explorer with all available endpoints. If that loads, the backend is healthy.
Clone and prepare the MCP server
The bridge between Claude Code and your memoryThe Mnemebrain MCP server is a separate package that translates MCP protocol calls into Mnemebrain API calls. Clone it from GitHub:
# Clone the MCP server repository git clone https://github.com/mnemebrain/mnemebrain-mcp.git # Move into the directory cd mnemebrain-mcp # Install dependencies with uv uv sync
The uv sync command reads the project's pyproject.toml and installs everything it needs into an isolated virtual environment automatically — no manual pip installs, no conflicts.
Note down the full path to this directory — you'll need it in the next step. You can get it with:
# macOS / Linux pwd # Example output: /Users/yourname/mnemebrain-mcp
cd without arguments to print the current path, e.g. C:\Users\yourname\mnemebrain-mcp. You'll need this exact path in the next step.
Register the MCP server with Claude Code
One command — this is the key step
Claude Code manages MCP servers via claude mcp add. Run this command, replacing /path/to/mnemebrain-mcp with the actual path you noted in Step 3:
claude mcp add \ --scope user \ mnemebrain \ -- uv --directory /path/to/mnemebrain-mcp run mnemebrain-mcp
That's one command (split across lines for readability). Let's break it down:
claude mcp add— register a new MCP server with Claude Code--scope user— make it available across all your projects (not just the current one)mnemebrain— the name you'll see in Claude Code's MCP status-- uv --directory ... run mnemebrain-mcp— the command Claude Code runs to launch the MCP server process
If you prefer, you can also register it by directly editing Claude Code's config file at ~/.claude.json (macOS/Linux) or %APPDATA%\Claude\claude.json (Windows). Add this inside the "mcpServers" object:
{
"mcpServers": {
"mnemebrain": {
"type": "stdio",
"command": "uv",
"args": [
"--directory",
"/path/to/mnemebrain-mcp", // ← your actual path
"run",
"mnemebrain-mcp"
],
"env": {
"MNEMEBRAIN_URL": "http://localhost:8000"
}
}
}
}
The MNEMEBRAIN_URL environment variable tells the MCP server where the Mnemebrain backend is running. The default (http://localhost:8000) is correct if you started it in Step 2 without changing the port.
--scope user stores the config in your personal ~/.claude.json and is available everywhere. --scope project stores it in a .mcp.json file in the current directory — great for sharing a config with your team via git. --scope local (default) is just you, current project only.
Verify the connection
Confirm everything is wired up before using itMake sure the Mnemebrain backend is still running (Step 2), then open Claude Code in any directory:
claude
Once Claude Code starts, type the /mcp command to check MCP server status:
/mcp
You should see:
MCP Server Status ● mnemebrain: connected Tools: believe, retract, explain, revise, search, list_beliefs, frame_open, frame_add, frame_scratchpad, frame_context, frame_commit, frame_close, health
If you see disconnected — double-check that the Mnemebrain backend is running in another terminal (mnemebrain-lite serve) and that the path in your config is correct.
health tool: "Check if the Mnemebrain backend is healthy." It will call the tool and report back.
Use Mnemebrain inside a Claude Code session
This is what persistent memory actually looks likeOnce connected, Claude Code can use all 13 Mnemebrain tools automatically. Here are the most useful patterns:
Store a project-level belief:
Remember that this project uses PostgreSQL 15, SQLAlchemy 2.0, and all database migrations must go through Alembic. Never use raw SQL in application code.
Claude will call believe to store three structured beliefs with evidence pointers back to your instruction. Next session, they'll be there.
Query what Claude remembers:
What do you know about this project's database setup?
Claude calls search semantically — not a keyword match, but a conceptual search — and surfaces the most confident, relevant beliefs.
Update a belief when things change:
We've migrated to Prisma. SQLAlchemy is no longer used in this project.
Mnemebrain detects the contradiction with the stored SQLAlchemy belief, creates an ATTACKS edge, and revises confidence automatically. The old belief is kept for history; the new one takes precedence.
Ask Claude to explain its reasoning:
Why did you choose to use Alembic for this migration?
Claude calls explain, which returns the full justification chain — what evidence supported the belief, what the confidence was, and whether any evidence ever attacked it.
Contradiction detection — what makes Mnemebrain different from simple memory:
You (Session 4): "we migrated the DB to MySQL"
// Mnemebrain detects the conflict
truth_state: BOTH ← not silently overwritten
conflict: true
belief_1: "PostgreSQL 15" confidence: 0.95 → 0.31
belief_2: "MySQL (migrated)" confidence: 0.91
evidence_trail: msg_003 → msg_041
// Claude reports the conflict instead of pretending it didn't happen
Claude: ⚠ Contradiction detected in DB beliefs.
Current best: MySQL. Old: PostgreSQL.
Explain() for full history.
Most retrieval-based memory systems cannot represent contradictions explicitly — they silently overwrite the old fact, and you'd never know a conflict existed. Mnemebrain creates an ATTACKS edge between the conflicting beliefs, flags the truth state as BOTH, and lets you — or the agent — decide what to do with the conflict.
Here's the full list of tools Claude Code now has access to:
| Tool | What it does |
|---|---|
| believe | Store a belief with supporting or attacking evidence |
| retract | Invalidate a piece of evidence; recomputes affected beliefs |
| revise | Add new evidence to an existing belief and recompute truth state |
| explain | Get the full justification chain for any belief |
| search | Semantic search with confidence ranking |
| list_beliefs | Filter beliefs by truth state, type, tag, or confidence |
| health | Check if the backend is reachable and healthy |
| frame_open | Open a working memory frame for multi-step reasoning |
| frame_add | Load an additional belief into the active frame |
| frame_scratchpad | Store intermediate reasoning in the frame |
| frame_context | Inspect current frame contents, conflicts, and step count |
| frame_commit | Commit frame results back to the permanent belief graph |
| frame_close | Abandon a frame without committing |
Scope options — personal, project, team
How to share your memory setup with teammatesClaude Code supports three scopes for MCP server configuration. Choose the right one for your situation:
claude mcp add --scope user mnemebrain \ -- uv --directory /path/to/mnemebrain-mcp run mnemebrain-mcp
claude mcp add --scope project mnemebrain \ -- uv --directory /path/to/mnemebrain-mcp run mnemebrain-mcp
With --scope project, Claude Code writes the server definition into a .mcp.json file in your current directory. Commit that file to git, and every teammate who pulls it gets the same MCP server configuration automatically.
.mcp.json with the shared server name and command. Each developer runs their own local Mnemebrain backend. Each developer's beliefs are private to their machine unless you configure a shared Mnemebrain instance — which is possible with the full version at localhost:8000.
Useful management commands:
# List all registered MCP servers claude mcp list # Check details for a specific server claude mcp get mnemebrain # Remove a server claude mcp remove mnemebrain # Check server status from inside Claude Code /mcp
Proof check — run this to confirm everything end-to-end:
Use the Mnemebrain health tool to confirm the backend is running, then store a test belief: "This is a working memory test", retrieve it, and tell me the confidence score.
If all four checks pass, Mnemebrain is fully integrated with Claude Code. Every future session will have access to accumulated beliefs — your project conventions, architectural decisions, resolved bugs — ready to retrieve and reason over.
truth_state representation cannot detect contradictions by design. Read the full benchmark →
Claude Code with a real memory.
Explore the full MCP server reference on GitHub, or browse the Mnemebrain SDK for deeper programmatic integrations.
MCP Server on GitHub → Mnemebrain Lite