← Back to blog
By Sri Panchavati · April 2026 3 min read

Add Memory to Claude Code in 30 Seconds with MCP

Claude Code is powerful, but it forgets everything between sessions. Your coding preferences, project context, architectural decisions—gone every time you start a new conversation. The Smara MCP server fixes this. Install it once, and Claude Code remembers.

What You Get

After setup, Claude Code will:

Setup (30 seconds)

1

Get a Smara API Key

Sign up at smara.io (free tier: 100 memories, no credit card).

2

Add to Claude Code Settings

// ~/.claude/settings.json
{
  "mcpServers": {
    "smara": {
      "command": "npx",
      "args": ["-y", "smara-mcp"],
      "env": {
        "SMARA_API_KEY": "smara_your_key_here",
        "SMARA_USER_ID": "your-name"
      }
    }
  }
}
3

Restart Claude Code

Close and reopen Claude Code. That's it.

How It Works

The MCP server exposes three tools to Claude Code:

smara_store
Save a memory. Claude Code calls this automatically when it learns something worth remembering.
{ "fact": "Sri prefers TypeScript with strict mode", "importance": 0.8 }
smara_search
Find relevant memories. Called before responding to search past sessions for context.
{ "q": "TypeScript preferences" }
smara_context
Get formatted context. Returns decay-ranked memories ready for the system prompt.
{ "q": "current project setup", "top_n": 5 }

See It in Action

Session 1

You: This project uses Fastify with TypeScript, Postgres with pgvector, and we deploy to Railway. Our API prefix is /v1/.

Claude Code: Got it! I'll remember your stack details.

[Internally calls smara_store for each fact]

Session 2 — days later

You: Add a new endpoint for user notifications.

[Searches Smara for project context]

Claude Code: I'll create a Fastify route at /v1/notifications following your existing patterns. Here's the implementation using your Postgres connection pool...

Using Namespaces

Organize memories by project so they don't bleed between codebases:

{
  "mcpServers": {
    "smara": {
      "command": "npx",
      "args": ["-y", "smara-mcp"],
      "env": {
        "SMARA_API_KEY": "smara_your_key_here",
        "SMARA_USER_ID": "sri",
        "SMARA_NAMESPACE": "my-api-project"
      }
    }
  }
}

Why Not Just Use CLAUDE.md?

CLAUDE.mdSmara MCP
ScopePer-projectCross-project + per-project
UpdatesManual editsAutomatic from conversations
SearchFull file loadedSemantic, only relevant facts
DecayNoYes — stale facts fade
PersonalizationProject onlyYou + project

The best setup is both: CLAUDE.md for static project docs, Smara MCP for dynamic personal and project memory.

Pricing

PlanMemoriesPrice
Free100$0/mo
Developer10,000$19/mo
Team100,000$79/mo

Troubleshooting

MCP server not loading? Check that npx is in your PATH and your API key is valid:

curl -H "Authorization: Bearer smara_your_key" https://api.smara.io/health

Want to see what's stored?

curl -H "Authorization: Bearer smara_your_key" \
  "https://api.smara.io/v1/memories?user_id=your-name"

Free, no credit card, 30 seconds to persistent memory in Claude Code.

Get Started Free →

Related Posts

Architecture

Building AI Agents with Persistent Memory

Patterns for giving agents context across sessions.

Comparison

Smara vs Mem0

Head-to-head comparison of architecture, pricing, and DX.

Technical

Ebbinghaus Curves for AI Memory

How forgetting curves make AI memory smarter.