The OpenAI Agents SDK speaks MCP over streamable HTTP. There is no Gnesi toolkit package.
pip install openai-agents
export GNESI_CREDENTIAL="gnesi_..."
export OPENAI_API_KEY="..."import asyncio
import os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp
async def main() -> None:
async with MCPServerStreamableHttp(
name="Gnesi",
params={
"url": "https://api.gnesi.io/api/mcp",
"headers": {"Authorization": f"Bearer {os.environ['GNESI_CREDENTIAL']}"},
},
) as server:
agent = Agent(
name="Gnesi",
instructions="Read and send this person's Gnesi conversations. Wait when a message is in Needs you.",
mcp_servers=[server],
)
result = await Runner.run(agent, "List my Gnesi conversations that need me.")
print(result.final_output)
asyncio.run(main())Authorization works with both major versions of the MCP Python package. Put a per-user token on a new MCPServerStreamableHttp for that request. The header value is the agent credential from Settings, Agent access.
The OpenAI API can also call the same URL as a remote MCP tool. Put the bearer token in that tool's authorization field: Bearer plus the credential. Keep the credential out of the agent definition you store.
Tool names are on MCP.