Skip to main content

MCP Server

The official Model Context Protocol server for MemoryRelay. Connects Claude Desktop, OpenClaw, and other MCP-compatible clients directly to your MemoryRelay instance.

Package: @memoryrelay/mcp-server

Installation

# Global install
npm install -g @memoryrelay/mcp-server

# Or run directly with npx (no install needed)
npx @memoryrelay/mcp-server

Claude Desktop Configuration

Add the following to your Claude Desktop MCP configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"memoryrelay": {
"command": "npx",
"args": ["-y", "@memoryrelay/mcp-server"],
"env": {
"MEMORYRELAY_API_KEY": "mem_your_api_key"
}
}
}
}
tip

If you installed the package globally, you can use "command": "memoryrelay-mcp" instead of npx.

Self-Hosted Instances

Point the server at your own deployment by adding MEMORYRELAY_API_URL:

{
"mcpServers": {
"memoryrelay": {
"command": "npx",
"args": ["-y", "@memoryrelay/mcp-server"],
"env": {
"MEMORYRELAY_API_KEY": "mem_your_api_key",
"MEMORYRELAY_API_URL": "https://memory.your-domain.com"
}
}
}
}

Tool Groups

The MCP server organizes its 73 tools into groups. By default, all groups are enabled. Configure which groups are active using the MEMORYRELAY_TOOLS environment variable.

{
"env": {
"MEMORYRELAY_API_KEY": "mem_your_api_key",
"MEMORYRELAY_TOOLS": "core,sessions,decisions"
}
}
info

Enable only the tool groups your workflow needs. Fewer tools means less context for the LLM to parse, which improves tool selection accuracy and reduces token usage. Set MEMORYRELAY_TOOLS=all (or omit it) to enable everything.

core (31 tools)

Core memory, entity, and agent operations.

ToolDescription
memory_storeStore a new memory with content and optional metadata
memory_searchSemantic search across stored memories
memory_listList memories with pagination
memory_getRetrieve a specific memory by ID
memory_updateUpdate memory content or metadata
memory_deleteSoft-delete a memory
memory_batch_storeStore multiple memories in a single call
memory_contextBuild a formatted context string from relevant memories
memory_healthCheck the health of the MemoryRelay service
memory_statusGet the processing status of a memory
memory_extraction_statusGet entity extraction status for a memory
memory_extract_entitiesTrigger entity re-extraction for a memory
memory_feedbackSubmit relevance feedback on a memory
memory_bulk_deleteBulk delete memories by IDs
memory_consolidateFind and merge near-duplicate memories
memory_restore_mergeRestore a previously merged memory
entity_createCreate a new entity (person, org, technology, concept)
entity_linkLink an entity to a memory with a relationship label
entity_listList entities with optional type filtering
entity_updateUpdate entity name or metadata
entity_deleteDelete an entity
entity_graphExplore the knowledge graph around an entity
entity_mergeMerge two entities
entity_create_relationshipCreate a relationship between entities
entity_delete_relationshipDelete a relationship between entities
entity_list_relationshipsList all entity relationships
agent_listList all agents
agent_createCreate a new agent
agent_getGet agent details
agent_updateUpdate agent name or description
agent_deleteDelete an agent and its data

sessions (7 tools)

Session tracking for bounded interaction periods.

ToolDescription
session_startStart a new session
session_endEnd an active session
session_recallRecall memories from a specific session
session_listList sessions
session_get_or_createGet or create a session by external ID
session_summarizeAuto-summarize a session's memories
session_deleteDelete a session

decisions (7 tools)

Architectural and design decision tracking.

ToolDescription
decision_recordRecord a new decision
decision_listList decisions with optional status filter
decision_supersedeSupersede an existing decision with a new one
decision_checkCheck for existing decisions about a topic
decision_getGet decision details
decision_updateUpdate a decision
decision_deleteDelete a decision

patterns (9 tools)

Reusable pattern discovery and sharing.

ToolDescription
pattern_createCreate a new reusable pattern
pattern_searchSearch patterns by meaning
pattern_adoptAdopt a pattern for a project
pattern_suggestGet pattern suggestions based on project context
pattern_getGet pattern details
pattern_listList patterns
pattern_updateUpdate a pattern
pattern_deleteDelete a pattern
pattern_unadoptRemove pattern adoption from a project

projects (5 tools)

Project registration and management.

ToolDescription
project_registerRegister a new project
project_listList all projects
project_infoGet detailed project information
project_updateUpdate project details
project_deleteDelete a project

relationships (6 tools)

Project dependency and relationship management.

ToolDescription
project_add_relationshipRegister a relationship between two projects
project_dependenciesWhat does this project depend on?
project_dependentsWhat depends on this project?
project_relatedAll related projects with relationship types
project_impactAnalyze impact of changes across linked projects
project_shared_patternsPatterns adopted by both projects

context (3 tools)

Context building and memory promotion.

ToolDescription
project_contextGet full project context (memories, decisions, patterns)
memory_promoteUpdate a memory's importance and tier
context_build_v2Build context using v2 API with advanced ranking

Configuration Reference

VariableRequiredDefaultDescription
MEMORYRELAY_API_KEYYes--Your MemoryRelay API key
MEMORYRELAY_API_URLNohttps://api.memoryrelay.netAPI base URL
MEMORYRELAY_TOOLSNoallComma-separated list of tool groups to enable (core, sessions, decisions, patterns, projects, relationships, context)
MEMORYRELAY_AGENT_IDNoauto-detectedAgent identifier
MEMORYRELAY_TIMEOUTNo30000Request timeout in milliseconds
MEMORYRELAY_LOG_LEVELNoinfoLog level (debug, info, warn, error)

Security

The MCP server includes several security measures:

  • API key masking -- Keys starting with mem_ are masked in all log output. Only the first 8 characters are shown.
  • Input validation -- All tool inputs are validated against Zod schemas before being sent to the API. Malformed requests are rejected client-side.
  • Sanitized errors -- Error messages returned to the LLM are sanitized to prevent leaking internal details like stack traces or database errors.
  • Stdio safety -- All logging is directed to stderr. Only valid MCP protocol messages are written to stdout, preventing log contamination of the protocol stream.
warning

The API key is passed via environment variables in the MCP configuration. Ensure your configuration file has appropriate file permissions (readable only by your user account).

Troubleshooting

Tools not appearing in Claude Desktop

  1. Verify the MCP configuration JSON is valid (no trailing commas).
  2. Restart Claude Desktop after editing the configuration.
  3. Check stderr output for initialization errors.

Authentication errors

  1. Confirm your API key starts with mem_ and has not expired.
  2. Verify the key has the required scopes (read, write) for the tools you are using.

Connection timeouts with self-hosted instances

  1. Ensure MEMORYRELAY_API_URL does not include a trailing slash.
  2. Verify the API is reachable: curl $MEMORYRELAY_API_URL/v1/health.