How it works
The MCP server (mcp/server.ts) runs as a stdio-based JSON-RPC service that provides four tools:
mem_search— Full-text search across all projectsmem_timeline— Chronological context around a specific observationmem_get— Retrieve full details by observation IDsmem_export— Export memory to JSON or Markdown
Protocol implementation
LongMem uses a minimal stdio MCP implementation:initialize— Handshake and capability negotiationtools/list— Returns available toolstools/call— Executes a tool with arguments
Tool schemas
1. mem_search
Description: Search past coding session memory across ALL projects2. mem_timeline
Description: Get chronological context around a specific observation3. mem_get
Description: Get full details of specific observations by ID4. mem_export
Description: Export memory to JSON or MarkdownTool limits
The MCP server enforces these limits:Configuration
OpenCode
Add the MCP server to your OpenCode config:Claude Code CLI
Add the MCP server to your Claude CLI config:Cursor
Add the MCP server to Cursor’s MCP settings:Cline (VSCode extension)
Add to your Cline settings:Auto-start behavior
The MCP server automatically starts the LongMem daemon if it’s not running:Verification
Test the MCP server manually:Troubleshooting
MCP server not responding
Check if the server is running:Tool calls timing out
Increase timeout in client config:Daemon not starting
Verify daemon binary exists:Debug MCP communication
Enable MCP debug logging (varies by client): OpenCode:~/.longmem/logs/mcp-debug.log