电影数据库查询工具

一个基于TMDB API的电影数据库查询工具,提供演员合作电影查询、人员工作关系查询、电影人员查询等功能。

  • by leonardogilrodriguez
  • TypeScript
  • 本地部署
  • 6 星标
  • 更新于
在 GitHub 查看 leonardogilrodriguez/mcp-tmdb

使用说明

MCP-TMDB

该项目是模型上下文协议(MCP)的实现,它提供了与电影数据库(TMDB)交互的工具。

关于TMDB

电影数据库(TMDB)是一个流行的、用户可编辑的电影和电视节目数据库。它提供了一个全面的API,允许开发人员访问电影和电视节目数据,包括:

  • 影视节目信息
  • 演员和工作人员详细信息
  • 图片和海报
  • 评级和评论
  • 类似内容推荐
  • 还有更多

API概述

TMDB API是免费使用的,但需要API密钥。您可以通过以下方式获取API密钥:

  1. 在以下网址创建帐户 TMDB
  2. 转到您的帐户设置
  3. 选择“API”部分
  4. 正在请求API密钥

速率限制

API有以下速率限制:

  • 每10秒40个请求
  • 每天1000个请求

有关API的更多信息,请访问 TMDB API文件.

先决条件

  • Node.js(推荐版本:18或更高)
  • pnpm(10.7.0或更高版本)

安装

  1. 克隆存储库:
git clone https://github.com/leonardogilrodriguez/mcp-tmdb.git
cd mcp-tmdb
  1. 安装依赖项:
pnpm install
  1. 创建一个 .env 使用TMDB API密钥在项目根目录中创建文件:
TMDB_API_KEY=your_api_key_here

可用工具

1.两个_控制器_屏幕

搜索两个演员一起出现在屏幕上的电影。

参数:

  • actor1:第一个演员的名字
  • actor2:第二个演员的名字
  • language:(可选)结果语言(默认值:“en”)

2.两个人

搜索两个人在任何角色中合作的电影。

参数:

  • person1:第一个人的姓名
  • job1:第一人的工作。可能值:演员、工作人员
  • person2:第二个人的姓名
  • job2:第二个人的工作。可能值:演员、工作人员
  • language:(可选)结果语言(默认值:“en”)

3.两部电影

搜索在两部电影中担任任何角色的人。

参数:

  • movie1:第一部电影的名字
  • year1:(可选)第一部电影的年份
  • movie2:第二部电影的名字
  • year2:(可选)第二部电影的年份
  • language:(可选)结果语言(默认值:“en”)

4.电影类型_演员_流派

搜索一个人作为特定类型演员的电影作品。

参数:

  • person:演员姓名
  • genre:(可选)流派名称
  • language:(可选)结果语言(默认值:“en”)

5.摄影_船员_ enre

搜索一个人作为特定类型的摄制组成员的电影作品。

参数:

  • person:人员姓名
  • job:(可选)作业名称
  • genre:(可选)流派名称
  • language:(可选)结果语言(默认值:“en”)

6.工作列表

提供可在filmography_crew_genre工具中使用的可用作业列表。

用法

要运行MCP服务器,请执行以下操作:

pnpm inspector

要在调试模式下运行,请执行以下操作:

pnpm dev:debug

项目结构

mcp-tmdb/
├── API/              # API functions and utilities
├── interfaces/       # Type and interface definitions
├── tools/           # Tool implementations
├── main.ts          # Main entry point
├── package.json     # Project configuration
└── .env            # Environment variables (create)

主要依赖关系

  • @模型上下文协议/sdk:^1.12.1
  • dotenv:^16.5.0
  • 佐德:^3.25.55

MCP配置

克劳德桌面

要在Claude Desktop中配置此MCP:

  1. 打开克劳德桌面
  2. 转到“设置”>“MCP配置”
  3. 使用以下设置添加新的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"
      }
    }

工具输出示例

1.两个_控制器_屏幕

搜索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"
    }
]

2.两个人

搜索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"
    }
 	...
]

3.两部电影

搜索在两部电影《泰坦尼克号》和《指环王:王者归来》中工作的人时的示例输出:

[{
        "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"
    }
]

4.电影类型_演员_流派

搜索汤姆·汉克斯的恐怖电影时的示例输出:

[{
        "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
    }
]

4.电影摄影_ crew_genre

搜索史蒂文·斯皮尔伯格执导的喜剧电影时的示例输出:

[{
        "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"
        ]
    }
]

5.工作列表

可用作业的示例输出:

{
  "jobs": [
    "Director",
    "Producer",
    "Screenplay",
    "Director of Photography",
    "Editor",
    "Production Design",
    "Art Direction",
    "Set Decoration",
    "Costume Design",
    "Makeup",
    "Sound",
    "Visual Effects",
    "Original Music Composer"
  ]
}

德莫斯

two_ators_on-screen

两部电影

许可证

麻省理工学院