# Social Publishing Infrastructure for AI Agents

Human page: https://pubnio.com/use-cases/ai-agents

## Summary

PubNio is built agent-first: connect Claude Code, OpenAI Codex, OpenAI Dots, Cursor, OpenCode, Grok & Grok Bot, Meta Muse & Muse Code, or custom agent loops to https://pubnio.com/mcp with browser OAuth. Agents use two Code Mode tools, search and execute, to inspect accounts, stage media, validate drafts before sending, schedule weekly queues, and verify confirmed deliveries without ever holding raw OAuth tokens.

## Capabilities & contract

| Capability | PubNio contract |
| --- | --- |
| Hosted MCP endpoint | https://pubnio.com/mcp (remote Streamable HTTP with browser OAuth) |
| Supported coding agents | Claude Code, OpenAI Codex, Cursor, OpenCode, and any standard MCP client |
| Token isolation | Social provider OAuth tokens stay encrypted server-side; agents never inspect or exfiltrate credentials |
| Preflight self-correction | 27 typed IssueCode errors tell the agent exactly what to fix (caption length, aspect ratio, TikTok disclosure) before publishing |
| Replay-safe retries | Idempotency keys prevent duplicate live posts when an agent retries a tool call after a network hiccup |
| Agent-friendly pricing | 100 free confirmed publishes/mo, $0/account, and $0 for drafts or failed validation runs |

## Why raw social APIs break agent workflows

- Unstructured HTTP 400 errors that cause LLM tool loops to hallucinate retries or burn rate limits.
- Long-lived OAuth secrets pasted into agent .env files with over-broad workspace permissions.
- Duplicate posts published when an agent times out waiting on slow video upload containers.
- Per-account SaaS seat fees that punish indie builders experimenting with multi-channel agents.

## Why agents succeed on the first call with PubNio

- One command registers https://pubnio.com/mcp and completes scoped browser OAuth sign-in.
- Flat tool schemas designed for reliable tool calling across frontier and lightweight models.
- Draft-first mode lets agents prepare validated multi-channel campaigns for human approval before publishing.
- Every public docs and reference page ships a clean .md mirror plus /llms.txt discovery.

## TypeScript SDK example

```ts
// Headless release agent (GitHub Actions / Cloudflare Worker)
const draft = await ws.posts.create({
  isDraft: true,
  text: releaseSummary,
  targets: connectedAccounts.map((a) => ({ accountId: a.id, placement: "feed" })),
});

const preflight = await ws.posts.validate(draft.postId);
if (preflight.valid) {
  await ws.posts.publish(draft.postId, { idempotencyKey: `release-${gitTag}` });
}
```

## Hosted MCP example

```sh
claude mcp add --transport http pubnio https://pubnio.com/mcp
codex mcp add pubnio --url https://pubnio.com/mcp && codex mcp login pubnio
opencode mcp add pubnio --url https://pubnio.com/mcp && opencode mcp auth pubnio
```

## CLI example

```sh
pnio login
pnio accounts list --json
pnio posts create --draft --file launch.json --json
pnio posts validate pst_01j9k4 --json
```

## FAQs

### Can an AI agent connect or delete my social accounts?

No. Account authorization, OAuth revocation, API keys, and webhook secrets remain human-controlled in the PubNio workspace or administrative API/CLI, keeping autonomous agents scoped to drafting, validation, scheduling, publishing, and reading status.

### Can agents prepare drafts for human review instead of publishing immediately?

Yes. Agents can save a draft and validate it without publishing, leaving validated multi-channel drafts ready for a person to approve in your product or the PubNio workspace.

### Which MCP transport does PubNio use?

PubNio runs remote Streamable HTTP MCP at https://pubnio.com/mcp with OAuth 2.1 browser sign-in, so there is no local stdio server to install or static key to manage.
