# AI Agent Setup & Tooling



**YTAPI** provides machine-readable documentation and integration tools for AI coding assistants, LLM pipelines, and Model Context Protocol (MCP) clients.

***

Machine-Readable Endpoints [#machine-readable-endpoints]

For LLMs and agents that need to fetch documentation into context windows without parsing heavy HTML:

| Resource           | URL                                    | Description                                                                         |
| :----------------- | :------------------------------------- | :---------------------------------------------------------------------------------- |
| **LLMs Index**     | `https://docs.ytapi.dev/llms.txt`      | Spec-compliant manifest of all documentation pages with short descriptions.         |
| **Full LLMs Dump** | `https://docs.ytapi.dev/llms-full.txt` | Single concatenated Markdown document containing the entire platform documentation. |
| **Raw Page MDX**   | `https://docs.ytapi.dev/{slug}.mdx`    | Append `.mdx` to any documentation URL to retrieve raw, clean Markdown.             |

<Callout type="idea" title="Agent Quick Fetch">
  In bash-based agents (e.g. Claude Code, Codex, Aider), fetch the entire API reference with:

  ```bash
  curl -s https://docs.ytapi.dev/llms-full.txt
  ```
</Callout>

***

Model Context Protocol (MCP) [#model-context-protocol-mcp]

<div id="mcp" />

YTAPI runs a remote MCP server. There is nothing to install: point your client at the URL, then sign in to your YTAPI account when the client asks, or send your API key.

|               |                                                                     |
| :------------ | :------------------------------------------------------------------ |
| **URL**       | `https://api.ytapi.dev/mcp`                                         |
| **Transport** | Streamable HTTP                                                     |
| **Auth**      | OAuth sign-in, or `Authorization: Bearer <YOUR_API_KEY>`            |
| **Billing**   | Same credits as the REST API. Connecting and listing tools is free. |

No key yet? The agent can create the account for its user: see [Agent sign-up](/agent-signup).

Claude (claude.ai and Claude Desktop) [#claude-claudeai-and-claude-desktop]

Add YTAPI as a custom connector. No API key is needed, and free Claude plans can add one custom connector:

1. Open **Customize → Connectors** (also reachable from **Settings → Connectors**), click **+ Add**, then **Add custom connector**.
2. Enter `https://api.ytapi.dev/mcp` and click **Connect**.
3. Sign in to YTAPI, or create an account (200 free credits, no card), then click **Allow**.

Then ask Claude about any YouTube video, channel or playlist. Requests use your account's credits and appear under **Usage**. To disconnect Claude, revoke the "Claude" connected app under [API keys](https://ytapi.dev/app/api-keys).

Claude Code [#claude-code]

Install the YTAPI plugin, which adds the server and skills for summaries, channel digests and topic research:

```text
/plugin marketplace add ytapi/youtube-skills
/plugin install ytapi@ytapi
```

Then run `/mcp`, pick `plugin:ytapi:ytapi` and choose **Authenticate** to sign in. If Claude Code is logged in with a claude.ai account that already has the YTAPI connector, the connector shows up on its own.

To use an API key instead:

```bash
claude mcp add --transport http ytapi https://api.ytapi.dev/mcp \
  --header "Authorization: Bearer YOUR_API_KEY"
```

Codex [#codex]

Export your key, then register the server:

```bash
export YTAPI_KEY=YOUR_API_KEY
codex mcp add ytapi --url https://api.ytapi.dev/mcp --bearer-token-env-var YTAPI_KEY
```

Or add it to `~/.codex/config.toml` yourself:

```toml
[mcp_servers.ytapi]
url = "https://api.ytapi.dev/mcp"
bearer_token_env_var = "YTAPI_KEY"
```

Cursor [#cursor]

Add to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project):

```json
{
  "mcpServers": {
    "ytapi": {
      "url": "https://api.ytapi.dev/mcp",
      "headers": { "Authorization": "Bearer YOUR_API_KEY" }
    }
  }
}
```

VS Code [#vs-code]

Add to `.vscode/mcp.json`. VS Code asks for the key once and stores it securely:

```json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "ytapi-key",
      "description": "YTAPI API key",
      "password": true
    }
  ],
  "servers": {
    "ytapi": {
      "type": "http",
      "url": "https://api.ytapi.dev/mcp",
      "headers": { "Authorization": "Bearer ${input:ytapi-key}" }
    }
  }
}
```

Google Antigravity [#google-antigravity]

Add to `~/.gemini/config/mcp_config.json` (all workspaces) or `.agents/mcp_config.json` (one workspace). Antigravity reads `serverUrl`, not `url`:

```json
{
  "mcpServers": {
    "ytapi": {
      "serverUrl": "https://api.ytapi.dev/mcp",
      "headers": { "Authorization": "Bearer YOUR_API_KEY" }
    }
  }
}
```

OpenClaw [#openclaw]

Add the server under `mcp.servers` in your OpenClaw config:

```json5
{
  mcp: {
    servers: {
      ytapi: {
        url: "https://api.ytapi.dev/mcp",
        transport: "streamable-http",
        enabled: true,
        headers: { Authorization: "Bearer YOUR_API_KEY" }
      }
    }
  }
}
```

Keep the key in OpenClaw's secret storage rather than in the file where you can.

Other stdio-only clients [#other-stdio-only-clients]

Bridge to the remote server with [`mcp-remote`](https://www.npmjs.com/package/mcp-remote) (requires Node.js):

```json
{
  "mcpServers": {
    "ytapi": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote", "https://api.ytapi.dev/mcp",
        "--header", "Authorization:${AUTH_HEADER}"
      ],
      "env": { "AUTH_HEADER": "Bearer YOUR_API_KEY" }
    }
  }
}
```

Tools [#tools]

| Tool                  | What it does                                                                                                                                                                                    | Credits                                                                          |
| :-------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------- |
| `get_transcript`      | Captions of a video as Markdown (a timestamp every few lines), plain text, or SRT or VTT (a start and end time on every caption line). Accepts a video ID or any YouTube URL, including Shorts. | 1 for the first page; later pages of the same transcript are free for 30 minutes |
| `get_video_info`      | Title, channel, duration and the caption languages a video has.                                                                                                                                 | 0                                                                                |
| `get_video_details`   | Exact view, like and comment counts, publish time, description, chapters, keywords and related videos, starting with views per day and like and comment rates.                                  | 1                                                                                |
| `get_video_heatmap`   | YouTube's "most replayed" graph: the most replayed moment, up to five peaks and the graph in 20 parts, with timestamped links. Many videos have none; that error is free.                       | 1                                                                                |
| `get_comments`        | A video's comments, top or newest first, about 20 per page, with likes and reply counts. Also reads a comment's replies.                                                                        | 1 per page                                                                       |
| `search_youtube`      | Search videos, channels, playlists or Shorts.                                                                                                                                                   | 1 per page                                                                       |
| `get_channel`         | A channel's profile: subscriber and video counts, country, description and links. Accepts a handle, channel ID or URL.                                                                          | 1                                                                                |
| `get_channel_videos`  | A channel's uploads, newest, most popular or oldest first. Accepts a handle, channel ID or URL.                                                                                                 | 1 per page                                                                       |
| `get_playlist_videos` | A playlist's details and videos, page by page.                                                                                                                                                  | 1 per page                                                                       |

Long transcripts come back in pages of 40,000 characters (set `max_chars` up to 100,000). When more remains, the result ends with the `offset` to pass on the next call. Errors, such as a video without captions, are returned as tool errors and cost nothing.

***

Code Mode & Function Calling [#code-mode--function-calling]

<div id="code-mode" />

When orchestrating extraction pipelines via OpenAI, Anthropic, or Gemini tool calling, provide the JSON Schema directly:

```json
{
  "name": "fetch_youtube_transcript",
  "description": "Extract subtitles or transcripts from any YouTube video in structured Markdown or SRT.",
  "parameters": {
    "type": "object",
    "properties": {
      "video_id": {
        "type": "string",
        "description": "11-character YouTube video ID"
      },
      "format": {
        "type": "string",
        "enum": ["markdown", "text", "srt", "vtt", "word_timestamps"],
        "default": "markdown"
      }
    },
    "required": ["video_id"]
  }
}
```

***

Platform Skills & System Prompts [#platform-skills--system-prompts]

<div id="skills" />

Cursor Rules (.cursorrules) [#cursor-rules-cursorrules]

Add this prompt rule to your project to instruct Cursor on how to query YouTube transcripts:

```markdown
# YTAPI guidelines

When writing code that extracts YouTube subtitles or transcripts:
1. Always use `https://api.ytapi.dev/v1/transcripts` with `Authorization: Bearer $YT_API_KEY`.
2. For LLM summaries or context injection, specify `"format": "markdown"`.
3. For video subtitle synchronizing, specify `"format": "word_timestamps"` with `"word_level": true`.
4. Check `X-Cache` response headers (`HIT` or `MISS`) to measure latency.
5. Refer to complete documentation at `https://docs.ytapi.dev/llms.txt`.
```
