> For the complete documentation index, see [llms.txt](https://docs.trezalabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trezalabs.com/api/mcp-server.md).

# MCP Server

Treza ships a remote [Model Context Protocol](https://modelcontextprotocol.io/) server, so AI assistants like Claude can build pipelines, run them, and inspect the results on your behalf.

```
https://trezalabs.com/api/mcp
```

The server speaks Streamable HTTP and authenticates every request. You can connect with OAuth (sign in with your Treza account, no key handling) or with an API key.

***

## Connect from claude.ai

Claude's web and desktop apps support custom connectors:

1. Open **Settings → Connectors → Add custom connector**.
2. Enter a name (for example, `Treza`) and the URL `https://trezalabs.com/api/mcp`. Leave the OAuth fields empty.
3. Click **Add**, then **Connect**. You'll be sent to Treza to sign in and approve access, then returned to Claude.

That's it. Ask Claude things like "list my Treza pipelines" or "run my daily short pipeline and tell me when it finishes."

***

## Connect from Claude Code

```bash
claude mcp add --transport http treza https://trezalabs.com/api/mcp
```

Claude Code discovers the OAuth flow automatically and opens a browser window to sign in. To use an [API key](/api/api-keys.md) instead:

```bash
claude mcp add --transport http treza https://trezalabs.com/api/mcp \
  --header "Authorization: Bearer treza_live_..."
```

Any other MCP client that supports Streamable HTTP works the same way: point it at the URL, and either complete the OAuth flow or send your key as a bearer token.

***

## Authentication and scopes

| Method  | How                                                         | Scopes                                                                 |
| ------- | ----------------------------------------------------------- | ---------------------------------------------------------------------- |
| OAuth   | Sign in with your Treza account when the client prompts you | `pipelines:read`, `pipelines:run`, `pipelines:write`, `keys:provision` |
| API key | `Authorization: Bearer treza_live_...` header               | Whatever the key was granted                                           |

API keys must carry the `pipelines:read` scope to connect, `pipelines:run` to start runs, and `pipelines:write` for the authoring tools. Grant scopes when you create the key on the **API keys** page. See [API Keys](/api/api-keys.md).

{% hint style="info" %}
Connected before late August 2026? Your connection likely holds only the read and run scopes: the server used to advertise just `pipelines:read`, and clients request exactly what is advertised. Disconnect and re-add the connector to pick up the full set. Do the same after any server update that changes tool schemas, since clients cache the tool list when the session opens.
{% endhint %}

Access is account-scoped either way: the server only ever sees pipelines owned by the signed-in account, and requests for anything else return an error.

***

## Available tools

**Find and inspect work**

| Tool             | Description                                                                                                                                                                                                |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `list_pipelines` | List your pipelines with status and a summary of recent runs                                                                                                                                               |
| `get_pipeline`   | One pipeline's metadata plus a graph summary; pass `includeGraph` for the complete graph with every node's config, required reading before an update, since a graph rebuilt from the summary drops configs |
| `list_runs`      | Recent runs for a pipeline, newest first                                                                                                                                                                   |
| `get_run`        | One run's status, per-node results, and output media URLs                                                                                                                                                  |

**Author a pipeline** (requires `pipelines:write`)

| Tool               | Description                                                                                                                                                         |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `list_node_types`  | Every node type available, by category                                                                                                                              |
| `get_node_type`    | One node type's ports and config schema; on model-bearing nodes it includes the live model catalog with each model's supported durations, aspect ratios, and voices |
| `create_pipeline`  | Create a pipeline from a node graph                                                                                                                                 |
| `update_pipeline`  | Change an existing pipeline's graph or metadata                                                                                                                     |
| `publish_pipeline` | Publish the current draft so scheduled and API runs pick it up                                                                                                      |

An assistant can learn the node vocabulary and build a working pipeline from a description. You do not have to draw one on the canvas first.

**Budget and run**

| Tool                      | Description                                                                                           |
| ------------------------- | ----------------------------------------------------------------------------------------------------- |
| `estimate_run_cost`       | Estimated charge for a pipeline before starting it                                                    |
| `get_credit_balance`      | Prepaid balance, plan usage, and how to top up                                                        |
| `run_pipeline`            | Start a run in the background and return its `runId` immediately                                      |
| `list_connected_channels` | The YouTube channels and TikTok accounts connected to the account, with the ids publishing nodes need |
| `create_api_key`          | Mint a durable scoped key for headless use (OAuth connections only)                                   |

***

## Runs are asynchronous

Video generation takes minutes, so `run_pipeline` never blocks. It starts the run on Treza's background workers and returns a `runId` right away; the assistant then polls `get_run` until the status is no longer `running`. Finished runs include output URLs for the generated media.

{% hint style="warning" %}
Runs started over MCP are real runs: they draw from your prepaid credit balance and appear in run history, exactly like runs started from the dashboard or the [Pipeline API](/api/pipeline-api.md).
{% endhint %}

***

## Credits, and paying without a human

Call `get_credit_balance` before committing to expensive work. It returns the current balance, roughly how many videos that covers, and where more credits come from:

```json
{
  "balanceUsd": 16.13,
  "typicalVideoChargeUsd": 1.06,
  "approxVideosRemaining": 15,
  "topUpUrl": "https://www.trezalabs.com/platform/settings",
  "x402": {
    "url": "https://www.trezalabs.com/api/billing/credits/x402",
    "topUpPerCallUsd": 5,
    "network": "eip155:8453"
  }
}
```

`topUpUrl` is for a signed-in human with a card. The `x402` block, when present, is for an agent that holds a wallet: pay that endpoint in USDC on Base and the credits post immediately, with nobody in the loop. See [x402 Payments](/api/mcp-server/x402-payments.md).

***

## What still needs a person

Three things no tool here can do, so ask for them rather than working around them:

1. **The Treza account.** Created by signing in during the OAuth flow you already completed.
2. **Credits**, unless the agent pays via x402 as above.
3. **A connected channel**, if the pipeline publishes. `list_connected_channels` returns the ids a `youtube-upload` or `tiktok-upload` node needs; connecting a new one happens under **Settings → Connected accounts**.

***

## Related

* [API Keys](/api/api-keys.md) - create a key with `pipelines:*` scopes.
* [x402 Payments](/api/mcp-server/x402-payments.md) - let an agent fund its own runs.
* [Pipeline API](/api/pipeline-api.md) - call a published pipeline over plain HTTP.
* [Build your first pipeline](/pipelines/quickstart.md) - end-to-end from the canvas.
