> 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 ChatGPT and Claude can build pipelines, run them, inspect the results, and turn media you already have into finished videos 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 ChatGPT

Treza is in ChatGPT's plugin directory, so there is no URL to paste:

1. Open [Treza in ChatGPT](https://chatgpt.com/plugins/plugin_asdk_app_6ab579a2fc24819199d8bea61fa8195f), or search for Treza under **Plugins** in ChatGPT, and add it.
2. You'll be sent to Treza to sign in with Google and approve access, then returned to ChatGPT. Signing in creates a Treza account if you don't have one.
3. Mention **@Treza** in a chat, for example "@Treza make a 30-second vertical video about the deep ocean with narration and captions."

***

## 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_..."
```

***

## Connect from Gemini CLI

Treza is a Gemini CLI extension. Install it:

```bash
gemini extensions install https://github.com/treza-labs/treza-plugin
```

Then run `/mcp auth treza` inside Gemini CLI. Your browser opens Treza's sign-in page; sign in with Google and approve access, and the tools are available. The extension also loads Treza's workflow skill, so Gemini checks your credits and tells you the price before it runs a pipeline.

***

## Connect from Cline

In Cline's **MCP Servers** view, open **Remote Servers**, name the server `treza`, enter `https://trezalabs.com/api/mcp`, choose **Streamable HTTP**, and add it. Then click **Authenticate**: your browser opens Treza's sign-in page, and after you approve access you're returned to Cline.

To add it by hand instead, put this in `cline_mcp_settings.json`:

```json
{
  "mcpServers": {
    "treza": {
      "type": "streamableHttp",
      "url": "https://trezalabs.com/api/mcp"
    }
  }
}
```

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. `assemble_video` and `edit_asset` need both `pipelines:run` and `pipelines:write`, because they save a pipeline and then run it. `import_media` and `create_upload_url` need `pipelines:write`, because they add to your library. 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. The last such update, on 25 September 2026, added connecting a channel and publishing from the chat, and the panels for checking a price, picking files, and seeing a pipeline.
{% 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, a summary of recent runs, and each schedule's state and next fire time                                                                                                                                                  |
| `get_pipeline`   | One pipeline's metadata, published-version info, full schedule state, 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; a finished run also carries `outputs`, what its Output nodes returned, keyed the way the [Pipeline API](/api/pipeline-api.md) keys them                                                       |

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

| Tool                      | Description                                                                                                                                                                                                                               |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `list_pipeline_templates` | Ready-made pipelines `create_pipeline` can copy, each with the entry node ids a run's `inputs` are keyed by                                                                                                                               |
| `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, and for video models what a second of video costs at each resolution |
| `create_pipeline`         | Create a pipeline from a template (`templateId`) or from a node graph. A graph with error-level issues is refused, with every issue listed, and nothing is saved                                                                          |
| `update_pipeline`         | Change an existing pipeline's graph or metadata. Send the whole graph back, as `get_pipeline` with `includeGraph` returns it; the same checks apply to what you change                                                                    |
| `publish_pipeline`        | Publish the current draft so scheduled and API runs pick it up                                                                                                                                                                            |
| `set_schedule_paused`     | Pause or resume a published pipeline's schedule without touching the deployed graph                                                                                                                                                       |

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.

Every edge names the two nodes it joins and a port on each, for example `{"source": "music", "sourceHandle": "audio", "target": "sequence", "targetHandle": "shots"}`, using the port ids `get_node_type` lists. So that a saved pipeline runs the way it was asked to, the authoring tools refuse settings the pipeline would otherwise ignore or quietly change, and each refusal names what would work instead:

* a config key the node does not have, or a value outside a field's options or range
* a model id that is not in the live catalog, or a duration, aspect ratio, resolution, or voice the chosen model does not offer
* a new wire that uses the generic `in` or `out` port on a node with several ports on that side, where the engine would have to guess which one you meant (`update_pipeline` refuses it; `create_pipeline` warns, so a copy of a working pipeline still saves)

Only what the call changes is held to these checks. Resending an older pipeline unchanged never fails over settings it already had.

Schedules are authored as a `schedule-trigger` node and only fire from the published snapshot: a schedule that exists only on the draft is inert until `publish_pipeline` deploys it. Pausing flips a flag the schedule runner checks, so the published graph stays exactly what was deployed, and resuming starts from the next real slot instead of replaying the slots missed while paused.

**Finish media you already have** (`assemble_video` and `edit_asset` require `pipelines:run` and `pipelines:write`; `import_media` and `create_upload_url` require `pipelines:write`)

| Tool                | Description                                                                                                                                                                                                   |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `list_assets`       | Your library of images, videos, and audio, newest first, filtered by kind or by words in the prompt that made them; the urls it returns are the ones `assemble_video` and `edit_asset` accept                 |
| `assemble_video`    | Join clips into one finished video, over a voiceover and a music bed (from your library, or composed from a description), with burned-in captions if you want them. Free once your account has bought credits |
| `edit_asset`        | Run any transform node over one file: captions, an upscale, background removal, lipsync, a crop, a trim, a logo in a corner of a video or a picture                                                           |
| `import_media`      | Add a file to your library: one you attached in ChatGPT, a public https link, or a local file uploaded through `create_upload_url`                                                                            |
| `create_upload_url` | A one-time link that a client able to run a command (Claude Code, Codex, Cursor) uploads a local file to, for `import_media` to add                                                                           |
| `open_library`      | Your library on a page of its own, opened from ChatGPT's sidebar or beside a conversation. Only the panel calls it                                                                                            |

These need no graph. See [Finish media you already have](#finish-media-you-already-have) and [Bring in your own files](#bring-in-your-own-files) below.

**Budget and run**

| Tool                      | Description                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `estimate_run_cost`       | Estimated charge for a pipeline before starting it, step by step, and a cheaper video model when one renders the same clip for far less                                                                                                                                                                                                                                                                                                   |
| `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. `inputs` are keyed by entry node id; a key that names no entry node, or an entry node left with nothing saved and nothing passed, is refused before anything runs or is charged. Pass `preview: true` to render only a cheap first look, the first video step as a short Veo 3.1 Lite clip, which `estimate_run_cost` prices when the balance will not cover a full run |
| `list_connected_channels` | The YouTube channels and TikTok accounts connected to the account, with the ids publishing nodes need                                                                                                                                                                                                                                                                                                                                     |
| `connect_channel`         | A link to connect a YouTube channel or TikTok account, which you finish in your own browser                                                                                                                                                                                                                                                                                                                                               |
| `publish_asset`           | Lay a finished video out for review before it posts to YouTube or TikTok; it posts only when you press **Post** in the panel                                                                                                                                                                                                                                                                                                              |
| `confirm_publish`         | Posts what `publish_asset` prepared when you press **Post**. Only the panel calls it                                                                                                                                                                                                                                                                                                                                                      |
| `create_api_key`          | Mint a durable scoped key for headless use (OAuth connections only)                                                                                                                                                                                                                                                                                                                                                                       |

***

## See results in the chat

In apps that show MCP panels, ChatGPT and Claude among them, Treza's results appear as panels in the conversation:

| Tool                                                           | Panel                                                                                                                                                                                                                                                                                                         |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `run_pipeline`, `assemble_video`, `edit_asset`, `import_media` | The file itself, shown like the chat's own images: images, videos you can play, and audio. Click an image to see it larger. Press **Edit** on a file and say in the chat what to change, and the assistant works on that file. A render shows its progress and turns into the finished file when it is ready. |
| `estimate_run_cost`                                            | The price of one run, step by step, against your balance, with a **Start render** button. When a video step would render the same clip for far less on Veo 3.1 Lite, the panel says so and offers the switch. The assistant waits for your go-ahead: the button, or saying so in the chat.                    |
| `list_assets`                                                  | Your library as a grid. Pick files, then tell the assistant in the chat what to do with them, and it works on exactly those, in the order you picked them when order matters.                                                                                                                                 |
| `get_pipeline`                                                 | A map of the pipeline's steps. A scheduled pipeline also shows when it runs next, with a switch to pause or resume it.                                                                                                                                                                                        |
| `set_schedule_paused`                                          | The schedule, with the same switch.                                                                                                                                                                                                                                                                           |
| `publish_asset`                                                | The post as it will go out: the account, the video, the title or caption. On YouTube you can edit the title, description and visibility; on TikTok you choose who can view it, which interactions to allow, and whether it is commercial content. It posts when you press **Post**, never before.             |

Apps that do not show panels get the same answers as text and links.

***

## Connect a channel and publish

Ask the assistant to post a video you made, and it can do the whole thing in the conversation:

1. **Connect the channel once.** `connect_channel` returns a link. Open it, sign in to Treza with the Google account you use with the assistant, and allow YouTube or TikTok to let Treza post. A page tells you when it is connected. The link only ever connects your own channel to your own account: opened while signed in to a different Treza account, it says so and connects nothing.
2. **Review the post.** `publish_asset` lays the video out in a panel with the account it will post as and its title or caption. Nothing is posted yet.
3. **Press Post.** On TikTok you first choose who can view it, which interactions to allow, and whether it promotes you or a brand, as TikTok requires for every post. A video Treza generated is labeled as AI-generated.

Posting needs an app that shows MCP panels, such as ChatGPT or Claude. In a client without panels, publish by building a pipeline that ends in an upload node.

***

## 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, and `outputs` holds what the pipeline returned. `assemble_video` and `edit_asset` work the same way.

{% 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 %}

***

## Finish media you already have

The images, videos, and audio your runs, chats, and uploads produce collect in one library. `list_assets` browses it, and two tools turn what is there into a finished file without drawing a graph:

* **`assemble_video`** joins up to 12 clips, in the order given, into one video. Add `narrationUrl` for a voiceover (everything else ducks under it), and `musicUrl` for a bed beneath it all or `musicPrompt` to have one composed for the cut from a description, set `captions` to burn in a transcript, pick `orientation` (`vertical`, `horizontal`, or `match_first`) and a `transition` between shots (`fade`, `fadeblack`, `wipeleft`, `zoomin`, or `none` for a hard cut), and fade the bed with `audioFadeInSec` and `audioFadeOutSec`. One clip plus a track, or one clip and a `musicPrompt`, is how to score a single video. Stills hold 3 seconds each, or stretch so a longer voiceover plays in full; the result's `lengthSec` says how long the cut will run.
* **`edit_asset`** runs up to 6 nodes over one file, each fed the output of the one before, so "caption it and upscale it" is one call with two `operations`. Any transform node in `list_node_types` works; `get_node_type` shows its config, and a setting the node does not have, or a value it does not offer, is refused with the valid ones listed. A Transcribe stage is added for you wherever an operation needs a transcript. Upload nodes cannot be chained onto an edit: to publish, build a pipeline that ends in the upload node.

Both only accept media this account owns, so take the urls from `list_assets` or from a finished run's outputs, exactly as returned. An example call to `assemble_video`:

```json
{
  "clipUrls": [
    "https://media.trezalabs.com/api/media/generated/.../clip-1.mp4?s=...",
    "https://media.trezalabs.com/api/media/generated/.../clip-2.mp4?s=..."
  ],
  "musicUrl": "https://media.trezalabs.com/api/media/generated/.../bed.mp3?s=...",
  "audioFadeOutSec": 3,
  "captions": true,
  "orientation": "vertical"
}
```

It returns a `pipelineId` and `runId` straight away. Poll `get_run` with both; when the status is `success`, `outputs` holds the finished video, which also lands in `list_assets`:

```json
{
  "status": "success",
  "outputs": {
    "video": "https://media.trezalabs.com/api/media/generated/.../final.mp4?s=..."
  }
}
```

The pipeline these tools run on is scratch space that the next `assemble_video` or `edit_asset` call overwrites, so do not schedule, publish, or share it. To keep a cut as something repeatable, build it as a pipeline with `create_pipeline`.

***

## Bring in your own files

`assemble_video` and `edit_asset` only take files that are already in your library. `import_media` puts one there, from wherever the file is:

| Where the file is                                    | How it gets in                                                                                                             |
| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| Attached in a ChatGPT conversation                   | ChatGPT passes the attachment to `import_media` directly                                                                   |
| At a public https link                               | `import_media` with `url` set to the link                                                                                  |
| On your computer, with Claude Code, Codex, or Cursor | `create_upload_url`, then a `PUT` of the file, then `import_media` with the returned `mediaUrl`                            |
| Attached in Claude on the web or desktop             | Drop it into your library at [trezalabs.com/chat/assets](https://www.trezalabs.com/chat/assets), then ask Claude to use it |

Claude's apps cannot pass an attachment to any MCP tool: Claude sees the image, but has no file or link to hand on. The library page is the way in there.

`import_media` reads the file's type from its contents, not its name. It takes images (PNG, JPEG, WebP, GIF) up to 25 MB, audio (MP3, M4A, WAV, OGG) up to 100 MB, and video (MP4, MOV, WebM) up to 200 MB, and refuses anything else, SVG included. It spends no credits, and returns the library url:

```json
{
  "url": "https://media.trezalabs.com/api/media/generated/uploads/...png?s=...",
  "kind": "image",
  "name": "Logo"
}
```

To put that logo in the bottom-left corner of a video or a picture, pass it to the Overlay node through `edit_asset`. A picture comes back as a PNG the same size:

```json
{
  "sourceUrl": "https://media.trezalabs.com/api/media/generated/.../video.mp4?s=...",
  "operations": [
    {
      "nodeType": "overlay",
      "config": { "position": "bottom-left", "sizePct": 12 },
      "inputs": { "image": "https://media.trezalabs.com/api/media/generated/uploads/...png?s=..." }
    }
  ]
}
```

With a local file, `create_upload_url` takes the file's `contentType` (for example `image/png`) and returns a `PUT` link that expires in 15 minutes, together with the command to run:

```bash
curl -sSf -X PUT -H 'Content-Type: image/png' --upload-file ./logo.png '<uploadUrl>'
```

Then call `import_media` with `url` set to the `mediaUrl` it returned. The file is not in your library until then.

***

## 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 (connections from ChatGPT get the balance alone):

```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/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. Ask the assistant to connect one: `connect_channel` gives you a link that signs you in to Treza and asks YouTube or TikTok for permission to post, then says when it is connected. `list_connected_channels` returns the ids a `youtube-upload` or `tiktok-upload` node needs.

***

## Related

* [API Keys](/api/api-keys.md) - create a key with `pipelines:*` scopes.
* [x402 Payments](/api/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.
