Edison Watch
Developers

OpenAI Agents SDK

Connect an OpenAI Agents SDK agent (Python or TypeScript) to Edison Watch as a streamable-HTTP MCP server, and keep a stable session per conversation so data-leak protection holds across every turn.

The OpenAI Agents SDK connects to Edison with its client-side MCPServerStreamableHttp class. Because your connection URL already carries your API key, you just pass the URL - no auth header.

Use the client-side MCPServerStreamableHttp (shown here), not the hosted HostedMCPTool / hostedMcpTool. Hosted MCP tools run the connection from OpenAI's servers via the Responses API, which would hand your Edison URL to OpenAI and connect from their network instead of yours. For a gateway you control, always connect client-side.

pip install openai-agents
import asyncio
import os

from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

async def main() -> None:
    async with MCPServerStreamableHttp(
        name="Edison Watch",
        params={"url": os.environ["EDISON_MCP_URL"]},
    ) as server:
        agent = Agent(
            name="Assistant",
            instructions="Use the Edison tools to answer.",
            mcp_servers=[server],
        )
        result = await Runner.run(agent, "List my available tools.")
        print(result.final_output)

asyncio.run(main())

Set EDISON_MCP_URL to your connection URL, e.g. https://mcp.edison.watch/mcp/<your-api-key>/?client=openai-agents.

npm install @openai/agents

The JS class needs an explicit connect() / close() lifecycle:

import { Agent, run, MCPServerStreamableHttp } from '@openai/agents';

const server = new MCPServerStreamableHttp({
  url: process.env.EDISON_MCP_URL!,
  name: 'Edison Watch',
});

const agent = new Agent({
  name: 'Assistant',
  instructions: 'Use the Edison tools to answer.',
  mcpServers: [server],
});

await server.connect();
try {
  const result = await run(agent, 'List my available tools.');
  console.log(result.finalOutput);
} finally {
  await server.close();
}

Keep a stable session across turns to preserve data-leak protection

Send a stable x-edison-conversation-id header on every turn of the same conversation. That header is what keeps Edison's data-leak protection intact across a multi-turn run: Edison tracks lethal-trifecta risk per session, so if each turn looks like a brand-new session, that protection resets - and a later turn can leak data that the accumulated risk should have blocked.

Hosted clients (Claude Code, VS Code) send it automatically. For a custom agent, set the header yourself (Python in params, TypeScript under requestInit.headers), keyed to your own conversation or thread id - and reuse that id on every turn:

MCPServerStreamableHttp(params={
    "url": os.environ["EDISON_MCP_URL"],
    "headers": {"x-edison-conversation-id": conversation_id},
})
new MCPServerStreamableHttp({
  url: process.env.EDISON_MCP_URL!,
  name: 'Edison Watch',
  requestInit: { headers: { 'x-edison-conversation-id': conversationId } },
});

Without a stable x-edison-conversation-id, each connection is treated as a fresh session that starts with empty risk state - so risk accumulated on an earlier turn won't be there to block a later exfiltration. The ?client= label is only a dashboard tag, not a session key. Use a unique id per conversation (a UUID is ideal); ids are scoped to your API key, so don't reuse one string for two different conversations.

Optional: the encrypted-secrets header

If you use servers with zero-knowledge-encrypted secrets, add x-edison-secret-key alongside x-edison-conversation-id. In Python they go in params; in TypeScript they go under requestInit.headers (there is no top-level headers option):

MCPServerStreamableHttp(params={
    "url": os.environ["EDISON_MCP_URL"],
    "headers": {
        "x-edison-conversation-id": conversation_id,
        "x-edison-secret-key": os.environ["EDISON_SECRET_KEY"],
    },
})
new MCPServerStreamableHttp({
  url: process.env.EDISON_MCP_URL!,
  name: 'Edison Watch',
  requestInit: {
    headers: {
      'x-edison-conversation-id': conversationId,
      'x-edison-secret-key': process.env.EDISON_SECRET_KEY!,
    },
  },
});