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 Go implementation of the official TypeScript Memory MCP Server.
create_entities
- Create multiple new entities in the knowledge graph
entities
(array, required): Array of entity objects to create
name
(string): The name of the entityentityType
(string): The type of the entityobservations
(array of strings): Observations associated with the entitycreate_relations
- Create multiple new relations between entities
relations
(array, required): Array of relation objects
from
(string): The name of the entity where the relation startsto
(string): The name of the entity where the relation endsrelationType
(string): The type of the relation (in active voice)add_observations
- Add new observations to existing entities
observations
(array, required): Array of observation additions
entityName
(string): The name of the entity to add observations tocontents
(array of strings): The observations to adddelete_entities
- Delete multiple entities and their associated relations
entityNames
(array, required): Array of entity names to deletedelete_observations
- Delete specific observations from entities
deletions
(array, required): Array of observation deletions
entityName
(string): The name of the entity containing the observationsobservations
(array of strings): The observations to deletedelete_relations
- Delete multiple relations from the knowledge graph
relations
(array, required): Array of relation objects to delete
from
(string): The source entity nameto
(string): The target entity namerelationType
(string): The relation typeread_graph
- Read the entire knowledge graph
search_nodes
- Search for nodes in the knowledge graph based on a query
query
(string, required): Search query to match against entity names, types, and observationsopen_nodes
- Open specific nodes in the knowledge graph by their names
names
(array, required): Array of entity names to retrieveDownload the latest pre-built binary for your platform from the GitHub Releases page:
Download the binary for your platform from the GitHub Releases page and follow the installation instructions below.
# Download the arm64 version
curl -L https://github.com/okooo5km/memory-mcp-server-go/releases/latest/download/memory-mcp-server-go-macos-arm64.zip -o memory-mcp-server.zip
unzip memory-mcp-server.zip
chmod +x memory-mcp-server-go
# Remove quarantine attribute to avoid security warnings
xattr -d com.apple.quarantine memory-mcp-server-go
# Install to your local bin directory
mkdir -p ~/.local/bin
mv memory-mcp-server-go ~/.local/bin/
rm memory-mcp-server.zip
# Download the x86_64 version
curl -L https://github.com/okooo5km/memory-mcp-server-go/releases/latest/download/memory-mcp-server-go-macos-x86_64.zip -o memory-mcp-server.zip
unzip memory-mcp-server.zip
chmod +x memory-mcp-server-go
# Remove quarantine attribute to avoid security warnings
xattr -d com.apple.quarantine memory-mcp-server-go
# Install to your local bin directory
mkdir -p ~/.local/bin
mv memory-mcp-server-go ~/.local/bin/
rm memory-mcp-server.zip
# Download the universal version
curl -L https://github.com/okooo5km/memory-mcp-server-go/releases/latest/download/memory-mcp-server-go-macos-universal.zip -o memory-mcp-server.zip
unzip memory-mcp-server.zip
chmod +x memory-mcp-server-go
# Remove quarantine attribute to avoid security warnings
xattr -d com.apple.quarantine memory-mcp-server-go
# Install to your local bin directory
mkdir -p ~/.local/bin
mv memory-mcp-server-go ~/.local/bin/
rm memory-mcp-server.zip
# Download the amd64 version
curl -L https://github.com/okooo5km/memory-mcp-server-go/releases/latest/download/memory-mcp-server-go-linux-amd64.tar.gz -o memory-mcp-server.tar.gz
tar -xzf memory-mcp-server.tar.gz
chmod +x memory-mcp-server-go
# Install to your local bin directory
mkdir -p ~/.local/bin
mv memory-mcp-server-go ~/.local/bin/
rm memory-mcp-server.tar.gz
# Download the arm64 version
curl -L https://github.com/okooo5km/memory-mcp-server-go/releases/latest/download/memory-mcp-server-go-linux-arm64.tar.gz -o memory-mcp-server.tar.gz
tar -xzf memory-mcp-server.tar.gz
chmod +x memory-mcp-server-go
# Install to your local bin directory
mkdir -p ~/.local/bin
mv memory-mcp-server-go ~/.local/bin/
rm memory-mcp-server.tar.gz
memory-mcp-server-go.exe
to a location in your PATHmemory-mcp-server-go.exe
to a location in your PATHMake sure the installation directory is in your PATH:
export PATH="$HOME/.local/bin:$PATH"
to your shell configuration file (.bashrc
, .zshrc
, etc.)Clone the repository:
git clone https://github.com/okooo5km/memory-mcp-server-go.git
cd memory-mcp-server-go
Build the project:
Using Make (recommended):
# Build for your current platform
make
# Or build for a specific platform
make build-darwin-universal # macOS Universal Binary
make build-darwin-arm64 # macOS Apple Silicon
make build-darwin-amd64 # macOS Intel
make build-linux-amd64 # Linux x86_64
make build-linux-arm64 # Linux ARM64
make build-windows-amd64 # Windows x86_64
# Or build for all platforms at once
make build-all
# Create distribution packages for all platforms
make dist
The binaries will be placed in the .build
directory.
Using Go directly:
go build
Install the binary:
# Install to user directory (recommended, no sudo required)
mkdir -p ~/.local/bin
cp memory-mcp-server-go ~/.local/bin/
Make sure ~/.local/bin
is in your PATH by adding to your shell configuration file:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc # or ~/.bashrc
source ~/.zshrc # or source ~/.bashrc
The server supports the following command line arguments:
-t, --transport
: Specify the transport type (stdio or sse, defaults to stdio)-m, --memory
: Custom path for storing the knowledge graph (optional)-p, --port
: Port number for SSE transport (defaults to 8080)Example usage:
# Use default settings (stdio transport, default memory file)
memory-mcp-server-go
# Specify a custom memory file location
memory-mcp-server-go --memory /path/to/your/memory.json
# Use SSE transport on a specific port
memory-mcp-server-go --transport sse --port 9000
The memory.json
file is used to store the knowledge graph data. The server determines its location using the following priority rules:
-m
or --memory
flag, this path will be usedMEMORY_FILE_PATH
environment variablememory.json
in the same directory as the executablePath handling rules:
/home/user/data/memory.json
or C:\Users\user\data\memory.json
), it will be used as-iscustom/memory.json
), it will be resolved relative to the executable's directoryFor example, if your executable is located at /usr/local/bin/memory-mcp-server-go
, and you don't specify any path, the default file path will be /usr/local/bin/memory.json
. If you specify a relative path like custom/memory.json
, the actual file path will be /usr/local/bin/custom/memory.json
.
Add to your Claude settings:
"mcpServers": {
"memory": {
"command": "memory-mcp-server-go",
"env": {
"MEMORY_FILE_PATH": "/Path/Of/Your/memory.json"
}
}
}
Add the following configuration to your Cursor editor's Settings - mcp.json:
{
"mcpServers": {
"memory": {
"command": "memory-mcp-server-go",
"env": {
"MEMORY_FILE_PATH": "/Path/Of/Your/memory.json"
}
}
}
}
You can use the following system prompt to help Claude utilize the memory-mcp-server effectively:
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.
The Memory MCP Server uses a simple graph structure to store knowledge:
The knowledge graph is persisted to disk as a line-delimited JSON file, where each line is either an entity or relation object.
{
"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"]
}
See GitHub Releases for version history and changelog.
memory-mcp-server-go 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.
A Go 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 Go using the MCP Go SDK.
Seamless access to top MCP servers powering the future of AI integration.