YouTubeMCPServer

robalexclark/YouTubeMCPServer

3.2

If you are the rightful owner of YouTubeMCPServer and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

This is a .NET 9 Model Context Protocol (MCP) server designed to fetch YouTube video transcripts using the YoutubeExplode library.

Tools
1
Resources
0
Prompts
0

YouTube MCP Server

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.

Features

  • 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).

Requirements

  • .NET 9 SDK

Build

  • Restore and build: dotnet build YouTubeMCPServer/YouTubeMCPServer.csproj -c Release

Run

  • 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.

MCP Tool

  • 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 en track first; if unavailable, falls back to the first available caption track.

Example Client Configuration

  • MCP client (e.g., Claude Desktop) using stdio:
    • Command: dotnet
    • Args: ["YouTubeMCPServer/bin/Release/net9.0/YouTubeMCPServer.dll"]

Example

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…"
      }
    ]
  }
}

Project Layout

  • YouTubeMCPServer/Program.cs: Host setup, stdio transport, logging, tool registration.
  • YouTubeMCPServer/Tools/YouTubeTranscriptionTool.cs: Implements the transcript tool using YoutubeExplode.
  • YouTubeMCPServer/YouTubeMCPServer.csproj: Targets net9.0 and references ModelContextProtocol and YoutubeExplode.

Notes

  • 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.

Use in ChatGPT (MCP URL)

  • This server communicates over stdio. To add it to ChatGPT via a URL-based MCP manifest:

    1. Build Release: dotnet build YouTubeMCPServer/YouTubeMCPServer.csproj -c Release
    2. Generate a local manifest: pwsh scripts/generate-mcp-manifest.ps1 (outputs mcp-manifest.json with absolute paths on your machine)
    3. Host the resulting mcp-manifest.json at an HTTPS URL (e.g., a private GitHub Gist raw link, GitHub Pages, or any static file host). You can also inspect mcp-manifest.example.json for the expected shape.
    4. In ChatGPT → Settings → Workspace → Add a connection → From URL, paste the HTTPS URL to your hosted manifest.
  • 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/args paths are valid on your machine and the file is executable.
    • Windows: the generator prefers the YouTubeMCPServer.exe if present; otherwise it uses dotnet <dll>.
    • macOS/Linux: ensure dotnet is on your PATH and use the dotnet <dll> form.

License

This project is licensed under the terms in LICENSE.txt.