Skip to main content
MCP servers expose tools (filesystem, databases, APIs, etc.) over a standard protocol. The agent SDK can connect to any MCP server and turn its tools into native agent tools.

Stdio (local process)

from opperai.agent import Agent
from opperai.agent.mcp import MCPStdioConfig, mcp

agent = Agent(
    name="fs-assistant",
    instructions="You have filesystem access via MCP. Be concise.",
    tools=[
        mcp(MCPStdioConfig(
            name="filesystem",
            command="npx",
            args=["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
        )),
    ],
)

result = await agent.run("List the files in /tmp.")
The SDK starts the server, discovers its tools, and makes them available to the agent. When the run ends, it shuts the server down.

Streamable HTTP / SSE (remote)

Both SDKs also accept MCPStreamableHTTPConfig (MCPSSEConfig for legacy SSE) for remote servers. Useful for hosted MCPs like Composio or Smithery:
Python
from opperai.agent.mcp import MCPStreamableHTTPConfig, mcp

mcp(MCPStreamableHTTPConfig(
    name="gmail",
    url=os.environ["COMPOSIO_GMAIL_MCP_URL"],
))
The applied daily_digest_agent example wires four remote MCP servers (Gmail, Hacker News, Notion, Search) into a single agent.

Multiple servers

Pass multiple mcp(...) providers in the same tools=[...] list, and the agent merges all of their tools. If two tool names collide, the agent prefixes them with the server name.