TMDB MCP Server

TMDB MCP Server

Provides 34 tools to search and discover movies, TV shows, and people from The Movie Database (TMDB) API.

Category
访问服务器

README

TMDB MCP Server

A production-ready Model Context Protocol (MCP) server that integrates with The Movie Database (TMDB) API, designed to run on Cloudflare Workers using Hono.js framework.

Features

  • 34 MCP Tools for comprehensive TMDB API access
  • Dual Transport Support: SSE (legacy) and Streamable HTTP (new standard)
  • Cloudflare Cache integration for improved performance
  • Robust Error Handling with graceful error messages
  • Type-Safe with full TypeScript support
  • Rate Limit Aware with proper error responses

Available Tools

Search & Discovery

Tool Description
search_movies Search for movies by title with optional year filter
search_tv_shows Search for TV shows by name
search_person Search for actors, directors, and crew
discover_movies Advanced movie discovery with filters
discover_tv Advanced TV show discovery with filters
get_trending Get trending movies, TV shows, or people

Movie Details

Tool Description
get_movie_details Get comprehensive movie details including cast & crew
get_movie_recommendations Get movie recommendations based on a movie
get_similar_movies Get movies similar to a specific movie
get_movie_videos Get all videos (trailers, teasers, clips) for a movie
get_movie_images Get all images (posters, backdrops, logos) for a movie
get_movie_reviews Get user reviews for a movie

TV Show Details

Tool Description
get_tv_details Get TV show details including seasons and episodes
get_tv_recommendations Get TV show recommendations based on a show
get_similar_tv Get TV shows similar to a specific show
get_tv_videos Get all videos for a TV show
get_tv_images Get all images for a TV show
get_tv_reviews Get user reviews for a TV show
get_season_details Get detailed information about a TV show season
get_episode_details Get detailed information about a TV show episode

Person Details

Tool Description
get_person_details Get person biography and filmography
get_person_images Get all profile images for a person

Lists & Charts

Tool Description
get_now_playing Get movies currently playing in theaters
get_upcoming Get movies being released in the next 2 weeks
get_popular_movies Get current popular movies
get_top_rated_movies Get top rated movies of all time
get_latest_movie Get the most recently added movie
get_airing_today Get TV shows airing today
get_on_the_air Get TV shows currently on the air
get_popular_tv Get current popular TV shows
get_top_rated_tv Get top rated TV shows of all time
get_latest_tv Get the most recently added TV show

Reference Data

Tool Description
get_movie_certifications Get movie certifications by country
get_tv_certifications Get TV show certifications by country

Prerequisites

  • Node.js 18+
  • npm or yarn
  • TMDB API Key (Read Access Token)
  • Cloudflare account (for deployment)

Setup

1. Install Dependencies

npm install

2. Configure Environment Variables

Create a .dev.vars file for local development:

cp .dev.vars.example .dev.vars

Edit .dev.vars and add your TMDB API key:

TMDB_API_KEY=your_tmdb_api_key_here

3. Local Development

Start the development server:

npm run dev

The server will be available at http://localhost:8787

4. Test Endpoints

Offline test suite:

npm test

Live integration tests (require TMDB_API_KEY and outbound access to api.themoviedb.org):

npm run test:endpoints
npm run test:integration

Health Check:

curl http://localhost:8787/health

List Available Tools:

curl http://localhost:8787/tools

SSE Connection (for MCP clients):

curl -N http://localhost:8787/sse

Deployment

Deploy to Cloudflare Workers

  1. Set the TMDB API key as a secret:
wrangler secret put TMDB_API_KEY
  1. Deploy:
npm run deploy

MCP Client Configuration

SSE Transport (Legacy)

Configure your MCP client to connect using SSE:

{
  "mcpServers": {
    "tmdb": {
      "url": "http://localhost:8787/sse",
      "transport": "sse"
    }
  }
}

Streamable HTTP Transport (Recommended)

The newer, more efficient transport protocol:

{
  "mcpServers": {
    "tmdb": {
      "url": "http://localhost:8787/mcp",
      "transport": "streamable-http"
    }
  }
}

For deployed workers:

{
  "mcpServers": {
    "tmdb": {
      "url": "https://tmdb-mcp-server.<your-subdomain>.workers.dev/mcp",
      "transport": "streamable-http"
    }
  }
}

Available Endpoints

Endpoint Method Description
/health GET Health check and server info
/tools GET List all available tools
/sse GET SSE transport connection (legacy)
/message POST SSE transport messages (legacy)
/mcp GET/POST/DELETE Streamable HTTP transport

Tool Usage Examples

Search Movies

{
  "name": "search_movies",
  "arguments": {
    "query": "The Matrix",
    "year": 1999
  }
}

Get Movie Details

{
  "name": "get_movie_details",
  "arguments": {
    "movie_id": 603
  }
}

Discover Movies

{
  "name": "discover_movies",
  "arguments": {
    "genres": "28,12",
    "min_rating": 7.5,
    "sort_by": "popularity.desc"
  }
}

Get Trending

{
  "name": "get_trending",
  "arguments": {
    "media_type": "movie",
    "time_window": "week"
  }
}

Project Structure

tmdb-mcp/
├── src/
│   ├── index.ts           # Main server entry point
│   └── lib/
│       ├── tmdb-client.ts # TMDB API client with caching
│       └── mcp-tools.ts   # MCP tool definitions
├── package.json
├── wrangler.toml
├── tsconfig.json
└── .dev.vars.example

API Reference

TMDBClient

The TMDBClient class provides a type-safe wrapper around the TMDB API:

  • Automatic error handling
  • Rate limit detection (429 responses)
  • Cloudflare Cache integration
  • Image URL transformation

Image URLs

All image paths returned by tools are converted to full URLs using the format:

https://image.tmdb.org/t/p/w500/{path}

Available sizes: w92, w154, w185, w342, w500, w780, original

Error Handling

The server handles various error scenarios:

  • TMDB API Errors: Returns descriptive error messages
  • Rate Limiting: Returns 429 with retry-after header
  • Network Errors: Graceful error messages
  • Invalid Input: Zod validation errors

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选