Skip to content

Quickstart: MCP

MCP (Model Context Protocol) lets Claude Desktop and Claude Code use MemLayer as a tool. Claude can store, search, organize, and forget memories on your behalf — no API calls required.

Add MemLayer to your claude_desktop_config.json:

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

The config file location depends on your OS:

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

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"
}
}
}
}

After adding the configuration, restart Claude Desktop or reload your Claude Code session.

Open a conversation with Claude and try these prompts in order:

Store a memory (retain):

“Remember that my favorite programming language is Haskell”

Claude calls the retain tool, which extracts the fact and stores it with a vector embedding.

Search memories (recall):

“What’s my favorite programming language?”

Claude calls the recall tool, which performs a semantic search and returns the matching memory.

Consolidate memories (reflect):

“Organize my memories”

Claude calls the reflect tool, which groups related facts into higher-level concepts and domains.

Forget a memory:

“Forget everything about my programming preferences”

Claude calls recall to find matching memories, then calls forget with the relevant entity IDs to remove them.

Behind the scenes, each prompt triggered a different MemLayer operation:

  1. Retain extracted “favorite programming language is Haskell” as a structured fact, generated a vector embedding, and stored it in both the bitemporal database and the vector index.
  2. Recall converted your question into an embedding, searched for semantically similar memories, and returned the best match.
  3. Reflect scanned stored memories for patterns and grouped related facts into concepts.
  4. Forget marked the specified entities as deleted in the bitemporal database and removed their vectors from the index. The data remains in the audit history but no longer appears in queries.