Skip to content

MCP Setup

MCP (Model Context Protocol) lets Claude use MemLayer as a tool. MemLayer uses the Streamable HTTP transport (MCP spec 2025-03-26).

Add MemLayer to your Claude Desktop configuration file:

{
"mcpServers": {
"memlayer": {
"url": "https://mcp.memlayer.dev/mcp",
"headers": {
"X-API-Key": "mlk_your_api_key_here"
}
}
}
}

Config file location:

OSPath
macOS~/Library/Application Support/Claude/claude_desktop_config.json
Windows%APPDATA%\Claude\claude_desktop_config.json

After saving, restart Claude Desktop.

Create a .mcp.json file in your project root:

{
"mcpServers": {
"memlayer": {
"url": "https://mcp.memlayer.dev/mcp",
"headers": {
"X-API-Key": "mlk_your_api_key_here"
}
}
}
}

Reload your Claude Code session to pick up the new configuration.

The MCP server authenticates requests using the X-API-Key header. Create an API token via the dashboard and include it in your client configuration.

The MCP server exposes the following endpoints:

MethodPurpose
POST /mcpSend JSON-RPC requests and notifications
GET /mcpOpen SSE stream for server-initiated messages
DELETE /mcpTerminate session

Session flow:

  1. Client POSTs initialize request
  2. Server responds with JSON-RPC result and a Mcp-Session-Id header
  3. Client includes Mcp-Session-Id on all subsequent requests
  4. Client DELETEs the session when done

The server supports both application/json and text/event-stream (SSE) response formats based on the client’s Accept header.

After configuring Claude, ask:

“Remember that my favorite color is blue”

If MemLayer is connected, Claude will call the memlayer_retain tool and confirm the memory was stored.

Troubleshooting:

Terminal window
curl -s -X POST https://mcp.memlayer.dev/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-API-Key: mlk_your_api_key_here' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize"}'