ClaudeMCPTutorial

Claude MCP Memory Tutorial: Give Claude Persistent Memory

10 min readBy Mohammad Saquib Daiyan

Claude is one of the most capable AI assistants available today, but it has a fundamental limitation: it forgets everything between conversations. Whether you are using Claude Desktop, Claude Code, or the API, every new session starts with a blank slate. This tutorial shows you exactly how to give Claude persistent memory using the Model Context Protocol (MCP) and PersistMemory, so it remembers your projects, preferences, and past decisions across every interaction.

What is MCP and Why Does It Matter for Memory?

The Model Context Protocol (MCP) is an open standard developed by Anthropic that allows AI assistants to connect to external tools and data sources. Think of it as a USB port for AI: any tool that speaks MCP can plug into any AI client that supports it. Claude Desktop, Claude Code, Cursor, VS Code Copilot, Windsurf, and Cline all support MCP natively.

MCP matters for memory because it provides a standardized way for Claude to store and retrieve information from an external system. Without MCP, you would need to manually copy-paste context into every conversation. With MCP, Claude can automatically search for relevant memories, store new information, and maintain context across unlimited sessions, all without you lifting a finger.

The protocol defines three primitives: tools (functions the AI can call), resources (data the AI can read), and prompts (templates for common workflows). A memory server primarily uses tools: store_memory to save new information, search_memory to find relevant context, and list_memories to browse stored knowledge.

Prerequisites

Before we start, make sure you have the following ready. You need Node.js 18 or later installed on your system for running the MCP bridge. You need Claude Desktop installed (download from claude.ai if you have not already). And you need a PersistMemory account, which you can create for free at persistmemory.com in about thirty seconds.

If you are using Claude Code (the terminal-based Claude), the setup is even simpler because it supports MCP servers directly from the command line. We will cover both Claude Desktop and Claude Code setups in this tutorial.

Step 1: Create Your PersistMemory Account

Head to persistmemory.com and click "Get Started." Sign up with your email or GitHub account. Once you are in the dashboard, your account is ready. MCP connections authenticate automatically through browser-based OAuth — no API key needed for MCP setup.

PersistMemory gives you a managed memory infrastructure out of the box: vector-powered semantic search, file processing, URL ingestion, and a fully compliant MCP server endpoint. There is nothing to install, configure, or maintain on the backend side. Your memories are stored securely and are accessible only through your authenticated sessions.

Step 2: Configure Claude Desktop

Claude Desktop reads its MCP server configuration from a JSON file. The location depends on your operating system. On macOS, it is at ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows, it is at %APPDATA%\Claude\claude_desktop_config.json. On Linux, check ~/.config/Claude/claude_desktop_config.json.

Open this file (create it if it does not exist) and add the PersistMemory MCP server configuration:

{
  "mcpServers": {
    "persistmemory": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mcp.persistmemory.com/mcp"
      ]
    }
  }
}

Save the file and restart Claude Desktop. On first launch, a browser window will open for you to log in with your PersistMemory account. This is a one-time OAuth authentication — your session lasts 20 days. You should see the PersistMemory tools appear in the tools menu (the hammer icon) at the bottom of the chat input.

Step 3: Configure Claude Code

If you use Claude Code (Anthropic's CLI tool for developers), the setup is a single command. Open your terminal and run:

# Add PersistMemory as an MCP server in Claude Code
claude mcp add persistmemory \
  --transport http \
  --url https://mcp.persistmemory.com/mcp

# Verify the connection
claude mcp list

That is it. Claude Code will now have access to PersistMemory tools in every session. The connection is persistent and will survive terminal restarts.

Step 4: Test the Memory Connection

With the MCP server connected, try a simple test. In Claude Desktop or Claude Code, type something like: "Remember that my current project uses Next.js 16 with TypeScript, Tailwind CSS, and Prisma for the database. The project is called Acme Dashboard."

Claude will call the store_memory tool to save this information. You should see a tool use indicator in the response. Now start a completely new conversation and ask: "What framework does my Acme Dashboard project use?" Claude will search memory, find the stored context, and respond accurately, even though this is a brand new conversation with no prior context.

This is the fundamental shift. Claude now has memory that persists across sessions. Every important piece of context you share will be available in future conversations, automatically retrieved through semantic search when it is relevant.

Step 5: Organize Memories with Namespaces

As your memory store grows, organization becomes important. PersistMemory supports namespaces that let you isolate memories by project, client, or domain. You can tell Claude which namespace to use: "Store this in the acme-dashboard namespace: We use Jest for unit tests and Playwright for E2E tests."

When searching, Claude will look in the appropriate namespace first. This prevents context from one project bleeding into another. If you are working on a React Native mobile app, you do not want memories from your Next.js web project appearing as context.

Namespaces also help with team workflows. Each team member can have their own namespace for personal preferences while sharing a common namespace for project-level knowledge. This creates a layered memory system where personal context and shared knowledge coexist without conflicts.

Advanced: File Processing and Document Memory

PersistMemory does not just store text. It can process and index entire files: PDFs, Word documents, images (with OCR), and even audio files (with transcription). This means you can feed your project documentation, design specs, API references, and meeting recordings into your memory store.

When Claude needs context about your API design, it can search through indexed documentation and find the relevant sections. When you ask about decisions from a meeting last week, it can pull up the transcribed content. This transforms Claude from a generic assistant into a domain expert that has actually read your documentation.

# Upload files via the PersistMemory API
curl -X POST https://backend.persistmemory.com/mcp/uploadFile \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@./docs/api-reference.pdf" \
  -F "space=acme-dashboard"

# Or ingest a URL
curl -X POST https://backend.persistmemory.com/mcp/ingestUrl \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"space": "acme-dashboard", "url": "https://docs.example.com/api", "title": "API Reference Docs"}'

Advanced: Custom Memory Instructions

You can fine-tune how Claude interacts with memory by adding instructions to your Claude system prompt or project settings. For example, you can tell Claude to automatically store architectural decisions, to always search memory before answering project-specific questions, or to summarize and store key takeaways at the end of each conversation.

A particularly effective pattern is the "memory-first" instruction: "Before answering any question about my project, always search your memory for relevant context. If you find relevant memories, incorporate them into your response. After each conversation, store any new decisions, preferences, or important information as memories."

This turns Claude into a proactive memory user rather than a passive one. It will search for context automatically and store new information without you having to explicitly ask it to remember things. Over time, the memory store becomes a comprehensive knowledge base about your work.

Troubleshooting Common Issues

If Claude Desktop does not show the PersistMemory tools, first check that your JSON config file is valid (a missing comma or bracket is the most common issue). Make sure Node.js is installed and accessible from your system PATH. Try running the npx command manually in a terminal to see if there are any error messages.

If searches return no results, verify that you have actually stored memories first. Check that you are searching in the correct namespace. Remember that semantic search works on meaning, not exact keywords, so try rephrasing your query if the results are not what you expect.

If you experience slow connections, this is usually due to the initial npx download on first run. Subsequent launches will be much faster because the package is cached. You can also install the mcp-remote package globally with npm install -g mcp-remote to eliminate startup latency.

What to Store: Best Practices

Not everything needs to be stored as a memory. Focus on information that is likely to be useful across sessions: project architecture and tech stack decisions, coding conventions and style preferences, recurring bug patterns and their solutions, deployment procedures and environment configurations, team member roles and responsibilities, and API schemas and integration details.

Avoid storing ephemeral information like temporary debug values, one-time questions, or highly time-sensitive data that will become stale quickly. The goal is to build a curated knowledge base, not a raw conversation log.

Conclusion

Giving Claude persistent memory through MCP and PersistMemory fundamentally changes how you interact with AI. Instead of treating each conversation as isolated, you build a continuous working relationship where Claude remembers your projects, understands your preferences, and builds on previous discussions. The setup takes less than five minutes, and the productivity gains start immediately. Every conversation makes Claude smarter about your specific work, turning it from a general-purpose assistant into a personalized collaborator that truly knows your codebase.

Give Claude persistent memory in 5 minutes

Sign up for PersistMemory and connect Claude Desktop or Claude Code to persistent memory. Free to start.