All posts
Engineering

MCP Memory Server vs CLAUDE.md for Claude Code

CLAUDE.md holds rules Claude Code loads every session; an MCP memory server is a store it searches when needed. Which to use, when to combine them, setup.

By Ilian Raykov, founder of BrainTube · · 6 min read

Use CLAUDE.md for the rules Claude Code must follow in every session of a project, and an MCP memory server for knowledge that is too big to load every time or has to follow you across machines, projects and other AI tools. Most setups need CLAUDE.md first; add a memory server when you hit one of those limits, and use both together.

The short answer

CLAUDE.mdAuto memoryMCP memory server
Who writes itYouClaudeYou, Claude or both, through the server's tools
Where it livesFiles in your repo and ~/.claude~/.claude/projects/<project>/memory/Wherever the server stores it, local or hosted
When it loadsStart of every sessionFirst 200 lines or 25 KB of MEMORY.md each sessionWhen Claude calls a tool
ScopeOrg, user, project, localOne repository, one machineSet per server: local, project or user
Shared with your teamYes, project file via gitNoYes, with a project-scoped .mcp.json
Best forBuild commands, conventions, rulesCorrections and preferences Claude picks upLarge or cross-tool knowledge

Sources: Claude Code memory docs, Claude Code MCP docs.

What CLAUDE.md is good at

CLAUDE.md files are Markdown instructions that Claude Code reads at the start of every session: a managed policy file for the organization, ~/.claude/CLAUDE.md for you, ./CLAUDE.md (or ./.claude/CLAUDE.md) for the project, and a gitignored CLAUDE.local.md for your own notes on one project. /init writes a starter file.

  • Always present. Every session gets the whole file (up to 4 MiB), and the project-root CLAUDE.md is re-read after /compact.
  • Shared through git. The project file travels with the repository.
  • Limits: Anthropic recommends under 200 lines per file, because longer files use more context and reduce adherence. And it is context, not enforced configuration: to block an action outright, Anthropic points you to a hook instead.

If your project's knowledge fits in a few hundred lines of rules, CLAUDE.md is the whole answer.

What an MCP memory server is good at

An MCP memory server is a separate program that Claude Code connects to. It exposes tools, such as search or save, and Claude calls them when it decides it needs them. That gives you what files in the repo can't:

  • Size. Nothing loads up front except tool names and server instructions: Claude Code's tool search defers tool definitions until they are needed, so adding servers has little effect on your context window.
  • Reach across machines and tools. Auto memory is machine-local and not shared across machines or cloud environments. A hosted server is the same wherever you connect from, and other MCP clients (ChatGPT, Cursor, Claude.ai) can use it too.
  • Writes from the conversation. Claude can save a decision into the server mid-session, and it is there next week in another repository.

The trade-off: retrieval is on demand. If Claude doesn't think to search, it doesn't see the memory. That is why the two work best together.

Use both: a simple pattern

Keep rules in CLAUDE.md and knowledge in the server, and use CLAUDE.md to tell Claude when to look:

## Memory
- Before designing a new feature, search the memory MCP server for earlier decisions on it.
- After we agree on an architecture decision, save it to the memory server with the date.

CLAUDE.md then stays short and always loaded, while the server holds the long tail.

How to set up each

CLAUDE.md: run /init in your project, then edit the file. Check it loaded with /context all (it appears under Memory files), and use /memory to open your memory files or toggle auto memory.

A local MCP memory server (the official Knowledge Graph Memory server, for example, which needs Node.js 24 or later):

claude mcp add memory --env MEMORY_FILE_PATH=~/memory.jsonl -- npx -y @modelcontextprotocol/server-memory

Set MEMORY_FILE_PATH as above: by default the graph file sits inside the npx cache, and the project warns that reinstalling or clearing that cache can delete it. On Windows, launch npx through cmd /c.

A hosted MCP memory server:

claude mcp add --transport http <name> <url>

Add --scope project to write it to a .mcp.json your team can commit, or --scope user to use it in all your projects. Claude Code asks for approval before it uses project-scoped servers from a .mcp.json.

What each costs

CLAUDE.md and auto memory cost nothing beyond the context they take up. MCP memory servers range from free, open-source local servers to hosted services with their own plans, so check each provider's pricing page. We compared the main ones, with their limits, in the best memory tools for Claude Code.

Where BrainTube fits, and where it doesn't

BrainTube is ours, so read this as labelled. It is a hosted MCP server, claude mcp add --transport http braintube https://mcp.brain-tube.com/mcp, over the docs, videos, podcasts, articles and notes you save. Claude Code can search it and write to it, and its export_claude_md tool turns your library into a CLAUDE.md-compatible context file. MCP is included on the Free plan; paid plans start at $9 a month.

When you don't need it: one repository whose rules fit in a CLAUDE.md under 200 lines. Use CLAUDE.md and auto memory, and add nothing. If you are choosing between plugins instead, see Claude memory plugin: what exists. The concept in more depth: what is an MCP memory server?

Sources

Takeaways

  • CLAUDE.md: rules you write, loaded in full at the start of every session; keep each file under 200 lines.
  • Auto memory: notes Claude writes, first 200 lines or 25 KB of MEMORY.md per session, machine-local.
  • MCP memory server: a store Claude searches on demand; only tool names and server instructions load up front.
  • Use CLAUDE.md for rules and a server for large or cross-tool knowledge, and tell Claude in CLAUDE.md when to search.
  • Share a server with your team through a project-scoped .mcp.json.

Frequently asked

Does an MCP memory server replace CLAUDE.md?
No. CLAUDE.md is loaded into every session, so it is the right place for rules. A memory server is searched on demand, so it suits large or cross-project knowledge. Most setups use both.
Is CLAUDE.md the same as Claude Code memory?
It is one of two built-in memory systems. CLAUDE.md files hold instructions you write; auto memory holds notes Claude writes itself in ~/.claude/projects/<project>/memory/.
Do MCP servers use up Claude Code's context?
Little at the start. With tool search, only tool names and server instructions load when a session begins; full tool definitions load when Claude needs them, and results take context when a tool is called.
Can my team share one memory server?
Yes. Add it with --scope project and Claude Code writes it to .mcp.json in the project root, which you commit. Each teammate approves project-scoped servers before first use.
Does CLAUDE.md work across machines?
The project CLAUDE.md does, through git. ~/.claude/CLAUDE.md and auto memory stay on the machine where they were written; for memory that follows you, use a hosted MCP server.

Try BrainTube on your own corpus

Free tier, no card. Export anytime.

Start free