Skip to main content
Glama

maoyan-mcp(猫眼 + 大麦票务查询 MCP)

一个只读的 MCP(模型上下文协议)服务器:让 AI 助手查询猫眼电影排片、 猫眼演出和大麦演出信息。只做查询,不下单、不抢票、不支付。

English summary: A read-only MCP server (FastMCP, stdio) for querying Maoyan movie showtimes and performance listings and Damai performance listings in China. Query-only — no ordering, no ticket grabbing, no payments. See NOTES.md for endpoint research (kept out of git by default).

功能

猫眼

工具

说明

需要登录

get_hot_movies

正在热映(全国热映榜)

否

get_coming_movies

即将上映(按城市)

否

search_movies

按片名搜索电影

否

get_movie_detail

电影详情:类型、导演、时长、评分、简介

否

list_cinemas

某城市影院列表,可按名/地址筛选

否

get_cinema_showtimes

某影院排片:场次时间、影厅、版本、语言

否

get_hot_performances

某城市热门演出列表

否

search_performances

在热门演出列表内按关键词/分类筛选

否

get_performance_detail

演出详情:时间、城市、场馆、票价档、开售时间

否

get_performance_tickets

演出场次与票档:时间、票档名、票面价/实售价、余票、限购(预售和已开售都已实测)

是

auth_status / import_cookie / logout

登录状态 / Cookie 导入 / 退出

—

send_sms_code / login_with_sms

暂未实现(见下)

—

大麦

大麦没有电影排片,只有演出。工具名都带 damai_ 前缀。

工具

说明

需要登录

damai_get_hot_performances

大麦热门演出列表,可按城市/分类筛选

否

damai_search_performances

在热门榜内按关键词(片名/艺人/场馆)筛选

否

damai_get_performance_detail

演出详情:时间、城市、场馆、票价区间、开售时间、艺人

否

damai_get_performance_tickets

演出场次与票档(见“已知限制”:目前场次不可用)

部分

damai_auth_status / damai_import_cookie / damai_logout

大麦登录状态 / Cookie 导入 / 退出

—

damai_send_sms_code / damai_login_with_sms

暂未实现(见下)

—

Related MCP server: Cinema Scheduler

安装

git clone https://github.com/<you>/maoyan-mcp.git
cd maoyan-mcp
python3 -m venv .venv
.venv/bin/pip install -e .

Python ≥ 3.10。依赖只有 fastmcp 和 httpx。

在 MCP 客户端里使用

以 Claude Desktop / Cursor 等为例,在 MCP 配置里加:

{
  "mcpServers": {
    "maoyan": {
      "command": "/path/to/maoyan-mcp/.venv/bin/maoyan-mcp"
    }
  }
}

也可以直接跑:.venv/bin/python -m maoyan_mcp(stdio 传输)。

冒烟测试(无需登录,真实联网查询):

.venv/bin/python scripts/smoke.py                 # 猫眼电影 + 演出
.venv/bin/python scripts/smoke_damai.py           # 大麦热门 / 搜索 / 详情

演出票档冒烟测试(需要先 import_cookie 登录,真实联网查询):

.venv/bin/python scripts/smoke_tickets.py [演出编号 ...]
# 默认查 518642([第25小时]跨年演唱会)和 509000(话剧《茶馆》)
.venv/bin/python scripts/smoke_damai_tickets.py [演出编号 ...]
# 默认查 1095761949422(周传雄深圳站)和 1101026106334(回春丹佛山站)

大麦登录单独验证(不保存凭证,Cookie 只从 stdin 读):

printf '%s' 'cookie2=...; tb_token_=...; ...' \
  | .venv/bin/python scripts/test_damai_auth.py

登录

绝大多数查询不需要登录。 只有演出场次与票档(get_performance_tickets) 需要登录,因为猫眼的场次接口未登录会返回“请先登录”。

短信验证码登录:暂未实现

send_sms_code / login_with_sms 调用时会明确返回不可用,不会假装成功。 原因是美团/大众点评的登录流程必须先通过滑块验证(verify.meituan.com, yoda),其 behavior / _token 参数与真实浏览器里的滑动轨迹绑定, 没有纯接口的短信登录流程。详见 NOTES.md。

  1. 在浏览器里登录大众点评,用和猫眼同一个手机号。 注意:只登录猫眼演出拿不到这个 Cookie,实测猫眼演出站本身没有 .dianping.com 的 Cookie,只有登录大众点评后才有 dper;

  2. 开发者工具 → Application → Cookies → .dianping.com,复制 dper 的值;

  3. 调 import_cookie,传入 dper=<值>。

工具会先拿这个凭证去猫眼校验,通过后才保存在本机 ~/.maoyan-mcp/auth.json(文件权限 0600),凭证只存本机、不上传、 不写入代码或日志。logout 可删除它。

大众点评 App 扫码登录是另一条已验证可行的路(catbus 项目在用), 但它需要 H5guard 的 JS 签名,本项目 MVP 未实现,见 NOTES.md。

大麦的登录是淘宝/支付宝账号体系,短信登录同样需要先过滑块验证 或 App 扫码,没有纯接口流程,所以 damai_send_sms_code / damai_login_with_sms 也明确返回不可用。

后备方式与猫眼相同,只是 Cookie 不同:大麦现在的登录里没有 SESSION 这个 Cookie(2026-12-03 用真实登录验证过:已登录 的浏览器里,passport.damai.cn 和 www.damai.cn 的 .damai.cn Cookie 列表里都没有 SESSION 这一行)。登录校验用的是淘宝的 登录 Cookie 组合,必须带上:

  • 必需:cookie2(淘宝登录会话)+ tb_token_(Damai H5 里 叫这个名字,淘宝侧也写作 _tb_token_);

  • 一起导入更好:cna、t、_hvn_login、damai.cn_user、 damai.cn_nickName、isg、sgcookie 等其余 .damai.cn 登录 Cookie;_m_h5_tk / _m_h5_tk_enc 不用复制,程序每次 调用时会自己向网关领新的。

步骤:

  1. 在浏览器里登录大麦;

  2. 开发者工具 → Application → Cookies → .damai.cn,在列表里 找到 cookie2、tb_token_ 等,双击 Value 单元格复制完整值 (值很长,单击只选中一部分,必须双击复制);

  3. 调 damai_import_cookie,传入整串 cookie2=<值>; tb_token_=<值>; cna=<值>; ...。

工具会先拿这组凭证去大麦的登录接口校验(未通过则不保存),通过后 保存在本机 ~/.maoyan-mcp/damai_auth.json(文件权限 0600),与猫眼 的凭证分开存。登录 Cookie 会过期,过期后需重新登录、重新导入。 注意:这条登录链路尚未用真实登录验证过(构建时没有可用的 大麦登录),见“已知限制”。想先单独验证登录而不保存凭证,可跑 scripts/test_damai_auth.py(Cookie 只从 stdin 读,不会打印出来)。

已知限制(诚实说明,不伪造数据)

大麦

  • 按场次查票档目前不可用:大麦公开的 H5 详情接口目前不返回 场次列表(performBases 为空,多个项目、多种参数都试过),且按 场次查票档的接口本身也需要登录。damai_get_performance_tickets 因此只返回演出的时间范围与票价区间,并如实说明场次不可用, 不编造场次和票价。等大麦恢复返回场次列表后,代码里已留好 按场次查票档的路径(需配合 damai_import_cookie 的登录 Cookie)。

  • 没有公开的关键词搜索接口:damai_search_performances 是在 热门榜(最多 150 条)内按关键词筛选,不是全库搜索;查指定演出 请用演出编号调 damai_get_performance_detail。

  • 热门榜是全国榜:大麦的榜单接口忽略城市参数,城市筛选是在 本地按场馆城市做的;小城市(如东莞、惠州)在前 150 条热门里 可能一条都没有,这不代表当地没有演出,只是榜单覆盖不到。

  • 大麦登录链路未实测:damai_import_cookie 的校验逻辑是按 上游接口的返回码写的,但构建时没有真实的大麦登录 Cookie 可用, 没有验证通过;用真实登录导入后请先跑 scripts/test_damai_auth.py(只从 stdin 读 Cookie,不保存) 或 scripts/smoke_damai_tickets.py 验证。另:大麦现在的登录 里没有 SESSION 这个 Cookie,见“大麦登录”一节,不要只传 SESSION。

猫眼

  • 售价不完整:电影场次的售价是猫眼“石墨字体”加密的,接口返回的是 自定义字体码位而非数字,无法直接解析。本项目不猜价格, sell_price 返回空,只返回明文的影城卡价 vip_price(如有), 并在结果里注明原因。影院列表里的起售价是明文的,可以正常看。

  • 排片只覆盖今天起 3 天:这是猫眼接口本身的范围,更远的日期暂无排片。

  • 演出没有公开的关键词搜索接口:search_performances 是在该城市 热门演出列表内筛选,不是全库搜索;查指定演出请用演出编号调 get_performance_detail。

  • 热门演出榜不是严格的本地表:cityId 确实会改变榜单(深圳、东莞、 惠州三城返回的编号完全不同),但榜单是按城市精选的“热门” feed,个别 条目是巡演项目、在其他城市开售(条目里的 on_sale_text 会注明,如 “哈尔滨已开售”)。想确认演出到底在哪个城市演,请看 get_performance_detail / get_performance_tickets 返回的城市和场馆。

  • 个别票档没有名字:上游对某些座位区票档只给价格和颜色,不给名字 (如话剧《茶馆》的 380/280/180/100 四档),本项目返回 name: null, 不编造名字。

  • 演出详情接口不稳定:get_performance_detail 在 2026-12-03 实测时 成功过一次,随后持续返回 403(疑似上游风控)。工具会如实返回上游 错误,不编造数据;热门演出列表本身稳定可用。

  • 12 月 5 日的排片可能还没放出来:以 2026-12-03 实测为例,东莞石龙 的影院里《饥饿游戏:收获日出》只排到 12 月 4 日,12 月 5 日尚无场次, 这是真实数据,不是接口故障。

平台结构

src/maoyan_mcp/providers/ 是按平台拆的:maoyan.py 实现猫眼, damai.py 实现大麦,__init__.py 里是 provider 的最小约定 (TicketProvider)。新平台照此加一个 provider 文件,在 server.py 里按平台分发即可。

免责声明

  • 本项目与猫眼、大麦无关,是非官方的个人学习/研究项目。

  • 请遵守猫眼、大麦的服务条款;仅以普通浏览的频率查询,不要高频抓取, 不要用于批量爬取或抢票。

  • 两家接口都未公开,随时可能变更或加风控;接口失效时工具会返回明确的 上游错误,而不是假数据。

License

MIT

Available Tools

24 tools
auth_statusAuth StatusB

查看当前登录状态。

Inputs: no named parameters. Returns: object

damai_auth_statusDamai Auth StatusA

查看大麦当前登录状态。

Inputs: no named parameters. Returns: object

damai_get_hot_performancesDamai Get Hot PerformancesA

大麦热门演出列表(演唱会、话剧、音乐会、体育等)。city 可传城市名如“深圳”——大麦的榜单是全国热门榜,城市筛选在本地按场馆城市做;小城市可能返回较少。category 可传“演唱会”“音乐会”“话剧歌剧”“舞蹈芭蕾”“曲苑杂坛”“体育”“展览休闲”或编号。

Inputs: city, limit, category. Returns: object

damai_get_performance_detailDamai Get Performance DetailA

大麦演出详情:时间、城市、场馆、票价区间、开售时间、艺人等,无需登录。item_id 来自大麦热门演出列表。

Inputs: item_id (required). Returns: object

damai_get_performance_ticketsDamai Get Performance TicketsA

大麦演出场次与票档。诚实说明:大麦公开的 H5 详情接口目前不返回场次列表,且按场次查票档需要登录;本工具返回演出时间范围与票价区间,并说明场次不可用的原因,不编造场次。

Inputs: item_id (required). Returns: object

damai_login_with_smsDamai Login With SmsB

【暂未实现】大麦用短信验证码登录。原因同 damai_send_sms_code:需先过滑块验证或 App 扫码,无法用纯接口完成。

Inputs: code (required), phone (required). Returns: object

damai_logoutDamai LogoutA

退出大麦登录:删除本机保存的大麦登录凭证。

Inputs: no named parameters. Returns: object

damai_search_performancesDamai Search PerformancesA

大麦按关键词搜演出(片名/艺人/场馆名)。注意:大麦没有可用的公开关键词搜索接口,本工具是在热门榜里筛选;如需查指定演出,请用演出编号调 damai_get_performance_detail。city 可传城市名,不传则全国。

Inputs: keyword (required), city, limit, category. Returns: object

damai_send_sms_codeDamai Send Sms CodeA

【暂未实现】大麦发送短信验证码。大麦登录是淘宝/支付宝账号体系,需先过滑块验证或 App 扫码,无法用纯接口完成,调用会明确返回不可用及替代方案。

Inputs: phone (required). Returns: object

get_cinema_showtimesGet Cinema ShowtimesB

某影院的排片:场次时间、影厅、版本、语言。只覆盖今天起 3 天;售价为石墨字体加密,返回为空,影城卡价(如有)在 vip_price。

Inputs: cinema_id (required), date, movie_id. Returns: object

get_coming_moviesGet Coming MoviesB

即将上映的电影列表(按城市)。city 可传城市名如“深圳”或编号如 30。

Inputs: city, limit. Returns: object

get_hot_moviesGet Hot MoviesB

正在热映的电影列表(全国热映榜,不分城市)。

Inputs: limit. Returns: object

get_hot_performancesGet Hot PerformancesA

热门演出列表(不指定关键词时用这个)。city 可传城市名或编号;返回的是按城市精选的热门榜,个别条目可能是巡演项目、在其他城市开售。

Inputs: city, limit. Returns: object

get_movie_detailGet Movie DetailA

一部电影的详情:类型、导演、时长、评分、简介等。movie_id 来自搜索或热映列表。

Inputs: movie_id (required). Returns: object

get_performance_detailGet Performance DetailB

演出详情:时间、城市、场馆、票价档、开售时间等,无需登录。item_id 来自热门演出列表。

Inputs: item_id (required). Returns: object

get_performance_ticketsGet Performance TicketsB

演出场次与票档:每场的时间、票档名、票面价/实售价、余票、限购。需要登录(import_cookie 后可用)。预售期走预选接口,已开售走场次+票档接口,两条都已实测;未登录会明确报错,不返回假数据。

Inputs: item_id (required), city. Returns: object

list_cinemasList CinemasB

某城市的影院列表,可按影院名/地址关键词筛选。day 为 YYYY-MM-DD,默认今天。

Inputs: day, city, limit, keyword. Returns: object

login_with_smsLogin With SmsB

【暂未实现】用短信验证码登录。原因同 send_sms_code:需先过滑块验证,无法用纯接口完成。

Inputs: code (required), phone (required). Returns: object

logoutLogoutA

退出登录:删除本机保存的登录凭证。

Inputs: no named parameters. Returns: object

search_moviesSearch MoviesB

按片名搜索电影。city 可传城市名如“深圳”或编号如 30。

Inputs: keyword (required), city. Returns: object

search_performancesSearch PerformancesB

某城市的热门演出列表(演唱会、话剧、音乐会等)。注意:这是猫眼按城市精选的热门榜,不是严格的本地演出表,个别条目可能是巡演项目、在其他城市开售,条目里的 on_sale_text 会注明。

Inputs: keyword (required), city, limit, category. Returns: object

send_sms_codeSend Sms CodeA

【暂未实现】发送短信验证码。美团/大众点评登录需先过滑块验证,无法用纯接口完成,调用会明确返回不可用及替代方案。

Inputs: phone (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 24 tools

    Disambiguation3/5

    The maoyan vs damai_ prefixed tools are mostly separable, but the parallel performance tools (search_performances vs get_hot_performances, and the four damai equivalents) blur together, and search_performances is described as a hot list rather than a keyword search. Four tools are explicitly marked 【暂未实现】 (send_sms_code, login_with_sms, damai_send_sms_code, damai_login_with_sms), which are dead ends an agent may still pick. The login story (import_cookie vs SMS login vs auth_status) also has overlapping intent.

    Naming Consistency3/5

    The verb_noun pattern is followed consistently (get_, list_, search_, import_, send_, login_with_), which is good. However, the namespace is asymmetric: damai tools carry a damai_ prefix while the equivalent Maoyan tools have no prefix, so identical concepts look like different families. The suffix naming (search_performances vs damai_search_performances) makes the pairing readable but not predictable.

    Tool Count3/5

    24 tools is heavy for a read-only discovery server, and four of them are unimplemented stubs that consume slots without adding capability. The movie/cinema/performance/damai breakdown is logical, but trimming the non-functional auth tools would make the set much tighter.

    Completeness3/5

    Discovery coverage is solid for movies (hot, coming, search, detail, cinemas, showtimes) and performances (hot, search, detail, tickets) across both Maoyan and Damai. But the surface stops at browsing: no seat maps, no order/booking flow, and get_cinema_showtimes returns empty prices due to encryption, leaving a dead end. The auth lifecycle is half-finished since SMS login paths are declared unavailable.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      12306 ticket purchase search server based on Model Context Protocol (MCP). It provides a simple API interface, allowing large models to search for 12306 ticket purchasing information through the interface.
      8
      1
      Apache 2.0
    • F
      license
      Not graded
      quality
      C
      maintenance
      An MCP server that scrapes movie theater schedules from eiga.com to provide movie, theater, and showtime data to AI assistants. It enables users to search for screenings and calculate the optimal viewing order for watching multiple movies.
      -
    • A
      license
      A
      quality
      D
      maintenance
      MCP server for searching, discovering, and exploring Chinese long-form video content from WeTV and Tencent Video, enabling AI assistants to recommend dramas, variety shows, anime, and movies with play links, ratings, and episode info.
      6
      MIT