home / mcp / memory mcp worker

Memory MCP Worker

Provides an MCP server for cross-device memory graphs with REST API, MCP protocol, and D1-based storage.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "45black-memory-mcp-worker": {
      "url": "https://memory-mcp.45black-limited.workers.dev/mcp",
      "headers": {
        "API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

You can access and manage a cross-device memory graph with a dedicated MCP server running as a Cloudflare Worker. It exposes a REST API for apps and a MCP protocol endpoint for direct MCP clients, backed by a D1 (SQLite-like) store and full-text search for observations. This lets you create entities, link them with relations, add observations, and query the entire knowledge graph across devices and platforms.

How to use

You connect your MCP client to the HTTP endpoint to perform actions such as creating entities, adding observations, and reading the full graph. Use the REST API for app integration and the MCP endpoint for protocol-driven communication. Security is enforced via an API key header on all endpoints except the health check, so store and send your key with every request.

In practice you can search across all observations, import large datasets in bulk, and push updates from mobile or desktop apps. When you need to migrate data from a local memory store, you can export your local memory and run the migration tools to align with the remote MCP server. The server supports a memory-centric workflow with entities, relations, and observations accessible through standard HTTP calls or MCP RPC.

How to install

Prerequisites: Node.js and npm installed on your workstation.

npm install

Create a D1 database named memory-graph using the CLI tool and then wire the output database_id into the deployment config.

wrangler d1 create memory-graph
# Copy the database_id from output to wrangler.toml

Run migrations to set up the local development schema and then run production migrations when you're ready to deploy.

# Local development
npm run db:migrate:local

# Production
npm run db:migrate

Deploy the worker after migrations complete.

npm run deploy

Set an API key as a secret for client authentication. Generate a key and store it as a hidden secret used by the server.

# Generate an API key
openssl rand -base64 32 | tr -d '/+=' | head -c 32

# Add as secret
echo "YOUR_API_KEY" | npx wrangler secret put API_KEY

Configure the Claude Code client to point at the memory MCP server by adding an MCP server configuration with the remote URL and the API key header.

{
  "mcpServers": {
    "memory-remote": {
      "type": "http",
      "url": "https://memory-mcp.45black-limited.workers.dev/mcp",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Additional notes

Authentication is required for all API and MCP endpoints via the API key header. The health check endpoint is public for quick readiness checks.

There is a REST API designed for mobile and desktop apps as well as for automation tools like n8n. The MCP protocol endpoint is available at the /mcp path for protocol clients and SSE at /mcp/sse for streaming updates.

If you need to migrate from a local memory store, export your data and use the provided migration flow to transfer it into the remote graph.

For client integrations, you can perform common tasks such as listing entities, adding observations, building a full graph, and bulk importing data through the REST API.

MCP endpoints and capabilities

REST API endpoints give you programmatic access to entities, observations, relations, and the overall graph. MCP endpoints are available for protocol clients to read and modify the knowledge graph.

Migration and development workflow

Use local migrations during development and perform production migrations before going live. When you deploy, the worker serves as both the REST API and MCP server, backed by the D1 database with a full-text search index for observations.

Security and best practices

Store your API key securely and rotate it periodically. Treat the API key as a credential that protects access to all MCP endpoints. Use the health check as a lightweight indicator of the service status.

Mobile and automation integration

From a mobile app, you can perform searches, add observations, and query the graph using the REST API. Automation tools like n8n can trigger MCP actions through the same API endpoints or via the MCP protocol client.

Available tools

create_entities

Create new entities in the knowledge graph.

create_relations

Create relations between existing entities.

add_observations

Add observations to entities to enrich the graph.

read_graph

Read the full knowledge graph, including entities, observations, and relations.

search_nodes

Search entities and observations by query.

open_nodes

Retrieve specific nodes by name.

delete_entities

Delete entities from the graph.

delete_relations

Delete relations between entities.

Memory MCP Worker - 45black/memory-mcp-worker