MCP Setup
MCP (Model Context Protocol) lets Claude use MemLayer as a tool. MemLayer uses the Streamable HTTP transport (MCP spec 2025-03-26).
Prerequisites
Section titled “Prerequisites”- Installation completed
- API token ready (
mlk_...)
Claude Desktop
Section titled “Claude Desktop”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:
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
After saving, restart Claude Desktop.
Claude Code
Section titled “Claude Code”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.
Authentication
Section titled “Authentication”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.
How it works
Section titled “How it works”The MCP server exposes the following endpoints:
| Method | Purpose |
|---|---|
POST /mcp | Send JSON-RPC requests and notifications |
GET /mcp | Open SSE stream for server-initiated messages |
DELETE /mcp | Terminate session |
Session flow:
- Client POSTs
initializerequest - Server responds with JSON-RPC result and a
Mcp-Session-Idheader - Client includes
Mcp-Session-Idon all subsequent requests - 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.
Verifying the connection
Section titled “Verifying the connection”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:
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"}'Next steps
Section titled “Next steps”- MCP Tools Reference — all available tools and their parameters
- Quickstart: MCP — guided walkthrough of all four operations