本项目实现了模型上下文协议(MCP),提供了与电影数据库(TMDB)进行交互的工具。
本项目是基于模型上下文协议(MCP)的实现,提供了与电影数据库(TMDB)交互的工具。TMDB 是一个流行的、用户可编辑的电影和电视剧数据库,拥有丰富的影视信息。
git clone https://github.com/leonardogilrodriguez/mcp-tmdb.git
cd mcp-tmdb
pnpm install
.env
文件,并添加你的 TMDB API 密钥:TMDB_API_KEY=your_api_key_here
要运行 MCP 服务器:
pnpm inspector
要以调试模式运行:
pnpm dev:debug
git clone https://github.com/leonardogilrodriguez/mcp-tmdb.git
cd mcp-tmdb
pnpm install
在项目根目录创建 .env
文件,并添加 TMDB API 密钥:
TMDB_API_KEY=your_api_key_here
pnpm inspector
pnpm dev:debug
以下是各个工具的使用说明和参数:
搜索两位演员共同出现在屏幕上的电影。 参数:
actor1
:第一位演员的姓名actor2
:第二位演员的姓名language
:(可选)结果语言(默认:"en")搜索两个人以任何角色共同参与的电影。 参数:
person1
:第一个人的姓名job1
:第一个人的工作。可能的值:cast, crewperson2
:第二个人的姓名job2
:第二个人的工作。可能的值:cast, crewlanguage
:(可选)结果语言(默认:"en")搜索在两部电影中以任何角色工作过的人员。 参数:
movie1
:第一部电影的名称year1
:(可选)第一部电影的年份movie2
:第二部电影的名称year2
:(可选)第二部电影的年份language
:(可选)结果语言(默认:"en")搜索某人作为演员在特定类型电影中的作品。 参数:
person
:演员的姓名genre
:(可选)类型名称language
:(可选)结果语言(默认:"en")搜索某人作为工作人员在特定类型电影中的作品。 参数:
person
:人员的姓名job
:(可选)工作名称genre
:(可选)类型名称language
:(可选)结果语言(默认:"en")提供可在 filmography_crew_genre
工具中使用的工作列表。
mcp-tmdb/
├── API/ # API 函数和实用工具
├── interfaces/ # 类型和接口定义
├── tools/ # 工具实现
├── main.ts # 主入口点
├── package.json # 项目配置
└── .env # 环境变量(需创建)
属性 | 详情 |
---|---|
主要依赖 | @modelcontextprotocol/sdk: ^1.12.1 dotenv: ^16.5.0 zod: ^3.25.55 |
要在 Claude Desktop 中配置此 MCP:
"tmdb": {
"disabled": false,
"timeout": 60,
"type": "stdio",
"command": "tsx",
"args": [
"complete_path_to_mcp-tmdb\\main.ts"
],
"env": {
"TMDB_API_KEY": "your_api_key_here"
}
}
搜索 Cary Grant 和 Katharine Hepburn 共同出演的电影的示例输出:
[
{
"id": 31866,
"title": "Sylvia Scarlett",
"year": 1935,
"media_type": "movie"
},
{
"id": 900,
"title": "Bringing Up Baby",
"year": 1938,
"media_type": "movie"
},
{
"id": 16274,
"title": "Holiday",
"year": 1938,
"media_type": "movie"
},
{
"id": 981,
"title": "The Philadelphia Story",
"year": 1940,
"media_type": "movie"
}
]
搜索 Christopher Nolan 和 Hans Zimmer 合作的电影的示例输出:
[
{
"id": 272,
"title": "Batman Begins",
"year": 2005,
"media_type": "movie"
},
{
"id": 155,
"title": "The Dark Knight",
"year": 2008,
"media_type": "movie"
},
{
"id": 27205,
"title": "Inception",
"year": 2010,
"media_type": "movie"
}
...
]
搜索在 Titanic 和 The Lord of the Rings: The Return of the King 两部电影中工作过的人员的示例输出:
[{
"id": 1369,
"name": "Bernard Hill",
"known_for_department": "Acting"
},
{
"id": 1327030,
"name": "Lora Hirschberg",
"job": "Sound Re-Recording Mixer",
"known_for_department": "Sound"
},
{
"id": 900,
"name": "Christopher Boyes",
"job": "Sound Re-Recording Mixer",
"known_for_department": "Sound"
},
{
"id": 1378696,
"name": "Ethan Van der Ryn",
"job": "Sound Effects Editor",
"known_for_department": "Sound"
},
{
"id": 1425978,
"name": "Gary Summers",
"job": "Sound Re-Recording Mixer",
"known_for_department": "Sound"
}
]
搜索 Tom Hanks 的恐怖电影的示例输出:
[{
"title": "He Knows You're Alone",
"character": "Elliot",
"media_type": "movie",
"year": 1980
},
{
"title": "The 'Burbs",
"character": "Ray Peterson",
"media_type": "movie",
"year": 1989
},
{
"title": "Vault of Horror I",
"character": "Baxter",
"media_type": "movie",
"year": 1994
}
]
搜索 Steven Spielberg 作为导演的喜剧电影的示例输出:
[{
"title": "The Sugarland Express",
"media_type": "movie",
"year": 1974,
"jobs": [
"Director"
]
},
{
"title": "1941",
"media_type": "movie",
"year": 1979,
"jobs": [
"Director"
]
},
{
"title": "Amazing Stories",
"media_type": "tv",
"year": 1985,
"jobs": [
"Director"
]
},
{
"title": "Hook",
"media_type": "movie",
"year": 1991,
"jobs": [
"Director"
]
},
{
"title": "The Terminal",
"media_type": "movie",
"year": 2004,
"jobs": [
"Director"
]
}
]
可用工作列表的示例输出:
{
"jobs": [
"Director",
"Producer",
"Screenplay",
"Director of Photography",
"Editor",
"Production Design",
"Art Direction",
"Set Decoration",
"Costume Design",
"Makeup",
"Sound",
"Visual Effects",
"Original Music Composer"
]
}
电影数据库(TMDB)是一个流行的、用户可编辑的电影和电视剧数据库。它提供了一个全面的 API,允许开发者访问电影和电视剧数据,包括:
TMDB API 可免费使用,但需要 API 密钥。你可以通过以下步骤获取 API 密钥:
API 有以下速率限制:
有关 API 的更多信息,请访问 TMDB API 文档。
本项目采用 MIT 许可证。