MCP Configs2026年4月7日·1 分钟阅读

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 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 17/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
Mcp Config
安装
Stage only
信任
信任等级:Established
入口
Memory MCP — Persistent AI Agent Knowledge Graph
安全暂存命令
npx -y tokrepo@latest install 554c4dc2-663c-489a-b57f-814948e9f714 --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

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.

常见问题

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.

引用来源 (3)
🙏

来源与感谢

modelcontextprotocol/servers — official MCP server collection, MIT

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产