Skip to main content
The v2.7.4 source targets the archived local Mem0 MCP SSE server. Mem0’s maintained service is an authenticated Streamable HTTP endpoint. Update the connection before running. See Mem0 MCP.
mem0.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your API keys

4

Use the maintained Mem0 MCP endpoint

Add import os, set mcp_server_url = "https://mcp.mem0.ai/mcp", change the MCPTools transport to streamable-http, and add header_provider=lambda: {"Authorization": f"Bearer {os.environ['MEM0_API_KEY']}"}.
5

Run the example

Save the code above as mem0.py, then run:
Full source: cookbook/91_tools/mcp/mem0.py