Skip to content

Transports

Every transport funnels into one set of handlers, so behaviour and payloads are identical whichever one you use.

On this page
  1. MCP over streamable HTTP
  2. REST tool execution
  3. OpenAPI and Custom GPTs
  4. Running the server yourself

MCP over streamable HTTP

The native transport for Model Context Protocol clients. The endpoint accepts GET and POST; sessions are keyed by the Mcp-Session-Id header the server returns from the initialize call.

MCP endpoint
https://mcp.postmcpai.com/mcp?apikey=pmcp_sec_YOUR_SECRET_KEY

Client-by-client setup for Claude, ChatGPT, Claude Desktop, Cursor and Claude Code is in the guide Connect an AI client. A tool call on the wire looks like this:

tools/call
{
  "method": "tools/call",
  "params": {
    "name": "get_connected_accounts",
    "arguments": {}
  }
}

REST tool execution

Every tool is also a POST endpoint under /api/tools/:name. Plain JSON in, plain JSON out; the name segment is the tool name in snake_case. Tools without arguments take an empty object.

cURL
curl -X POST "https://api.postmcpai.com/api/tools/get_user_info" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $POSTMCPAI_API_KEY" \
  -d '{}'

Each tool page shows the same request in cURL, JavaScript, Python and as an MCP call. Start with get_user_info: a 200 means the key is wired up correctly.

OpenAPI and Custom GPTs

An OpenAPI 3.0.1 document is generated per request against the host it is served from, so it can be imported straight into a ChatGPT Custom GPT action or any OpenAPI tooling.

OpenAPI spec
https://api.postmcpai.com/openapi.json
  1. 1
    In the Custom GPT editor, add an Action and import from URL
    Paste the spec URL above. Every tool appears as an operation.
  2. 2
    Set authentication to API key
    Header name x-api-key, or Authorization with the Bearer prefix. Paste your key.
  3. 3
    Test with get_user_info
    Ask the GPT who it is signed in as. It should answer with the plan and credit balance.

Running the server yourself

The server behind all three transports is open source, MIT licensed and published on npm as @postmcpai/server. Without a PORT it speaks MCP over stdio for local clients; with one it serves the HTTP endpoints above from your own host.

Terminal
export POSTMCPAI_API_KEY="pmcp_sec_YOUR_SECRET_KEY"
export PORT=3000
npx -y @postmcpai/server
Environment variables for a self-hosted server
VariableMeaningDefault
POSTMCPAI_API_KEYRequired. The key used for every backend call.none
POSTMCPAI_PROJECT_IDWorkspace to act on, overriding the one bound to the key.the key’s workspace
PORTSet it to serve streamable HTTP, REST and OpenAPI. Unset means stdio.unset

Source, licence and the full environment reference are on the MCP server page.