MCP Server

Memory

Official Verified

Store and recall persistent knowledge as entities, relationships and observations. This reference MCP server keeps its graph in a local JSONL file and supports stdio or self-hosted Streamable HTTP.

Views
106
Tools
9
Transport
stdio, Streamable HTTP
Share resource
Capabilities & compatibility

Use cases

  • Recall preferences across conversations
  • Track entities and relationships
  • Maintain shared project knowledge

Requirements

Node.js 24 or later for npx or source installation. Configure a writable absolute MEMORY_FILE_PATH to persist the graph outside the package directory.

Connection & setup

Install command

Install command
npx -y @modelcontextprotocol/server-memory

Client configuration

Client configuration
{
    "mcpServers": {
        "memory": {
            "command": "npx",
            "args": [
                "-y",
                "@modelcontextprotocol/server-memory"
            ],
            "env": {
                "MEMORY_FILE_PATH": "~/memory.jsonl"
            }
        }
    }
}

Setup instructions

Add the configuration to your MCP client and restart the client. Set MEMORY_FILE_PATH to a writable location owned by your user. To self-host an HTTP endpoint, start npx -y @modelcontextprotocol/server-memory --transport streamable-http and connect to http://127.0.0.1:3001/mcp. The upstream documentation describes HTTP access and deployment options.

Connection parameters

Environment variables

MEMORY_FILE_PATHOptional

Absolute path to the JSONL graph file. A leading ~ expands to the home directory.

Required permissions

Reads and writes a local memory file on the user's machine.

Runtime & data

Runs locally via npx; memory data stays in a local file.

Tools & resources

Tools 9

create_entities

Create named entities with a type and observations in the knowledge graph.

Input parameters
Input schema
{
    "type": "object",
    "properties": {
        "entities": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "entityType": {
                        "type": "string"
                    },
                    "observations": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "required": [
                    "name",
                    "entityType",
                    "observations"
                ]
            }
        }
    },
    "required": [
        "entities"
    ]
}

create_relations

Add directed relationships between existing entities.

Input parameters
Input schema
{
    "type": "object",
    "properties": {
        "relations": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "from": {
                        "type": "string"
                    },
                    "to": {
                        "type": "string"
                    },
                    "relationType": {
                        "type": "string"
                    }
                },
                "required": [
                    "from",
                    "to",
                    "relationType"
                ]
            }
        }
    },
    "required": [
        "relations"
    ]
}

add_observations

Append new observations to existing entities.

Input parameters
Input schema
{
    "type": "object",
    "properties": {
        "observations": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "entityName": {
                        "type": "string"
                    },
                    "contents": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "required": [
                    "entityName",
                    "contents"
                ]
            }
        }
    },
    "required": [
        "observations"
    ]
}

delete_entities

Delete entities and the relationships attached to them.

Input parameters
Input schema
{
    "type": "object",
    "properties": {
        "entityNames": {
            "type": "array",
            "items": {
                "type": "string"
            }
        }
    },
    "required": [
        "entityNames"
    ]
}

delete_observations

Remove selected observations while keeping their entities.

Input parameters
Input schema
{
    "type": "object",
    "properties": {
        "deletions": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "entityName": {
                        "type": "string"
                    },
                    "observations": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "required": [
                    "entityName",
                    "observations"
                ]
            }
        }
    },
    "required": [
        "deletions"
    ]
}

delete_relations

Remove exact relationship matches while keeping both entities.

Input parameters
Input schema
{
    "type": "object",
    "properties": {
        "relations": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "from": {
                        "type": "string"
                    },
                    "to": {
                        "type": "string"
                    },
                    "relationType": {
                        "type": "string"
                    }
                },
                "required": [
                    "from",
                    "to",
                    "relationType"
                ]
            }
        }
    },
    "required": [
        "relations"
    ]
}

read_graph

Read the graph, optionally filtering entity types or limiting returned observations.

Input parameters
Input schema
{
    "type": "object",
    "properties": {
        "entityTypes": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "observationLimit": {
            "type": "integer",
            "minimum": 0
        }
    }
}

search_nodes

Find entities by matching names, types and observation text.

Input parameters
Input schema
{
    "type": "object",
    "properties": {
        "query": {
            "type": "string",
            "maxLength": 2048
        },
        "limit": {
            "type": "integer",
            "minimum": 1
        },
        "observationLimit": {
            "type": "integer",
            "minimum": 0
        }
    },
    "required": [
        "query"
    ]
}

open_nodes

Retrieve specific entities and their relationships by name.

Input parameters
Input schema
{
    "type": "object",
    "properties": {
        "names": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "observationLimit": {
            "type": "integer",
            "minimum": 0
        }
    },
    "required": [
        "names"
    ]
}

Resources 1

knowledge-graph

Read the stored knowledge graph as JSON. Supports resource update notifications.

Resource URI memory://knowledge-graph

Media type application/json

README

Persistent knowledge for MCP

Memory models information as entities, observations and directed relations. Write tools create or update that graph. Read tools retrieve the full graph, search by text or open selected entities.

Storage and setup

The graph is stored in a JSONL file. Choose an absolute path through MEMORY_FILE_PATH so the file is retained when the npm package is updated. The containing directory must be writable.

Connection options

Use stdio from a desktop or command-line MCP client, or run a self-hosted Streamable HTTP endpoint with --transport streamable-http.

Read the upstream setup and deployment guide