Skip to content

MCP Setup

MCP (Model Context Protocol) lets Claude use MemLayer as a tool. MemLayer uses stdio transport for local communication.

  • Installation completed
  • memlayer server running (bb local-server or bb server)

Add MemLayer to your Claude Desktop configuration file:

{
"mcpServers": {
"memlayer": {
"command": "bb",
"args": ["mcp"],
"cwd": "/path/to/memlayer"
}
}
}

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.

Add memlayer with a single command:

Terminal window
claude mcp add memlayer -- bb mcp

Or create a .mcp.json file in your project root:

{
"mcpServers": {
"memlayer": {
"command": "bb",
"args": ["mcp"],
"cwd": "/path/to/memlayer"
}
}
}

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

The MCP server communicates over stdio (standard input/output). When your MCP client starts memlayer, it launches the bb mcp command which reads JSON-RPC messages from stdin and writes responses to stdout.

Session flow:

  1. Client launches bb mcp process
  2. Client sends initialize request via stdin
  3. Server responds with capabilities and serves SKILL.md — a set of behavioral instructions that teach the agent when and how to use memory (see Connect Your Agent for details)
  4. Client sends tool calls (tools/call) as needed
  5. Client terminates the process when done

After configuring Claude, ask:

“Remember that I prefer dark mode in all my editors”

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

Troubleshooting:

Test the MCP server directly:

Terminal window
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | bb mcp