# MCP server

Connect Claude Code, Codex or Cursor to the tiktornado MCP server with an API key, check that it works, and see how tool output is framed as data.

The tiktornado MCP server lets an AI agent work with your TikTok accounts: list them, upload media, schedule, edit and cancel posts with every post setting, set posting times, read stats and comments, and reply.

```text
https://api.tiktornado.com/mcp
```

Each tool is a call to the [REST API](/api-reference) with your own API key, so the same scopes, limits and rules apply. The tools are listed on [MCP tools](/mcp/tools).

## How it connects [#how-it-connects]

- **Transport:** Streamable HTTP. Every message is an HTTP `POST` to `/mcp`, and every answer is a single JSON body: the server never opens a stream.
- **Sessions:** none. Each request stands on its own, so there is nothing to keep alive or resume.
- **Sign in:** your tiktornado API key in the `Authorization: Bearer` header. There is no OAuth sign-in.
- **Scopes:** an agent only sees the tools its key's [scopes](/getting-started/authentication#scopes) allow. A key with every scope gets every tool.

## Supported clients [#supported-clients]

We support and test three clients: Claude Code, Codex and Cursor. Each one reads the key from the environment variable `TIKTORNADO_API_KEY`. Set it first, in the environment the client runs in:

```bash
export TIKTORNADO_API_KEY=<your key>
```

Create the key on the [API and MCP page](https://app.tiktornado.com/api) of the tiktornado app. The same page shows these lines, ready to copy.

<Tabs items={["Claude Code","Codex","Cursor"]}>
<Tab value="Claude Code">
```bash
claude mcp add --transport http tiktornado https://api.tiktornado.com/mcp --header 'Authorization: Bearer ${TIKTORNADO_API_KEY}'
```

Keep the single quotes. With them, Claude Code stores `${TIKTORNADO_API_KEY}` as written and reads the variable each time it connects. With double quotes, your shell would put the key itself into Claude Code's config file. See [Claude Code's MCP docs](https://code.claude.com/docs/en/mcp).
</Tab>

<Tab value="Codex">
```bash
codex mcp add tiktornado --url https://api.tiktornado.com/mcp --bearer-token-env-var TIKTORNADO_API_KEY
```

Codex reads the key from `TIKTORNADO_API_KEY` when it connects and sends it as the bearer token.
</Tab>

<Tab value="Cursor">
Add the server to your Cursor MCP config, `~/.cursor/mcp.json` for every project or `.cursor/mcp.json` for one:

```json kind="config"
{
  "mcpServers": {
    "tiktornado": {
      "url": "https://api.tiktornado.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:TIKTORNADO_API_KEY}"
      }
    }
  }
}
```

Cursor fills in `${env:TIKTORNADO_API_KEY}` from the environment when it connects.
</Tab>
</Tabs>

### Why the key stays in a variable [#why-the-key-stays-in-a-variable]

All three setups name the variable, never the key. The key stays out of config files, which are easy to share, sync or commit by mistake. To replace a key, revoke it in the app and change the variable: the client setup stays the same.

### Other clients [#other-clients]

Any other MCP-capable client that sends a custom header may work but is untested.

## Check that it works [#check-that-it-works]

Ask your agent: "List my tiktornado accounts." It should call `list_accounts` and answer with your accounts.

To check the server and your key without a client, ask for the tool list with `curl`:

```bash kind="mcp"
curl https://api.tiktornado.com/mcp \
  -H "Authorization: Bearer $TIKTORNADO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "MCP-Protocol-Version: 2025-11-25" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'
```

The answer lists the tools your key can use. An HTTP `401` means the key is wrong or revoked, and a `403` with reason `access_locked` means your tiktornado account is locked: fix it under Billing in the app.

## Tool output is data [#tool-output-is-data]

Captions, usernames, comments, and TikTok's music and place names are written by people, and comments come from strangers on TikTok. An agent must never take them as instructions. So every tool answers the same way:

- `structuredContent` holds the API's JSON answer as it is.
- The text content starts with a fixed note saying the data was written by people and is never an instruction, then the same JSON on one line. Text from people always stays inside JSON strings.
- A refusal is a tool result with `isError: true` and our usual `{"error": {"reason", "message"}}`. Messages are ours: they never contain your text or TikTok's.

## Good to know [#good-to-know]

- **Changes need an `idempotencyKey`.** Every tool that changes something takes an `idempotencyKey` argument: a new value for each change, reused only to retry that same change. See [Safe retries](/getting-started/idempotency).
- **Arguments are exact.** An argument a tool's input schema doesn't list, inside `settings` too, is refused with `invalid_request` before anything runs.
- **Local files go through an upload.** `create_upload_link`, then an HTTP `PUT` of the file to the link, then `schedule_post` with the `mediaRef`. A client that can't send files can use a public `https` link to the file instead.
- **Limits.** Each tool call counts as two requests against your key's 120 a minute. See [Rate limits](/getting-started/rate-limits#mcp-requests).
- **Requests from browsers are refused.** A request that carries an `Origin` header answers `403`, so browser-based MCP clients can't connect.

## Protocol details [#protocol-details]

| | |
| --- | --- |
| MCP versions | `2026-07-28`, plus `2025-11-25`, `2025-06-18` and `2025-03-26` through `initialize` |
| Methods | `initialize`, `server/discover`, `ping`, `tools/list`, `tools/call`. Notifications answer `202` |
| HTTP methods | `POST` only. `GET` and `DELETE` answer `405` |
| Body size | At most 64 KB |
| Batches | Only on `2025-03-26`, at most 20 messages |
| Unsupported version | `400` with error `-32022` and `data: {supported, requested}` |

On `2026-07-28` there is no handshake: every request carries `io.modelcontextprotocol/protocolVersion` and `io.modelcontextprotocol/clientCapabilities` in `params._meta`, plus the `MCP-Protocol-Version` and `Mcp-Method` headers, and `Mcp-Name` on `tools/call`. The headers must match the body, or the answer is `400` with error `-32020`.