memory knowledge graph.com
memory knowledge graph.com logo

Memory Knowledge Graph

Provides a persistent knowledge graph system for maintaining structured memory across conversations, enabling creation,...

Created byApr 22, 2025

Memory MCP Server

A Model Context Protocol server that provides knowledge graph management capabilities. This server enables LLMs to create, read, update, and delete entities and relations in a persistent knowledge graph, helping AI assistants maintain memory across conversations. This is a Swift implementation of the official TypeScript Memory MCP Server.
Note: This Swift version requires macOS 14.0 or later. For broader platform support (including Windows, Linux, and macOS 11.0+), check out the Go language implementation: [memory-mcp-server-go](https://github.com/okooo5km/memory-mcp-server-go).
Swift Platform License

Features

  • Knowledge Graph Storage: Maintain a persistent graph of entities and their relationships
  • Entity Management: Create, retrieve, update, and delete entities with custom types
  • Relation Tracking: Define and manage relationships between entities in active voice
  • Observation System: Add and remove observations about entities over time
  • Powerful Search: Find relevant nodes by name, type, or observation content
  • Persistent Storage: Data persists between sessions in a simple JSON format

Available Tools

  • create_entities - Create multiple new entities in the knowledge graph
  • create_relations - Create multiple new relations between entities
  • add_observations - Add new observations to existing entities
  • delete_entities - Delete multiple entities and their associated relations
  • delete_observations - Delete specific observations from entities
  • delete_relations - Delete multiple relations from the knowledge graph
  • read_graph - Read the entire knowledge graph
  • search_nodes - Search for nodes in the knowledge graph based on a query
  • open_nodes - Open specific nodes in the knowledge graph by their names

Installation

Option 1: One-Line Installation (curl)

The easiest way to install is with the one-line installer, which automatically downloads the latest version and installs it to ~/.local/bin in your home directory:
The installer will:
  • Create ~/.local/bin if it doesn't exist
  • Add this directory to your PATH (in .zshrc or .bashrc)
  • Download and install the latest version
  • Make the binary executable

Option 2: Build from Source

  1. Clone the repository:
  1. Build the project:
  1. Install the binary:Make sure ~/.local/bin is in your PATH by adding to your shell configuration file:

Command Line Arguments

The server supports the following command line arguments:
  • -h, --help: Display help information about the server, its usage, and available options
  • -v, --version: Display the version number of the memory-mcp-server
Example usage:

Configuration

Environment Variables

The server supports the following environment variables:
  • MEMORY_FILE_PATH: Custom path for storing the knowledge graph (optional)
You can check the configured file path in the server logs when starting the server.

Configure for Claude.app

Add to your Claude settings:

Configure for Cursor

Add the following configuration to your Cursor editor's Settings - mcp.json:
cursor-settings

Configure for Chatwise

Add the memory MCP server to your Chatwise Settings - Tools.
chatwise-settings-tools

Example System Prompt

You can use the following system prompt to help Claude utilize the memory-mcp-server effectively:

Development Requirements

  • Swift 6.0 or later
  • macOS 14.0 or later
  • MCP Swift SDK 0.2.0 or later

Knowledge Graph Structure

The Memory MCP Server uses a simple graph structure to store knowledge:
  • Entities: Nodes in the graph with a name, type, and list of observations
  • Relations: Edges between entities with a relation type in active voice
  • Observations: Facts or details associated with entities
The knowledge graph is persisted to disk as a line-delimited JSON file, where each line is either an entity or relation object.

Usage Examples

Creating Entities

Creating Relations

Adding Observations

Searching Nodes

Opening Specific Nodes

Use Cases

  • Long-term Memory for AI Assistants: Enable AI assistants to remember user preferences, past interactions, and important facts
  • Knowledge Management: Organize information about people, places, events, and concepts
  • Relationship Tracking: Maintain networks of relationships between entities
  • Context Persistence: Preserve important context across multiple sessions
  • Journal and Daily Logs: Maintain a structured record of events, activities, and reflections over time, making it easy to retrieve and relate past experiences chronologically

Version History

See GitHub Releases for version history and changelog.

Support the Project

If you find Memory MCP Server helpful, please consider supporting its development:
  • Star the project on GitHub
  • Report bugs or suggest features
  • Support via:

License

memory-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.

About

A Swift implementation of a knowledge graph memory server for Model Context Protocol (MCP), enabling persistent memory capabilities for large language models. This project is based on the official TypeScript implementation but rewritten in Swift using the MCP Swift SDK.

Memory MCP Server

A Model Context Protocol server that provides knowledge graph management capabilities. This server enables LLMs to create, read, update, and delete entities and relations in a persistent knowledge graph, helping AI assistants maintain memory across conversations. This is a Swift implementation of the official TypeScript Memory MCP Server.
Note: This Swift version requires macOS 14.0 or later. For broader platform support (including Windows, Linux, and macOS 11.0+), check out the Go language implementation: [memory-mcp-server-go](https://github.com/okooo5km/memory-mcp-server-go).
Swift Platform License

Features

  • Knowledge Graph Storage: Maintain a persistent graph of entities and their relationships
  • Entity Management: Create, retrieve, update, and delete entities with custom types
  • Relation Tracking: Define and manage relationships between entities in active voice
  • Observation System: Add and remove observations about entities over time
  • Powerful Search: Find relevant nodes by name, type, or observation content
  • Persistent Storage: Data persists between sessions in a simple JSON format

Available Tools

  • create_entities - Create multiple new entities in the knowledge graph
  • create_relations - Create multiple new relations between entities
  • add_observations - Add new observations to existing entities
  • delete_entities - Delete multiple entities and their associated relations
  • delete_observations - Delete specific observations from entities
  • delete_relations - Delete multiple relations from the knowledge graph
  • read_graph - Read the entire knowledge graph
  • search_nodes - Search for nodes in the knowledge graph based on a query
  • open_nodes - Open specific nodes in the knowledge graph by their names

Installation

Option 1: One-Line Installation (curl)

The easiest way to install is with the one-line installer, which automatically downloads the latest version and installs it to ~/.local/bin in your home directory:
The installer will:
  • Create ~/.local/bin if it doesn't exist
  • Add this directory to your PATH (in .zshrc or .bashrc)
  • Download and install the latest version
  • Make the binary executable

Option 2: Build from Source

  1. Clone the repository:
  1. Build the project:
  1. Install the binary:Make sure ~/.local/bin is in your PATH by adding to your shell configuration file:

Command Line Arguments

The server supports the following command line arguments:
  • -h, --help: Display help information about the server, its usage, and available options
  • -v, --version: Display the version number of the memory-mcp-server
Example usage:

Configuration

Environment Variables

The server supports the following environment variables:
  • MEMORY_FILE_PATH: Custom path for storing the knowledge graph (optional)
You can check the configured file path in the server logs when starting the server.

Configure for Claude.app

Add to your Claude settings:

Configure for Cursor

Add the following configuration to your Cursor editor's Settings - mcp.json:
cursor-settings

Configure for Chatwise

Add the memory MCP server to your Chatwise Settings - Tools.
chatwise-settings-tools

Example System Prompt

You can use the following system prompt to help Claude utilize the memory-mcp-server effectively:

Development Requirements

  • Swift 6.0 or later
  • macOS 14.0 or later
  • MCP Swift SDK 0.2.0 or later

Knowledge Graph Structure

The Memory MCP Server uses a simple graph structure to store knowledge:
  • Entities: Nodes in the graph with a name, type, and list of observations
  • Relations: Edges between entities with a relation type in active voice
  • Observations: Facts or details associated with entities
The knowledge graph is persisted to disk as a line-delimited JSON file, where each line is either an entity or relation object.

Usage Examples

Creating Entities

Creating Relations

Adding Observations

Searching Nodes

Opening Specific Nodes

Use Cases

  • Long-term Memory for AI Assistants: Enable AI assistants to remember user preferences, past interactions, and important facts
  • Knowledge Management: Organize information about people, places, events, and concepts
  • Relationship Tracking: Maintain networks of relationships between entities
  • Context Persistence: Preserve important context across multiple sessions
  • Journal and Daily Logs: Maintain a structured record of events, activities, and reflections over time, making it easy to retrieve and relate past experiences chronologically

Version History

See GitHub Releases for version history and changelog.

Support the Project

If you find Memory MCP Server helpful, please consider supporting its development:
  • Star the project on GitHub
  • Report bugs or suggest features
  • Support via:

License

memory-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.

About

A Swift implementation of a knowledge graph memory server for Model Context Protocol (MCP), enabling persistent memory capabilities for large language models. This project is based on the official TypeScript implementation but rewritten in Swift using the MCP Swift SDK.