Knowledge Graph Memory Server
Unverified●29/40Claude Code·UnknownFrontmatter could not be read
Cursor·UnknownWe have not crawled the repo tree, so we will not guess
Codex·UnknownWe have not crawled the repo tree, so we will not guess
Gemini CLI·UnknownThe spec defines no detection rule for Gemini
Copilot·UnknownWe have not crawled the repo tree, so we will not guess
npx agentalley add memoryWho is stuck, and on what
The whole source
Frontmatter: no frontmatter — costs points on criterion B3.
| 1 | # Knowledge Graph Memory ServerA5 — No allowed-tools declared — no way to tell what this skill may touchB3 — Frontmatter: no frontmatter |
| 2 | |
| 3 | A basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats. |
| 4 | |
| 5 | Published on npm as [`@modelcontextprotocol/server-memory`](https://www.npmjs.com/package/@modelcontextprotocol/server-memory). |
| 6 | |
| 7 | ## Core Concepts |
| 8 | |
| 9 | ### Entities |
| 10 | Entities are the primary nodes in the knowledge graph. Each entity has: |
| 11 | - A unique name (identifier) |
| 12 | - An entity type (e.g., "person", "organization", "event") |
| 13 | - A list of observations |
| 14 | |
| 15 | Example: |
| 16 | ```json |
| 17 | { |
| 18 | "name": "John_Smith", |
| 19 | "entityType": "person", |
| 20 | "observations": ["Speaks fluent Spanish"] |
| 21 | } |
| 22 | ``` |
| 23 | |
| 24 | ### Relations |
| 25 | Relations define directed connections between entities. They are always stored in active voice and describe how entities interact or relate to each other. |
| 26 | |
| 27 | Example: |
| 28 | ```json |
| 29 | { |
| 30 | "from": "John_Smith", |
| 31 | "to": "Anthropic", |
| 32 | "relationType": "works_at" |
| 33 | } |
| 34 | ``` |
| 35 | ### Observations |
| 36 | Observations are discrete pieces of information about an entity. They are: |
| 37 | |
| 38 | - Stored as strings |
| 39 | - Attached to specific entities |
| 40 | - Can be added or removed independently |
| 41 | - Should be atomic (one fact per observation) |
| 42 | |
| 43 | Example: |
| 44 | ```json |
| 45 | { |
| 46 | "entityName": "John_Smith", |
| 47 | "observations": [ |
| 48 | "Speaks fluent Spanish", |
| 49 | "Graduated in 2019", |
| 50 | "Prefers morning meetings" |
| 51 | ] |
| 52 | } |
| 53 | ``` |
| 54 | |
| 55 | ## API |
| 56 | |
| 57 | ### Tools |
| 58 | - **create_entities** |
| 59 | - Create multiple new entities in the knowledge graph |
| 60 | - Input: `entities` (array of objects) |
| 61 | - Each object contains: |
| 62 | - `name` (string): Entity identifier |
| 63 | - `entityType` (string): Type classification |
| 64 | - `observations` (string[]): Associated observations |
| 65 | - Ignores entities with existing names |
| 66 | |
| 67 | - **create_relations** |
| 68 | - Create multiple new relations between entities |
| 69 | - Input: `relations` (array of objects) |
| 70 | - Each object contains: |
| 71 | - `from` (string): Source entity name |
| 72 | - `to` (string): Target entity name |
| 73 | - `relationType` (string): Relationship type in active voice |
| 74 | - Skips duplicate relations |
| 75 | - Fails if either the source or target entity doesn't exist |
| 76 | |
| 77 | - **add_observations** |
| 78 | - Add new observations to existing entities |
| 79 | - Input: `observations` (array of objects) |
| 80 | - Each object contains: |
| 81 | - `entityName` (string): Target entity |
| 82 | - `contents` (string[]): New observations to add |
| 83 | - Returns added observations per entity |
| 84 | - Fails if entity doesn't exist |
| 85 | |
| 86 | - **delete_entities** |
| 87 | - Remove entities and their relations |
| 88 | - Input: `entityNames` (string[]) |
| 89 | - Cascading deletion of associated relations |
| 90 | - No error if an entity doesn't exist; the response reports which names were not found |
| 91 | |
| 92 | - **delete_observations** |
| 93 | - Remove specific observations from entities |
| 94 | - Input: `deletions` (array of objects) |
| 95 | - Each object contains: |
| 96 | - `entityName` (string): Target entity |
| 97 | - `observations` (string[]): Observations to remove |
| 98 | - No error if an observation doesn't exist; the response reports how many were deleted |
| 99 | |
| 100 | - **delete_relations** |
| 101 | - Remove specific relations from the graph |
| 102 | - Input: `relations` (array of objects) |
| 103 | - Each object contains: |
| 104 | - `from` (string): Source entity name |
| 105 | - `to` (string): Target entity name |
| 106 | - `relationType` (string): Relationship type |
| 107 | - No error if a relation doesn't exist; the response reports how many were deleted |
| 108 | |
| 109 | - **read_graph** |
| 110 | - Read the entire knowledge graph |
| 111 | - No input required |
| 112 | - Returns complete graph structure with all entities and relations |
| 113 | |
| 114 | - **search_nodes** |
| 115 | - Search for nodes based on query |
| 116 | - Input: `query` (string) |
| 117 | - Searches across: |
| 118 | - Entity names |
| 119 | - Entity types |
| 120 | - Observation content |
| 121 | - Returns matching entities and their relations |
| 122 | |
| 123 | - **open_nodes** |
| 124 | - Retrieve specific nodes by name |
| 125 | - Input: `names` (string[]) |
| 126 | - Returns: |
| 127 | - Requested entities |
| 128 | - Relations between requested entities |
| 129 | - Silently skips non-existent nodes |
| 130 | |
| 131 | ### Resources |
| 132 | |
| 133 | - **knowledge-graph** (`memory://knowledge-graph`) |
| 134 | - The full knowledge graph as a readable MCP Resource |
| 135 | - MIME type: `application/json` |
| 136 | - Returns the same shape as `read_graph` (entities and relations) |
| 137 | - Mutation tools (`create_entities`, `create_relations`, `add_observations`, `delete_entities`, `delete_observations`, `delete_relations`) emit `notifications/resources/updated` for this URI, so subscribed clients see live changes |
| 138 | |
| 139 | # Usage with Claude Desktop |
| 140 | |
| 141 | ### Setup |
| 142 | |
| 143 | Add this to your claude_desktop_config.json: |
| 144 | |
| 145 | #### Docker |
| 146 | |
| 147 | ```json |
| 148 | { |
| 149 | "mcpServers": { |
| 150 | "memory": { |
| 151 | "command": "docker", |
| 152 | "args": ["run", "-i", "-v", "claude-memory:/app/dist", "--rm", "mcp/memory"] |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | ``` |
| 157 | |
| 158 | #### NPX |
| 159 | ```json |
| 160 | { |
| 161 | "mcpServers": { |
| 162 | "memory": { |
| 163 | "command": "npx", |
| 164 | "args": [ |
| 165 | "-y", |
| 166 | "@modelcontextprotocol/server-memory" |
| 167 | ] |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | ``` |
| 172 | |
| 173 | On Windows, use `cmd /c` to launch `npx`: |
| 174 | |
| 175 | ```json |
| 176 | { |
| 177 | "mcpServers": { |
| 178 | "memory": { |
| 179 | "command": "cmd", |
| 180 | "args": [ |
| 181 | "/c", |
| 182 | "npx", |
| 183 | "-y", |
| 184 | "@modelcontextprotocol/server-memory" |
| 185 | ] |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | ``` |
| 190 | |
| 191 | #### NPX with custom setting |
| 192 | |
| 193 | The server can be configured using the following environment variables: |
| 194 | |
| 195 | ```json |
| 196 | { |
| 197 | "mcpServers": { |
| 198 | "memory": { |
| 199 | "command": "npx", |
| 200 | "args": [ |
| 201 | "-y", |
| 202 | "@modelcontextprotocol/server-memory" |
| 203 | ], |
| 204 | "env": { |
| 205 | "MEMORY_FILE_PATH": "/path/to/custom/memory.jsonl" |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | ``` |
| 211 | |
| 212 | On Windows, use: |
| 213 | |
| 214 | ```json |
| 215 | { |
| 216 | "mcpServers": { |
| 217 | "memory": { |
| 218 | "command": "cmd", |
| 219 | "args": [ |
| 220 | "/c", |
| 221 | "npx", |
| 222 | "-y", |
| 223 | "@modelcontextprotocol/server-memory" |
| 224 | ], |
| 225 | "env": { |
| 226 | "MEMORY_FILE_PATH": "/path/to/custom/memory.jsonl" |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | ``` |
| 232 | |
| 233 | - `MEMORY_FILE_PATH`: Path to the memory storage JSONL file (default: `memory.jsonl` in the server directory) |
| 234 | |
| 235 | # VS Code Installation Instructions |
| 236 | |
| 237 | For quick installation, use one of the one-click installation buttons below: |
| 238 | |
| 239 | [](https://insiders.vscode.dev/redirect/mcp/install?name=memory&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40modelcontextprotocol%2Fserver-memory%22%5D%7D) [](https://insiders.vscode.dev/redirect/mcp/install?name=memory&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40modelcontextprotocol%2Fserver-memory%22%5D%7D&quality=insiders)B1 — Line is 668 characters — unreadable by eye |
| 240 | |
| 241 | [](https://insiders.vscode.dev/redirect/mcp/install?name=memory&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22-v%22%2C%22claude-memory%3A%2Fapp%2Fdist%22%2C%22--rm%22%2C%22mcp%2Fmemory%22%5D%7D) [](https://insiders.vscode.dev/redirect/mcp/install?name=memory&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22-v%22%2C%22claude-memory%3A%2Fapp%2Fdist%22%2C%22--rm%22%2C%22mcp%2Fmemory%22%5D%7D&quality=insiders)B1 — Line is 780 characters — unreadable by eye |
| 242 | |
| 243 | For manual installation, you can configure the MCP server using one of these methods: |
| 244 | |
| 245 | **Method 1: User Configuration (Recommended)** |
| 246 | Add the configuration to your user-level MCP configuration file. Open the Command Palette (`Ctrl + Shift + P`) and run `MCP: Open User Configuration`. This will open your user `mcp.json` file where you can add the server configuration. |
| 247 | |
| 248 | **Method 2: Workspace Configuration** |
| 249 | Alternatively, you can add the configuration to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others. |
| 250 | |
| 251 | > For more details about MCP configuration in VS Code, see the [official VS Code MCP documentation](https://code.visualstudio.com/docs/copilot/customization/mcp-servers). |
| 252 | |
| 253 | #### NPX |
| 254 | |
| 255 | ```json |
| 256 | { |
| 257 | "servers": { |
| 258 | "memory": { |
| 259 | "command": "npx", |
| 260 | "args": [ |
| 261 | "-y", |
| 262 | "@modelcontextprotocol/server-memory" |
| 263 | ] |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | ``` |
| 268 | |
| 269 | On Windows, use: |
| 270 | |
| 271 | ```json |
| 272 | { |
| 273 | "servers": { |
| 274 | "memory": { |
| 275 | "command": "cmd", |
| 276 | "args": [ |
| 277 | "/c", |
| 278 | "npx", |
| 279 | "-y", |
| 280 | "@modelcontextprotocol/server-memory" |
| 281 | ] |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | ``` |
| 286 | |
| 287 | #### Docker |
| 288 | |
| 289 | ```json |
| 290 | { |
| 291 | "servers": { |
| 292 | "memory": { |
| 293 | "command": "docker", |
| 294 | "args": [ |
| 295 | "run", |
| 296 | "-i", |
| 297 | "-v", |
| 298 | "claude-memory:/app/dist", |
| 299 | "--rm", |
| 300 | "mcp/memory" |
| 301 | ] |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | ``` |
| 306 | |
| 307 | ### System Prompt |
| 308 | |
| 309 | The prompt for utilizing memory depends on the use case. Changing the prompt will help the model determine the frequency and types of memories created. |
| 310 | |
| 311 | Here is an example prompt for chat personalization. You could use this prompt in the "Custom Instructions" field of a [Claude.ai Project](https://www.anthropic.com/news/projects). |
| 312 | |
| 313 | ``` |
| 314 | Follow these steps for each interaction: |
| 315 | |
| 316 | 1. User Identification: |
| 317 | - You should assume that you are interacting with default_user |
| 318 | - If you have not identified default_user, proactively try to do so. |
| 319 | |
| 320 | 2. Memory Retrieval: |
| 321 | - Always begin your chat by saying only "Remembering..." and retrieve all relevant information from your knowledge graph |
| 322 | - Always refer to your knowledge graph as your "memory" |
| 323 | |
| 324 | 3. Memory |
| 325 | - While conversing with the user, be attentive to any new information that falls into these categories: |
| 326 | a) Basic Identity (age, gender, location, job title, education level, etc.) |
| 327 | b) Behaviors (interests, habits, etc.) |
| 328 | c) Preferences (communication style, preferred language, etc.) |
| 329 | d) Goals (goals, targets, aspirations, etc.) |
| 330 | e) Relationships (personal and professional relationships up to 3 degrees of separation) |
| 331 | |
| 332 | 4. Memory Update: |
| 333 | - If any new information was gathered during the interaction, update your memory as follows: |
| 334 | a) Create entities for recurring organizations, people, and significant events |
| 335 | b) Connect them to the current entities using relations |
| 336 | c) Store facts about them as observations |
| 337 | ``` |
| 338 | |
| 339 | ## Building |
| 340 | |
| 341 | Docker: |
| 342 | |
| 343 | ```sh |
| 344 | docker build -t mcp/memory -f src/memory/Dockerfile . |
| 345 | ``` |
| 346 | |
| 347 | For Awareness: a prior mcp/memory volume contains an index.js file that could be overwritten by the new container. If you are using a docker volume for storage, delete the old docker volume's `index.js` file before starting the new container. |
| 348 | |
| 349 | ## License |
| 350 | |
| 351 | This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository. |
| 352 |
Reviews
Installed this one?Write the first review and take the Trailblazer badge.
Alternatives
Subagent Driven DevelopmentUse when executing implementation plans with independent tasks in the current session◐◐◐◐◐●36/40Python Code Style & DocumentationPython code style, linting, formatting, naming conventions, and documentation standards. Use when writing new code, reviewing style, configuring linters, writing docstrings, or establishing project standards.◐····●35/40Competitor Price Analysis 💲Competitor pricing strategy analysis and market positioning. Price mapping, pricing gaps identification, elasticity signals evaluation, and strategic pricing optimization. Use when the user asks about competitor pricing, price analysis, pricing strategy, or co◐····●34/40Competitor Price Tracker 📊Set up competitor price tracking and monitoring workflows. Track price changes, detect promotions, analyze pricing patterns, and get alerts for competitive price movements.◐····●34/40