YouTube transcript API and MCP server
Turn an available caption track from a public YouTube video into timestamped plain text. Pass a video URL or ID to the REST API or the MCP tool. The YouTube tool retrieves transcripts only.
YouTube transcript API pricing
A transcript costs $0.01 per call through either POST /api/v1/youtube/get or glim_youtube_get. Use a glim.sh API key or pay from a wallet.
Get a transcript from a video URL
For REST, pass the URL or its 11-character ID in video_id. The response includes the caption language, the caption source in origin, and the cleaned text in transcript when it fits inline.
curl -X POST https://glim.sh/api/v1/youtube/get \
-H "x-api-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"video_id":"https://youtu.be/LCEmiRjPEtQ","language_code":"en"}'For MCP, pass the same video in ref. The default output is text, with the transcript after a short metadata header. Use json when your agent needs the download link, byte size and expiry time on every result.
{
"name": "glim_youtube_get",
"arguments": { "ref": "https://youtu.be/LCEmiRjPEtQ", "format": "json" }
}Caption languages and sources
English (en) is the default. Set language_code to request another language, such as de. glim.sh looks for uploader-provided captions first. If that track is missing, it tries auto-generated captions in the requested language. To request those directly, set origin to auto_generated.
Read or download a long transcript
The inline limit is 40,000 characters of cleaned text. Above that limit, follow download_url for the full transcript. REST and MCP JSON also return length_chars, size_bytes and expires_at. The download link is valid for one hour.
To get just the metadata and link over REST, set format to url. On MCP, both text and json include the transcript when it fits.
Connect the YouTube MCP server
Use https://glim.sh/mcp as the server URL. To give your agent only the transcript tool, connect to https://glim.sh/mcp?tools=glim_youtube_get. See the MCP quickstart for client configuration.
$ claude mcp add -s user -t http glim https://glim.sh/mcp$ codex mcp add glim --url https://glim.sh/mcp$ opencode mcp add$ npx x402-proxy mcp add glim https://glim.sh/mcpCompare ways to retrieve YouTube captions
- The YouTube Data API caption download requires permission to edit the video.
- The youtube-transcript-api Python library lets you fetch a transcript by video ID from your Python program.
- Use glim.sh for a hosted HTTPS endpoint or an MCP tool. Supply a public video URL with available captions and read the resulting text.
Good to know
- The transcript strips caption tags and removes lines repeated across consecutive cues. Timestamps such as
[2:30]mark passages roughly 30 seconds apart so you can locate a quote. - glim.sh caches transcript metadata for seven days by video ID, language and caption source. Call again for a fresh download link after yours expires.
FAQ
What if a video has no captions?
The tool reads existing caption tracks. If it cannot find one in the requested language, REST returns HTTP 404 and MCP returns a tool error. Try a language available on the video. The tool does not transcribe the audio.
Can I search for videos with the YouTube MCP tool?
No. Start with a video URL or ID. Video search, uploads and channel statistics are outside the scope of this tool.