RabbitMV MCP Service
基于 Model Context Protocol 实现的数据服务,提供视频、文章、演员、角色和网站数据的访问能力。
特性
- 基于 MCP (Model Context Protocol) SDK 构建
- 提供标准化的数据访问工具
- 支持多种数据过滤和查询方式
- 内置缓存机制
- 完整的错误处理和日志记录
- 类型注解和全面的测试覆盖
系统要求
- Python 3.12 或更高版本
- 支持 asyncio 的操作系统(Linux, macOS, Windows)
安装
- 确保已安装 uv:
pip install uv
- 克隆仓库:
git clone https://github.com/yourusername/rabbitmv-mcp.git
cd rabbitmv-mcp
- 创建并激活虚拟环境:
uv venv
source .venv/bin/activate # Linux/macOS
# 或
.venv\Scripts\activate # Windows
- 安装依赖:
uv pip install -r requirements.txt
- 安装开发依赖(可选):
uv pip install -r requirements.txt[dev]
配置
- 复制示例配置文件:
cp .env.example .env
- 根据需要修改
.env文件中的配置项:
LOG_LEVEL: 日志级别 (DEBUG, INFO, WARNING, ERROR)CACHE_TIME: 缓存时间(秒)NEED_AUTH: 是否启用鉴权AUTH_KEY: 鉴权密钥IMG_URL: 图片域名前缀
MCP 工具
服务提供以下 MCP 工具:
1. get_vod - 视频数据工具
获取视频相关数据。
参数:
ids: 视频ID,多个用逗号分隔t: 分类IDh: 几小时内的数据wd: 关键词搜索year: 年份范围,如:2020或2020-2023from: 播放器组标识isend: 是否完结 (1完结,0未完结)ac: 是否获取详情 (detail获取详情)pg: 页码,默认1pagesize: 每页数量,默认20,最大100
2. get_art - 文章数据工具
获取文章相关数据。
参数:
ids: 文章ID,多个用逗号分隔t: 分类IDh: 几小时内的数据wd: 关键词搜索ac: 是否获取详情pg: 页码pagesize: 每页数量
3. get_actor - 演员数据工具
获取演员相关数据。
参数:
ids: 演员ID,多个用逗号分隔t: 分类IDh: 几小时内的数据wd: 关键词搜索ac: 是否获取详情pg: 页码pagesize: 每页数量
4. get_role - 角色数据工具
获取角色相关数据。
参数:
ids: 角色ID,多个用逗号分隔t: 分类IDh: 几小时内的数据wd: 关键词搜索ac: 是否获取详情pg: 页码pagesize: 每页数量
5. get_website - 网站数据工具
获取网站相关数据。
参数:
ids: 网站ID,多个用逗号分隔t: 分类IDh: 几小时内的数据wd: 关键词搜索ac: 是否获取详情pg: 页码pagesize: 每页数量
开发指南
运行测试
uv pip install -r requirements.txt[dev] # 如果还没有安装开发依赖
pytest
代码格式化
black .
isort .
类型检查
mypy .
使用示例
from modelcontextprotocol import MCPClient
async def main():
client = MCPClient()
# 获取视频列表
result = await client.call_tool("get_vod", {
"pg": 1,
"pagesize": 20,
"wd": "示例"
})
print(result)
# 获取文章详情
result = await client.call_tool("get_art", {
"ids": "1",
"ac": "detail"
})
print(result)
asyncio.run(main())
特别说明
- 所有接口支持缓存机制,缓存时间通过
CACHE_TIME环境变量配置 - 接口支持鉴权,通过
NEED_AUTH和AUTH_KEY环境变量控制 - 图片地址支持配置域名前缀,通过
IMG_URL环境变量设置 - 所有数据查询都支持基于 ID、分类、时间和关键词的过滤
- 详情模式(ac=detail)会返回更完整的数据内容
- 项目使用 uv 进行依赖管理,确保依赖安装的确定性和可重现性
许可证
MIT
Metadata
Release files for rabbitmv-mcp 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rabbitmv_mcp-0.1.2.tar.gz | 29.8 kB | Without provenance | Details for rabbitmv_mcp-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rabbitmv_mcp-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for rabbitmv_mcp-0.1.2-py3-none-any.whl |
Total release size: 67.3 kB
Release files / rabbitmv_mcp-0.1.2.tar.gz
| Download URL | rabbitmv_mcp-0.1.2.tar.gz |
|---|---|
| Size | 29.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ded416eb9f781157dcf264a252a75c5ba8665af5f2ad878c222b510e97d08747
|
|
BLAKE2b-256 checksum How to use checksums |
f4b5f7dc71e239453f3d597f0d47db3cd03ba362a45efcf69a84365b797ffd67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / rabbitmv_mcp-0.1.2-py3-none-any.whl
| Download URL | rabbitmv_mcp-0.1.2-py3-none-any.whl |
|---|---|
| Size | 37.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79ad8c98c8e7b755ec71e26c307efc4930939afe82522e8f4d1e8809af8d8994
|
|
BLAKE2b-256 checksum How to use checksums |
e5394c88741cb2ad25b7e3286bfcedc959960804718129cd1d7c70af793f33db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Security for rabbitmv-mcp 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.