# 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. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use Add to your `.mcp.json`: ```json { "mcpServers": { "memory": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-memory"] } } } ``` Restart Claude Code. The agent now has persistent memory across sessions. ## What is Memory MCP? Memory MCP is an official Model Context Protocol server that provides AI agents with persistent memory through a local knowledge graph. It stores entities, relationships, and observations in a JSON file — enabling agents to remember facts, preferences, and context across conversations. **Answer-Ready**: Memory MCP is an official MCP server that gives AI agents like Claude Code persistent memory via a local knowledge graph. It stores entities, relationships, and observations in JSON, enabling cross-session context retention. **Best for**: Claude Code and Cline users who want their AI to remember project context. **Works with**: Any MCP-compatible tool (Claude Code, Cline, Cursor). **Setup time**: Under 1 minute. ## Core Features ### 1. Entity Management Store and retrieve named entities with types: ``` Agent creates: Entity: "Auth Module" (type: component) Entity: "Alice" (type: team_member) Entity: "PostgreSQL" (type: technology) ``` ### 2. Relationships Connect entities with typed relationships: ``` "Auth Module" --uses--> "PostgreSQL" "Alice" --maintains--> "Auth Module" "Auth Module" --depends_on--> "JWT Library" ``` ### 3. Observations Attach facts to entities that accumulate over time: ``` Entity: "Auth Module" Observations: - "Refactored to use JWT in March 2026" - "Has 95% test coverage" - "Handles 10k req/s in production" ``` ### 4. Available Tools | Tool | Description | |------|-------------| | `create_entities` | Add new entities with types | | `create_relations` | Link entities together | | `add_observations` | Attach facts to entities | | `search_nodes` | Full-text search across the graph | | `open_nodes` | Retrieve specific entities | | `delete_entities` | Remove entities | | `delete_observations` | Remove specific facts | | `delete_relations` | Remove relationships | ### 5. Storage Data persists in `~/.claude/memory.json` (configurable): ```json { "entities": [ { "name": "Auth Module", "entityType": "component", "observations": ["Uses JWT tokens", "95% test coverage"] } ], "relations": [ { "from": "Auth Module", "to": "PostgreSQL", "relationType": "uses" } ] } ``` ## Use Cases | Use Case | How | |----------|-----| | Project context | Remember architecture decisions across sessions | | Team info | Store who works on what | | Preferences | Remember coding style and tool preferences | | Debug history | Track past issues and their solutions | ## FAQ **Q: Where is the data stored?** A: In a local JSON file (default: `~/.claude/memory.json`). Never sent to external servers. **Q: Does it work with Claude Code?** A: Yes, it is an official MCP server designed for Claude Code and other MCP-compatible tools. **Q: How much data can it handle?** A: Practical limit is thousands of entities. For larger datasets, consider a database-backed MCP server. ## Source & Thanks > Created by [Anthropic](https://github.com/modelcontextprotocol). Licensed under MIT. > > [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) — Part of the official MCP servers collection ## Quick Start Add this configuration to `.mcp.json` and restart Claude Code: ```json { "mcpServers": { "memory": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-memory"] } } } ``` ## What is Memory MCP? Memory MCP is an official MCP server that gives AI agents persistent memory via a local knowledge graph. It stores entities, relationships, and observations to maintain context across sessions. **In one sentence**: Memory MCP is the official MCP server providing cross-session persistent memory to Claude Code and similar tools via a local knowledge graph. **For**: Claude Code / Cline users who want the AI to remember project context. **Setup time**: under 1 minute. ## Core Features ### 1. Entity Management Create named entities with types (components, team members, technologies, etc.). ### 2. Relationship Graph Connect entities with typed relationships. ### 3. Observation Records Attach facts to entities and accumulate them over time. ### 4. Full-Text Search Search the entire knowledge graph. ## FAQ **Q: Where is the data stored?** A: In a local JSON file — nothing is sent to external servers. **Q: Does it work with Claude Code?** A: Yes — this is the official MCP server. ## Source & Thanks > [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) — official MCP server collection, MIT --- Source: https://tokrepo.com/en/workflows/memory-mcp-persistent-ai-agent-knowledge-graph-554c4dc2 Author: MCP Hub