Skip to main content

OpenAI Platform API

OpenAI Platform API is an API for interacting with OpenAI models. It supports tool calling and remote MCP tools

Quickstart

First, you'll need an mcp.run token to authenticate yourself. Run this command and follow the instructions to get a token:

npx --yes -p @dylibso/mcpx gen-session
Token Format

The token will be of the form mcpx/<username>/<redacted-token>

You can now pass this into the OpenAI responses API like so:

curl https://api.openai.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-openai-key>" \
-d '{
"model": "gpt-4.1",
"tools": [
{
"type": "mcp",
"server_label": "mcprun",
"server_url": "https://www.mcp.run/api/mcp/sse?profile=<your/profile>",
"require_approval": "never",
"headers": {
"Cookie": "sessionId=<your-session-token>"
}
}
],
"input": "What tools do you have access to?"
}'
Setting Variables
  • Set <your-openai-key> to a valid OpenAI API key
  • Set <your-session-token> to the mcp.run token you just generated
  • Set <your/profile> to one of your profiles
    • For example, for a personal profile, if your username is benjamin and the profile you want is named my-profile, you could set profile to benjamin/my-profile
    • Or, if you are part of an org with a name like dylibso, and you want to connect to a profile named our-profile, you could set profile to dylibso/our-profile