A Go implementation of the Memory MCP server that mirrors the existing TypeScript version. Supports both stdio and Streamable HTTP transports and optional Basic Auth for HTTP. Stores data in SQLite with a BoltDB-backed token index for fast search.
- Transports: stdio, Streamable HTTP
- Auth: Optional Basic Auth for HTTP via env or file-based secrets
- Storage: SQLite database for entities/relations/observations, BoltDB for token index
- Parity: Same tool surface as the TS server
Entities are the primary nodes in the knowledge graph. Each entity has a unique name, an entityType, and a list of observations.
Example:
{
"name": "John_Smith",
"entityType": "person",
"observations": ["Speaks fluent Spanish"]
}Directed connections between entities, stored in active voice.
Example:
{
"from": "John_Smith",
"to": "Anthropic",
"relationType": "works_at"
}Atomic facts attached to entities.
Example:
{
"entityName": "John_Smith",
"observations": [
"Speaks fluent Spanish",
"Graduated in 2019",
"Prefers morning meetings"
]
}- Go 1.25+ for local build/testing
- Docker (optional) for containerized build/run
# Pull dependencies and run tests
go mod tidy
go test ./...
# Build binary
go build -o mcp-memory ./Add this to your claude_desktop_config.json.
{
"mcpServers": {
"memory": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-v", "claude-memory:/app",
"ghcr.io/viktorprogger/mcp-memory:latest"
]
}
}
}This mounts a named volume claude-memory at /app so the default SQLite/Bolt files (/app/memory.db, /app/memory.db.bolt) persist across runs.
{
"mcpServers": {
"memory": {
"command": "bash",
"args": [
"-lc",
"cd /absolute/path/to/mcp-memory && go run ."
]
}
}
}For custom settings (HTTP mode, custom DB paths, Basic Auth), see the Configuration section below.
TRANSPORT:stdio(default) orhttpHTTP_ADDR: HTTP listen address (default:8080)HTTP_PATH: HTTP endpoint path (default/mcp)MEMORY_FILE_PATH: path to the SQLite database file (defaultmemory.dbnext to the binary)BOLT_DB_PATH: path to the BoltDB token index file (default<MEMORY_FILE_PATH>.bolt)BASIC_AUTH_USER/BASIC_AUTH_PASSWORD: credentials for Basic AuthBASIC_AUTH_USER_FILE/BASIC_AUTH_PASSWORD_FILE: file-based credentials (take precedence over env vars)
Notes:
- If either
BASIC_AUTH_USERorBASIC_AUTH_PASSWORD(or the*_FILEvariants) is set, Basic Auth is enforced. By default (no values set) HTTP runs without auth.
- MCP Inspector
- Install:
npx @modelcontextprotocol/inspector - Connect:
http://localhost:8080/mcp
- Install:
- Claude Code / VS Code / Cursor
- Add as HTTP MCP server with URL
http://localhost:8080/mcp - If Basic Auth enabled, include
Authorization: Basic <base64(user:pass)>header per client configuration
- Add as HTTP MCP server with URL
- STDIO
- Use as a local spawned process transport where the host MCP client manages stdio
-
create_entities
- Create multiple new entities in the knowledge graph
- Input:
entities(array of objects)- Each contains
name(string),entityType(string),observations(string[])
- Each contains
- Ignores entities with existing names
-
create_relations
- Create multiple new relations between entities
- Input:
relations(array of objects)- Each contains
from(string),to(string),relationType(string)
- Each contains
- Skips duplicate relations
-
add_observations
- Add new observations to existing entities
- Input:
observations(array of objects)- Each contains
entityName(string),contents(string[])
- Each contains
- Returns added observations per entity; fails if entity doesn't exist
-
delete_entities
- Remove entities and their relations
- Input:
entityNames(string[]) - Cascading deletion of associated relations; silent if entity doesn't exist
-
delete_observations
- Remove specific observations from entities
- Input:
deletions(array of objects)- Each contains
entityName(string),observations(string[])
- Each contains
- Silent if observation doesn't exist
-
delete_relations
- Remove specific relations from the graph
- Input:
relations(array of objects)- Each contains
from(string),to(string),relationType(string)
- Each contains
- Silent if relation doesn't exist
-
read_graph
- Read the entire knowledge graph
- No input; returns all entities and relations
-
search_nodes
- Search for nodes based on a query string
- Input:
query(string); searches names, types, observation content - Returns matching entities and their relations
-
open_nodes
- Retrieve specific nodes by name
- Input:
names(string[]) - Returns requested entities and relations between them
- Stored in SQLite tables for entities, observations, and relations.
- A BoltDB-based token index is maintained for efficient search.
- MCP Spec: 2025-06-18
- TS SDK (
@modelcontextprotocol/sdk) latest: see npm; project previously used1.0.1 - Go SDK:
github.com/modelcontextprotocol/go-sdkv1.0.0
MIT