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, exposes them to the agent, and tears the server down when the run ends.

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 — the agent merges all of their tools. Tool name collisions are resolved with the server name as a prefix.