中国MCP
给人工智能代理看中国互联网。
一台MCP服务器。五个平台。需要零个API密钥。
搜索、阅读和分析以下内容 买, 知乎, 微博, 小红书 (红色注释),以及 抖音 --直接从您的AI代理。
它能做什么?
- 搜索 只需一个查询,即可跨所有中文平台
- 阅读 干净的Markdown中的完整帖子、文章和视频描述
- 获取评论 以及嵌套回复的讨论
- 追踪趋势 中国互联网上的话题
- 查找用户 --个人资料、关注者数量、个人简介
所有输出都是LLM优化的Markdown,而不是原始JSON,因此您的代理将令牌用于推理,而不是解析。
快速开始
克劳德桌面
添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"china-mcp": {
"command": "uv",
"args": ["run", "--directory", "/path/to/china-mcp", "python", "-m", "china_mcp.server"]
}
}
}克劳德代码
claude mcp add china-mcp -- uv run --directory /path/to/china-mcp python -m china_mcp.server光标
添加 .cursor/mcp.json 在项目根目录中:
{
"mcpServers": {
"china-mcp": {
"command": "uv",
"args": ["run", "--directory", "/path/to/china-mcp", "python", "-m", "china_mcp.server"]
}
}
}替换 /path/to/china-mcp 使用克隆存储库的实际路径。支持平台
| 平台 | 搜索 | 阅读帖子 | 评论 | 趋势 | 用户资料 |
|---|---|---|---|---|---|
| 商品 | ✅ | ✅ | ✅ | ✅ | ✅ |
| 知乎 | ✅ | ✅ | ✅ | ✅ | ✅ |
| 微博 | ✅ | ✅ | ✅ | ✅ | ✅ |
| 小红书(RedNote) | 🚧 | ✅ | 🚧 | 🚧 | ✅ |
| 抖音🚧 | ✅ | 🚧 | ✅ | 🚧 |
✅ 已执行🚧 尚不可用(反机器人程序或没有公共API)
安装
先决条件:Python 3.12+, 紫外线
# Clone the repository
git clone https://github.com/butstill3/china-mcp.git
cd china-mcp
# Install dependencies
uv sync
# Install browser for Playwright (needed for Zhihu, Douyin)
uv run playwright install chromium验证安装:
uv run python -m china_mcp.server您应该看到FastMCP横幅 Starting MCP server 'ChinaMCP'.
可用工具
search(query, platform?, limit?)
在中国平台上搜索内容。如果未指定平台,则搜索所有可用平台。
get_post(url)
通过URL获取帖子、文章或视频的完整内容。自动检测平台。
get_comments(url, limit?)
获取嵌套回复的帖子评论。
trending(platform?, limit?)
获取热门话题。如果未指定平台,则返回所有平台的组合趋势。
get_user(url_or_username, platform?)
获取用户资料信息——个人简介、关注者数量、帖子数量。
hot_topics(category?)
按主题分组的跨平台趋势概述。 *(即将推出)*
用法示例
连接到MCP客户端后,请尝试以下提示:
Search Bilibili for "AI Agent" tutorialsWhat's trending on Zhihu right now?Get the full content of this post: https://www.zhihu.com/question/123456/answer/789012Show me the comments on this Bilibili video: https://www.bilibili.com/video/BV1xx411c7mDLook up this Bilibili user: https://space.bilibili.com/12345建筑
MCP Client (Claude / Cursor / custom)
│
▼ MCP Protocol (stdio)
┌──────────────────────────┐
│ ChinaMCP Server │
│ │
│ Tools → Registry → Adapters → Formatter → Markdown
│ │
│ bilibili.py (httpx) │
│ zhihu.py (httpx + │
│ Playwright)│
│ weibo.py (httpx) │
│ xiaohongshu.py (httpx) │
│ douyin.py (Playwright) │
└──────────────────────────┘每个平台都有自己的 适配器 它实现了统一的接口。所有适配器返回 Pydantic模型,它们被格式化为 LLM优化Markdown 在发送回客户端之前。
发展
# Run tests
uv run pytest tests/ -x -v
# Lint
uv run ruff check src/ tests/
# Format
uv run ruff format src/ tests/
# Type check
uv run pyright src/添加新平台
- 创建
src/china_mcp/adapters/your_platform.py - 实施
BaseAdapter(5种方法:search,get_post,get_comments,get_trending,get_user) - 注册于
src/china_mcp/adapters/registry.py - 添加URL模式以进行自动检测
- 在中编写测试
tests/test_your_platform.py
贡献
欢迎投稿!无论是新的平台适配器、错误修复还是文档改进。
- 分叉存储库
- 创建您的分支(
git checkout -b feat/add-weibo-adapter) - 为您的更改编写测试
- 确保所有检查均已通过(
uv run pytest && uv run ruff check src/ tests/ && uv run pyright src/) - 打开拉取请求
