Skip to content

Hosted MCP

Give an MCP client the full PubNio API through two Code Mode tools over Streamable HTTP.

PubNio serves its hosted MCP endpoint at https://pubnio.com/mcp over Streamable HTTP. Connect with WorkOS OAuth or a workspace API key.

Rather than flooding your agent’s context window with dozens of endpoint tools, PubNio uses Code Mode (search + execute) backed directly by the live OpenAPI 3.1 contract (PubNioApi). Your agent inspects only the endpoints it needs and runs multi-step workflows in an isolated V8 sandbox.

Connect your agent

Add PubNio using the instructions for your coding agent. Complete OAuth in your browser, then ask the agent to list your PubNio workspaces.

Codex

codex mcp add pubnio --url https://pubnio.com/mcp
codex mcp login pubnio

Claude Code

claude mcp add --transport http pubnio https://pubnio.com/mcp

Open /mcp in Claude Code, select PubNio, and complete browser sign-in.

Cursor

Merge this entry into mcpServers in your project’s .cursor/mcp.json. Open Cursor’s MCP settings to connect PubNio and complete browser sign-in.

{
  "mcpServers": {
    "pubnio": {
      "url": "https://pubnio.com/mcp"
    }
  }
}

OpenCode

opencode mcp add pubnio --url https://pubnio.com/mcp
opencode mcp auth pubnio

Muse & Muse Code

Add PubNio under mcp_servers in ~/.config/muse/settings.json (keeping "schema_version": 1 at the top level):

{
  "schema_version": 1,
  "mcp_servers": {
    "pubnio": {
      "transport": "streamable_http",
      "url": "https://pubnio.com/mcp"
    }
  }
}

Then run muse mcp login pubnio and check /mcp inside a Muse Code session.

Grok & Grok Bot

Open grok.com/connectors, select New Connector → Custom, enter https://pubnio.com/mcp, and complete OAuth sign-in. For headless xAI API runs, pass https://pubnio.com/mcp in the tools array as an mcp tool with a scoped workspace API key.

OpenAI Dots

In your ChatGPT workspace Plugins / Custom MCP settings, choose Add → Create custom MCP server, enter https://pubnio.com/mcp, and complete OAuth sign-in. Always-on Dots automatically inherit the connected workspace tools across background tasks.

For any other OAuth-capable client, add https://pubnio.com/mcp as a remote Streamable HTTP server and sign in when the client prompts you.

API key

A client that sends static headers can use a workspace API key instead of OAuth. Send Authorization: Bearer pubnio_sk_.... The key is bound to one workspace (codemode.workspaceId), so API-key calls may omit workspaceId. Keys with only read see read-only endpoints; keys with publish, engage, or ads_manage see the operations their scopes allow, and Core enforces the exact scope on every call.

Code Mode tools

tools/list exposes exactly two tools:

Tool What it does
search Run a JS arrow function over await codemode.spec() (your caller’s filtered OpenAPI 3.1 spec with $refs resolved inline).
execute Run a JS arrow function calling await codemode.request({ method, path, query, headers, body }) and await codemode.sleep(ms) in an isolated sandbox with zero outbound internet access.

Authentication is always attached on the host side — tokens and API keys never enter the sandbox. Every response returns { status, ok, data, requestId, apiVersion } using the exact same schemas, IDs, and RFC 9457 Problem Details as the HTTP API.

Read-only mode

Add ?readOnly=1 (or send X-PubNio-Read-Only: 1) to restrict both search and execute to GET endpoints only:

https://pubnio.com/mcp?readOnly=1

Any non-GET call in read-only mode is rejected with 403 read_only_mode. API keys without publish, engage, or ads_manage scopes are always read-only.

Publish from an MCP client

Server instructions include the golden-path endpoints so your agent can publish in a single execute call without needing a prior search:

  1. Discover workspace (OAuth only): GET /api/v1/workspaces. API keys already know codemode.workspaceId.
  2. List ready accounts: GET /api/v1/integrations?workspaceId=<id>&ready=true.
  3. Inspect rules: GET /api/v1/capabilities.
  4. Add media (optional): POST /api/v1/media/import with { url } or POST /api/v1/media/inline with { data, mimeType } (base64 up to 8 MiB), then poll GET /api/v1/media/{mediaId}/status.
  5. Publish, schedule, or draft: POST /api/v1/posts with text and one of platforms, accounts, or targets (plus optional media, scheduledAt, or isDraft: true).
  6. Wait or recover: poll GET /api/v1/posts/{postId} with await codemode.sleep(1000) within the 30-second execution budget, or call POST /api/v1/posts/{postId}/targets/{targetId}/retry / /reconcile.

Use search to explore any other domain in the API — weekly queues and calendar scheduling, inbox conversations/comments/mentions, organic analytics, outbound webhooks, and read-only ads.

Authorization

The server advertises its protected-resource metadata at /.well-known/oauth-protected-resource/mcp. Requests without a token receive a 401 challenge. PubNio accepts either a WorkOS user-delegated OAuth token or a workspace API key.

OAuth tokens must be user tokens for the exact MCP audience. PubNio rejects M2M, WorkOS agent, and Widget token families. Workspace membership and the owner role for publish and schedule changes are checked by Core. API keys are workspace-bound and use read, publish, engage, ads_read, and ads_manage scopes. Invalid and revoked keys receive the same 401 challenge.

Type to search…

↑↓ navigate↵ selectEsc close