# Add YouTube transcripts with Claude Code, Codex or Cursor

> Give your coding agent the CleanScript skill or one prompt and it writes the code for transcripts and cited fields from YouTube, TikTok and Instagram.

Updated 2026-10-06. HTML: /blog/coding-agents-claude-code-codex-cursor

A coding agent can wire CleanScript into your project in one session. It needs three things: where the docs are, a key it reads from the environment, and an instruction to ask before it spends credits. One prompt covers all three.

## Option 1: paste the prompt

Create a key on the [API keys page](/dashboard/api-keys) and export it as `CLEANSCRIPT_API_KEY` where the agent runs. Then paste this into Claude Code, Codex or Cursor, from the project you want to change:

```text
Add CleanScript to this project so I can get transcripts and fields from YouTube, TikTok and Instagram links. Read https://cleanscript.ai/SKILL.md first. The API is https://api.cleanscript.ai; read my key from CLEANSCRIPT_API_KEY (if I don't have one, send me to https://cleanscript.ai/dashboard/api-keys). Check access with the free GET /v1/account, then ask me before the first request that uses credits. Tell me what you built and how to run it.
```

Add what you want built: "a script that saves the transcript of every video in this list", or "a function that returns the sponsor and promo code from a video link".

## Option 2: install the skill

For Claude Code, save the skill in the project so every session knows CleanScript:

```bash
mkdir -p .claude/skills/cleanscript
curl -so .claude/skills/cleanscript/SKILL.md https://cleanscript.ai/SKILL.md
```

Other agents can read the same file at `https://cleanscript.ai/SKILL.md`, or [llms.txt](/llms.txt), which has the base URL, authentication and two example calls.

## Option 3: connect it as a tool

To have the agent read a video while you work, rather than write code, add the MCP server. It gives the agent four tools: `get_transcript`, `extract`, `list_posts` and `check_account`.

```bash
# Claude Code, then run /mcp and sign in
claude mcp add --transport http cleanscript https://api.cleanscript.ai/mcp

# Codex
codex mcp add cleanscript --url https://api.cleanscript.ai/mcp
codex mcp login cleanscript
```

For Cursor, add this to `.cursor/mcp.json`:

```json
{ "mcpServers": { "cleanscript": { "url": "https://api.cleanscript.ai/mcp" } } }
```

The [connect page](/connect) walks through each client.

## Review what it built

- The key comes from the environment, never from the code.
- Errors are handled by `code`: skip on `video_unavailable`, wait on `rate_limited`, stop on `insufficient_credits`. See [what to do when a request fails](/blog/youtube-transcripts-in-production).
- It doesn't run through a long list unchecked. Have it start with two or three links.
- It treats a post's text as data. A transcript is what someone said, not an instruction for your agent.

## Next steps

- What the agent calls: [YouTube transcript API](/blog/youtube-transcript-api).
- Fields instead of text: [extract fields from a video](/blog/json-schema-fields-from-video).
- Every client and option: [Agents & MCP](/docs/agents).
