Skip to main content

MCP

When several agents or products need the same governed tools and resources, copying local functions into every application creates duplicated integrations and inconsistent permissions. MCP solves that sharing problem with a standard tool and resource server. Keep the MCP server behind your authorization boundary, allow-list tools, and pass the authenticated application user ID to the server.

from agents import Agent, Runner
from agents.mcp import MCPServerStdio
from iztro_agents import ChatSession, iztro_ziwei_agent

async with MCPServerStdio(
name="internal-tools",
params={"command": "node", "args": ["./mcp-server.js"]},
) as mcp_server:
agent = iztro_ziwei_agent(mcp_servers=[mcp_server])
session = ChatSession(external_user_id="user_42")
result = await Runner.run(
agent,
"Use the approved MCP tools to answer my question.",
session=session,
)
print(result.final_output)

The exact MCP constructor can vary by the pinned Agent SDK version. Pin the dependency and test tool discovery before enabling a server for production users.