Blog/Tutorial
2 minute setup

How to Add Memory to Claude

By default, Claude forgets everything when you close a session. This guide shows you how to give Claude Desktop and Claude Code persistent, structured memory using Memstate MCP — so Claude remembers your preferences, project context, and decisions across every session.

March 23, 2026·5 min read·Memstate AI

Why Claude Forgets Everything

Claude is a stateless language model. Every conversation starts with a blank context window. When you close Claude Desktop or start a new Claude Code session, everything from the previous session is gone — your preferences, the decisions you made, the architecture you discussed, all of it.

This is a fundamental limitation of how large language models work, not a bug in Claude specifically. The context window is temporary. When the session ends, it's wiped.

The solution is to give Claude access to an external memory system via the Model Context Protocol (MCP). When Claude starts a new session, it can query this memory system to retrieve relevant facts from past sessions — effectively giving it long-term memory.

What You Need

  • Claude Desktop or Claude Code (any recent version)
  • Node.js 18+ installed (for npx)
  • A free Memstate AI account (no credit card required)

Step-by-Step Setup

1Create a free Memstate account

Go to memstate.ai and sign up for free. No credit card required. Once logged in, go to the API Keys section in your dashboard and create a new key.

2Run the auto-setup command (recommended)

The easiest way to set up Memstate with Claude is to run the setup command. It will detect Claude automatically and write the MCP config for you:

npx @memstate/mcp setup

The command will prompt you for your API key, detect Claude Desktop and Claude Code, and write the correct config to the right location on your system.

3Manual setup (Claude Desktop)

If you prefer to configure manually, edit your Claude Desktop config file:

macOS

~/Library/Application Support/Claude/claude_desktop_config.json

Windows

%APPDATA%\Claude\claude_desktop_config.json

Add the following to your config:

{
  "mcpServers": {
    "memstate": {
      "command": "npx",
      "args": ["-y", "@memstate/mcp"],
      "env": {
        "MEMSTATE_API_KEY": "your-api-key-here"
      }
    }
  }
}

4Restart Claude Desktop

Fully quit Claude Desktop — don't just close the window. On macOS, use Cmd+Q or right-click the Dock icon → Quit. On Windows, right-click the taskbar icon → Quit.

Relaunch Claude Desktop. You should see a small hammer icon (🔨) in the chat input area indicating MCP tools are active.

How to Use Claude Memory

Once Memstate is connected, Claude has access to memory tools. You can ask Claude to remember things explicitly:

"Remember that we use TypeScript strict mode in this project."

"Remember that the database is PostgreSQL 16 on port 5433."

"Remember that I prefer functional components over class components."

Claude will automatically store these as structured memories. In future sessions, Claude will query Memstate at the start of the conversation to retrieve relevant context — so it already knows your preferences before you say a word.

You can also ask Claude to recall specific facts: "What database port did we agree on?" — and it will query Memstate and return the exact stored value, not a hallucinated guess.

Why Memstate vs Other Claude Memory Solutions

There are several MCP memory servers available for Claude. The key differences with Memstate:

Versioned memory

When a fact changes (e.g., you switch from PostgreSQL to MySQL), Memstate versions the old value and stores the new one. Other memory systems keep both, causing contradictions.

Conflict detection

Memstate detects when a new memory contradicts an existing one and resolves it automatically. Vector-based systems like Mem0 silently accumulate contradictions.

Benchmark accuracy

Memstate scores 84.4% on the LoCoMo benchmark. Mem0 scores 20.4%. The difference is the structured, versioned memory model.

Structured retrieval

Memstate returns precise facts, not fuzzy vector matches. Claude gets the exact answer it needs, not a pile of similar-sounding text.

Give Claude memory now

Free forever. No credit card. Setup in 30 seconds.