mcpField
M
MCP Service

MCP Service

本地服务
github.com/Ukenn2112游戏娱乐2727 周前更新

关于 MCP Service

Bangumi MCP Server 为 Bangumi TV API 提供程序化访问,使 Claude 等 AI 助手能够查询动画、漫画、音乐、游戏和真人影视的条目、角色、人物与用户数据。

主要功能

  1. 0155 个覆盖 Bangumi API 端点的工具
  2. 023 个多步骤工作流提示词
  3. 031 个 OpenAPI 规范资源
  4. 04基于 httpx 的异步 API 调用
  5. 05支持可选的访问令牌

适用场景

  1. 01按关键字搜索动画并生成摘要
  2. 02查询条目的角色与声优信息
  3. 03管理用户的收藏与观看进度(需要认证)

MCP 相关

该项目是 MCP 服务,将 Bangumi API 的端点以工具形式提供给 MCP 客户端,并提供提示词与 OpenAPI 资源。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Bangumi MCP Server

English | 中文


English

一个 Model Context Protocol (MCP) 服务,可通过编程方式访问 Bangumi TV API,让 Claude 等 AI 助手能够使用全面的动画、漫画、音乐、游戏和现实媒体数据。

功能特性
  • 55 个 MCP 工具:全面覆盖 Bangumi API 端点
  • 3 个工作流提示词:为常见任务预置的多步骤工作流
  • 1 个资源:完整的 OpenAPI 规范,用于 API 文档
  • 模块化架构:遵循 MCP 最佳实践,代码库简洁且易于维护
  • 类型安全:完整的 Python 类型提示和枚举定义
  • 异步支持:使用 httpx 执行非阻塞 API 调用
快速开始
前置条件
  • Python 3.10 或更高版本
  • uv 包管理器(推荐)或 pip
安装
# Clone the repository
git clone https://github.com/Ukenn2112/BangumiMCP.git
cd BangumiMCP

# Create and activate virtual environment
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
uv pip install -e .
Claude Desktop 配置

在 claude_desktop_config.json 中添加:

{
  "mcpServers": {
    "bangumi-tv": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/BangumiMCP",
        "run",
        "main.py"
      ],
      "env": {
        "BANGUMI_TOKEN": "your_token_here"
      }
    }
  }
}

注意:BANGUMI_TOKEN 为可选项,但以下操作需要此令牌:

  • 需要身份验证的操作(收藏、个人数据)
  • 访问 R18 内容
  • 写入操作(创建、更新、删除)

获取令牌:https://next.bgm.tv/demo/access-token

项目架构

BangumiMCP 采用模块化架构,旨在提升可维护性和可扩展性:

BangumiMCP/
├── main.py                           # Server initialization (44 lines)
├── src/
│   ├── config.py                     # Configuration constants
│   ├── enums.py                      # API enum definitions (8 types)
│   ├── utils/
│   │   ├── api_client.py             # HTTP client & error handling
│   │   └── formatters.py             # Data formatting utilities
│   ├── resources/
│   │   └── openapi_resource.py       # OpenAPI specification resource
│   ├── tools/                        # 55 MCP tools organized by domain
│   │   ├── subject_tools.py          # Subjects & episodes (10 tools)
│   │   ├── character_tools.py        # Characters (7 tools)
│   │   ├── person_tools.py           # Persons & companies (7 tools)
│   │   ├── user_tools.py             # User information (3 tools)
│   │   ├── collection_tools.py       # Collections (11 tools)
│   │   ├── revision_tools.py         # Edit history (8 tools)
│   │   └── index_tools.py            # Indices/directories (9 tools)
│   └── prompts/
│       └── workflow_prompts.py       # Composite prompts (3)
├── bangumi-tv-api.json               # OpenAPI 3.0.3 specification
└── pyproject.toml                    # Project metadata
可用工具
条目与剧集(10 个工具)
  • get_daily_broadcast - 每周播出时间表
  • search_subjects - 带筛选条件的全文搜索
  • browse_subjects - 按类别浏览
  • get_subject_details - 条目详细信息
  • get_subject_image - 条目图片 URL
  • get_subject_persons - 相关创作者/工作人员
  • get_subject_characters - 相关角色
  • get_subject_relations - 相关条目
  • get_episodes - 剧集列表
  • get_episode_details - 剧集信息
角色(7 个工具)
  • search_characters - 搜索角色
  • get_character_details - 角色信息
  • get_character_image - 角色图片 URL
  • get_character_subjects - 包含该角色的条目
  • get_character_persons - 配音演员和创作者
  • collect_character - 添加到收藏 ⚠️ 需要身份验证
  • uncollect_character - 从收藏中移除 ⚠️ 需要身份验证
人物(7 个工具)
  • search_persons - 搜索创作者/演员
  • get_person_details - 人物信息
  • get_person_image - 人物图片 URL
  • get_person_subjects - 该人物参与的作品
  • get_person_characters - 相关角色
  • collect_person - 添加到收藏 ⚠️ 需要身份验证
  • uncollect_person - 从收藏中移除 ⚠️ 需要身份验证
用户(3 个工具)
  • get_user_info - 公开用户资料
  • get_user_avatar - 用户头像 URL
  • get_current_user - 已通过身份验证的用户信息 ⚠️ 需要身份验证
收藏(11 个工具)
  • get_user_collections - 用户的条目收藏
  • get_user_subject_collection - 条目收藏状态
  • update_subject_collection - 更新条目状态 ⚠️ 需要身份验证
  • get_user_episode_collection - 剧集观看列表 ⚠️ 需要身份验证
  • update_episode_collection - 批量更新剧集 ⚠️ 需要身份验证
  • get_single_episode_collection - 单集状态 ⚠️ 需要身份验证
  • update_single_episode_collection - 更新单集状态 ⚠️ 需要身份验证
  • get_user_character_collections - 角色收藏
  • get_user_character_collection - 角色收藏状态
  • get_user_person_collections - 人物收藏
  • get_user_person_collection - 人物收藏状态
修订记录(8 个工具)
  • get_person_revisions - 人物编辑历史
  • get_person_revision - 单条人物编辑详情
  • get_character_revisions - 角色编辑历史
  • get_character_revision - 单条角色编辑详情
  • get_subject_revisions - 条目编辑历史
  • get_subject_revision - 单条条目编辑详情
  • get_episode_revisions - 剧集编辑历史
  • get_episode_revision - 单条剧集编辑详情
Indices (9 tools)
  • create_index - Create new index ⚠️ Requires auth
  • get_index - Index details
  • update_index - Update index info ⚠️ Requires auth
  • get_index_subjects - Subjects in index
  • add_subject_to_index - Add subject ⚠️ Requires auth
  • update_index_subject - Update subject info ⚠️ Requires auth
  • remove_subject_from_index - Remove subject ⚠️ Requires auth
  • collect_index - Add index to collection ⚠️ Requires auth
  • uncollect_index - Remove index from collection ⚠️ Requires auth
Workflow Prompts

Pre-built multi-step workflows for common tasks:

  • search_and_summarize_anime - Search anime by keyword and get AI summary
  • get_subject_full_info - Get comprehensive subject information (details, persons, characters, relations)
  • find_voice_actor - Search character and identify voice actors
Development
Adding New Tools
  1. Identify the appropriate category (subject, character, person, etc.)
  2. Add the tool function to the corresponding file in src/tools/
  3. Register the tool in the module's register() function
  4. Update this README with the new tool count
Testing
# Test imports
python -c "from src.config import BANGUMI_TOKEN; print('OK')"
python -c "from src.tools import subject_tools; print('OK')"

# Run the server
uv run main.py
Code Structure

Dependency Hierarchy (no circular imports):

  • Level 0: config.py, enums.py (no dependencies)
  • Level 1: utils/ (depends on config & enums)
  • Level 2: resources/, tools/, prompts/ (depend on utils)
  • Level 3: main.py (orchestrates everything)

Import Guidelines:

  • Use relative imports within src/ package (e.g., from ..config import)
  • Import from specific modules, not package level
  • Follow the dependency hierarchy to avoid circular imports
Environment Variables
VariableRequiredDescription
BANGUMI_TOKENNoBangumi Access Token for authenticated operations and R18 content
License

This project is built on the Bangumi API documentation and follows its terms of service.

Related Projects
Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.


中文

一个基于 Model Context Protocol (MCP) 的服务器,为 Bangumi TV API 提供程序化访问接口,使 Claude 等 AI 助手能够与海量的动画、漫画、音乐、游戏和真人影视数据进行交互。

功能特性
  • 55 个 MCP 工具:完整覆盖 Bangumi API 端点
  • 3 个工作流提示:预构建的多步骤工作流,用于常见任务
  • 1 个资源:完整的 OpenAPI 规范文档
  • 模块化架构:清晰、可维护的代码库,遵循 MCP 最佳实践
  • 类型安全:完整的 Python 类型提示和枚举定义
  • 异步支持:使用 httpx 的非阻塞 API 调用
快速开始
前置要求
  • Python 3.10 或更高版本
  • uv 包管理器(推荐)或 pip
安装
# 克隆仓库
git clone https://github.com/Ukenn2112/BangumiMCP.git
cd BangumiMCP

# 创建并激活虚拟环境
uv venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# 安装依赖
uv pip install -e .
Claude Desktop 配置

在 claude_desktop_config.json 中添加:

{
  "mcpServers": {
    "bangumi-tv": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/BangumiMCP",
        "run",
        "main.py"
      ],
      "env": {
        "BANGUMI_TOKEN": "your_token_here"
      }
    }
  }
}

注意:BANGUMI_TOKEN 是可选的,但以下操作需要:

  • 认证操作(收藏、个人数据)
  • 访问 R18 内容
  • 写操作(创建、更新、删除)

获取令牌:https://next.bgm.tv/demo/access-token

项目架构

BangumiMCP 采用模块化架构,便于维护和扩展:

BangumiMCP/
├── main.py                           # 服务器初始化(44 行)
├── src/
│   ├── config.py                     # 配置常量
│   ├── enums.py                      # API 枚举定义(8 种类型)
│   ├── utils/
│   │   ├── api_client.py             # HTTP 客户端和错误处理
│   │   └── formatters.py             # 数据格式化工具
│   ├── resources/
│   │   └── openapi_resource.py       # OpenAPI 规范资源
│   ├── tools/                        # 55 个 MCP 工具,按领域组织
│   │   ├── subject_tools.py          # 条目和章节(10 个工具)
│   │   ├── character_tools.py        # 角色(7 个工具)
│   │   ├── person_tools.py           # 人物和公司(7 个工具)
│   │   ├── user_tools.py             # 用户信息(3 个工具)
│   │   ├── collection_tools.py       # 收藏(11 个工具)
│   │   ├── revision_tools.py         # 编辑历史(8 个工具)
│   │   └── index_tools.py            # 目录(9 个工具)
│   └── prompts/
│       └── workflow_prompts.py       # 组合提示(3 个)
├── bangumi-tv-api.json               # OpenAPI 3.0.3 规范
└── pyproject.toml                    # 项目元数据
可用工具
条目和章节(10 个工具)
  • get_daily_broadcast - 每周放送时间表
  • search_subjects - 全文搜索,支持过滤
  • browse_subjects - 按分类浏览
  • get_subject_details - 详细条目信息
  • get_subject_image - 条目图片 URL
  • get_subject_persons - 相关创作者/制作人员
  • get_subject_characters - 相关角色
  • get_subject_relations - 相关条目
  • get_episodes - 章节列表
  • get_episode_details - 章节信息
角色(7 个工具)
  • search_characters - 角色搜索
  • get_character_details - 角色信息
  • get_character_image - 角色图片 URL
  • get_character_subjects - 角色出现的条目
  • get_character_persons - 声优和创作者
  • collect_character - 添加到收藏 ⚠️ 需要认证
  • uncollect_character - 从收藏中移除 ⚠️ 需要认证
人物(7 个工具)
  • search_persons - 搜索创作者/演员
  • get_person_details - 人物信息
  • get_person_image - 人物图片 URL
  • get_person_subjects - 人物参与的作品
  • get_person_characters - 关联的角色
  • collect_person - 添加到收藏 ⚠️ 需要认证
  • uncollect_person - 从收藏中移除 ⚠️ 需要认证
用户(3 个工具)
  • get_user_info - 公开用户资料
  • get_user_avatar - 用户头像 URL
  • get_current_user - 当前认证用户信息 ⚠️ 需要认证
收藏(11 个工具)
  • get_user_collections - 用户的条目收藏
  • get_user_subject_collection - 条目收藏状态
  • update_subject_collection - 更新条目状态 ⚠️ 需要认证
  • get_user_episode_collection - 章节观看列表 ⚠️ 需要认证
  • update_episode_collection - 批量更新章节 ⚠️ 需要认证
  • get_single_episode_collection - 单个章节状态 ⚠️ 需要认证
  • update_single_episode_collection - 更新单个章节 ⚠️ 需要认证
  • get_user_character_collections - 角色收藏
  • get_user_character_collection - 角色收藏状态
  • get_user_person_collections - 人物收藏
  • get_user_person_collection - 人物收藏状态
修订历史(8 个工具)
  • get_person_revisions - 人物编辑历史
  • get_person_revision - 单个人物编辑详情
  • get_character_revisions - 角色编辑历史
  • get_character_revision - 单个角色编辑详情
  • get_subject_revisions - 条目编辑历史
  • get_subject_revision - 单个条目编辑详情
  • get_episode_revisions - 章节编辑历史
  • get_episode_revision - 单个章节编辑详情
目录(9 个工具)
  • create_index - 创建新目录 ⚠️ 需要认证
  • get_index - 目录详情
  • update_index - 更新目录信息 ⚠️ 需要认证
  • get_index_subjects - 目录中的条目
  • add_subject_to_index - 添加条目 ⚠️ 需要认证
  • update_index_subject - 更新条目信息 ⚠️ 需要认证
  • remove_subject_from_index - 移除条目 ⚠️ 需要认证
  • collect_index - 收藏目录 ⚠️ 需要认证
  • uncollect_index - 取消收藏目录 ⚠️ 需要认证
工作流提示

预构建的多步骤工作流,用于常见任务:

  • search_and_summarize_anime - 按关键字搜索动画并获取 AI 摘要
  • get_subject_full_info - 获取全面的条目信息(详情、人物、角色、关联)
  • find_voice_actor - 搜索角色并识别声优
开发
添加新工具
  1. 确定合适的类别(条目、角色、人物等)
  2. 将工具函数添加到 src/tools/ 中相应的文件
  3. 在模块的 register() 函数中注册工具
  4. 更新此 README 中的工具数量
测试
# 测试导入
python -c "from src.config import BANGUMI_TOKEN; print('OK')"
python -c "from src.tools import subject_tools; print('OK')"

# 运行服务器
uv run main.py
代码结构

依赖层次结构(无循环导入):

  • Level 0: config.py, enums.py(无依赖)
  • Level 1: utils/(依赖 config 和 enums)
  • Level 2: resources/, tools/, prompts/(依赖 utils)
  • Level 3: main.py(协调所有模块)

导入指南:

  • 在 src/ 包内使用相对导入(例如 from ..config import)
  • 从特定模块导入,而不是包级别
  • 遵循依赖层次结构以避免循环导入
环境变量
变量必填说明
BANGUMI_TOKEN否Bangumi 访问令牌,用于认证操作和访问 R18 内容
许可证

此项目基于 Bangumi API 文档构建,并遵循其服务条款。

相关项目
贡献

欢迎贡献!请随时提交问题或拉取请求。


致谢

此项目基于 Bangumi API 文档构建。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。