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>
118 lines
3.5 KiB
Plaintext
118 lines
3.5 KiB
Plaintext
---
|
|
title: 'MCP Server Introduction'
|
|
description: 'Model Context Protocol server for AI-powered memory operations'
|
|
---
|
|
|
|
# MCP Server Overview
|
|
|
|
The T6 Mem0 v2 MCP (Model Context Protocol) server provides a standardized interface for AI assistants and agents to interact with the memory system. It exposes all memory operations as MCP tools that can be used by any MCP-compatible client.
|
|
|
|
## What is MCP?
|
|
|
|
Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to LLMs. Created by Anthropic, it enables:
|
|
|
|
- **Universal tool access** - One protocol works across all AI assistants
|
|
- **Secure communication** - Structured message format with validation
|
|
- **Rich capabilities** - Tools, resources, and prompts in a single protocol
|
|
|
|
## Features
|
|
|
|
- ✅ **7 Memory Tools** - Complete CRUD operations for memories
|
|
- ✅ **HTTP/SSE Transport** - Compatible with n8n and web-based clients
|
|
- ✅ **stdio Transport** - Compatible with Claude Code and terminal-based clients
|
|
- ✅ **Synchronized Operations** - Ensures both Supabase and Neo4j stay in sync
|
|
- ✅ **Type-safe** - Full schema validation for all operations
|
|
|
|
## Available Tools
|
|
|
|
| Tool | Description |
|
|
|------|-------------|
|
|
| `add_memory` | Store new memories from conversation messages |
|
|
| `search_memories` | Semantic search across stored memories |
|
|
| `get_memory` | Retrieve a specific memory by ID |
|
|
| `get_all_memories` | Get all memories for a user or agent |
|
|
| `update_memory` | Update existing memory content |
|
|
| `delete_memory` | Delete a specific memory |
|
|
| `delete_all_memories` | Delete all memories for a user/agent |
|
|
|
|
## Transport Options
|
|
|
|
### HTTP/SSE Transport
|
|
|
|
Best for:
|
|
- n8n workflows
|
|
- Web applications
|
|
- REST API integrations
|
|
- Remote access
|
|
|
|
**Endpoint**: `http://localhost:8765/mcp`
|
|
|
|
### stdio Transport
|
|
|
|
Best for:
|
|
- Claude Code integration
|
|
- Local development tools
|
|
- Command-line applications
|
|
- Direct Python integration
|
|
|
|
**Usage**: Run as a subprocess with JSON-RPC over stdin/stdout
|
|
|
|
## Quick Example
|
|
|
|
```javascript
|
|
// Using n8n MCP Client Tool
|
|
{
|
|
"endpointUrl": "http://172.21.0.14:8765/mcp",
|
|
"serverTransport": "httpStreamable",
|
|
"authentication": "none",
|
|
"include": "all"
|
|
}
|
|
```
|
|
|
|
```python
|
|
# Using Python MCP SDK
|
|
from mcp import ClientSession, StdioServerParameters
|
|
from mcp.client.stdio import stdio_client
|
|
|
|
server_params = StdioServerParameters(
|
|
command="python",
|
|
args=["-m", "mcp_server.main"]
|
|
)
|
|
|
|
async with stdio_client(server_params) as (read, write):
|
|
async with ClientSession(read, write) as session:
|
|
await session.initialize()
|
|
|
|
# List available tools
|
|
tools = await session.list_tools()
|
|
|
|
# Call a tool
|
|
result = await session.call_tool(
|
|
"add_memory",
|
|
arguments={
|
|
"messages": [
|
|
{"role": "user", "content": "I love Python"},
|
|
{"role": "assistant", "content": "Noted!"}
|
|
],
|
|
"user_id": "user_123"
|
|
}
|
|
)
|
|
```
|
|
|
|
## Next Steps
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="Installation" icon="download" href="/mcp/installation">
|
|
Set up the MCP server locally or in Docker
|
|
</Card>
|
|
<Card title="Tool Reference" icon="wrench" href="/mcp/tools">
|
|
Detailed documentation for all available tools
|
|
</Card>
|
|
<Card title="n8n Integration" icon="workflow" href="/examples/n8n">
|
|
Use MCP tools in n8n AI Agent workflows
|
|
</Card>
|
|
<Card title="Claude Code" icon="code" href="/examples/claude-code">
|
|
Integrate with Claude Code for AI-powered coding
|
|
</Card>
|
|
</CardGroup>
|