# Bilibili API MCP Server
用于哔哩哔哩 API 的 MCP(模型上下文协议)服务器,支持多种操作。
## 环境要求
- [uv](https://docs.astral.sh/uv/) - 一个项目管理工具,可以很方便管理依赖。
## 使用方法
1. clone 本项目
2. 使用 uv 安装依赖
```bash
uv sync
```
3. 在任意 mcp client 中配置本 Server
```json
{
"mcpServers": {
"bilibili": {
"command": "uv",
"args": [
"--directory",
"/your-project-path/bilibili-mcp-server",
"run",
"bilibili.py"
]
}
}
}
```
4. 在 client 中使用
## 支持的操作
支持以下操作:
1. `general_search`: 基础搜索功能,使用关键词在哔哩哔哩进行搜索。
2. `search_user`: 专门用于搜索哔哩哔哩用户的功能,可以按照粉丝数排序。
3. `get_precise_results`: 精确搜索功能,可以过滤掉不必要的信息,支持多种搜索类型:
- 用户搜索 (`user`):精确匹配用户名,只返回完全匹配的结果。例如搜索"双雷"只会返回用户名为"双雷"的账号信息,不会返回其他相关用户
- 视频搜索 (`video`)
- 直播搜索 (`live`)
- 专栏搜索 (`article`)
返回结果包含 `exact_match` 字段,标识是否找到精确匹配的结果。
4. `get_video_danmaku·`: 获取视频弹幕信息。
## 如何为本项目做贡献
1. Fork 本项目
2. 新建分支,并在新的分支上做改动
3. 提交 PR
## 🎉 更新内容
本项目现在包含了完整的打包和部署解决方案:
### 📦 打包选项
1. **Python包打包**(推荐)
```bash
python build.py
pip install dist/*.whl
```
2. **Docker容器化**
```bash
docker build -t bilibili-mcp-server .
docker-compose up -d
```
3. **自动化安装**
```bash
python install.py
```
### 🚀 快速开始
```bash
# 1. 自动安装和配置
python install.py
# 2. 或者手动构建
python build.py
# 3. 运行演示
python example.py
```
### 📋 生成的配置文件
- `mcp_config.json` - 开发模式配置 (uv run)
- `mcp_config_pip.json` - pip安装模式配置
- `mcp_config_uvx.json` - uvx运行配置 (推荐)
- `mcp_config_wheel.json` - 直接从wheel包运行
- `docker-compose.yml` - Docker部署配置
- `Dockerfile` - 容器构建文件
### 📚 详细文档
查看 [`PACKAGING.md`](./PACKAGING.md) 获取完整的打包指南和使用说明。
## License
MIT
Raw data
{
"_id": null,
"home_page": null,
"name": "bilibili-mcp-tools",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "api, bilibili, b\u7ad9, danmaku, mcp, search, \u5f39\u5e55",
"author": null,
"author_email": "bilibili-mcp-tools <mcp@example.com>",
"download_url": "https://files.pythonhosted.org/packages/12/21/919523e93758fb26344225c18901bf7563260652695432a2e8cf28e46945/bilibili_mcp_tools-0.1.1.tar.gz",
"platform": null,
"description": "# Bilibili API MCP Server\n\n\u7528\u4e8e\u54d4\u54e9\u54d4\u54e9 API \u7684 MCP\uff08\u6a21\u578b\u4e0a\u4e0b\u6587\u534f\u8bae\uff09\u670d\u52a1\u5668\uff0c\u652f\u6301\u591a\u79cd\u64cd\u4f5c\u3002\n\n## \u73af\u5883\u8981\u6c42\n\n- [uv](https://docs.astral.sh/uv/) - \u4e00\u4e2a\u9879\u76ee\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7ba1\u7406\u4f9d\u8d56\u3002\n\n## \u4f7f\u7528\u65b9\u6cd5\n\n1. clone \u672c\u9879\u76ee\n\n2. \u4f7f\u7528 uv \u5b89\u88c5\u4f9d\u8d56\n\n```bash\nuv sync\n```\n\n3. \u5728\u4efb\u610f mcp client \u4e2d\u914d\u7f6e\u672c Server\n\n```json\n{\n \"mcpServers\": {\n \"bilibili\": {\n \"command\": \"uv\",\n \"args\": [\n \"--directory\",\n \"/your-project-path/bilibili-mcp-server\",\n \"run\",\n \"bilibili.py\"\n ]\n }\n }\n}\n```\n\n4. \u5728 client \u4e2d\u4f7f\u7528\n\n## \u652f\u6301\u7684\u64cd\u4f5c\n\n\u652f\u6301\u4ee5\u4e0b\u64cd\u4f5c\uff1a\n\n1. `general_search`: \u57fa\u7840\u641c\u7d22\u529f\u80fd\uff0c\u4f7f\u7528\u5173\u952e\u8bcd\u5728\u54d4\u54e9\u54d4\u54e9\u8fdb\u884c\u641c\u7d22\u3002\n2. `search_user`: \u4e13\u95e8\u7528\u4e8e\u641c\u7d22\u54d4\u54e9\u54d4\u54e9\u7528\u6237\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u6309\u7167\u7c89\u4e1d\u6570\u6392\u5e8f\u3002\n3. `get_precise_results`: \u7cbe\u786e\u641c\u7d22\u529f\u80fd\uff0c\u53ef\u4ee5\u8fc7\u6ee4\u6389\u4e0d\u5fc5\u8981\u7684\u4fe1\u606f\uff0c\u652f\u6301\u591a\u79cd\u641c\u7d22\u7c7b\u578b\uff1a\n - \u7528\u6237\u641c\u7d22 (`user`)\uff1a\u7cbe\u786e\u5339\u914d\u7528\u6237\u540d\uff0c\u53ea\u8fd4\u56de\u5b8c\u5168\u5339\u914d\u7684\u7ed3\u679c\u3002\u4f8b\u5982\u641c\u7d22\"\u53cc\u96f7\"\u53ea\u4f1a\u8fd4\u56de\u7528\u6237\u540d\u4e3a\"\u53cc\u96f7\"\u7684\u8d26\u53f7\u4fe1\u606f\uff0c\u4e0d\u4f1a\u8fd4\u56de\u5176\u4ed6\u76f8\u5173\u7528\u6237\n - \u89c6\u9891\u641c\u7d22 (`video`)\n - \u76f4\u64ad\u641c\u7d22 (`live`)\n - \u4e13\u680f\u641c\u7d22 (`article`)\n\u8fd4\u56de\u7ed3\u679c\u5305\u542b `exact_match` \u5b57\u6bb5\uff0c\u6807\u8bc6\u662f\u5426\u627e\u5230\u7cbe\u786e\u5339\u914d\u7684\u7ed3\u679c\u3002\n4. `get_video_danmaku\u00b7`: \u83b7\u53d6\u89c6\u9891\u5f39\u5e55\u4fe1\u606f\u3002\n\n## \u5982\u4f55\u4e3a\u672c\u9879\u76ee\u505a\u8d21\u732e\n\n1. Fork \u672c\u9879\u76ee\n2. \u65b0\u5efa\u5206\u652f\uff0c\u5e76\u5728\u65b0\u7684\u5206\u652f\u4e0a\u505a\u6539\u52a8\n3. \u63d0\u4ea4 PR\n\n## \ud83c\udf89 \u66f4\u65b0\u5185\u5bb9\n\n\u672c\u9879\u76ee\u73b0\u5728\u5305\u542b\u4e86\u5b8c\u6574\u7684\u6253\u5305\u548c\u90e8\u7f72\u89e3\u51b3\u65b9\u6848\uff1a\n\n### \ud83d\udce6 \u6253\u5305\u9009\u9879\n\n1. **Python\u5305\u6253\u5305**\uff08\u63a8\u8350\uff09\n ```bash\n python build.py\n pip install dist/*.whl\n ```\n\n2. **Docker\u5bb9\u5668\u5316**\n ```bash\n docker build -t bilibili-mcp-server .\n docker-compose up -d\n ```\n\n3. **\u81ea\u52a8\u5316\u5b89\u88c5**\n ```bash\n python install.py\n ```\n\n### \ud83d\ude80 \u5feb\u901f\u5f00\u59cb\n\n```bash\n# 1. \u81ea\u52a8\u5b89\u88c5\u548c\u914d\u7f6e\npython install.py\n\n# 2. \u6216\u8005\u624b\u52a8\u6784\u5efa\npython build.py\n\n# 3. \u8fd0\u884c\u6f14\u793a\npython example.py\n```\n\n### \ud83d\udccb \u751f\u6210\u7684\u914d\u7f6e\u6587\u4ef6\n\n- `mcp_config.json` - \u5f00\u53d1\u6a21\u5f0f\u914d\u7f6e (uv run)\n- `mcp_config_pip.json` - pip\u5b89\u88c5\u6a21\u5f0f\u914d\u7f6e\n- `mcp_config_uvx.json` - uvx\u8fd0\u884c\u914d\u7f6e (\u63a8\u8350)\n- `mcp_config_wheel.json` - \u76f4\u63a5\u4ecewheel\u5305\u8fd0\u884c\n- `docker-compose.yml` - Docker\u90e8\u7f72\u914d\u7f6e\n- `Dockerfile` - \u5bb9\u5668\u6784\u5efa\u6587\u4ef6\n\n### \ud83d\udcda \u8be6\u7ec6\u6587\u6863\n\n\u67e5\u770b [`PACKAGING.md`](./PACKAGING.md) \u83b7\u53d6\u5b8c\u6574\u7684\u6253\u5305\u6307\u5357\u548c\u4f7f\u7528\u8bf4\u660e\u3002\n\n## License\n\nMIT\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\u54d4\u54e9\u54d4\u54e9 MCP \u670d\u52a1\u5668 - \u652f\u6301\u641c\u7d22\u3001\u5f39\u5e55\u3001\u7528\u6237\u4fe1\u606f\u7b49\u529f\u80fd\u7684\u6a21\u578b\u4e0a\u4e0b\u6587\u534f\u8bae\u670d\u52a1\u5668",
"version": "0.1.1",
"project_urls": {
"Bug Reports": "https://github.com/bilibili-mcp/bilibili-mcp-server/issues",
"Documentation": "https://github.com/bilibili-mcp/bilibili-mcp-server/blob/main/README.md",
"Homepage": "https://github.com/bilibili-mcp/bilibili-mcp-server",
"Repository": "https://github.com/bilibili-mcp/bilibili-mcp-server"
},
"split_keywords": [
"api",
" bilibili",
" b\u7ad9",
" danmaku",
" mcp",
" search",
" \u5f39\u5e55"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3653ddf2296db38129f296b33da5a1df07f0af11b209dfed0f0d618f390bf8ab",
"md5": "83ae680bd56d641ab7a0179aba1fbf8c",
"sha256": "8c3c3611ef445ce8cb5cabd69ca3b514734116cd421af11b473f10d01b5e1e66"
},
"downloads": -1,
"filename": "bilibili_mcp_tools-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "83ae680bd56d641ab7a0179aba1fbf8c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 11471,
"upload_time": "2025-08-11T09:18:26",
"upload_time_iso_8601": "2025-08-11T09:18:26.842285Z",
"url": "https://files.pythonhosted.org/packages/36/53/ddf2296db38129f296b33da5a1df07f0af11b209dfed0f0d618f390bf8ab/bilibili_mcp_tools-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1221919523e93758fb26344225c18901bf7563260652695432a2e8cf28e46945",
"md5": "46b1f9e5658999028d213b5730b67055",
"sha256": "b49134876adb00f39288bf2ceb6c4e76000ec6c57e68c56b71f4b6638cdea044"
},
"downloads": -1,
"filename": "bilibili_mcp_tools-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "46b1f9e5658999028d213b5730b67055",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 9513,
"upload_time": "2025-08-11T09:18:28",
"upload_time_iso_8601": "2025-08-11T09:18:28.388351Z",
"url": "https://files.pythonhosted.org/packages/12/21/919523e93758fb26344225c18901bf7563260652695432a2e8cf28e46945/bilibili_mcp_tools-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-11 09:18:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bilibili-mcp",
"github_project": "bilibili-mcp-server",
"github_not_found": true,
"lcname": "bilibili-mcp-tools"
}