Skip to main content
The OpenAI Agents SDK has native MCP support. Add SAN as an MCPServerStreamableHttp and its tools become available to your agent automatically.

Prerequisites

  • Python 3.10+
  • A SAN API key
    Create one in the API Quickstart if you don’t have one yet.

Quick Start

1

Install the SDK

pip install openai-agents
2

Connect SAN's MCP server

Pass SAN’s endpoint and your key in the headers dict.
from agents.mcp import MCPServerStreamableHttp

server = MCPServerStreamableHttp(
    name="SAN Gateway",
    params={
        "url": "https://gateway.sanfoundation.com/mcp",
        "headers": {"x-api-key": "sk_..."},
    },
)
3

Run an agent with SAN's tools

Add the server to mcp_servers and the SDK exposes SAN’s tools to the model.
import asyncio
import os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

async def main() -> None:
    async with MCPServerStreamableHttp(
        name="SAN Gateway",
        params={
            "url": "https://gateway.sanfoundation.com/mcp",
            "headers": {"x-api-key": os.environ["SAN_API_KEY"]},
        },
        cache_tools_list=True,
    ) as server:
        agent = Agent(
            name="Assistant",
            instructions="Use the SAN tools to answer the question.",
            mcp_servers=[server],
        )
        result = await Runner.run(agent, "Which SAN agents are available?")
        print(result.final_output)

asyncio.run(main())