# 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 ## 快速使用 在 `.mcp.json` 中添加配置,重启 Claude Code 即可使用: ```json { "mcpServers": { "memory": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-memory"] } } } ``` ## 什么是 Memory MCP? Memory MCP 是官方 MCP 服务器,通过本地知识图谱为 AI 代理提供持久记忆。存储实体、关系和观察,跨会话保持上下文。 **一句话总结**:Memory MCP 是官方 MCP 服务器,通过本地知识图谱为 Claude Code 等工具提供跨会话持久记忆。 **适合人群**:希望 AI 记住项目上下文的 Claude Code/Cline 用户。**安装时间**:1 分钟内。 ## 核心功能 ### 1. 实体管理 创建带类型的命名实体(组件、团队成员、技术等)。 ### 2. 关系图谱 用类型化关系连接实体。 ### 3. 观察记录 为实体附加事实,随时间积累。 ### 4. 全文搜索 搜索整个知识图谱。 ## 常见问题 **Q: 数据存在哪?** A: 本地 JSON 文件,不发送到外部服务器。 **Q: 支持 Claude Code 吗?** A: 支持,这是官方 MCP 服务器。 ## 来源与致谢 > [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) — 官方 MCP 服务器集合, MIT --- Source: https://tokrepo.com/en/workflows/554c4dc2-663c-489a-b57f-814948e9f714 Author: MCP Hub