diff --git a/docs/cookbooks/frameworks/gemini-3-with-mem0-mcp.mdx b/docs/cookbooks/frameworks/gemini-3-with-mem0-mcp.mdx index de51f1e2f..04d0f31dd 100644 --- a/docs/cookbooks/frameworks/gemini-3-with-mem0-mcp.mdx +++ b/docs/cookbooks/frameworks/gemini-3-with-mem0-mcp.mdx @@ -3,7 +3,7 @@ title: "Gemini 3 with Mem0 MCP" description: "Create snappy, smart, memory-aware agents by pairing Gemini 3 with Mem0 MCP server." --- -Gemini 3, when paired with mem0-mcp-server, works in synergy to create snappy, smart, memory-aware agents. +Gemini 3, when paired with Mem0's cloud MCP server, works in synergy to create snappy, smart, memory-aware agents. This is the primary example of MCP integration - the same patterns work with Claude Desktop, Cursor, or any MCP-compatible client. @@ -27,10 +27,22 @@ The Mem0 MCP server provides these tools to Gemini: ## Setup +### Configure Mem0 MCP + +Add Mem0 MCP to your MCP client: + +```bash +npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "claude,claude code,cursor,windsurf,vscode,opencode" +``` + ### Install dependencies ```bash -pip install pydantic-ai nest-asyncio python-dotenv uv google-genai +pip install pydantic-ai nest-asyncio python-dotenv google-genai ``` ### Environment Setup @@ -40,7 +52,6 @@ Create a file named `.env`: ```bash MEM0_API_KEY=m0-xxxxxxxxxxxxxxxxx GEMINI_API_KEY=your-gemini-api-key-here -MEM0_DEFAULT_USER_ID=demo-user ``` @@ -60,7 +71,7 @@ import asyncio import os from dotenv import load_dotenv from pydantic_ai import Agent -from pydantic_ai.mcp import MCPServerStdio +from pydantic_ai.mcp import MCPServerHTTP # Load environment variables load_dotenv() @@ -75,11 +86,9 @@ class MemoryAgent: def _setup(self): """Initialize the agent with MCP tools""" - # Create MCP server directly - self.server = MCPServerStdio( - command="uvx", - args=["mem0-mcp-server"], - env=os.environ + # Connect to Mem0's cloud MCP server + self.server = MCPServerHTTP( + url="https://mcp.mem0.ai/mcp" ) # Create agent with Gemini and memory tools diff --git a/docs/images/smithery-mem0-mcp.png b/docs/images/smithery-mem0-mcp.png deleted file mode 100644 index ac115e87f..000000000 Binary files a/docs/images/smithery-mem0-mcp.png and /dev/null differ diff --git a/docs/platform/features/mcp-integration.mdx b/docs/platform/features/mcp-integration.mdx index 928dff802..77ef7642e 100644 --- a/docs/platform/features/mcp-integration.mdx +++ b/docs/platform/features/mcp-integration.mdx @@ -9,11 +9,48 @@ description: "Connect any AI client to Mem0 using Model Context Protocol for uni When building AI applications, memory management often requires manual integration. MCP eliminates this complexity by: -- **Universal compatibility**: Works with any MCP-compatible client (Claude Desktop, Cursor, custom agents) +- **Universal compatibility**: Works with any MCP-compatible client (Claude, Claude Code, Cursor, Windsurf, VS Code, OpenCode) - **Agent autonomy**: AI agents decide when to save, search, or update memories -- **Zero infrastructure**: No servers to maintain - Mem0 handles everything +- **Zero infrastructure**: No servers to maintain - Mem0's cloud MCP handles everything - **Standardized protocol**: One integration works across all your AI tools +## Setup + +Add Mem0 MCP to all supported clients with a single command: + +```bash +npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "claude,claude code,cursor,windsurf,vscode,opencode" +``` + +Or configure a specific client: + +```bash +npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "cursor" +``` + +For manual configuration, add this to your MCP client config: + +```json +{ + "mcpServers": { + "mem0-mcp": { + "type": "http", + "url": "https://mcp.mem0.ai/mcp" + } + } +} +``` + +For detailed per-client instructions, see the [Mem0 MCP Quickstart](/platform/mem0-mcp). + ## Available tools The MCP server exposes 9 memory tools to your AI client: @@ -30,139 +67,12 @@ The MCP server exposes 9 memory tools to your AI client: | `get_memory` | Retrieve single memory by ID | | `list_entities` | View stored entities | -## Deployment options +## How it works -Choose the deployment method that fits your workflow: - - - - Install and run locally with uvx: - - ```bash - uv pip install mem0-mcp-server - ``` - - Configure your client: - ```json - { - "mcpServers": { - "mem0": { - "command": "uvx", - "args": ["mem0-mcp-server"], - "env": { - "MEM0_API_KEY": "m0-...", - "MEM0_DEFAULT_USER_ID": "your-handle" - } - } - } - } - ``` - - - - Containerized deployment with HTTP endpoint: - - ```bash - docker build -t mem0-mcp-server https://github.com/mem0ai/mem0-mcp.git - docker run --rm -d -e MEM0_API_KEY="m0-..." -p 8080:8081 mem0-mcp-server - ``` - - Configure for HTTP: - ```json - { - "mcpServers": { - "mem0-docker": { - "command": "curl", - "args": ["-X", "POST", "http://localhost:8080/mcp", "--data-binary", "@"], - "env": { - "MEM0_API_KEY": "m0-..." - } - } - } - } - ``` - - - - One-click setup with managed service: - - Visit [smithery.ai/server/@mem0ai/mem0-memory-mcp](https://smithery.ai/server/@mem0ai/mem0-memory-mcp) and: - - 1. Select your AI client (Cursor, Claude Desktop, etc.) - 2. Configure your Mem0 API key - 3. Set your default user ID - 4. Enable graph memory (optional) - 5. Copy the generated configuration - - Your client connects automatically - no installation required. - - - -## Configuration - -### Required environment variables -```bash -MEM0_API_KEY="m0-..." # Your Mem0 API key -MEM0_DEFAULT_USER_ID="your-handle" # Default user ID -``` - -### Optional variables -```bash -MEM0_ENABLE_GRAPH_DEFAULT="true" # Enable graph memories -MEM0_MCP_AGENT_MODEL="gpt-4o-mini" # LLM for bundled examples -``` - - - - The included Pydantic AI agent provides an interactive REPL to test memory operations: - - ```bash - # Install the package - pip install mem0-mcp-server - - # Set your API keys - export MEM0_API_KEY="m0-..." - export OPENAI_API_KEY="sk-openai-..." - - # Clone and test with the agent - git clone https://github.com/mem0ai/mem0-mcp.git - cd mem0-mcp-server - python example/pydantic_ai_repl.py - ``` - - **Testing different server configurations:** - - - **Local server** (default): `python example/pydantic_ai_repl.py` - - - **Docker container**: - ```bash - export MEM0_MCP_CONFIG_PATH=example/docker-config.json - export MEM0_MCP_CONFIG_SERVER=mem0-docker - python example/pydantic_ai_repl.py - ``` - - - **Smithery remote**: - ```bash - export MEM0_MCP_CONFIG_PATH=example/config-smithery.json - export MEM0_MCP_CONFIG_SERVER=mem0-memory-mcp - python example/pydantic_ai_repl.py - ``` - - Try these test prompts: - - "Remember that I love tiramisu" - - "Search for my food preferences" - - "Update my project: the mobile app is now 80% complete" - - "Show me all memories about project Phoenix" - - "Delete memories from 2023" - - - -## How the testing works - -1. **Configuration loads** - Reads from `example/config.json` by default -2. **Server starts** - Launches or connects to the Mem0 MCP server -3. **Agent connects** - Pydantic AI agent (Mem0Guide) attaches to the server -4. **Interactive REPL** - You get a chat interface to test all memory operations +1. **Configure the MCP server** - Add Mem0 MCP to your AI client using the setup command above +2. **Agent connects** - Your AI client connects to Mem0's cloud MCP server over HTTP +3. **Autonomous memory** - The agent decides when to store/retrieve memories as part of its reasoning +4. **No manual API calls** - The agent manages memory automatically through MCP tools ## Example interactions @@ -225,14 +135,11 @@ The Mem0 MCP server enables powerful memory capabilities for your AI application ## Best practices -- **Start simple**: Use the Python package for development +- **Use the cloud MCP**: The hosted MCP server at `https://mcp.mem0.ai/mcp` handles infrastructure for you - **Use wildcards**: `user_id: "*"` to search across all users -- **Test locally**: Use the bundled Python agent to verify setup - **Monitor usage**: Track memory operations in the dashboard - **Document patterns**: Share successful prompt patterns with your team -{/* DEBUG: verify CTA targets */} - - \ No newline at end of file + diff --git a/docs/platform/mem0-mcp.mdx b/docs/platform/mem0-mcp.mdx index 3613287ca..04b786228 100644 --- a/docs/platform/mem0-mcp.mdx +++ b/docs/platform/mem0-mcp.mdx @@ -2,28 +2,34 @@ title: "Mem0 MCP" description: "Connect any AI client to Mem0 using Model Context Protocol in minutes" icon: "puzzle-piece" -estimatedTime: "~5 minutes" +estimatedTime: "~2 minutes" --- **Prerequisites** - Mem0 Platform account ([Sign up here](https://app.mem0.ai)) - API key ([Get one from dashboard](https://app.mem0.ai/settings/api-keys)) - - Python 3.10+, Docker, or Node.js 14+ - - An MCP-compatible client (Claude Desktop, Cursor, or custom agent) + - Node.js 14+ (for npx) + - An MCP-compatible client (Claude, Claude Code, Cursor, Windsurf, VS Code, OpenCode) ## What is Mem0 MCP? -Mem0 MCP Server exposes Mem0's memory capabilities as MCP tools, letting AI agents decide when to save, search, or update information. +Mem0 MCP Server exposes Mem0's memory capabilities as MCP tools, letting AI agents decide when to save, search, or update information. The cloud-hosted MCP server requires no local installation — just connect and start using memory. -## Deployment Options +## Quick Setup -Choose from three deployment methods: +Add Mem0 MCP to your preferred clients with a single command: -1. **Python Package (Recommended)** - Install locally with `uvx` for instant setup -2. **Docker Container** - Isolated deployment with HTTP endpoint -3. **Smithery** - Remote hosted service for managed deployments +```bash +npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "claude,claude code,cursor,windsurf,vscode,opencode" +``` + +This automatically configures Mem0 MCP for all supported clients at once. ## Available Tools @@ -43,54 +49,105 @@ The MCP server exposes these memory tools to your AI client: --- -## Quickstart with Python (UVX) +## Client-Specific Setup - - -```bash -uv pip install mem0-mcp-server -``` - +You can also configure individual clients: - -Add this to your MCP client (e.g., Claude Desktop): + + + ```bash + npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "claude" + ``` -```json -{ - "mcpServers": { - "mem0": { - "command": "uvx", - "args": ["mem0-mcp-server"], - "env": { - "MEM0_API_KEY": "m0-...", - "MEM0_DEFAULT_USER_ID": "your-handle" + Or manually add to your Claude Desktop configuration (`claude_desktop_config.json`): + ```json + { + "mcpServers": { + "mem0-mcp": { + "type": "http", + "url": "https://mcp.mem0.ai/mcp" + } } } - } -} -``` + ``` + -Set your environment variables: + + ```bash + npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "claude code" + ``` + -```bash -export MEM0_API_KEY="m0-..." -export MEM0_DEFAULT_USER_ID="your-handle" -``` - + + ```bash + npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "cursor" + ``` - -```bash -# Clone the mem0-mcp repository -git clone https://github.com/mem0ai/mem0-mcp.git -cd mem0-mcp + Or go to Cursor → Settings → MCP and add: + ```json + { + "mcpServers": { + "mem0-mcp": { + "type": "http", + "url": "https://mcp.mem0.ai/mcp" + } + } + } + ``` + -# Set your API keys -export MEM0_API_KEY="m0-..." -export OPENAI_API_KEY="sk-openai-..." + + ```bash + npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "windsurf" + ``` + -# Run the interactive agent -python example/pydantic_ai_repl.py -``` + + ```bash + npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "vscode" + ``` + + + + ```bash + npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "opencode" + ``` + + + +--- + +## Verify Your Setup + +Once configured, your AI client can: +- Automatically save information with `add_memory` +- Search memories with `search_memories` +- Update memories with `update_memory` +- Delete memories with `delete_memory` **Sample Interactions:** @@ -104,107 +161,18 @@ Agent: Based on your memories, you love tiramisu. User: Update my project: the mobile app is now 80% complete Agent: Updated your project status successfully. ``` - - - -Your AI client can now: -- Automatically save information with `add_memory` -- Search memories with `search_memories` -- Update memories with `update_memory` -- Delete memories with `delete_memory` - If you get "Connection failed", ensure your API key is valid and the server is running. + If you get "Connection failed", ensure you have a valid API key from [Mem0 Dashboard](https://app.mem0.ai/settings/api-keys). - - - ---- - -## Quickstart with Docker - - - -```bash -docker build -t mem0-mcp-server https://github.com/mem0ai/mem0-mcp.git -``` - - - -```bash -docker run --rm -d \ - --name mem0-mcp \ - -e MEM0_API_KEY="m0-..." \ - -p 8080:8081 \ - mem0-mcp-server -``` - - - -For clients that connect via HTTP (instead of stdio): - -```json -{ - "mcpServers": { - "mem0-docker": { - "command": "curl", - "args": ["-X", "POST", "http://localhost:8080/mcp", "--data-binary", "@-"], - "env": { - "MEM0_API_KEY": "m0-..." - } - } - } -} -``` - - - -```bash -# Check container logs -docker logs mem0-mcp - -# Test HTTP endpoint -curl http://localhost:8080/health -``` - - - The container should start successfully and respond to HTTP requests. If port 8080 is occupied, change it with `-p 8081:8081`. - - - - ---- - -## Quickstart with Smithery (Hosted) - -For the simplest integration, use Smithery's hosted Mem0 MCP server - no installation required. - -**Example: One-click setup in Cursor** - -1. Visit [smithery.ai/server/@mem0ai/mem0-memory-mcp](https://smithery.ai/server/@mem0ai/mem0-memory-mcp) and select Cursor as your client - -![Smithery Mem0 MCP Configuration](/images/smithery-mem0-mcp.png) - -2. Open Cursor → Settings → MCP -3. Click `mem0-mcp` → Initiate authorization -4. Configure Smithery with your environment: - - `MEM0_API_KEY`: Your Mem0 API key - - `MEM0_DEFAULT_USER_ID`: Your user ID - - `MEM0_ENABLE_GRAPH_DEFAULT`: Optional, set to `true` for graph memories -5. Return to Cursor settings and wait for tools to load -6. Start chatting with Cursor and begin storing preferences - -**For other clients:** -Visit [smithery.ai/server/@mem0ai/mem0-memory-mcp](https://smithery.ai/server/@mem0ai/mem0-memory-mcp) to connect any MCP-compatible client with your Mem0 credentials. --- ## Quick Recovery -- **"uvx command not found"** → Install with `pip install uv` or use `pip install mem0-mcp-server` instead. Make sure your Python environment has `uv` installed (or system-wide). -- **"Connection refused"** → Check that the server is running and the correct port is configured +- **"Connection refused"** → Check your internet connection and ensure the MCP client is correctly configured - **"Invalid API key"** → Get a new key from [Mem0 Dashboard](https://app.mem0.ai/settings/api-keys) -- **"Permission denied"** → Ensure Docker has access to bind ports (try with `sudo` on Linux) +- **"npx command not found"** → Install Node.js from [nodejs.org](https://nodejs.org) --- @@ -227,6 +195,5 @@ Visit [smithery.ai/server/@mem0ai/mem0-memory-mcp](https://smithery.ai/server/@m ## Additional Resources -- **[Mem0 MCP Repository](https://github.com/mem0ai/mem0-mcp)** - Source code and examples - **[Platform Quickstart](/platform/quickstart)** - Direct API integration guide -- **[MCP Specification](https://modelcontextprotocol.io)** - Learn about MCP protocol \ No newline at end of file +- **[MCP Specification](https://modelcontextprotocol.io)** - Learn about MCP protocol diff --git a/docs/vibecoding.mdx b/docs/vibecoding.mdx index 3c4818baf..174baca31 100644 --- a/docs/vibecoding.mdx +++ b/docs/vibecoding.mdx @@ -32,26 +32,19 @@ Works with Claude Code, Cursor, Windsurf, and any assistant that supports skills ## MCP Server Setup -Connect Cursor, Windsurf, Claude Desktop, or any MCP-compatible client to Mem0. +Connect Claude, Claude Code, Cursor, Windsurf, VS Code, OpenCode, or any MCP-compatible client to Mem0. -Get your API key from [app.mem0.ai](https://app.mem0.ai), then add to your MCP config: +Get your API key from [app.mem0.ai](https://app.mem0.ai), then add Mem0 MCP with a single command: -```json -{ - "mcpServers": { - "mem0": { - "command": "uvx", - "args": ["mem0-mcp-server"], - "env": { - "MEM0_API_KEY": "m0-...", - "MEM0_DEFAULT_USER_ID": "your-handle" - } - } - } -} +```bash +npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "claude,claude code,cursor,windsurf,vscode,opencode" ``` -For Docker, Smithery, and advanced options, see [Mem0 MCP Setup](/platform/mem0-mcp). +For per-client setup and advanced options, see [Mem0 MCP Setup](/platform/mem0-mcp). ## Universal Starter Prompt diff --git a/skills/mem0/references/features.md b/skills/mem0/references/features.md index fa2130f47..2e68b21ba 100644 --- a/skills/mem0/references/features.md +++ b/skills/mem0/references/features.md @@ -349,23 +349,18 @@ Use the `name` field in messages to identify speakers. Mem0 maps names to entity ## MCP Integration -Model Context Protocol integration enables AI clients (Claude Desktop, Cursor, custom agents) to manage Mem0 memory autonomously. +Model Context Protocol integration enables AI clients (Claude, Claude Code, Cursor, Windsurf, VS Code, OpenCode) to manage Mem0 memory autonomously. -### Configuration +### Setup -```json -{ - "mcpServers": { - "mem0": { - "command": "uvx", - "args": ["mem0-mcp-server"], - "env": { - "MEM0_API_KEY": "m0-your-api-key", - "MEM0_DEFAULT_USER_ID": "your-user-id" - } - } - } -} +Add Mem0 MCP to your clients with a single command: + +```bash +npx mcp-add \ + --name mem0-mcp \ + --type http \ + --url "https://mcp.mem0.ai/mcp" \ + --clients "claude,claude code,cursor,windsurf,vscode,opencode" ``` ### Available MCP Tools @@ -377,7 +372,7 @@ The MCP server exposes 9 memory tools that AI agents can use autonomously: ### How It Works -1. Configure the MCP server in your AI client +1. Add Mem0 MCP to your AI client using the setup command above 2. The agent autonomously decides when to store/retrieve memories 3. No manual API calls needed — the agent manages memory as part of its reasoning