OpenAI Agents SDK 0.20 httpx2 MCP headers: Sume API key
With a custom MCP HTTP client in Agents SDK 0.20, send the Sume key as an Authorization Bearer or x-api-key header. httpx2 only matters if you built the client.

Put the Sume key in a request header, either Authorization: Bearer $SUME_API_KEY or x-api-key: $SUME_API_KEY, whichever HTTP client you use. Agents SDK 0.20 changes nothing about that for ordinary connections; it only matters if you supply your own httpx.Auth object or httpx.AsyncClient factory and MCP Python SDK v2 gets installed, in which case those must move to httpx2.
SDK behavior from its release notes; header forms from OAuth and API keys, read 2026-10-01.
What changed in Agents SDK 0.20?
Local MCP HTTP customization follows the installed MCP package: MCP Python SDK v1 uses legacy httpx, v2 uses httpx2. The SDK adapts ordinary stdio, SSE and Streamable HTTP connections automatically and does not convert arbitrary legacy httpx objects. If resolution picks MCP v2, custom httpx.Auth objects and httpx.AsyncClient factories must be migrated to httpx2, or you pin mcp<2.
Which header does Sume accept?
| Header | Value |
|---|---|
Authorization | Bearer $SUME_API_KEY |
x-api-key | $SUME_API_KEY |
What is the simplest setup?
A plain headers dict avoids a custom client altogether, so the httpx or httpx2 question never comes up.
import asyncio
import os
from agents.mcp import MCPServerStreamableHttp
async def main():
key = os.environ["SUME_API_KEY"]
async with MCPServerStreamableHttp(
name="sume",
params={
"url": "https://mcp.sume.com/mcp",
"headers": {"Authorization": "Bearer " + key},
},
) as server:
tools = await server.list_tools()
print([t.name for t in tools])
asyncio.run(main())What if I do need a custom client?
Set the same header on whichever client your installed MCP package expects, and keep the key in an environment variable rather than in code. API-key sessions can see write and paid tools, and paid calls still need an idempotency_key. For a second server alongside Sume, see McpServerManager with a second server.
Sources
Related posts
More in Developers
- Agents SDK mcp.Client mode auto against Sume's MCP server
With MCP Python SDK v2, the Agents SDK probes the newest protocol and falls back to initialize. Sume's hosted server still serves initialize with 2025-11-25.
- OpenAI Agents Python MCP error content: reading Sume tool errors
openai-agents-python v0.20.0 keeps MCP error content with structured output. Sume tool failures arrive as isError text with code, message and http_status.
- OpenAI Agents Python MCP non-text content as JSON: Sume results
openai-agents-python v0.20.0 serializes non-text MCP blocks as JSON. Sume tool results are text blocks, with media delivered as URLs inside the JSON.
- Agents SDK approve_unsafe_replay with Sume paid calls
approve_unsafe_replay resends a model request, not a Sume tool call. Sume paid and write tools need a stable idempotency_key; keep it fixed on a repeat.
Written by Sume