# AI agents and MCP

> Let an AI agent make vertical videos: the MCP server, connecting an agent with a person's approval, and what agents should know about the API.

VAPI is built to be used by AI agents as well as by people's code. A person keeps control of the money and the keys; the agent does the work with a key that has a spending limit.

## The MCP server

`https://vapi.cloud.redge.media/mcp` is a Model Context Protocol server (Streamable HTTP). Its tools:

| Tool | What it does |
|---|---|
| `reframe_video` | Start a reframe job from a video URL, an upload or an earlier job (a revision). |
| `get_job` | A job's status and result; waits up to 60 seconds for it to finish. |
| `list_jobs` | Your recent jobs. |
| `cancel_job` | Cancel a job. |
| `estimate_cost` | Price a video before starting it. |
| `probe_video` | Inspect a video (free). |
| `create_upload` | An address to `PUT` a local file to, for agents that can run commands. |
| `get_account` | The organization's balance, free minutes, and the key's limit and spending. |

## Connecting an agent

**With a person's approval (OAuth).** Add the server to the agent without a key. The first time, the agent opens the Redge Media Cloud console in the browser; a person with the owner or admin role signs in, picks the organization, the monthly spending limit and what the agent may do, and approves. The agent gets its own key, which shows in the console's API keys, where it can be revoked at any time.

**With a key.** Create an agent key in the [console](https://console.cloud.redge.media/api-keys) and give it to the agent as `Authorization: Bearer rmk_...`.

Claude Code:

```bash
claude mcp add --transport http redge-vapi https://vapi.cloud.redge.media/mcp
# or, with a key:
claude mcp add --transport http redge-vapi https://vapi.cloud.redge.media/mcp --header "Authorization: Bearer rmk_..."
```

Claude (claude.ai and the desktop app): Settings, Connectors, Add custom connector, with the address `https://vapi.cloud.redge.media/mcp`.

Cursor, VS Code and other clients that take a JSON configuration:

```json
{
  "mcpServers": {
    "redge-vapi": {
      "url": "https://vapi.cloud.redge.media/mcp",
      "headers": {"Authorization": "Bearer rmk_..."}
    }
  }
}
```

## A skill for Claude

`https://vapi.cloud.redge.media/agents/skill.zip` is an Agent Skill (`SKILL.md`) that teaches Claude how to use VAPI well: when to estimate, how to wait, how to review scenes and revise them. Unpack it into `~/.claude/skills/` (Claude Code) or upload it in Claude's settings.

## Tips for agents

- Read `https://vapi.cloud.redge.media/llms.txt` first; every page of this guide is Markdown at its address plus `.md`.
- Estimate before you start long or many videos (`POST /v1/estimates`), and tell the person what it will cost.
- Give videos by URL: you do not need to download and upload them.
- Send an `Idempotency-Key` with every `POST` that starts a job, and reuse it when you retry.
- Wait with `GET /v1/jobs/{id}?wait=60` instead of polling quickly.
- Errors have a `code`, a `hint` saying what to do and a `docs_url`. On `503`, wait `Retry-After` seconds and retry. On `402`, stop and tell the person: only they can add money or raise the limit.
- Use a test key (`rmk_test_...`) while you learn: it is free and processes 10 seconds of the video.
- To check the result, look at `result.scenes[].preview_url`: each scene's crop, marked on the source.
