import os
import base64
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStreamableHTTP
# 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 agent with StackOne MCP server
agent = Agent(
model="openai:gpt-5",
mcp_servers=[
MCPServerStreamableHTTP(
url="https://api.stackone.com/mcp",
headers={
"Authorization": f"Basic {auth_token}",
"x-account-id": STACKONE_ACCOUNT_ID,
"MCP-Protocol-Version": "2025-06-18"
}
)
]
)
# Run agent with StackOne tools
result = agent.run_sync("Search recent calls in Gong")
print(result.data)