Setup Guide

Mnemebrain for
Claude Code CLI
via MCP

Connect Claude Code's agentic coding sessions to a persistent belief memory. Every fact Claude learns about your codebase, preferences, and decisions gets stored, tracked, and reasoned over — across every session.

Without it, Claude forgets everything when the session ends. With Mnemebrain, knowledge persists.

March 2026 ~5 min install Claude Code + MCP + Mnemebrain
claude codemcpsetup guidemnemebrain-lite
What you need before starting
✓ Claude Code CLI installed (npm install -g @anthropic-ai/claude-code)
✓ Python 3.10+ on your machine
✓ uv installed — the fast Python package runner (pip install uv)
✓ Git installed
terminal
# Monday morning
$ claude

You: remember our API uses REST, not GraphQL
Claude: Stored. "API is REST-only" · confidence 0.95

You: /exit
$
# Tuesday — fresh session, zero shared context
$ claude

You: what API style does this project use?
Claude: REST API (confidence: 0.95)
Retrieved from belief memory · evidence: msg_001
TL;DR
1pip install mnemebrain-lite then mnemebrain-lite serve
2git clone mnemebrain-mcp then uv sync
3claude mcp add --scope user mnemebrain -- uv --directory /path/to/mnemebrain-mcp run mnemebrain-mcp
4Open Claude Code → type /mcp → confirm mnemebrain: connected
5Talk to Claude. It will store, retrieve, and reason over beliefs automatically.
Steps in this guide
Real cross-session memory — two separate Claude Code sessions
Session 1 — Monday
You: Our API uses REST, not GraphQL.
Avoid adding GraphQL dependencies.

↳ believe() called
claim: "API is REST-only"
confidence: 0.95
evidence: [msg_001]

You: /exit
Session 2 — Tuesday (fresh session, zero shared context)
You: What architecture style does this project use?

↳ search() called
query: "API architecture style"

Claude: This project uses a REST API
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.

01

How it all fits together

Architecture in 2 minutes

Claude 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.

Three moving parts
  • 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.
You terminal Claude Code MCP client mnemebrain-mcp stdio bridge Mnemebrain localhost:8000 Kuzu DB prompt stdio/MCP HTTP YOUR MACHINE — FULLY LOCAL

All of this runs entirely on your machine. Nothing leaves your computer unless you configure it to.

02

Install and start the Mnemebrain backend

The belief memory store — keep it running

The backend is Mnemebrain Lite — the open-source belief memory engine. Install it with pip:

Terminal
pip install mnemebrain-lite

Once installed, start the server:

Terminal — keep this window open
mnemebrain-lite serve

You'll see:

Server output
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.

Quick sanity check: Open 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.
03

Clone and prepare the MCP server

The bridge between Claude Code and your memory

The Mnemebrain MCP server is a separate package that translates MCP protocol calls into Mnemebrain API calls. Clone it from GitHub:

Terminal (new window)
# 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:

Terminal
# macOS / Linux
pwd

# Example output:
/Users/yourname/mnemebrain-mcp
Windows users: Use 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.
04

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:

Terminal — register as user-scoped (available in all your projects)
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:

What each part means
  • 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:

~/.claude.json — manual config (alternative method)
{
  "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.

Scopes explained: --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.
05

Verify the connection

Confirm everything is wired up before using it

Make sure the Mnemebrain backend is still running (Step 2), then open Claude Code in any directory:

Terminal
claude

Once Claude Code starts, type the /mcp command to check MCP server status:

Inside Claude Code
/mcp

You should see:

Expected output
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.

Quick health check from inside Claude Code: Ask Claude to run the health tool: "Check if the Mnemebrain backend is healthy." It will call the tool and report back.
06

Use Mnemebrain inside a Claude Code session

This is what persistent memory actually looks like

Once connected, Claude Code can use all 13 Mnemebrain tools automatically. Here are the most useful patterns:

Store a project-level belief:

You → Claude Code
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:

You → Claude Code
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:

You → Claude Code
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:

You → Claude Code
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:

ATTACKS edge detected — belief revision in action
You (Session 1): "project uses PostgreSQL 15"
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:

ToolWhat it does
believeStore a belief with supporting or attacking evidence
retractInvalidate a piece of evidence; recomputes affected beliefs
reviseAdd new evidence to an existing belief and recompute truth state
explainGet the full justification chain for any belief
searchSemantic search with confidence ranking
list_beliefsFilter beliefs by truth state, type, tag, or confidence
healthCheck if the backend is reachable and healthy
frame_openOpen a working memory frame for multi-step reasoning
frame_addLoad an additional belief into the active frame
frame_scratchpadStore intermediate reasoning in the frame
frame_contextInspect current frame contents, conflicts, and step count
frame_commitCommit frame results back to the permanent belief graph
frame_closeAbandon a frame without committing
07

Scope options — personal, project, team

How to share your memory setup with teammates

Claude Code supports three scopes for MCP server configuration. Choose the right one for your situation:

User scope — you, all projects
claude mcp add --scope user mnemebrain \
  -- uv --directory /path/to/mnemebrain-mcp run mnemebrain-mcp
Project scope — shared with teammates via .mcp.json in git
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.

Sharing setup in a team: Commit .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:

Claude Code MCP management
# 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:

You → Claude Code
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.
What a successful response looks like
Backend health check✓ healthy
Belief stored with evidence✓ uuid returned
Belief retrieved via search✓ confidence: 0.95
Truth state✓ TRUE

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.

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