Framework Integration

OpenAI Agents SDK & Codex MCP Crypto Trading

Teams building programmatic GPT trading workflows can skip hand-writing dozens of OpenAI function-calling schemas. Eterna exposes 3 compact MCP tools (`search_sdk`, `search_examples`, `execute_code`) that keep token overhead low even on long reasoning chains.

Updated: By Eterna Engineering (MCP & Agent Infrastructure Team)Read as Markdown
Quick Answer

The OpenAI Agents SDK (TypeScript and Python) and OpenAI Responses API both support remote streamable-HTTP MCP servers natively. Point `MCPServerStreamableHttp` or the `mcp` tool config at `https://mcp.eterna.exchange/mcp` with an OAuth bearer token to give GPT models all 30+ `eterna.*` trading and technical analysis methods.

OpenAI SurfacesAgents SDK + CodexWorks with Responses API and ChatGPT too
MCP TransportStreamable HTTPhttps://mcp.eterna.exchange/mcp
Tool Overhead3 MCP toolsAvoids 50-tool JSON schema bloat
Execution Fees0.014% / 0.035%Regular-tier USDT perp maker / taker
https://mcp.eterna.exchange/mcp

1. Connect OpenAI Agents SDK (TypeScript)

Attach Eterna as a streamable HTTP MCP server so the agent discovers SDK docs on demand and runs atomic TypeScript strategies inside `execute_code`.

openai-eterna-agent.ts
import { Agent, run, MCPServerStreamableHttp } from "@openai/agents";

const eternaMcp = new MCPServerStreamableHttp({
  url: "https://mcp.eterna.exchange/mcp",
  name: "eterna",
  requestInit: {
    headers: {
      Authorization: `Bearer ${process.env.ETERNA_ACCESS_TOKEN}`,
    },
  },
});

await eternaMcp.connect();

const trader = new Agent({
  name: "EternaPerpAnalyst",
  model: "gpt-5",
  instructions:
    "Use Eterna MCP search_sdk and execute_code to inspect live market data and manage risk. Never exceed 3x leverage. Always set stopLoss and takeProfit.",
  mcpServers: [eternaMcp],
});

const result = await run(
  trader,
  "Check BTCUSDT and ETHUSDT 1h RSI, 50 EMA, and my open positions. Return a concise trade plan without placing an order yet.",
);
console.log(result.finalOutput);
await eternaMcp.close();
Note: Obtain an OAuth bearer token via Eterna OAuth 2.1 device flow (`npx @eterna-hybrid-exchange/cli auth login`).

2. Connect OpenAI Codex CLI

Add Eterna to `~/.codex/config.toml` so Codex coding sessions can query live crypto prices, test indicator scripts, and review open risk alongside your codebase.

~/.codex/config.toml
[mcp_servers.eterna]
url = "https://mcp.eterna.exchange/mcp"
FAQ

Frequently asked questions

Why use Eterna MCP instead of custom OpenAI function tools?
Custom function tools require you to maintain exchange auth, REST retries, HMAC signatures, indicator math, and 30+ JSON schemas. Eterna MCP exposes 3 tools and runs complete TypeScript logic inside a managed Deno sandbox.
How do I authenticate a headless OpenAI agent on a server?
Use Eterna's OAuth 2.1 device flow via `npx @eterna-hybrid-exchange/cli` to mint scoped bearer tokens without hardcoding exchange API secrets.
Primary Sources

References & verification links

Start Trading via MCP

Connect your AI agent in 30 seconds

One remote MCP URL. 800+ USDT perpetuals, 380+ spot pairs, 0.014% maker / 0.035% taker, no KYC.

View on GitHub