Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.stackone.com/llms.txt

Use this file to discover all available pages before exploring further.

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 asyncio
import base64
from agents import Agent, Runner
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()

async def main():
    # 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
            }
        )
    )

    # Use async context manager to connect/disconnect automatically
    async with stackone_mcp:
        # Create agent with StackOne tools
        agent = Agent(
            name="stackone-assistant",
            model="gpt-5",
            mcp_servers=[stackone_mcp]
        )

        # Run agent
        result = await Runner.run(agent, "List Salesforce accounts")
        print(result.final_output)

asyncio.run(main())

Environment Variables

STACKONE_API_KEY=<stackone_api_key>
OPENAI_API_KEY=your_openai_key

Multi-Turn Conversation

Pass previous messages as context for follow-up questions:
import os
import asyncio
import base64
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp, MCPServerStreamableHttpParams

STACKONE_ACCOUNT_ID = "<account_id>"
auth_token = base64.b64encode(
    f"{os.getenv('STACKONE_API_KEY')}:".encode()
).decode()

async def main():
    stackone_mcp = MCPServerStreamableHttp(
        params=MCPServerStreamableHttpParams(
            url="https://api.stackone.com/mcp",
            headers={
                "Authorization": f"Basic {auth_token}",
                "x-account-id": STACKONE_ACCOUNT_ID
            }
        )
    )

    async with stackone_mcp:
        agent = Agent(
            name="stackone-assistant",
            model="gpt-5",
            mcp_servers=[stackone_mcp]
        )

        # First turn
        result = await Runner.run(agent, "List Salesforce accounts")
        print(result.final_output)

        # Continue conversation — pass previous output as context
        result = await Runner.run(
            agent,
            "Show me the most recent account activities",
            context=result.context
        )
        print(result.final_output)

asyncio.run(main())

Resources

Next Steps

Pydantic AI

Try Pydantic AI with built-in MCP support

LangChain

Build agents with LangChain MCP adapters