MCP & Integrations/August 5, 2026

Using Refine's MCP Server with OpenAI: ChatGPT, the Responses API & the Agents SDK

Robin Pautigny

Robin Pautigny

Co-founder, Refine

Using Refine's MCP Server with OpenAI: ChatGPT, the Responses API & the Agents SDK

Summary

OpenAI adopted MCP across its stack: the Responses API accepts remote MCP servers as tools, the Agents SDK wires them into autonomous agents, and ChatGPT and Codex support MCP connectors. This guide shows how to point each of them at Refine's MCP server so GPT models can read your AI visibility data, manage your prompt universe and trigger content generation — with copy-paste code for the two API routes.

Why this matters

Your GEO data should not be locked to one assistant. The same Refine MCP endpoint that serves Claude serves OpenAI — same URL, same API key, same fifteen tools. Whatever your team builds on, your agents get the same view of your AI visibility.

OpenAI and MCP: What Connects Where

OpenAI supports MCP at four levels, and the right one depends on what you are building:

  • Responses API — pass a remote MCP server directly in the tools array of a single API call. Best for one-shot analysis and server-side features.
  • Agents SDK — attach MCP servers to long-running agents with handoffs, guardrails and tracing. Best for autonomous GEO workflows.
  • ChatGPT — custom connectors bring MCP tools into the chat interface for your workspace.
  • Codex — OpenAI’s coding agent reads MCP servers from its config, useful when your GEO automation lives next to your codebase.

The Responses API: Remote MCP in One Request

The fastest route: declare Refine as an MCP tool and the OpenAI platform handles the tool-calling loop server-side. No infrastructure on your end.

JavaScript (OpenAI SDK)
const response = await client.responses.create({
  model: "gpt-5",
  tools: [
    {
      type: "mcp",
      server_label: "refine",
      server_url: "https://app.refine-app.com/api/mcp/mcp",
      headers: { Authorization: "Bearer rfn_live_your_key" },
      require_approval: "never",
    },
  ],
  input:
    "What's my mention rate over the last 30 days, and which competitor gained the most share?",
});

The model lists the available Refine tools, calls the ones it needs — get_visibility, get_prompt_history, list_competitors — and returns a synthesized answer grounded in your actual data.

The Agents SDK: GEO Agents in a Few Lines

For recurring or multi-step work, wrap the same server in an agent. The hosted MCP tool keeps the tool-calling loop on OpenAI infrastructure:

Python (OpenAI Agents SDK)
from agents import Agent, HostedMCPTool, Runner

geo_analyst = Agent(
    name="GEO Analyst",
    instructions=(
        "You monitor the brand's AI search visibility with the "
        "Refine tools. Always ground claims in tool results."
    ),
    tools=[
        HostedMCPTool(
            tool_config={
                "type": "mcp",
                "server_label": "refine",
                "server_url": "https://app.refine-app.com/api/mcp/mcp",
                "headers": {"Authorization": "Bearer rfn_live_your_key"},
                "require_approval": "never",
            }
        )
    ],
)

result = Runner.run_sync(
    geo_analyst,
    "Find my weakest prompt and start a blog article for it.",
)

ChatGPT and Codex

In ChatGPT, custom MCP connectors are added from the connectors settings (developer mode for full tool access on Plus, Pro and Business workspaces). Connector auth support varies by workspace tier — if your setup requires OAuth and can't attach a bearer key yet, use the Responses API or Agents SDK routes above, which fully support header-based auth today.

Codex reads MCP servers from its config file. Recent versions support remote Streamable HTTP servers natively; for older stdio-only versions, bridge with mcp-remote:

~/.codex/config.toml
[mcp_servers.refine]
command = "npx"
args = [
  "-y", "mcp-remote",
  "https://app.refine-app.com/api/mcp/mcp",
  "--header", "Authorization: Bearer rfn_live_your_key",
]

A Concrete Workflow: The Self-Steering Content Loop

Here is the loop we see teams automate first, end to end, on a weekly schedule:

  • The agent pulls 30-day visibility history and ranks prompts by mention-rate decline.
  • For the two weakest prompts, it reads the raw AI answers and identifies which sources the engines cite instead of you.
  • It calls generate_content for each prompt — a blog article and a Reddit response — grounded in your best existing pages as source URLs.
  • It polls get_content until the drafts are ready and delivers them with a summary of why these prompts, why now.
  • Next week, it measures whether the published content moved the mention rate — and re-targets.

Practical Notes and Limits

  • Same key, same limits as every client: 60 requests per minute per key, keys scoped to one brand, up to 20 active keys.
  • Set require_approval to "never" only for read-heavy agents you trust; keep approval on for agents that create or delete prompts.
  • Content generation is gated to the Autopilot plan; analytics tools work from the Visibility plan up.
  • Store the API key in your secret manager and inject it at runtime — never hardcode it in agent instructions or repo files.

The Bottom Line

One endpoint, every OpenAI surface: a single Responses API call for quick answers, the Agents SDK for autonomous GEO loops, connectors for ChatGPT and Codex. Your GPT agents stop reasoning about your AI visibility from memory and start operating on live data.

Short on time? Have an assistant summarise this page for you.