OpenSubtitles MCP Server
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).
README
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:
# Install dependencies
npm install
npm run build
# Start HTTP server
npm start
# or
PORT=1620 MCP_MODE=http node dist/index.js
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
npx @opensubtitles/mcp-server
Install via mcp-get
npx @michaellatman/mcp-get@latest install @opensubtitles/mcp-server
Claude Desktop Integration
Add to your Claude Desktop configuration:
{
"mcpServers": {
"opensubtitles": {
"command": "npx",
"args": ["-y", "@opensubtitles/mcp-server"],
"env": {
"MCP_MODE": "stdio",
"OPENSUBTITLES_USER_KEY": "your_api_key_here"
}
}
}
}
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:
await mcpClient.callTool("search_subtitles", {
query: "The Matrix",
year: 1999,
languages: "en"
});
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:
await mcpClient.callTool("download_subtitle", {
subtitle_id: "123456",
format: "srt",
user_api_key: "your_api_key"
});
3. calculate_file_hash
Calculate OpenSubtitles hash for local movie files:
Parameters:
file_path(string, required): Path to the movie file
Example:
await mcpClient.callTool("calculate_file_hash", {
file_path: "/path/to/movie.mkv"
});
Usage Examples
Search by Movie Title
await mcpClient.callTool("search_subtitles", {
query: "Inception",
year: 2010,
languages: "en"
});
Search by File Hash
// First calculate the hash
const hashResult = await mcpClient.callTool("calculate_file_hash", {
file_path: "/path/to/inception.mkv"
});
// Then search using the hash
await mcpClient.callTool("search_subtitles", {
moviehash: "8e245d9679d31e12",
moviebytesize: 12909756
});
Search TV Show Episodes
await mcpClient.callTool("search_subtitles", {
parent_imdb_id: 944947, // Game of Thrones
season_number: 1,
episode_number: 5,
languages: "en"
});
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_KEYenvironment variable or pass it in tool calls
Development
Prerequisites
- Node.js 18.0.0 or higher
- TypeScript
Setup
git clone <repository>
cd mcp-opensubtitles
npm install
Building
npm run build
Development Commands
# HTTP Mode (Web Server)
npm run dev # Build and run HTTP server on port 1620
npm start # Run built HTTP server
# Stdio Mode (Claude Desktop)
npm run dev:stdio # Build and run stdio mode
npm start:stdio # Run built stdio mode
# Development with Auto-rebuild
npm run watch
Testing
# For HTTP mode testing
curl http://localhost:1620/health # Health check
curl http://localhost:1620/ # API info
# For Stdio mode testing
npm test # Run evaluation tests
npm run inspector # Debug with MCP Inspector (stdio mode)
# MCP evaluation tests
npx mcp-eval evals/evals.ts dist/index.js
Environment Variables
OPENSUBTITLES_API_BASE=https://api.opensubtitles.com # Default Kong gateway
NODE_ENV=production
PORT=1620
OPENSUBTITLES_USER_KEY=your_api_key_here # Optional
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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。