A Model Context Protocol (MCP) server for retrieving YouTube video captions and subtitles. This server provides seamless integration with MCP-compatible clients to fetch and process YouTube video transcripts.
🌐 Live Server: mcp-youtube-subtitles.fly.dev/mcp
- 🎥 Fetch captions from YouTube videos
- 🌐 Support for multiple subtitle formats
- 🔧 MCP-compliant server implementation
- 📝 TypeScript support with full type safety
- 🍪 Optional cookie support for enhanced access
- ⚡ Express.js server with CORS support
- Node.js >= 18.0.0
- npm or yarn package manager
npm installCreate a .env file in the root directory with the following optional variables:
PORT=3000
COOKIES_URL=https://url/path/to/cookies.txt| Variable | Description | Default | Required |
|---|---|---|---|
PORT |
Server port number | 3000 |
No |
COOKIES_URL |
URL to cookies.txt file for enhanced YouTube access | - | No |
npm run devnpm run build
npm startnpm testDebug and inspect the MCP server using the official inspector:
npm run server:inspectnpm run build- Compile TypeScript to JavaScriptnpm start- Start the production servernpm run dev- Start development server with hot reloadnpm test- Run testsnpm run clean- Remove build directorynpm run server:inspect- Start MCP inspector for debugging
@modelcontextprotocol/sdk- MCP SDK for server implementationaxios- HTTP client for API requestsexpress- Web frameworkzod- Runtime type validation
@modelcontextprotocol/inspector- MCP debugging tooltypescript- TypeScript compilertsx- TypeScript execution engine
This project is licensed under the Mozilla Public License 2.0 (MPL-2.0).
xharuke
- Fork the repository at github.com/xHaruke/youtube-subtitles-mcp
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
mcp, model-context-protocol, youtube, captions, subtitles, typescript