The Memory MCP Server provides knowledge graph management capabilities for large language models. It allows AI assistants to create, read, update, and delete entities and relations in a persistent knowledge graph, maintaining memory across conversations. This Swift implementation requires macOS 14.0 or later.
Install the server with a simple one-line command:
curl -fsSL https://raw.githubusercontent.com/okooo5km/memory-mcp-server/main/install.sh | bash
This will:
~/.local/bin
directory if neededgit clone https://github.com/okooo5km/memory-mcp-server.git
cd memory-mcp-server
swift build -c release
mkdir -p ~/.local/bin
cp $(swift build -c release --show-bin-path)/memory-mcp-server ~/.local/bin/
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc # or ~/.bashrc
source ~/.zshrc # or source ~/.bashrc
# Display help information
memory-mcp-server --help
# Display version information
memory-mcp-server --version
Configure the storage location for your knowledge graph:
export MEMORY_FILE_PATH="/path/to/your/memory.json"
If not specified, it defaults to memory.json
in the current directory.
Add to your Claude settings:
"mcpServers": {
"memory": {
"command": "memory-mcp-server",
"env": {
"MEMORY_FILE_PATH": "/path/to/your/memory.json"
}
}
}
Add to your Cursor editor's Settings - mcp.json:
{
"mcpServers": {
"memory": {
"command": "memory-mcp-server",
"env": {
"MEMORY_FILE_PATH": "/path/to/your/memory.json"
}
}
}
}
{
"entities": [
{
"name": "John Smith",
"entityType": "Person",
"observations": ["Software engineer", "Lives in San Francisco", "Enjoys hiking"]
},
{
"name": "Acme Corp",
"entityType": "Company",
"observations": ["Founded in 2010", "Tech startup"]
}
]
}
{
"relations": [
{
"from": "John Smith",
"to": "Acme Corp",
"relationType": "works at"
}
]
}
{
"observations": [
{
"entityName": "John Smith",
"contents": ["Recently promoted to Senior Engineer", "Working on AI projects"]
}
]
}
{
"query": "San Francisco"
}
{
"names": ["John Smith", "Acme Corp"]
}
You have access to a Knowledge Graph memory system, which can store and retrieve information across conversations. Use it to remember important details about the user, their preferences, and any facts they've shared.
When you discover important information, save it using memory tools:
- `create_entities` to add new people, places, or concepts
- `create_relations` to record how entities relate to each other
- `add_observations` to record facts about existing entities
Before answering questions that might require past context, check your memory:
- `search_nodes` to find relevant information
- `open_nodes` to retrieve specific entities
- `read_graph` to get a complete view of your knowledge
Always prioritize information from your memory when responding to the user, especially when they reference past conversations.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "memory" '{"command":"memory-mcp-server","env":{"MEMORY_FILE_PATH":"/path/to/your/memory.json"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"memory": {
"command": "memory-mcp-server",
"env": {
"MEMORY_FILE_PATH": "/path/to/your/memory.json"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"memory": {
"command": "memory-mcp-server",
"env": {
"MEMORY_FILE_PATH": "/path/to/your/memory.json"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect