How to Use the Mem0 MCP in OpenAI Agents SDK
Give your OpenAI Agents SDK production MCP workflows persistent recall that survives agent handoffs and matches your safety guardrails.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Mem0 MCP to OpenAI Agents SDK
Create your Vinkius account to connect Mem0 to OpenAI Agents SDK and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.
Persistent OpenAI Agents SDK context across handoffs
The `add_memory` tool lets your OpenAI Agents SDK write structured user facts to Mem0 during a live session, meaning when you hand off a conversation from a triage agent to a billing agent, the context doesn't vanish. Your receiving agent queries the database immediately to understand the user's past choices. You don't have to pass massive system prompts down the chain anymore. By letting the active agent run `search_memories`, you fetch only the relevant facts, cutting down token overhead and keeping your MCP tracing dashboard clean.
Guardrail-validated memory pruning
The `delete_memory` tool integrates directly into the OpenAI Agents SDK safety loop to ensure users can wipe their stored preferences instantly. If a user asks to clear their data, your agent executes this tool to remove the specific memory ID without human intervention. Because the SDK enforces strict validation before calling external MCP tools, you can set parameters that prevent the agent from accidentally wiping the wrong memory records. This keeps your user profile database clean and compliant.
On-demand profile building for agent routing
The `get_memories` tool retrieves the complete list of stored facts for any specific user ID so your OpenAI Agents SDK can route the conversation based on user history. When the memory list shows a preference for advanced technical support, the SDK routes the user to the senior engineering agent immediately. Running this check at the start of a session lets you boot up the agent with pre-loaded user context. You avoid making the user repeat their preferences, creating a continuous conversational thread.
Set up Mem0 MCP in OpenAI Agents SDK
Prerequisites
- Python 3.10+ installed
-
openai-agentspackage (pip install openai-agents) - Active Vinkius subscription with a valid endpoint token
- 1
Install the SDK
Run
pip install openai-agentsto install the OpenAI Agents SDK. The MCP integration is built-in — no extra dependencies needed. - 2
Connect via SSE transport
Use
MCPServerSsewith your Vinkius endpoint URL. Replace[YOUR_TOKEN_HERE]with your token from cloud.vinkius.com. The SDK auto-discovers all Mem0 tools at runtime. - 3
Create your Agent
Pass the MCP to
Agent(mcp_servers=[server]). The agent receives Mem0 tools as native definitions — JSON schemas resolve automatically. - 4
Run the agent
Call
Runner.run(agent, prompt)to execute. The agent invokes the appropriate Mem0 tools and returns structured results. Copy the full example on the right to get started.
import asyncio
from agents import Agent, Runner
from agents.mcp import MCPServerSse
async def main():
async with MCPServerSse(
url="https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
) as server:
agent = Agent(
name="Mem0 Agent",
instructions="You have access to Mem0 tools.",
mcp_servers=[server],
)
result = await Runner.run(agent, "List recent transactions")
print(result.final_output)
asyncio.run(main()) Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by Mem0. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.
Why Choose Vinkius
Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.
Real-time monitoring
Live
visibility into every interaction
Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.
Built-in savings
60%
lower AI costs
Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.
Single dashboard
One
place for every integration
Every tool your AI connects to, managed from a single screen. One account, complete control.
Common questions about Mem0 MCP in OpenAI Agents SDK
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Mem0 MCP today
We host it, we monitor it, we maintain it. You just paste one token.