Skip to main content
Glama

mcp-medusa

MCP 服务器,暴露 Medusa 动漫自动化工具。

工具

add_anime

使用 POST /api/v2/anime/add 将动漫添加到 Medusa。

常见参数:

{
  "anime_id": 62076,
  "source": "myanimelist",
  "root_dir": "/media/videos/Anime",
  "anime": true,
  "scene": false,
  "status": "wanted",
  "initial_release_group": "SubsPlease",
  "fallback_release_groups": ["SubsPlease", "Erai-raws"],
  "release_group_fallback_days": 7
}

参数:

参数

必需

默认值

允许的值 / 备注

anime_id

是

无

特定来源的动漫 ID。对于 myanimelist,这是 MAL 动漫 ID。

root_dir

是

无

新剧集的 Medusa 根目录路径。

source

否

myanimelist

不区分大小写:myanimelist、livechart

anime

否

true

通常保持 true。

scene

否

false

是否启用场景编号。

status

否

wanted

Medusa 剧集状态字符串,通常为 wanted、skipped 或 ignored。

initial_release_group

否

无

要加入白名单的第一个/当前发布组,例如 SubsPlease。

fallback_release_groups

否

无

要轮换的发布组有序列表。将初始组放在首位以确保确定性行为。

release_group_fallback_days

否

7

剧集播出日期后多少天切换到下一个备用组。

directory_name

否

Medusa 生成

可选的剧集文件夹名称覆盖。

seasonal_anime

使用 GET /api/v2/anime/seasonal 查询 Medusa 季节性动漫。

{
  "year": 2026,
  "season": "SPRING",
  "source": "myanimelist",
  "source_sort": "anime_num_list_users",
  "page": 1,
  "limit": 10,
  "fields": ["animeId", "displayTitle", "year", "animeType", "genres", "score", "imageUrl"]
}

使用当前动漫季默认值的最小调用:

{}

参数:

参数

必需

默认值

允许的值 / 备注

year

否

当前年份

如果省略,则根据 MCP 服务器的当前日期计算。

season

否

当前动漫季

不区分大小写:WINTER、SPRING、SUMMER、FALL 或类似 Summer 的值。如果省略,则根据 MCP 服务器的当前月份计算。

source

否

myanimelist

不区分大小写:myanimelist、livechart

source_sort

否

anime_num_list_users

不区分大小写:anime_num_list_users、anime_score

page

否

1

Medusa 结果页码。必须大于或等于 1。

limit

否

10

每页结果数。Medusa 允许 1 到 1000;默认值故意设得较小,以避免 MCP 客户端截断。

fields

否

null

可选的要保留的响应字段列表。如果省略/为 null,则返回完整的 Medusa 动漫对象。

当前动漫季默认值使用以下月份映射:

月份

季节

一月-三月

WINTER

四月-六月

SPRING

七月-九月

SUMMER

十月-十二月

FALL

有用的 fields 值包括:

["animeId", "source", "displayTitle", "titleRomanji", "titleEnglish", "year", "season", "animeType", "status", "episodes", "episodeInfo", "genres", "studios", "score", "numListUsers", "imageUrl", "anidbId", "tvdbId", "malId", "url", "directoryName"]

resolve_anime_title

使用 GET /api/v2/anime/search(带 source、includeDetails=true 和 limit)将标题解析为丰富的 Medusa/MyAnimeList 候选。

{
  "title": "Frieren",
  "source": "myanimelist",
  "limit": 10,
  "min_score": 88,
  "score_gap": 8
}

返回 decision(值为 match、ambiguous 或 no_match)以及带评分的候选。

anime_info

按标题或 MAL ID 返回紧凑的动漫详情和 Medusa 存在状态,不添加任何内容。

{
  "title": "Frieren",
  "source": "myanimelist"
}

或:

{
  "mal_id": 52991,
  "source": "myanimelist"
}

seasonal_candidates

在应用剩余的 OpenClaw 特定启发式规则之前,使用 Medusa 的服务器端季节性过滤器获取季节性候选。

{
  "year": 2026,
  "season": "SUMMER",
  "source": "myanimelist",
  "limit": 25,
  "min_num_list_users": 3000,
  "fields": ["animeId", "displayTitle", "animeType", "genres", "numListUsers", "synopsis"]
}

MCP 工具发送 Medusa 过滤器,如 animeType=TV、minNumListUsers、excludeGenres=Kids,Boys Love、matched=false、firstSeasonOnly=true 和 fields,以减小负载大小。

prepare_seasonal_review

将季节性候选项目压缩为带有保守审查说明的 AI 审查包。

{
  "items": [{"animeId": 62076, "displayTitle": "Example Title"}],
  "max_items": 25
}

resolve_and_add_anime

通过 Medusa 的批量添加端点解析并试运行或执行单个添加。写入需要 execute: true。

{
  "title": "Frieren",
  "root_dir": "/media/videos/Anime",
  "execute": false
}

scheduler_status

返回 Medusa 调度器线程健康状况和队列状态。当动漫添加似乎卡住或未验证时使用。

{}

search_tvdb

按剧集名称在 TVDB 中搜索 TVDB ID。当动漫添加因 AniDB 到 TVDB 的映射问题而失败时,用作后备方案。

{ "query": "Dorohedoro", "language": "en" }

add_series

通过 POST /api/v2/series 直接按 TVDB ID 添加剧集。完全绕过动漫解析。当 add_anime 失败时,在 search_tvdb 之后使用。

参数:

参数

必需

默认值

备注

tvdb_id

是

无

TVDB 剧集 ID(来自 search_tvdb)。

root_dir

是

无

Medusa 根目录路径。

anime

否

true

status

否

wanted

接受类似 wanted、skipped、ignored 的字符串——内部转换为数字。

language

否

无

索引器语言覆盖。

show_dir

否

无

自定义剧集文件夹名称覆盖。

scene

否

false

paused

否

false

{ "tvdb_id": 370761, "root_dir": "/media/videos/Anime" }

set_episode_status

通过 POST /api/v2/internal/updateEpisodeStatus 设置剧集的剧集状态。当 TVDB 元数据不同步且 Medusa 未下载本应可用的剧集时使用。

参数:

参数

必需

默认值

备注

series_slug

是

无

剧集 slug(例如 tvdb370761)。

episodes

是

无

剧集 slug 列表(例如 ["s01e01", "s01e02"])。

status

否

wanted

目标状态:wanted、skipped、ignored。

{ "series_slug": "tvdb370761", "episodes": ["s01e01", "s01e02"], "status": "wanted" }

通过 PUT /api/v2/search/manual 强制手动搜索特定剧集。排队一个提供者搜索,主动查询已启用的提供者并抓取匹配的发布。在将剧集设置为 "wanted" 后使用。

参数:

参数

必需

默认值

备注

series_slug

是

无

剧集 slug(例如 tvdb370761)。

episodes

是

无

剧集 slug 列表(例如 ["s01e01", "s01e02"])。

{ "series_slug": "tvdb370761", "episodes": ["s01e01"] }

update_series_quality

通过 PATCH /api/v2/series/{slug} 更新现有剧集的允许或首选质量。使用人类可读的质量名称。省略的字段保持不变。

参数:

参数

必需

默认值

备注

series_slug

是

无

剧集 slug(例如 tvdb370761)。

allowed_qualities

否

无

允许列表的质量名称。

preferred_qualities

否

无

首选列表的质量名称。

质量名称:"SDTV"、"SD DVD"、"720p HDTV"、"RawHD"、"1080p HDTV"、"720p WEB-DL"、"1080p WEB-DL"、"720p BluRay"、"1080p BluRay"、"4K UHD TV"、"8K UHD TV"、"4K UHD WEB-DL"、"8K UHD WEB-DL"、"4K UHD BluRay"、"8K UHD BluRay"。

{ "series_slug": "tvdb370761", "allowed_qualities": ["1080p BluRay", "720p HDTV"] }

organize_season_folders

启用季文件夹并将剧集文件移动到 Season XX/ 子目录中,而不重命名文件。调用 POST /api/v2/series/{slug}/operation,使用 type=ORGANIZE_SEASON_FOLDERS。

当多季动漫的所有文件都在一个扁平目录中,且 Plex 因对单文件夹多季支持不佳而缺少剧集时使用。

参数:

参数

必需

默认值

备注

series_slug

是

无

剧集 slug(例如 tvdb370761)。

{ "series_slug": "tvdb370761" }

postprocess

在目录上触发 Medusa 手动后处理。扫描下载/暂存文件夹并将匹配的剧集移动到其剧集文件夹中。复用 MEDUSA_URL / MEDUSA_API_KEY 凭据。在自动后处理失败后(例如下载处理程序因发布命名错误而放弃),使用此工具清理滞留在暂存区的文件。调用 POST /api/v2/postprocess。

重要: directory 参数由 Medusa 核心 解释,因此它必须是 Medusa 容器内部看到的路径(例如 /data/medusa),而不是从单独的 Hermes 容器中可见的路径。

参数:

参数

必需

默认值

备注

directory

否

/data/medusa

要扫描的 Medusa 容器路径。必须与 Medusa 核心的视图一致,而不是 Hermes 挂载点。

process_type

否

auto

auto、manual 或 failed。

force_replace

否

false

覆盖现有的剧集文件。

process_method

否

copy

copy 或 move。

{ "proc_dir": "/data/medusa", "proc_type": "auto" }

bulk_add_anime

通过 POST /api/v2/anime/bulk-add 试运行或执行多个动漫添加。写入需要 execute: true。

{
  "items": [{"animeId": 62076, "displayTitle": "Example Title", "aiDecision": "add"}],
  "decision_field": "aiDecision",
  "allowed_decisions": ["add"],
  "execute": false
}

Related MCP server: MyAnimeList MCP Server

配置

环境变量:

变量

是否必需

描述

MEDUSA_URL

是

Medusa 的基础 URL,例如 http://medusa:8081

MEDUSA_API_KEY

建议

以 X-Api-Key 形式发送的 Medusa API 密钥

MEDUSA_WEB_ROOT

否

如果 Medusa 托管在某个路径下,则为 Web 根目录

MEDUSA_TIMEOUT

否

HTTP 超时时间(秒),默认 30

MCP_TRANSPORT

否

stdio 或 sse,默认 stdio

MCP_HOST

否

SSE 绑定主机,默认 0.0.0.0

MCP_PORT

否

SSE 绑定端口,默认 8000

MCP_DNS_REBINDING_PROTECTION

否

启用 MCP SDK Host/Origin 校验,默认 false

MCP_ALLOWED_HOSTS

否

启用 DNS 重绑定保护时,允许的 Host 请求头(逗号分隔),例如 daniel-nas.localdomain:3001,localhost:3001

MCP_ALLOWED_ORIGINS

否

启用 DNS 重绑定保护时,允许的 Origin 请求头(逗号分隔)

对于容器/SSE 部署,请保持 MCP_HOST=0.0.0.0 或显式设置它。DNS 重绑定保护默认处于禁用状态,因为映射端口、反向代理和局域网主机名通常会导致 421 Misdirected Request 错误。如果启用它,请在 MCP_ALLOWED_HOSTS 中包含外部可见的主机和端口。

本地运行

pip install -e .
MEDUSA_URL=http://localhost:8081 MEDUSA_API_KEY=... mcp-medusa

对于 SSE:

MEDUSA_URL=http://localhost:8081 MEDUSA_API_KEY=... mcp-medusa --transport sse --port 8000

Docker

镜像默认在端口 8000 上使用 SSE。

docker build -t mcp-medusa .
docker run --rm -p 8000:8000 \
  -e MEDUSA_URL=http://medusa:8081 \
  -e MEDUSA_API_KEY=... \
  mcp-medusa

如需改用 stdio:

docker run --rm -i \
  -e MEDUSA_URL=http://medusa:8081 \
  -e MEDUSA_API_KEY=... \
  mcp-medusa --transport stdio

CI/CD

该仓库使用全自动流水线(无需手动发布步骤):

  1. 针对 main 分支打开 PR。ci.yml 工作流会运行 tests/test_boot.py,该测试会实际启动服务器(stdio + SSE),并断言 FastMCP 构造、预期工具注册以及两种传输方式的绑定。这是在上线前捕获启动/导入崩溃的关卡。

  2. 自动合并。 一旦启动测试通过,enable-auto-merge 作业会使用 ACTIONS_PAT 仓库密钥合并 PR(squash 合并)(默认的 GITHUB_TOKEN 无法在此仓库中合并 PR)。

  3. 自动发布 + 构建。 推送到 main 会触发 merge-release.yml,它会重新运行启动测试,从 main 创建补丁版本递增的发布(v0.0.N+1),并在同一工作流中构建 + 推送 Docker 镜像(构建被并入 merge-release.yml,而不是单独的发布触发工作流,因为当发布由工作流通过 GITHUB_TOKEN 创建时,GitHub 会抑制 release: published 事件)。

在本地运行测试

uv venv
uv pip install -e ".[test]"
uv run pytest tests/ -v

启动测试会启动真实服务器,因此不需要 Docker。如果你修改了 server.py 启动路径中的任何内容,请在推送前运行此测试——如果服务器无法启动,CI 将阻止合并。

必需的密钥

  • ACTIONS_PAT — 具有 Contents: read+write 和 Pull requests: read+write 权限的细粒度 PAT(或经典 repo 令牌),以仓库密钥形式存储。由 ci.yml 用于合并 PR。(默认的 GITHUB_TOKEN 在此处不具备合并能力。)

  • DOCKER_USERNAME / DOCKER_PASSWORD — 由 docker-release.yml 用于推送镜像。

Available Tools

21 tools
add_animeA

Add an anime series to Medusa via /api/v2/anime/add.

Note: Some anime may fail with "no name on TVDBv2" due to AniDB→TVDB ID mapping issues. As a workaround, use search_tvdb to find the correct TVDB ID, then add_series to add it directly.

Inputs: anime_id (required), root_dir (required), anime, scene, +7 more.

add_seriesA

Add a series to Medusa directly by TVDB ID via POST /api/v2/series.

Use this as a fallback when add_anime fails due to AniDB-to-TVDB mapping issues. First find the correct TVDB ID with search_tvdb, then add it here. This bypasses anime resolution entirely and adds via the standard series endpoint.

quality values: "N/A", "Unknown", "SDTV", "SD DVD", "720p HDTV", "RawHD", "1080p HDTV", "720p WEB-DL", "1080p WEB-DL", "720p BluRay", "1080p BluRay", "4K UHD TV", "8K UHD TV", "4K UHD WEB-DL", "8K UHD WEB-DL", "4K UHD BluRay", "8K UHD BluRay". When omitted, Medusa's global quality defaults are used.

Inputs: tvdb_id (required), root_dir (required), anime, scene, +6 more.

anime_infoA

Return compact anime details and Medusa presence by title or MAL ID. Does not add anime.

Inputs: limit, title, mal_id, source, +3 more. Returns: object

bulk_add_animeB

Dry-run or add multiple anime items; skips filterDecision=skip.

Read each results[].outcome as in resolve_and_add_anime. With execute=true, only items that pass the dry-run as ready_to_add are submitted. already_exists and already_queued are skips; needs_review and mapping_failed need follow-up.

Inputs: items (required), source, execute, root_dir, +9 more. Returns: object

create_aliasA

Create a local scene exception (alias) for a series.

This enables Medusa to recognize an alternative release title when searching, allowing it to match releases that use a different naming scheme. Only local (user-managed) scene exceptions can be created via this tool.

Inputs: name (required), series_slug (required), season. Returns: object

delete_aliasB

Delete a scene exception (alias) by ID.

Inputs: alias_id (required). Returns: result

diagnose_release_groupsA

Diagnose release group issues for a series by comparing config vs available releases.

Checks provider cache first; if empty, triggers a manual search and retries. Returns a structured diagnosis with recommendation.

Inputs: series_slug (required), season, episode, max_retries, +1 more. Returns: object

get_aliasesA

List scene exceptions (aliases) for a series.

Scene exceptions are alternative episode/release titles that Medusa recognizes when searching. This tool reads them; use create_alias to add new ones.

Inputs: series_slug (required), season. Returns: result

organize_season_foldersA

Move episodes into Season XX/ subdirectories without renaming files.

Enables season folders on the series and moves all downloaded episode files into Season XX/ subdirectories, preserving original filenames. Also moves associated files (subtitles, etc.).

Use this when:

  • A multi-season anime has all files in a flat directory

  • Plex is missing episodes due to poor multi-season-in-one-folder support

  • A second season was added years later to a show originally added flat

Calls POST /api/v2/series/{slug}/operation with type=ORGANIZE_SEASON_FOLDERS.

Inputs: series_slug (required). Returns: object

postprocessA

Trigger Medusa manual post-processing on a directory.

Scans directory (a download/staging folder) and moves matched episodes into their show folders. Reuses Medusa credentials from MEDUSA_URL / MEDUSA_API_KEY. Use this to clear files stranded in staging after a failed auto-post-process (e.g. a mis-named release that the download handler bailed on).

IMPORTANT: directory is interpreted by MEDUSA CORE, so it must be the path as seen inside the Medusa container (e.g. /data/medusa), NOT the path visible from the Hermes container.

Inputs: directory, process_type, force_replace, process_method. Returns: object

prepare_seasonal_reviewC

Compact seasonal candidates into an AI review packet.

Inputs: items (required), max_items. Returns: object

resolve_and_add_animeB

Resolve one anime and report its add outcome. Dry-run unless execute is true.

Act on outcome, not title similarity: already_exists means skip (see match.slug); ready_to_add means execute only if authorized; needs_review means show candidates without adding; mapping_failed means use a confirmed TVDB ID with add_series. queued and already_queued are not proof of installation or episode downloads.

Inputs: limit, title, mal_id, source, +10 more. Returns: object

resolve_anime_titleB

Resolve an anime title to MAL candidates with match/ambiguous/no_match decision.

Inputs: title (required), limit, fields, source, +2 more. Returns: object

scheduler_statusA

Return Medusa scheduler and queue status.

Shows whether each scheduler thread is alive, enabled, and currently active. Useful for diagnosing stuck queues.

Inputs: no named parameters. Returns: object

search_tvdbA

Search TVDB for a show by name and return matching TVDB IDs.

Use this when an anime add fails due to AniDB-to-TVDB mapping issues. Find the correct TVDB ID here, then add the show with add_series.

Inputs: query (required), language. Returns: result

seasonal_animeB

Query a paginated seasonal anime page from Medusa, optionally returning only selected fields.

Season, source, and source_sort are case-insensitive.

Inputs: page, year, limit, fields, +3 more.

seasonal_candidatesC

Fetch server-filtered seasonal anime candidates and apply residual preference heuristics.

Inputs: year, limit, fields, season, +5 more. Returns: object

set_episode_statusA

Set episode statuses for a series via PATCH /api/v2/episodes/{series_slug}.

Use when TVDB metadata is out of sync with actual episode status and Medusa is not downloading episodes that should be available. Set affected episodes to "wanted" to force Medusa to search for them.

Uses the same PATCH endpoint as the Medusa Web UI, so it can change UNAIRED episodes to WANTED unlike the internal bulk-update endpoint.

Inputs: episodes (required), series_slug (required), status. Returns: object

update_release_groupsA

Update release group configuration for a series.

Sends PATCH /api/v2/series/{slug} with the specified config.release.* fields. Only the provided fields are changed; omitted fields are left as-is.

Inputs: series_slug (required), blacklist, whitelist, fallback_days, +1 more. Returns: object

update_series_qualityA

Update allowed and/or preferred qualities for an existing series.

Sends PATCH /api/v2/series/{slug} with config.qualities.* fields. Only the provided fields are changed; omitted fields are left as-is.

quality values: "N/A", "Unknown", "SDTV", "SD DVD", "720p HDTV", "RawHD", "1080p HDTV", "720p WEB-DL", "1080p WEB-DL", "720p BluRay", "1080p BluRay", "4K UHD TV", "8K UHD TV", "4K UHD WEB-DL", "8K UHD WEB-DL", "4K UHD BluRay", "8K UHD BluRay".

Inputs: series_slug (required), allowed_qualities, preferred_qualities.

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 21 tools

    Disambiguation4/5

    Most tools have distinct purposes, and the descriptions clearly differentiate workflows such as resolve_and_add_anime versus bulk_add_anime and add_anime versus add_series. However, seasonal_anime, seasonal_candidates, and prepare_seasonal_review overlap enough that an agent may hesitate about which seasonal query path to use.

    Naming Consistency3/5

    All names use snake_case, but verbs and noun-style names are mixed: get_aliases/create_alias/delete_alias, add_anime/add_series, resolve_anime_title, and noun-only names like scheduler_status and seasonal_candidates. The convention is still readable, but it is not a consistent verb_noun pattern throughout.

    Tool Count3/5

    At 21 tools, the surface is in the borderline-heavy range for this domain. Several tools are justified by distinct workflows, but the cluster of seasonal lookup tools and multiple add/resolve paths feels somewhat overgrown.

    Completeness3/5

    The surface covers adding series/anime, resolving titles, aliases CRUD, release groups, quality updates, episode status, search, post-processing, and scheduling. However, obvious gaps remain: there is no delete/remove series tool and no general list-series or series detail enumeration, which are common lifecycle operations.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers