Skip to main content

Overview

OpenAI Agents SDK includes native MCP support with MCPServerStreamableHttp, enabling direct integration with StackOne’s MCP server. Official Docs

Installation

pip install openai-agents
Or with uv:
uv add openai-agents

Quick Start

Connect to StackOne MCP and use tools with OpenAI agents:
import os
import base64
from agents import Agent
from agents.mcp import MCPServerStreamableHttp, MCPServerStreamableHttpParams

# Configure StackOne account
STACKONE_ACCOUNT_ID = "<account_id>"  # Your StackOne account ID

# Encode API key for Basic auth
auth_token = base64.b64encode(
    f"{os.getenv('STACKONE_API_KEY')}:".encode()
).decode()

# Create MCP server connection
stackone_mcp = MCPServerStreamableHttp(
    params=MCPServerStreamableHttpParams(
        url="https://api.stackone.com/mcp",
        headers={
            "Authorization": f"Basic {auth_token}",
            "x-account-id": STACKONE_ACCOUNT_ID
        }
    )
)

# Create agent with StackOne tools
agent = Agent(
    model="gpt-5",
    mcp_servers=[stackone_mcp]
)

# Run agent
response = agent.run("List Salesforce accounts")
print(response.output)

Environment Variables

STACKONE_API_KEY=<stackone_api_key>
OPENAI_API_KEY=your_openai_key

Multi-Turn Conversation

# Continue conversation with context
response = agent.run(
    "Show me the most recent account activities",
    context=response.context
)

Resources

Next Steps