Back to Codex
AI Frameworks·
intermediate
·8 min read·Apr 4, 2026

How to Use the Memory MCP Server for Persistent AI Knowledge

Give your AI agent persistent memory using the Knowledge Graph MCP server. Store and retrieve information across conversations.

memoryknowledge graphpersistent statecontextlong-term memory

Use the Memory MCP Server for Persistent AI Knowledge

The Memory MCP server (also called Knowledge Graph server) gives AI agents the ability to store and retrieve information across conversations, creating a persistent knowledge base.

Why Persistent Memory?

By default, AI agents forget everything between conversations. The Memory server solves this by:

  • Storing facts, preferences, and context as a knowledge graph
  • Allowing retrieval of past information in new conversations
  • Building a personal knowledge base over time

Configuration

json
{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    }
  }
}

How It Works

The memory server stores information as a knowledge graph with:

  • Entities: People, projects, concepts (nodes)
  • Relations: Connections between entities (edges)
  • Observations: Facts about entities (properties)

Available Tools

ToolDescription
code
create_entities
Add new entities to the graph
code
create_relations
Connect entities with relationships
code
add_observations
Add facts about entities
code
delete_entities
Remove entities
code
delete_observations
Remove specific facts
code
delete_relations
Remove connections
code
read_graph
Read the entire knowledge graph
code
search_nodes
Search for specific entities
code
open_nodes
Get details about specific nodes

Example Usage

Storing Project Context

code
"Remember that Project Alpha is using React and TypeScript, is led by Sarah, and has a deadline of March 15th"

Retrieving Information

code
"What do you know about Project Alpha?"

Building Relationships

code
"Sarah manages Project Alpha and reports to David. David oversees the Engineering department."

Storage Location

By default, the knowledge graph is stored in a local JSON file. You can specify a custom path:

json
{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"],
      "env": {
        "MEMORY_FILE_PATH": "/path/to/memory.json"
      }
    }
  }
}

Tips

  • Tell the AI to "remember" important information explicitly
  • Periodically review the knowledge graph for accuracy
  • The knowledge graph works best for structured, factual information
  • Combine with other servers for powerful context-aware workflows