Small .NET 9 Model Context Protocol (MCP) server that exposes a tool to fetch YouTube video transcripts using YoutubeExplode. The server communicates over stdio using the ModelContextProtocol package and is designed to be launched by an MCP‑compatible client.
- MCP stdio server: Registers tools via
WithToolsFromAssembly()and serves MCP JSON‑RPC over stdio. - Transcript tool: Fetches captions for a YouTube URL/ID, preferring English and falling back to the first available track.
- Plain‑text output: Returns a single text block containing the transcript lines (SRT output is not currently selectable via inputs).
- .NET 9 SDK
- Restore and build:
dotnet build YouTubeMCPServer/YouTubeMCPServer.csproj -c Release
- Typical (from an MCP client): Configure the client to launch this server over stdio.
- Manual run:
dotnet YouTubeMCPServer/bin/Release/net9.0/YouTubeMCPServer.dll- The process waits for MCP JSON‑RPC messages on stdio and logs to the console.
- Name:
RetrieveYoutubeTranscript(derived from the public tool method name). - Description: Retrieves the transcript for a given YouTube URL/ID.
- Inputs:
url(string, required): YouTube video URL or ID.
- Output: A single text value containing the transcript lines concatenated with newlines.
- Behavior: Attempts the
entrack first; if unavailable, falls back to the first available caption track.
- MCP client (e.g., Claude Desktop) using stdio:
- Command:
dotnet - Args:
["YouTubeMCPServer/bin/Release/net9.0/YouTubeMCPServer.dll"]
- Command:
Call the tool over MCP JSON-RPC:
Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "RetrieveYoutubeTranscript",
"arguments": {
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
}
}Response (truncated):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "…transcript text…"
}
]
}
}YouTubeMCPServer/Program.cs: Host setup, stdio transport, logging, tool registration.YouTubeMCPServer/Tools/YouTubeTranscriptionTool.cs: Implements the transcript tool usingYoutubeExplode.YouTubeMCPServer/YouTubeMCPServer.csproj: Targetsnet9.0and referencesModelContextProtocolandYoutubeExplode.
- No API keys required; relies on publicly accessible caption tracks via
YoutubeExplode. - Auto-generated captions may vary in quality; some videos lack captions entirely.
- Logging is emitted to stdout/stderr; Ctrl+C triggers graceful shutdown.
-
This server communicates over stdio. To add it to ChatGPT via a URL-based MCP manifest:
- Build Release:
dotnet build YouTubeMCPServer/YouTubeMCPServer.csproj -c Release - Generate a local manifest:
pwsh scripts/generate-mcp-manifest.ps1(outputsmcp-manifest.jsonwith absolute paths on your machine) - Host the resulting
mcp-manifest.jsonat an HTTPS URL (e.g., a private GitHub Gist raw link, GitHub Pages, or any static file host). You can also inspectmcp-manifest.example.jsonfor the expected shape. - In ChatGPT → Settings → Workspace → Add a connection → From URL, paste the HTTPS URL to your hosted manifest.
- Build Release:
-
The manifest uses stdio transport and will instruct ChatGPT to launch the built server locally. If you move the repo or rebuild to a new location, regenerate and re-upload the manifest so the command path stays correct.
-
Troubleshooting:
- If ChatGPT can’t start the server, confirm the manifest’s
command/argspaths are valid on your machine and the file is executable. - Windows: the generator prefers the
YouTubeMCPServer.exeif present; otherwise it usesdotnet <dll>. - macOS/Linux: ensure
dotnetis on your PATH and use thedotnet <dll>form.
- If ChatGPT can’t start the server, confirm the manifest’s
This project is licensed under the terms in LICENSE.txt.