Creates and configures HTTP with Server-Sent Events Model Context Protocol (MCP) server connections for OpenAI Agents SDK
This skill helps create and configure HTTP with Server-Sent Events Model Context Protocol (MCP) server connections for OpenAI Agents SDK.
Use this skill when:
import asyncio
from agents import Agent, Runner
from agents.model_settings import ModelSettings
from agents.mcp import MCPServerSse
workspace_id = "demo-workspace"
async def main() -> None:
async with MCPServerSse(
name="SSE Python Server",
params={
"url": "http://localhost:8000/sse",
"headers": {"X-Workspace": workspace_id},
},
cache_tools_list=True,
) as server:
agent = Agent(
name="Assistant",
mcp_servers=[server],
model_settings=ModelSettings(tool_choice="required"),
)
result = await Runner.run(agent, "What's the weather in Tokyo?")
print(result.final_output)
asyncio.run(main())