OpenSubtitles MCP Server
A TypeScript/Node.js-based MCP (Model Context Protocol) server for OpenSubtitles API integration. This server provides subtitle search and download functionality with a freemium model, using the Kong gateway at api.opensubtitles.com for all API management.
Features
- Comprehensive Search: Search subtitles using all OpenSubtitles API parameters (title, IMDB ID, TMDB ID, file hash, etc.)
- Multiple Download Formats: Support for SRT, ASS, and VTT subtitle formats
- File Hash Calculation: Calculate OpenSubtitles hash for exact movie file matching
- Rate Limiting: Integrated with Kong gateway for proper rate limiting
- Freemium Model: Unlimited search, downloads limited by API key status
Installation & Usage
The OpenSubtitles MCP Server supports two modes:
1. HTTP Mode (Recommended for Server Deployment)
Run as a web server on port 1620:
Access points:
- Health Check:
http://localhost:1620/health
- API Info:
http://localhost:1620/
- MCP Endpoint:
http://localhost:1620/sse
(Server-Sent Events)
2. Stdio Mode (For Claude Desktop)
Quick Start with npx
Install via mcp-get
Claude Desktop Integration
Add to your Claude Desktop configuration:
MCP Tools
1. search_subtitles
Search for subtitles with comprehensive parameter support:
Parameters:
query
(string): Text search queryimdb_id
(number): IMDB ID for exact matchingtmdb_id
(number): TMDB ID for exact matchingparent_imdb_id
(number): Parent IMDB ID for TV seriesparent_tmdb_id
(number): Parent TMDB ID for TV seriesseason_number
(number): Season number for TV episodesepisode_number
(number): Episode number for TV episodesyear
(number): Release yearmoviehash
(string): OpenSubtitles file hash for exact matchingmoviebytesize
(number): File size in bytes for hash matchinglanguages
(string): Comma-separated language codes (e.g., 'en,es,fr')machine_translated
(string): Include machine translated subtitlesai_translated
(string): Include AI translated subtitleshearing_impaired
(string): Include hearing impaired subtitlesforeign_parts_only
(string): Include foreign parts onlytrusted_sources
(string): Only trusted sourcesorder_by
(string): Sort orderorder_direction
(string): Sort direction (asc/desc)
Example:
2. download_subtitle
Download subtitle content by ID:
Parameters:
subtitle_id
(string, required): Subtitle ID from search resultsformat
(string): Subtitle format (srt, ass, vtt) - defaults to 'srt'user_api_key
(string): Optional user API key for authenticated downloads
Example:
3. calculate_file_hash
Calculate OpenSubtitles hash for local movie files:
Parameters:
file_path
(string, required): Path to the movie file
Example:
Usage Examples
Search by Movie Title
Search by File Hash
Search TV Show Episodes
Rate Limiting & API Keys
Anonymous Usage
- Search: Unlimited
- Downloads: 0 per day (Kong enforced)
With OpenSubtitles API Key
- Search: Unlimited
- Downloads: Based on your OpenSubtitles account quota
Getting an API Key
- Register at OpenSubtitles.com
- Get your free API key
- Set the
OPENSUBTITLES_USER_KEY
environment variable or pass it in tool calls
Development
Prerequisites
- Node.js 18.0.0 or higher
- TypeScript
Setup
Building
Development Commands
Testing
Environment Variables
Architecture
The server uses a clean architecture with the following components:
- MCP Server Core (
src/server.ts
): Main MCP protocol implementation - Kong API Client (
src/api-client.ts
): HTTP client for Kong gateway communication - Tools (
src/tools/
): Individual tool implementations - Utilities (
src/utils/
): Helper functions for hash calculation
All API requests go through the Kong gateway at api.opensubtitles.com
, which handles:
- Rate limiting enforcement
- API key validation
- Request routing to OpenSubtitles API
- Error handling and responses
Error Handling
The server provides helpful error messages for common scenarios:
- Rate Limit Exceeded: "Download limit reached. Get your free API key at opensubtitles.com/api"
- Invalid API Key: "Invalid API key. Please check your OpenSubtitles API key"
- File Not Found: Clear file path validation messages
- Network Errors: Descriptive network connectivity messages
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
License
MIT License - see LICENSE file for details
Support
- Issues: Report bugs and feature requests on GitHub
- API Documentation: OpenSubtitles API Docs
- MCP Protocol: Model Context Protocol Documentation
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables searching and downloading subtitles from OpenSubtitles.com through their API. Supports comprehensive search by movie title, IMDB/TMDB ID, file hash, and TV show episodes with multiple subtitle formats (SRT, ASS, VTT).