Files
t6_mem0_v2/MCP_SETUP.md
Claude Code 1998bef6f4 Add MCP HTTP/SSE server and complete n8n integration
Major Changes:
- Implemented MCP HTTP/SSE transport server for n8n and web clients
- Created mcp_server/http_server.py with FastAPI for JSON-RPC 2.0 over HTTP
- Added health check endpoint (/health) for container monitoring
- Refactored mcp-server/ to mcp_server/ (Python module structure)
- Updated Dockerfile.mcp to run HTTP server with health checks

MCP Server Features:
- 7 memory tools exposed via MCP (add, search, get, update, delete)
- HTTP/SSE transport on port 8765 for n8n integration
- stdio transport for Claude Code integration
- JSON-RPC 2.0 protocol implementation
- CORS support for web clients

n8n Integration:
- Successfully tested with AI Agent workflows
- MCP Client Tool configuration documented
- Working webhook endpoint tested and verified
- System prompt optimized for automatic user_id usage

Documentation:
- Created comprehensive Mintlify documentation site
- Added docs/mcp/introduction.mdx - MCP server overview
- Added docs/mcp/installation.mdx - Installation guide
- Added docs/mcp/tools.mdx - Complete tool reference
- Added docs/examples/n8n.mdx - n8n integration guide
- Added docs/examples/claude-code.mdx - Claude Code setup
- Updated README.md with MCP HTTP server info
- Updated roadmap to mark Phase 1 as complete

Bug Fixes:
- Fixed synchronized delete operations across Supabase and Neo4j
- Updated memory_service.py with proper error handling
- Fixed Neo4j connection issues in delete operations

Configuration:
- Added MCP_HOST and MCP_PORT environment variables
- Updated .env.example with MCP server configuration
- Updated docker-compose.yml with MCP container health checks

Testing:
- Added test scripts for MCP HTTP endpoint verification
- Created test workflows in n8n
- Verified all 7 memory tools working correctly
- Tested synchronized operations across both stores

Version: 1.0.0
Status: Phase 1 Complete - Production Ready

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-15 13:56:41 +02:00

3.8 KiB

T6 Mem0 v2 MCP Server Setup

MCP Server Test Results

The MCP server has been tested and is working correctly:

  • ✓ Server initialized successfully
  • ✓ Memory instance connected (Supabase + Neo4j)
  • ✓ 7 MCP tools available and functional

Configuration for Claude Code

Add this to your Claude Code MCP configuration file:

Location

  • macOS/Linux: ~/.config/claude-code/mcp.json
  • Windows: %APPDATA%\claude-code\mcp.json

Configuration

{
  "mcpServers": {
    "t6-mem0": {
      "command": "/home/klas/mem0/start-mcp-server.sh",
      "description": "T6 Mem0 v2 - Memory management with Supabase + Neo4j",
      "env": {}
    }
  }
}

If you already have other MCP servers configured, just add the "t6-mem0" section to the existing "mcpServers" object.

Available MCP Tools

Once configured, you'll have access to these 7 memory management tools:

1. add_memory

Add new memory from conversation messages. Extracts and stores important information.

Required: messages (array of {role, content} objects) Optional: user_id, agent_id, metadata

Example:

{
  "messages": [
    {"role": "user", "content": "I love pizza and pasta"},
    {"role": "assistant", "content": "Great! I'll remember that."}
  ],
  "user_id": "user123"
}

2. search_memories

Search memories by semantic similarity. Find relevant memories based on a query.

Required: query (string) Optional: user_id, agent_id, limit (default: 10, max: 50)

Example:

{
  "query": "What foods does the user like?",
  "user_id": "user123",
  "limit": 5
}

3. get_memory

Get a specific memory by its ID.

Required: memory_id (string)

Example:

{
  "memory_id": "894a70ed-d756-4fd6-810d-265cd99b1f99"
}

4. get_all_memories

Get all memories for a user or agent.

Optional: user_id, agent_id

Example:

{
  "user_id": "user123"
}

5. update_memory

Update an existing memory's content.

Required: memory_id (string), data (string)

Example:

{
  "memory_id": "894a70ed-d756-4fd6-810d-265cd99b1f99",
  "data": "User loves pizza, pasta, and Italian food"
}

6. delete_memory

Delete a specific memory by ID.

Required: memory_id (string)

Example:

{
  "memory_id": "894a70ed-d756-4fd6-810d-265cd99b1f99"
}

7. delete_all_memories

Delete all memories for a user or agent. Use with caution!

Optional: user_id, agent_id

Example:

{
  "user_id": "user123"
}

Backend Architecture

The MCP server uses the same backend as the REST API:

  • Vector Store: Supabase (PostgreSQL with pgvector)
  • Graph Store: Neo4j (for relationships)
  • LLM: OpenAI GPT-4o-mini (for extraction)
  • Embeddings: OpenAI text-embedding-3-small

All fixes applied to the REST API (serialization bug fixes) are also active in the MCP server.

Testing

To test the MCP server manually:

cd /home/klas/mem0
python3 test-mcp-tools.py

This will verify:

  • MCP server initialization
  • Memory backend connection
  • All 7 tools are properly registered

Activation

After adding the configuration:

  1. Restart Claude Code to load the new MCP server
  2. The server will start automatically when Claude Code launches
  3. Tools will be available in your conversations

You can verify the server is running by checking for the t6-mem0 server in Claude Code's MCP server status.

Troubleshooting

If the server doesn't start:

  1. Check that all dependencies are installed: pip install -r requirements.txt
  2. Verify Docker containers are running: docker ps | grep mem0
  3. Check logs: Run the test script to see detailed error messages
  4. Ensure Neo4j and Supabase are accessible from the host machine

Last tested: 2025-10-15 Status: All tests passing