MCP ConfigsApr 7, 2026·2 min read

Memory MCP — Persistent AI Agent Knowledge Graph

MCP server that gives AI agents persistent memory using a local knowledge graph. Stores entities, relationships, and observations across sessions for Claude Code.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 17/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
Mcp Config
Install
Stage only
Trust
Trust: Established
Entrypoint
Memory MCP — Persistent AI Agent Knowledge Graph
Safe staging command
npx -y tokrepo@latest install 554c4dc2-663c-489a-b57f-814948e9f714 --target codex

Stages files first; activation requires review of the staged README and plan.

TL;DR
Memory MCP stores entities, relationships, and observations in a local knowledge graph so AI agents remember across sessions.
§01

What it is

Memory MCP is a Model Context Protocol server that provides AI agents with persistent memory via a local knowledge graph. The agent can create entities (people, projects, concepts), add observations about them, and define relationships between them. This structured memory persists across sessions.

It is part of the official MCP server collection and targets developers who want their AI agents to build and maintain a knowledge base over time rather than starting fresh each conversation.

§02

How it saves time or tokens

Without persistent memory, every AI conversation starts from zero. You re-explain your project structure, preferences, and context. Memory MCP lets the agent store and retrieve this information, reducing repeated context-setting.

The estimated token cost for this workflow is approximately 4,000 tokens. The knowledge graph format is more structured than raw text memory, making retrieval more precise.

§03

How to use

  1. Add to your MCP configuration:
{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    }
  }
}
  1. Restart Claude Code or your MCP-compatible agent.
  1. The agent now has tools to create entities, add observations, and query the knowledge graph:
You: Remember that our project uses PostgreSQL 16 with pgvector
Agent: I will store this in my knowledge graph...
[Creates entity: 'Project Database' with observation: 'Uses PostgreSQL 16 with pgvector']
§04

Example

// Example knowledge graph operations the agent performs:

// Create an entity
{"tool": "create_entities", "entities": [
  {"name": "TokRepo", "entityType": "project",
   "observations": ["Nuxt 3 + Go-Zero stack", "Port 3001 frontend"]}
]}

// Create a relationship
{"tool": "create_relations", "relations": [
  {"from": "TokRepo", "to": "PostgreSQL", "relationType": "uses"}
]}

// Search memory
{"tool": "search_nodes", "query": "database"}
// Returns: TokRepo -> uses -> PostgreSQL
§05

Related on TokRepo

§06

Common pitfalls

  • The knowledge graph is stored as a local JSON file. If you delete the file, all memory is lost. Back it up if the data matters.
  • Memory MCP stores everything the agent decides to remember. Over time the graph can grow large. Periodically review and prune irrelevant entities.
  • The agent must be explicitly asked to remember or check memory. It does not automatically store or retrieve information unless prompted.

Frequently Asked Questions

Where is the knowledge graph stored?+

By default, Memory MCP stores the knowledge graph as a JSON file in the local filesystem. The exact location depends on your MCP configuration. You can specify a custom path via environment variables.

Can multiple agents share the same memory?+

Yes. If two MCP clients point to the same memory file, they share the knowledge graph. However, there is no built-in conflict resolution for concurrent writes.

What is the difference between Memory MCP and a vector database?+

Memory MCP stores structured entities and relationships in a knowledge graph. Vector databases store embeddings for semantic search. Memory MCP is better for facts and relationships; vector databases are better for fuzzy similarity search.

Does the agent automatically remember things?+

The agent uses the memory tools when it determines information should be stored or retrieved. You can prompt it to remember specific facts, or configure system prompts that instruct the agent to actively use its memory.

Can I view or edit the knowledge graph manually?+

Yes. The knowledge graph is stored as a JSON file that you can open and edit with any text editor. The format uses entities, observations, and relations arrays.

Citations (3)
🙏

Source & Thanks

Created by Anthropic. Licensed under MIT.

modelcontextprotocol/servers — Part of the official MCP servers collection

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets