How to Give Cursor and Claude Code Long-Term Memory Across Sessions via MCP
By MemorySync Team ΓÇó Published September 2026 ΓÇó 8 min read
The Problem: Context Amnesia in AI Coding Assistants
If you use Cursor, Claude Code, or Claude Desktop for serious software development, you have encountered this daily frustration:
You explain your project's architecture, database conventions, and pinned dependency versions in one chat session. An hour later, you open a new chatΓÇöand the model has completely forgotten everything.
Developers typically resort to two flawed workarounds:
-
Static Rules Files (
.cursorrules/CLAUDE.md): As your project grows, these files bloat to thousands of lines, eating up expensive context window tokens on every single query and causing the model to miss instructions. - Copy-Pasting Context: You waste the first 5 minutes of every coding session copying past decisions, API schemas, and test conventions.
What coding agents need is durable, semantic, cross-session memory: the ability to store architectural decisions once, and automatically recall only the relevant facts when a specific question is asked in a fresh conversation.
In this guide, we will set up persistent long-term memory for Cursor and Claude Code in under 60 seconds using the Model Context Protocol (MCP) and MemorySync.
How It Works: The Remote MCP Memory Architecture
The Model Context Protocol (MCP) is the open standard developed by Anthropic that allows LLMs to interact with external tools and state.
MemorySync provides a high-speed, remote MCP memory server:
Key Architectural Advantages:
- Zero Local Daemons: No Docker containers, Python venvs, or local Postgres/Qdrant processes running on your laptop.
- Cross-Client Synchronization: Decisions saved in Cursor while writing frontend code are instantly accessible to Claude Code running in your CLI terminal.
-
Cryptographic Isolation: Every memory is strictly isolated by
X-Project-IDandX-End-User-ID, preventing cross-project context pollution. - Auditability: Every recalled memory has an immutable ID and timestamp, so you always know why the model made a specific architectural choice.
60-Second Setup: Cursor
Option A: Install via Cursor Directory (1-Click)
- Visit the official listing on cursor.directory/plugins/memorysync.
- Click Install Plugin to automatically configure the MCP server, rules, and memory hooks.
Option B: Manual Configuration
- In Cursor, open Settings (
Ctrl + ,orCmd + ,) -> Features -> MCP Servers. - Click + Add New MCP Server.
-
Fill in the connection parameters:
-
Name:
memorysync -
Type:
sse -
Server URL:
https://mcp.memorysync.io/mcp - Headers:
{ "Authorization": "Bearer YOUR_MEMORYSYNC_API_KEY", "X-Project-ID": "your-project-slug" } -
Name:
Click Save. Cursor will verify the connection and show a green dot next to
memorysync.
(You can get a free API key at app.memorysync.io).
60-Second Setup: Claude Code & Claude Desktop
For Claude Desktop:
Open your claude_desktop_config.json:
-
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json -
Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add the MemorySync MCP server definition:
{
"mcpServers": {
"memorysync": {
"url": "https://mcp.memorysync.io/mcp",
"headers": {
"Authorization": "Bearer YOUR_MEMORYSYNC_API_KEY",
"X-Project-ID": "your-project-slug"
}
}
}
}
For Claude Code (Terminal CLI):
Run the following command in your terminal:
claude mcp add memorysync https://mcp.memorysync.io/mcp --header "Authorization: Bearer YOUR_MEMORYSYNC_API_KEY" --header "X-Project-ID: your-project-slug"
Verifying Persistent Memory: The "Fresh Session" Test
To prove that memory persists across chat sessions, run this quick 2-minute test:
Step 1: Store an Architecture Constraint (Session 1)
In Cursor or Claude, start a chat and write:
"Remember this project decision: All API endpoints must use strict UTC ISO-8601 timestamps with millisecond precision (e.g., 2026-09-13T12:00:00.000Z). Do not use Unix epoch integers."
The model will invoke save_memory via the MemorySync MCP server:
{
"status": "success",
"memory_id": "mem_9f82a1b",
"stored": "All API endpoints must use strict UTC ISO-8601 timestamps with millisecond precision. Do not use Unix epoch integers."
}
Step 2: Open a Brand New Chat (Session 2)
- Close the current chat window.
- Open a completely fresh chat session (do not mention the rule from Step 1).
- Ask the assistant: > "Write a FastAPI route that returns the current server status and response timestamp."
Step 3: Observe Automatic Retrieval
Notice what happens before the model writes the code:
- It automatically calls
query_memory(query="server timestamp API endpoint"). - MemorySync returns
mem_9f82a1b. - The generated code strictly uses
datetime.now(timezone.utc).isoformat(timespec='milliseconds')instead oftime.time().
The model recalled your architecture rule without you re-explaining it.
Comparison: How MemorySync Compares to Alternatives
| Capability | MemorySync (MCP) | Mem0 | Zep | Static .cursorrules
|
|---|---|---|---|---|
| Model Context Protocol (MCP) | Native Remote SSE | Custom tool wrapper | REST API | None (Static file) |
| Setup Overhead | 60 Seconds (1-line) | Requires Python environment | Complex cloud dashboard | Manual copy/paste |
| Cross-IDE Sync | Cursor + Claude Code synced | Single environment | Single environment | Workspace-local only |
| Token Efficiency | High (Dynamic semantic recall) | Moderate | Moderate | Poor (Consumes prompt tokens every turn) |
| Multi-Tenant Isolation | Cryptographic Headers | String filtering | Session IDs | None |
| Free Tier / Zero Cost | Free Community Tier | Self-hosted or Cloud | Paid Cloud | Free |
Next Steps
- Read the Documentation: docs.memorysync.io/guides/cursor
- Explore Migration Guides: Migrating from Mem0 or Migrating from Zep
- Join the Community: Star and explore the official Cursor plugin at cursor.directory/plugins/memorysync
Top comments (0)