What is an MCP memory server?
A Model Context Protocol memory server is a program that exposes memory operations to an MCP host through tools, resources or prompts. Tools perform actions such as remembering or searching. Resources expose readable context. The MCP specification defines how clients discover and call these capabilities; it does not decide what should be remembered.
That boundary matters. MCP is the connection layer, not the memory architecture. A production server still needs identity, scoped storage, extraction, ranking, source history, correction and deletion. Without those controls, a memory server becomes a shared text file that every connected agent can poison or overread.
Should an MCP memory server run locally or remotely?
Use local STDIO when one desktop or coding client needs memory tied to that machine. Use remote Streamable HTTP when several clients need the same customer or team memory. The MCP architecture describes local STDIO servers as typically serving one client and remote Streamable HTTP servers as serving many clients.
| Mode | Best fit | Main tradeoff |
|---|---|---|
| Local STDIO | One developer, one desktop, or a private project store | Memory usually depends on one machine and process lifecycle |
| Remote Streamable HTTP | Shared memory across Claude, Cursor, Codex, support tools or team apps | Requires strong authentication, tenant isolation and operations |
| Remote with per-client tokens | The same server serving several products or client installations | Every connection must resolve to the correct user and tenant before tool execution |
Do not copy a local JSON memory file into a remote deployment and call it multi-client memory. The remote version needs a real identity and authorization model.
Which tools should an MCP memory server expose?
Expose a small, unambiguous tool surface. The model should know exactly when to search memory, when to save a durable fact and when a fact should be corrected or removed. Bloated tool sets create ambiguous choices and increase context cost.
| Tool | Input | Expected behavior |
|---|---|---|
| search_memory | Natural-language query, optional memory kind, result limit | Search only the authenticated principal’s allowed scopes |
| remember | A concise event, source and optional subject | Extract or write durable memory; reject secrets and transient chatter |
| correct_memory | Memory ID, replacement fact and reason | Supersede the old value while preserving an audit trail |
| forget_memory | Memory ID or authorized scope | Delete the record and its derived retrieval artifacts |
| memory_summary | Allowed scope and optional topic | Return a bounded summary without dumping the full graph |
The tool schema should not accept userId or tenantId from the model. Those values belong to the authenticated MCP connection.
How should an MCP memory server scope user and tenant data?
Resolve authorization before a tool handler runs. Bind the MCP session or access token to a principal, then pass that trusted context into memory reads and writes. If scope resolution fails, return an error instead of falling back to a shared identity.
- Use the authenticated principal, not generated tool arguments, for scope.
- Keep tenant at the outermost boundary and user inside it.
- Use client and agent identifiers for provenance, not as a bypass around user scope.
- Block writes that contain credentials, payment data or unrelated sensitive details.
type Principal = {
tenantId: string;
userId: string;
clientId: string;
};
async function searchMemory(
input: { query: string; limit?: number },
principal: Principal
) {
if (!principal.tenantId || !principal.userId) {
throw new Error('Authorized memory scope is missing');
}
return memory.search({
query: input.query,
userId: principal.userId,
metadata: { tenant: principal.tenantId },
limit: Math.min(input.limit ?? 8, 12),
});
}How can several MCP clients share the same memory?
Share a remote memory service, not a raw transport session. Each host opens its own MCP connection, authenticates the same human identity and receives a scoped view of the same durable graph. A Cursor client, Claude client and web agent can then remember the same project without copying private context into one another’s local files.
Use separate agent identities when working context should stay private. A shared project decision can live at project scope while a coding agent’s temporary hypothesis remains scoped to that agent or run. Promotion from private to shared memory should be an explicit operation.
| Memory | Suggested scope | Example |
|---|---|---|
| Company account | tenant | Current plan and security region |
| Personal preference | tenant + user | Preferred language and review style |
| Project decision | tenant + project | Postgres is the approved primary database |
| Agent working state | tenant + agent + session | A temporary migration hypothesis |
| Shared team fact | tenant + team | The release window and approval owner |
How should you secure an MCP memory server?
Remote servers should use standard HTTP authorization, normally OAuth-based access tokens, and validate the token on every request. Local servers still need a boundary because a compromised host process can read anything that server can access.
Memory tools also expand the prompt-injection surface. Treat tool results as untrusted data, attach provenance to every memory, and require confirmation before high-impact actions based on remembered facts. A poisoned preference should not be able to redirect a payment or change production access.
- Require authenticated transport for remote memory and rotate credentials.
- Validate token audience, tenant, user and expiry before dispatch.
- Store source, timestamp and trust level next to every durable fact.
- Rate-limit searches and writes per principal to contain noisy clients.
- Log tool name, scope hash and outcome without logging memory content.
- Test deletion through every client and every read path.
How do you test an MCP memory server?
Test protocol behavior and memory behavior separately. First prove discovery and tool calls work in the MCP Inspector. Then prove the same identity retrieves only authorized memory and that a second user or tenant cannot cross the boundary.
| Test | Pass condition |
|---|---|
| Client discovers tools | search_memory, remember and correction/delete tools appear with precise schemas |
| Same user, second client | The durable project fact is retrieved without copying local state |
| Same agent, different tenant | No foreign tenant memory is returned |
| User asks to forget | The memory disappears from search, summaries and export |
| Tool result contains injected instructions | The host treats it as data, not authority |
| Remote token expires | The call fails closed instead of using a default scope |
What is the recommended MCP memory architecture?
Keep the MCP layer thin and the memory contract explicit. Resolve identity at the transport boundary, expose only a few tools, enforce scopes inside every handler and make correction and deletion first-class. The protocol makes memory portable across clients only when the service behind it remains portable and governed.
Frequently asked questions
Is MCP itself a memory system?
No. MCP standardizes how clients and servers exchange tools, resources and prompts. Durable storage, extraction, retrieval and lifecycle policy must exist behind the server.
Should an MCP memory server be local or remote?
Use local STDIO for a single private client and remote Streamable HTTP for memory shared across clients. Remote deployment requires stronger authentication and tenant isolation.
Can Claude, Cursor and Codex use the same memory?
Yes, if each host connects to the same authenticated remote memory service and resolves the same authorized user and project scope.
Should tenant IDs be tool arguments?
No. Resolve the tenant from the authenticated MCP connection. Letting the model supply a tenant ID creates an authorization bypass.
How many memory tools should an MCP server expose?
Expose the smallest clear set: search, remember, correct, forget and optionally a bounded summary. Avoid overlapping tools that force the model to guess.
Does AI Memory currently provide a hosted MCP server?
This guide describes the server contract rather than claiming an unsupported hosted feature. Use the AI Memory API for durable storage, or confirm current MCP availability before configuring a client.
