MCP Is the Missing Link for Agent Memory — And It Just Got Real
June 1, 2026 · 6 min read
This week, Cursor IDE announced it now remembers your coding preferences using MCP — the Model Context Protocol. It hit 109 points on Hacker News and it’s easy to see why. Persistent agent memory has been the holy grail since the first AI coding assistant, and MCP might be how we finally get there.
The Memory Problem
Every AI coding agent today has the same fundamental flaw: it forgets everything between sessions.
You tell Claude “we use snake_case for variables.” It follows that rule for the next 10 turns. You close the session, open a new one, and it’s back to camelCase. No memory, no learning, no compounding.
In my pipeline, I solved this with CLAUDE.md — a project-level file that codifies conventions, gotchas, and architecture. It works, but it’s manual. I have to write the rules. And if I forget to update it, the agent repeats mistakes.
What MCP enables is the reverse: the agent writes its own memory, reads it back in future sessions, and adapts without me editing a file.
How MCP Changes the Game
If you’re not familiar, MCP (Model Context Protocol) is an open standard for connecting LLMs to external tools and data sources. Think of it as USB-C for AI agents — one protocol that lets them read databases, query APIs, and access file systems in a structured way.
The Cursor announcement is significant because it uses MCP for exactly the use case I’ve been hacking together with CLAUDE.md:
- Your coding preferences are stored in a structured format
- The agent reads them at session start via MCP
- Preferences evolve as you work — the agent adds new ones based on your feedback
- They persist across projects, sessions, and even different models
DIY Agent Memory with MCP
You don’t need Cursor to get this benefit. MCP is an open protocol and you can set up your own memory server. Here’s the architecture I’m experimenting with:
# mcp-memory-server/ — a lightweight memory layer
# Agent reads: "What does this project prefer?"
GET /preferences → returns JSON of coding conventions
# Agent writes: "User told me to use dataclasses instead of NamedTuple"
POST /preferences { key: "style-classes", value: "use dataclasses" }
# Agent queries: "Have we seen this issue pattern before?"
GET /memory/fixes?query="nullable+column+error" → returns past fix strategy
The beauty of this approach: you can use any model that supports MCP, not just one vendor’s ecosystem. Claude, GPT, Gemini — they all work with the same memory server. Your agent’s knowledge becomes portable.
In my test setup, I have a simple SQLite-backed MCP server. The agent reads relevant memories at the start of a session and writes new learnings at the end. After two weeks, the agent has accumulated:
- 17 project-specific coding conventions it learned from my PR feedback
- 5 recurring bug patterns with known fixes
- 3 deployment gotchas it figured out the hard way
Every one of those was written by the agent. I never touched a file.
Where This Breaks Down
I want to be honest about the limitations I’ve hit:
Memory bloat. After a week, the preferences file had 40 entries. Not all were still relevant. You need a pruning strategy — something that archives old rules or asks you to validate them.
Conflicting memories. Two different agents might write contradictory rules. “Use DRF serializers” from the backend agent vs “Use raw SQL for performance” from the database agent. MCP doesn’t have a conflict resolution layer yet — you need one yourself.
Security. If an agent can write to memory, a compromised agent can write bad rules that future agents follow. You need read/write separation at the agent level. My Coder can read and write. My Reviewer is read-only. My QC can’t touch memory at all.
The Road Ahead
MCP for agent memory is where version control was in the early 2000s. The protocol works, the concepts are solid, but the tooling is still figuring out the ergonomics. Cursor’s implementation is a big step because it proves the pattern at scale — millions of developers will now experience persistent agent memory as a default feature, not a hack.
For my own setup, I’m keeping both systems running: CLAUDE.md for hand-written project knowledge and MCP memory for agent-learned patterns. They serve different purposes. One is the constitution, the other is the case law.
If you’re building agent systems today, start with CLAUDE.md. Add MCP memory when you find yourself editing it more than once a week. That’s the signal that your agent has enough history to start writing its own rules.
Part of the ongoing AI development series at susiloharjo.web.id. Follow me on X for MCP experiments and agent architecture deep dives.
Discover more from Susiloharjo
Subscribe to get the latest posts sent to your email.