Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt

Use this file to discover all available pages before exploring further.

Corsair App supports two common OpenAI paths:
  • Responses API remote MCP tool config
  • OpenAI Agents SDK MCPServerStreamableHttp
Both use the same tenant mcpHttpUrl and tenant MCP secret.

Install

npm install @corsair-dev/app openai
For the Agents SDK example:
npm install @openai/agents

Responses API

Use getOpenAiMcpConfig() to create the remote MCP tool config.
import OpenAI from "openai";
import { createClient, getOpenAiMcpConfig } from "@corsair-dev/app";

const corsair = createClient({
  apiKey: process.env.CORSAIR_API_KEY!,
});

const tenant = corsair
  .instance(process.env.CORSAIR_INSTANCE_ID!)
  .tenant("dev");

const conn = await tenant.mcpKeys.connection();

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY!,
});

const response = await openai.responses.create({
  model: "gpt-4.1",
  tools: [
    getOpenAiMcpConfig({
      url: conn.mcpHttpUrl,
      apiKey: process.env.CORSAIR_MCP_API_KEY!,
    }),
  ],
  input: "Star the corsairdev/corsair repo on GitHub",
});

console.log(response.output_text);
getOpenAiMcpConfig() returns:
{
  type: "mcp",
  server_label: "corsair",
  server_url: "https://...",
  headers: {
    Authorization: "Bearer ..."
  }
}

OpenAI Agents SDK

Use createOpenAiMcpServer() when the OpenAI Agents SDK expects MCP server instances.
import { Agent, run } from "@openai/agents";
import { createClient, createOpenAiMcpServer } from "@corsair-dev/app";

const corsair = createClient({
  apiKey: process.env.CORSAIR_API_KEY!,
});

const tenant = corsair
  .instance(process.env.CORSAIR_INSTANCE_ID!)
  .tenant("dev");

const conn = await tenant.mcpKeys.connection();

const corsairServer = await createOpenAiMcpServer({
  url: conn.mcpHttpUrl,
  apiKey: process.env.CORSAIR_MCP_API_KEY!,
});

const agent = new Agent({
  name: "corsair-agent",
  instructions: "Use Corsair tools to complete the user's requested action.",
  mcpServers: [corsairServer],
});

const result = await run(
  agent,
  "Star the corsairdev/corsair repo on GitHub",
);

console.log(result.finalOutput);

Key usage

ValueUse
OPENAI_API_KEYAuthenticates your OpenAI request
CORSAIR_API_KEYDeveloper API key for provisioning and fetching tenant connection info
CORSAIR_MCP_API_KEYTenant MCP secret sent to Corsair’s MCP server
Do not use your developer API key as the MCP bearer token. The MCP bearer token should be the tenant secret returned by tenant.mcpKeys.create().