@memoryrelay/mcp-server
OfficialClick on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@@memoryrelay/mcp-server Remember that we chose Postgres over MySQL for the billing service"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@memoryrelay/mcp-server
This repository is superseded. The MCP server now lives in
memoryrelay/api, which publishes@memoryrelay/mcp-serverfrom 0.6.0 onward. This copy stops at 0.5.0 and no longer publishes; open issues and pull requests there.
MCP server for MemoryRelay - Give your AI agents persistent memory across sessions.
๐ Features
Persistent Memory: Store and retrieve memories across conversations
Semantic Search: Find relevant memories using natural language queries
Batch Operations: Create multiple memories in a single request for optimal performance
Security Hardened: API key masking, input validation, sanitized errors
MCP Compliant: Works with Claude Desktop, OpenClaw, and any MCP client
Fully Tested: 169 test cases covering all functionality
Related MCP server: Recall
Why MemoryRelay?
Feature | MemoryRelay | Mem0 | Basic MCP Memory |
Semantic Search | Yes | Yes | No |
Work Sessions | Yes | No | No |
Architectural Decisions (ADRs) | Yes | No | No |
Reusable Patterns | Yes | No | No |
Project Orchestration | Yes | No | No |
Knowledge Graph (Entities) | Yes | Limited | No |
Multi-Agent Support | Yes | Yes | No |
V2 Async Storage (60-600x faster) | Yes | No | No |
Tools | 44 | ~10 | 3-5 |
MemoryRelay is purpose-built for engineering teams managing complex, long-running projects โ not general-purpose Q&A memory.
Use Cases
Tech Lead managing 3+ projects โ track architectural decisions across repos, build pattern libraries, understand cross-project dependencies
DevOps Engineer โ record infrastructure decisions with rationale, store runbooks as reusable patterns, track deployment configurations
Solo Developer โ build a persistent knowledge base that grows across sessions, link related concepts through entities
Coding Agent โ auto-capture important context, adopt proven patterns, maintain session continuity across conversations
๐ฆ Installation
Using npx (recommended)
No installation needed - run directly:
npx @memoryrelay/mcp-serverGlobal Installation
npm install -g @memoryrelay/mcp-serverLocal Project Installation
npm install @memoryrelay/mcp-serverโก Quick Start
1. Get Your API Key
Sign up at memoryrelay.ai to get your API key (format: mem_prod_xxxxx).
2. Configure Your MCP Client
For OpenClaw
See docs/OPENCLAW_GUIDE.md for a comprehensive setup guide.
Edit ~/.openclaw/openclaw.json:
{
"mcpServers": {
"memoryrelay": {
"command": "npx",
"args": ["-y", "@memoryrelay/mcp-server"],
"env": {
"MEMORYRELAY_API_KEY": "mem_prod_xxxxx",
"MEMORYRELAY_AGENT_ID": "iris"
}
}
}
}For Claude Desktop (macOS)
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"MemoryRelay": {
"command": "npx",
"args": ["-y", "@memoryrelay/mcp-server"],
"env": {
"MEMORYRELAY_API_KEY": "mem_prod_xxxxx"
}
}
}
}For Claude Desktop (Windows)
On Windows, npx with scoped packages can fail to resolve the bin entry. Install globally first, then use node directly.
Step 1: Install the package globally:
npm install -g @memoryrelay/mcp-serverStep 2: Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"MemoryRelay": {
"command": "node",
"args": ["%APPDATA%\\npm\\node_modules\\@memoryrelay\\mcp-server\\dist\\index.js"],
"env": {
"MEMORYRELAY_API_KEY": "mem_prod_xxxxx"
}
}
}
}Note: Replace
%APPDATA%with your actual path (e.g.,C:\\Users\\YourName\\AppData\\Roaming). You can find it by runningecho %APPDATA%in Command Prompt.
3. Restart Your Client
Restart OpenClaw or Claude Desktop to load the MCP server.
4. Test It Out
Try asking:
"Remember that I prefer Python over JavaScript"
"What programming languages do I like?"
"Create an entity for the MemoryRelay project"
๐ง Configuration
Environment Variables
Variable | Required | Default | Description |
| โ Yes | - | Your API key (starts with |
| No |
| API base URL (for custom deployments) |
| No | Auto-detected | Agent identifier (auto-generated if not set) |
| No |
| Request timeout in milliseconds |
| No |
| Logging level ( |
| No |
| Comma-separated tool groups to enable (see below) |
| No | - | Agent name when running under OpenClaw (used for agent ID detection) |
Tool Groups
Control which tools are exposed via the MEMORYRELAY_TOOLS environment variable:
Group | Tools | Description |
| 18 tools | Memory CRUD, entities, agents, health, aliases (forget/recall) |
| 3 tools | Async memory storage, status polling, context building |
| 4 tools | Session lifecycle (start, end, recall, list) |
| 4 tools | Decision recording and checking |
| 4 tools | Pattern library (create, search, adopt, suggest) |
| 3 tools | Project registration and listing |
| 6 tools | Project graph (add, deps, dependents, related, impact, shared patterns) |
| 2 tools | Project context, memory promotion |
Examples:
MEMORYRELAY_TOOLS=all(default) โ all tools enabledMEMORYRELAY_TOOLS=core,sessionsโ only core + session toolsMEMORYRELAY_TOOLS=core,relationships,contextโ core + graph tools
Agent ID Detection
The server automatically detects your agent ID from:
MEMORYRELAY_AGENT_IDenvironment variableOPENCLAW_AGENT_NAMEenvironment variable (OpenClaw)Hostname-based generation (if neither is set)
๐ ๏ธ Available Tools
The MCP server provides 44 tools organized into groups:
Memory Management Tools
memory_store
Store a new memory with optional metadata.
Note: The
agent_idparameter is automatically injected fromMEMORYRELAY_AGENT_IDenvironment variable. You don't need to include it in your request.
Parameters:
content(string, required) - The memory content to store (1-50,000 characters)metadata(object, optional) - Key-value metadata to attach (max 10KB when serialized)
Example:
{
"content": "User prefers Python for data analysis projects",
"metadata": {
"category": "preference",
"topic": "programming"
}
}Returns: Memory object with id, content, agent_id, metadata, created_at, updated_at
Rate Limit: 30 requests per minute
memory_search
Search memories using semantic similarity.
Parameters:
query(string, required) - Natural language search querylimit(number, optional, default: 10) - Maximum results (1-50)threshold(number, optional, default: 0.5) - Minimum similarity score (0-1)
Example:
{
"query": "What are the user's programming preferences?",
"limit": 5,
"threshold": 0.7
}Returns: Array of memory objects with similarity scores
memory_list
List recent memories chronologically.
Parameters:
limit(number, optional, default: 20) - Number of memories to return (1-100)offset(number, optional, default: 0) - Pagination offset
Example:
{
"limit": 10,
"offset": 0
}Returns: Object with memories array, total, limit, offset
memory_get
Retrieve a specific memory by ID.
Parameters:
id(string, required) - Memory UUID
Example:
{
"id": "550e8400-e29b-41d4-a716-446655440000"
}Returns: Memory object
memory_update
Update an existing memory's content or metadata.
Note: Metadata updates are merged with existing metadata, not replaced. To remove a key, explicitly set it to
null.
Parameters:
id(string, required) - Memory UUIDcontent(string, required) - New content (1-50,000 characters)metadata(object, optional) - Updated metadata (merged with existing, max 10KB)
Example:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"content": "Updated: User prefers Python and TypeScript for data analysis",
"metadata": {
"category": "preference",
"updated": "2026-02-12"
}
}Returns: Updated memory object
memory_delete
Permanently delete a memory.
Parameters:
id(string, required) - Memory UUID
Example:
{
"id": "550e8400-e29b-41d4-a716-446655440000"
}Returns: Success confirmation
Health Check Tool
memory_health
Check API connectivity and server health.
Parameters: None
Example:
{}Returns: Health status object with status, version, latency
๐ Security
This MCP server is designed with security best practices:
API Key Protection
API keys starting with
mem_are automatically masked in all logsKeys are never exposed in error messages or debug output
Environment variables are the only supported authentication method
Input Validation
All inputs validated using Zod schemas before processing
UUIDs validated for format correctness
String lengths enforced (content max 50,000 characters, metadata max 10KB)
Memory IDs must be valid UUIDs
Error Handling
Errors sanitized to prevent information leakage
No internal paths or stack traces exposed to clients
All errors logged to stderr (stdout reserved for MCP protocol)
STDIO Safety
All logging strictly to stderr
STDIO transport properly isolated per MCP specification
For detailed security information, see SECURITY.md.
๐งช Development
Prerequisites
Node.js 24+
npm or yarn
Setup
# Clone the repository
git clone https://github.com/memoryrelay/mcp-server.git
cd mcp-server
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Run all tests (including integration)
npm run test:all
# Generate coverage report
npm run test:coverage
# Type checking
npm run type-checkAvailable Scripts
npm run build- Build for productionnpm run dev- Build in watch modenpm test- Run unit testsnpm run test:watch- Run tests in watch modenpm run test:integration- Run integration tests (requires API key)npm run test:server- Run server-specific testsnpm run test:security- Run security-focused testsnpm run test:all- Run all testsnpm run test:coverage- Generate coverage reportnpm run type-check- Run TypeScript type checking
Project Structure
mcp-server/
โโโ src/
โ โโโ index.ts # Entry point with CLI routing
โ โโโ server.ts # MCP server implementation (44 tools)
โ โโโ client.ts # MemoryRelay API client
โ โโโ config.ts # Configuration loader + tool groups
โ โโโ logger.ts # Security-hardened logging
โ โโโ types.ts # TypeScript types
โ โโโ cli/
โ โโโ setup.ts # Interactive setup wizard
โ โโโ test.ts # Connection test command
โโโ tests/
โ โโโ server.test.ts # Server tests
โ โโโ client.test.ts # Client tests
โ โโโ config.test.ts # Config tests
โ โโโ security.test.ts # Security tests
โ โโโ entity.test.ts # Entity tests
โ โโโ e2e-protocol.test.ts # MCP protocol e2e tests
โ โโโ integration.test.ts # Integration tests
โโโ docs/
โ โโโ SECURITY.md # Security documentation
โ โโโ OPENCLAW_GUIDE.md # OpenClaw setup guide
โโโ package.json
โโโ tsconfig.json
โโโ tsup.config.ts
โโโ vitest.config.ts
โโโ eslint.config.js
โโโ CHANGELOG.md
โโโ LICENSE
โโโ README.md๐ Troubleshooting
Server Won't Start
Problem: Failed to start MemoryRelay MCP server
Solutions:
Verify your API key is set correctly:
echo $MEMORYRELAY_API_KEYCheck the API key format (should start with
mem_)Ensure Node.js version is 24+ (
node --version)Try running with debug logging:
{ "env": { "MEMORYRELAY_LOG_LEVEL": "debug" } }
Connection Errors
Problem: API request failed or timeout errors
Solutions:
Check internet connectivity
Verify API URL (if using custom deployment)
Increase timeout:
{ "env": { "MEMORYRELAY_TIMEOUT": "60000" } }Check firewall/proxy settings
Windows: npx Fails with Scoped Package
Problem: 'memoryrelay-mcp' is not recognized when using npx on Windows
Solutions:
Install globally instead of using
npx:npm install -g @memoryrelay/mcp-serverUse
nodedirectly in your Claude Desktop config (see Windows setup above)Verify the global install path:
npm root -g
Tools Not Showing Up
Problem: MCP tools not available in client
Solutions:
Restart your MCP client (Claude Desktop, OpenClaw)
Check configuration file syntax (valid JSON)
Verify the
commandpath is correctCheck client logs for MCP server connection errors
Authentication Errors
Problem: 401 Unauthorized errors
Solutions:
Verify API key is correct and active
Check for extra spaces in environment variable
Ensure key hasn't expired
Contact support if key should be valid
Validation Errors
Problem: Validation error when calling tools
Solutions:
Check parameter types match schema (e.g.,
limitshould be number, not string)Verify required parameters are provided
Check UUID format for ID parameters
Ensure string lengths are within limits (e.g., entity names max 200 chars)
Debug Mode
Enable debug logging to see detailed information:
{
"env": {
"MEMORYRELAY_LOG_LEVEL": "debug"
}
}Debug logs go to stderr and include:
API request/response details (with masked API keys)
Tool invocation parameters
Validation errors
Connection status
Getting Help
๐ Full Documentation
๐ Report Issues
๐ฌ Discussions
๐ Security Policy
๐ Testing
The project has comprehensive test coverage:
169 test cases covering all functionality
Unit tests for each component
Integration tests against live API
Security-focused tests for API key masking and input validation
Server protocol tests
Run tests:
# All unit tests
npm test
# With coverage
npm run test:coverage
# Integration tests (requires API key)
MEMORYRELAY_API_KEY=mem_prod_xxx npm run test:integration
# Specific test suites
npm run test:server # Server tests only
npm run test:security # Security tests only๐ License
MIT License - see LICENSE for details
๐ Links
Documentation: GitHub Repository
npm Package: @memoryrelay/mcp-server
Website: memoryrelay.ai
API: api.memoryrelay.net
Model Context Protocol: modelcontextprotocol.io
OpenClaw: openclaw.org
๐ Contributing
Contributions welcome! Please open an issue or pull request on GitHub.
๐ Changelog
v0.2.0 (2026-03-04)
39 tools across 7 configurable tool groups (up from 9)
Session tools:
session_start,session_end,session_recall,session_listโ track development sessions with automatic memory linkingDecision tools:
decision_record,decision_list,decision_supersede,decision_checkโ log architectural decisions with semantic searchPattern tools:
pattern_create,pattern_search,pattern_adopt,pattern_suggestโ share and reuse conventions across projectsProject tools:
project_register,project_list,project_info,project_contextโ manage project namespaces and load full contextRelationship tools:
project_add_relationship,project_dependencies,project_dependents,project_related,project_impact,project_shared_patternsโ map project dependencies and analyze impactContext tools:
memory_promoteโ manage memory importance tiers (hot/warm/cold)Tool group configuration:
MEMORYRELAY_TOOLSenv var to selectively enable tool groupsSession-aware descriptions: Tool descriptions dynamically show active session context
Server instructions: Recommended workflow guidance via MCP protocol instructions field
169 test cases with full coverage
v0.1.0 (2026-02-12)
Initial release
9 MCP tools for memory and entity management
Semantic search with configurable thresholds
Entity linking for knowledge graphs
Security hardened with API key masking and input validation
102 test cases with full coverage
Support for OpenClaw and Claude Desktop
Made with โค๏ธ by the MemoryRelay Team
Available Tools
44 toolsagent_createA
Create a named agent. Agents are namespaces that isolate memories for different use cases or AI assistants.
Inputs: name (required), description.
agent_getC
Get details of a specific agent by ID, including memory count.
Inputs: id (required).
agent_listB
List all agents with their memory counts. Agents are namespaces that isolate memories.
Inputs: limit.
context_buildB
Build a ranked context bundle from memories using V2 API with optional AI summarization. Searches for relevant memories, ranks them by composite score, and optionally generates an AI summary. Useful for building token-efficient context windows for LLM prompts. Supports custom LLM endpoints (Ollama, llama.cpp, vLLM, etc.).
Inputs: query (required), llm_model, max_tokens, ai_enhanced, +4 more.
decision_checkA
Check if there are existing decisions about a topic using semantic search. Use this before making a new decision to see if the topic has already been addressed.
Inputs: query (required), limit, project, threshold, +1 more.
decision_listA
List recorded decisions, optionally filtered by project, status, or tags.
Inputs: tags, limit, status, project.
decision_recordB
Record an architectural decision with rationale. Use to log important technical choices, design decisions, or policy changes so they can be referenced later.
Inputs: title (required), rationale (required), tags, status, +2 more.
decision_supersedeA
Supersede an existing decision with a new one. Marks the old decision as superseded and creates a new active decision.
Inputs: id (required), title (required), rationale (required), tags, +1 more.
entity_createB
Create a named entity (person, place, organization, project, concept) for the knowledge graph. Entities help organize and connect memories.
Inputs: name (required), type (required), metadata.
entity_graphB
Explore the knowledge graph around an entity. Returns neighboring entities and their relationships up to N hops away. Useful for understanding connections between people, projects, and concepts.
Inputs: entity_id (required), depth, max_neighbors.
entity_linkC
Link an entity to a memory to establish relationships in the knowledge graph.
Inputs: entity_id (required), memory_id (required), relationship.
entity_listB
List entities in the knowledge graph with pagination. Entities are people, places, organizations, projects, and concepts extracted from memories.
Inputs: limit, offset.
memory_batch_storeA
Store multiple memories in a single operation. More efficient than calling memory_store repeatedly when saving several related facts or observations.
Inputs: memories (required).
memory_contextA
Build a formatted context string from relevant memories for a given query. Returns ranked memories with similarity scores, ready for use in prompts. More convenient than memory_search when you need a single context block.
Inputs: query (required), limit, threshold, max_tokens.
memory_deleteB
Permanently delete a memory. Use sparingly - memories are valuable context.
Inputs: id (required).
memory_forgetB
Delete a memory by ID, or search by query to find candidates. Alias for memory_delete. Provide memoryId for direct deletion, or query to search first.
Inputs: query, memoryId.
memory_getB
Retrieve a specific memory by its ID.
Inputs: id (required).
memory_healthB
Check API connectivity and health status.
Inputs: no named parameters.
memory_listB
List recent memories chronologically. Use to review what has been remembered.
Inputs: limit, offset.
memory_promoteA
Update a memory's importance and tier. Use to promote critical memories to hot tier (always in context) or demote them to cold tier (archived).
Inputs: memory_id (required), importance (required), tier.
memory_recallB
Search memories using natural language. Alias for memory_search with default project scoping. Returns the most relevant memories based on semantic similarity.
Inputs: query (required), limit, project, threshold, +1 more.
memory_searchB
Search memories using natural language. Returns the most relevant memories based on semantic similarity to the query. Omit agent_id to search across all agents.
Inputs: query (required), tier, limit, project, +7 more.
memory_statusA
Check the processing status of a memory created via memory_store_async. Poll this endpoint to determine when embedding generation is complete. Status values: pending (waiting for worker), processing (generating embedding), ready (searchable), failed (error occurred).
Inputs: memory_id (required).
memory_storeB
Store a new memory. Use this to save important information, facts, preferences, or context that should be remembered for future conversations. Tip: Call session_start first to track what you are working on.
Inputs: content (required), tier, project, metadata, +5 more.
memory_store_asyncA
Store a memory asynchronously using V2 API. Returns immediately (<50ms) with 202 Accepted and a job ID. Background workers generate the embedding. Use memory_status to poll for completion. Prefer this over memory_store for high-throughput or latency-sensitive applications.
Inputs: content (required), tier, project, metadata, +2 more.
memory_updateB
Update the content of an existing memory. Use to correct or expand stored information.
Inputs: id (required), content (required), metadata.
pattern_adoptB
Mark a pattern as adopted by a project. This links the pattern to the project so it shows up in project-scoped searches.
Inputs: id (required), project (required).
pattern_createA
Create a reusable development pattern or convention. Use to document patterns like "always use Zod for validation" or "error responses follow RFC 7807" so they can be discovered and adopted across projects.
Inputs: title (required), description (required), tags, scope, +3 more.
pattern_searchA
Search for development patterns using semantic similarity. When working on a project, shows both global patterns and patterns adopted by that project.
Inputs: query (required), limit, project, category, +1 more.
pattern_suggestA
Suggest relevant patterns for a project based on what similar projects have adopted. Returns patterns not yet adopted by the target project, ranked by popularity.
Inputs: project (required), limit.
project_add_relationshipC
Register a relationship between two projects (e.g., depends_on, api_consumer, shares_schema, shares_infra, pattern_source, forked_from).
Inputs: to (required), from (required), type (required), details.
project_contextB
Get full project context for LLM consumption. Returns hot-tier memories, active decisions, adopted patterns, and a pre-formatted markdown context string.
Inputs: project (required).
project_dependenciesA
What does this project depend on? Returns outgoing depends_on and api_consumer relationships.
Inputs: project (required).
project_dependentsA
What depends on this project? Returns incoming depends_on and api_consumer relationships.
Inputs: project (required).
project_impactB
Impact analysis: given a change description, which dependent projects might be affected? Searches decisions and memories in downstream projects.
Inputs: project (required), change_description (required).
project_infoB
Get detailed information about a specific project by its slug, including memory count and stack metadata.
Inputs: slug (required).
project_listC
List registered projects. Shows all projects with their memory counts.
Inputs: limit.
project_registerB
Register a project (codebase/repository) to scope memories, sessions, and decisions. Projects have a unique slug for ergonomic referencing.
Inputs: name (required), slug (required), stack, repo_url, +1 more.
session_endB
End an active session with an optional summary of what was accomplished.
Inputs: id (required), summary.
session_listB
List recent sessions, optionally filtered by project or status. Shows session summaries to understand what happened in previous sessions.
Inputs: limit, status, project.
session_recallA
Recall a session by ID, including all memories created during it. Use this to review what happened in a past session.
Inputs: id (required).
session_startB
Start a new session to group related memories. Sessions track bounded interaction periods (e.g., a coding session, a conversation). Use session_recall to see what happened in previous sessions.
Inputs: title, project, metadata.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 44 tools
Most tool families are distinct (memory_, entity_, decision_, pattern_, session_, project_), but several overlaps exist: memory_recall/memory_search, memory_forget/memory_delete are explicit aliases, and memory_context/context_build/project_context all build context bundles with subtle differences. memory_status vs memory_health could also confuse. Descriptions help but the boundaries are not crisp.
Almost all tools follow a consistent {domain}_{verb} snake_case pattern (memory_store, entity_create, project_register, session_start), which is readable and predictable. Minor deviations like project_shared_patterns and project_dependencies use noun phrases rather than verbs, but the overall convention is coherent.
44 tools is well beyond comfortable scope for an agent to select from, and the surface contains redundant aliases (memory_recall, memory_forget) and near-duplicate context builders. While the domain is large, several tools could be merged or folded into parameters.
Coverage is broad: full CRUD for memories and agents, plus entities, projects, decisions, patterns, and sessions with relationships and lifecycle operations. Minor gaps exist (no entity_update/entity_delete, no project_update, no pattern/decision delete), but core workflows are fully supported.
Maintenance
Related MCP Connectors
Persistent memory for AI agents across Claude, ChatGPT and any MCP client.
Persistent AI memory shared across Claude, ChatGPT, coding agents, and compatible MCP clients.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Persistent memory for AI assistants. Save once; recall from Claude, ChatGPT, or any MCP client.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables personal AI memory management through MCP tools for adding, searching, exporting, and deleting memories, with knowledge-graph retrieval and multi-hop association for clients like Claude Desktop and Cursor.61Apache 2.0
- AlicenseNot gradedqualityAmaintenanceEnables persistent cross-session memory for Claude and other AI agents by storing and automatically retrieving decisions, patterns, and knowledge across conversations and workspace contexts, surviving restarts and context compaction.17 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to persist, version, retrieve, and consolidate episodic, semantic, and procedural knowledge in SQLite with hybrid search, then expose that long-term memory to MCP clients such as Claude Desktop or VS Code.MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents and MCP clients to store and retrieve long-term memory across sessions, with shared access for Claude Code, Cursor, Codex, and other clients.289Apache 2.0