cn-scraper-mcp
CN Scraper MCP is a Model Context Protocol server that enables AI agents to search and scrape content from major Chinese internet platforms, handling anti-scraping measures, login states, and browser environments locally.
🛒 E-Commerce
Taobao/Tmall: Search products and get product details (TLS fingerprint spoofing + MTOP signing, no browser needed)
JD.com: Search products and get product details (requires local Chrome with persistent login profile)
Pinduoduo: Get product details without limits; search is limited to the first session only
📱 Social & Content Platforms
Xiaohongshu: Search notes, get note details, and fetch comments (requires local Chrome + login cookies)
Zhihu: Search content, view hot list, get answers, question answer lists, and comments (requires login cookies)
Weibo: Search posts, view hot list (no login needed), get user timelines, post details, and comments
Douyin: Search videos (experimental), view hot list, get video details and comments (requires login + manual CAPTCHA handling)
Bilibili: Search videos, view popular videos, get video details and comments (all public APIs, no login required)
Douban: Search items, get subject details and reviews
Dianping: Search merchants, get shop details and reviews
ZSXQ (知识星球): Fetch paid community topics and full article content (requires login cookie)
🔐 Authentication & Cookie Management
guided_login: Opens Chrome, navigates to a platform's login page, waits for manual login, then harvests cookies automaticallyharvest_cookies: Extracts cookies from an already-logged-in Chrome session via CDPcheck_cookies: Checks all platform cookie files for existence, validity, required fields, and freshnessverify_login: Makes a live request to verify if cached login sessions are still accepted (supports Zhihu, Weibo, ZSXQ, Douyin)
🔧 Environment Diagnostics
diagnose: Checks Python version, dependencies, Chrome installation, CDP ports, cookie status, and recent errors without making any real scraping requests
Provides search functionality for Taobao/Tmall e-commerce platform, returning product listings with price, sales, and shop info.
Provides search for notes and retrieval of note details including body, tags, and comments on Xiaohongshu.
Provides search for questions and articles, and supports fetching trending topics from Zhihu.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cn-scraper-mcpsearch taobao for 儿童学习桌"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
这是什么
每个 AI Agent(Codex、Claude Code、Cursor、Trae)都能搜网页,但中文平台通常需要登录态、浏览器环境或平台专用参数:
淘宝:需要浏览器一致的网络指纹和登录 Cookie
京东:依赖已登录的本地浏览器环境
小红书:需要住宅 IP、本地浏览器和搜索结果中的访问参数
知乎:游客搜索已关闭,全部 API 需要登录态
拼多多:平台限制严格,目前不推荐使用
微博:搜索 API 需要登录态(SUB token),热搜游客即可访问
抖音:需要浏览器登录并可能人工处理验证码
B站:搜索、热门、视频详情和评论可直接使用公开 API
豆瓣:条目搜索、条目详情和短评/影评
大众点评:商户搜索、商户详情和用户评价
知识星球:付费社群,内容藏在 cookie 认证的 REST API 后面
这个项目就是把踩了好几个月的坑打包成一个 MCP Server——你的 Agent 一句话就能搜:taobao_search("儿童学习桌")。
安全与隐私
cn-scraper-mcp 在你的电脑上本地运行,不需要把 Cookie、账号密码或浏览器 Profile 上传到任何中转服务器:
Cookie 默认保存在
~/.cn-scraper-cookies/,京东登录态保存在本地 Chrome Profile。登录过程直接发生在平台官方页面,软件不会读取或保存你的账号密码。
Cookie 值不会写入日志,也不会通过 MCP 工具结果返回给 Agent;工具只返回状态、字段名和本地路径等非敏感信息。
发起抓取或在线登录验证时,凭证只会发送给对应平台域名。
代码完全开源,所有凭证处理流程都可以审查。
建议仍像保护浏览器登录态一样保护本机账号:不要分享 Cookie 文件,不要把凭证提交到 Git,并限制本地文件的访问权限。
Related MCP server: rednote-analyzer-mcp
平台支持
电商
平台 | 方式 | 需要浏览器 | 限制 | 稳定性 |
淘宝/Tmall |
| ❌ | 宽松¹ | ✅ 稳定 |
京东/JD | Chrome CDP headful | ✅ | 中等 | ✅ 稳定² |
拼多多/PDD ❌ | — | — | — | ❌ 不可用³ |
¹ 淘宝无硬性限流,但平台可能随时收紧,不建议高频批量抓取。 ² 京东由本地 Chrome 生成登录态和动态签名,工具读取结构化 API 响应;通过
guided_login("jd")可自动初始化持久化 Profile。 ³ 拼多多每个浏览器会话仅放行第一次搜索,之后永久"系统繁忙"。单次搜索结果零实用价值,引擎代码保留但不推荐使用。
内容社区
平台 | 方式 | 需要浏览器 | 限制 | 稳定性 |
小红书/XHS | 本地 Chrome CDP + cookie | ✅ | 中等⁴ | ✅ 稳定 |
知乎/Zhihu | REST API v4 | ❌ | 正常 | ✅ 稳定 |
知识星球/ZSXQ | REST API v2 | ❌ | 正常 | ✅ 稳定 |
微博/Weibo | REST API | ❌ | 正常 | ✅ 稳定 |
抖音/Douyin ⚠️ | Chrome CDP + 验证码轮询 | ✅ | 实验性⁵ | ⚠️ 实验性 |
B站/Bilibili | 公开 Web API | ❌ | 建议低频调用 | ✅ 稳定 |
豆瓣/Douban | 移动端 JSON API | ❌ | 搜索可能触发风控 | ⚠️ 依会话 |
大众点评/Dianping | 公开网页解析 | ❌ | 可能触发页面风控 | ⚠️ 依页面结构 |
⁴ 小红书只允许住宅 IP——云浏览器/数据中心 IP 直接封。必须用本地 Chrome。 ⁵ 抖音搜索需要登录态 + 手动过滑块验证码。支持 120s 等待用户手动验证,通过后自动抓取。
guided_login("douyin")可引导登录。
快速开始
安装
pip install cn-scraper-mcp也可以从源码安装开发版本:
git clone https://github.com/goesByhc/cn-scraper-mcp.git
cd cn-scraper-mcp
pip install .推荐:CDP 自动登录并保存 Cookie
安装并连接 MCP 后,直接让 Agent 调用:
guided_login(platform="weibo")它会打开本地 Chrome 并进入平台官方登录页。你自己扫码或输入密码后,工具通过 CDP 自动读取完整 Cookie(包括 JavaScript 无法读取的 HttpOnly Cookie),再保存到本机 ~/.cn-scraper-cookies/。京东则保存到本地持久化 Chrome Profile。
这是推荐方式,因为它不会要求你复制 Cookie,不容易漏掉关键字段,也更适合 Cookie 过期后的重新登录。可用平台名包括 taobao、jd、xiaohongshu、zhihu、weibo、zsxq、douyin、pdd、douban 和 dianping。
已有通过远程调试端口启动且登录完成的 Chrome 时,也可以调用:
harvest_cookies(platform="weibo")启动
cn-scraper-mcp
# 或: python -m cn_scraper_mcp.serverDocker
容器内预装 Chromium,无需本地浏览器:
docker build -t cn-scraper-mcp .
docker run -i --rm \
-v ~/.cn-scraper-cookies:/root/.cn-scraper-cookies \
-v ~/.jd_login_profile:/root/.jd_login_profile \
cn-scraper-mcpAgent 集成配置:
# Codex ~/.codex/config.toml
[mcp_servers.cn-scraper]
command = "docker"
args = ["run", "-i", "--rm",
"-v", "/本机绝对路径/.cn-scraper-cookies:/root/.cn-scraper-cookies",
"-v", "/本机绝对路径/.jd_login_profile:/root/.jd_login_profile",
"cn-scraper-mcp"]请把 /本机绝对路径/ 替换为真实路径;MCP 客户端直接启动进程时不会替你展开 ~。
Docker 镜像内置 Chromium +
--no-sandbox。京东 headful 模式如需 Xvfb,设置环境变量XVFB_WRAPPER=1。小红书仍需住宅 IP——数据中心 IP 会被封。
MCP 工具一览
电商搜索
工具 | 说明 |
| 淘宝/天猫关键词搜索 → 价格、销量、店铺 |
| 淘宝商品详情 → 标题、价格、店铺 |
| 京东关键词搜索 → SKU、价格、商品名 |
| 京东商品详情 → 名称、价格、店铺、规格 |
| 拼多多搜索 → 仅首次有效 |
| 拼多多商品详情 → 不限次数 |
内容社区
工具 | 说明 |
| 小红书笔记搜索 → 标题、作者、点赞、 |
| 小红书笔记详情 → 标题、正文、作者、标签、互动数、发布时间 |
| 小红书笔记首屏评论 → 评论内容、用户、点赞、时间(需要 |
| 知乎搜索 → 问题、文章 |
| 知乎热榜 |
| 知乎回答评论(支持分页) |
| 知乎回答完整正文 |
| 知乎问题下的回答列表 |
| 微博搜索 → 微博帖子内容 |
| 微博热搜榜 |
| 微博用户时间线 |
| 微博帖子评论(支持分页) |
| 微博帖子完整详情 |
| 抖音搜索 → CDP 浏览器 + 验证码轮询(⚠️ 实验性) |
| 抖音热搜榜 |
| 抖音视频详情 |
| 抖音视频评论 |
| B 站视频搜索(纯 HTTP,无需登录) |
| B 站热门视频榜 |
| B 站视频详情及互动统计 |
| B 站视频一级评论(支持分页) |
| 豆瓣书籍、电影、音乐等条目搜索 |
| 豆瓣条目详情 |
| 豆瓣条目短评/影评 |
| 大众点评商户搜索 |
| 大众点评商户详情 |
| 大众点评商户评价 |
| 知识星球付费社群帖子 |
| 知识星球文章全文 |
Cookie 管理
工具 | 说明 |
| 检查所有平台 Cookie 状态 |
| 在线验证知乎、微博、知识星球、抖音登录态;不支持的平台明确返回 unsupported |
| 环境诊断——依赖版本、浏览器、CDP 端口 |
| CDP 自动收割 Cookie(包括 HttpOnly) |
| 引导登录——自动打开浏览器 → 你扫码 → 登录后自动收割 Cookie |
MCP 客户端配置
Codex
~/.codex/config.toml:
[mcp_servers.cn-scraper]
command = "cn-scraper-mcp"
args = []保存后可用 codex mcp list 检查连接状态。
Claude Code / Cursor / Reasonix
这三个客户端都支持标准的 mcpServers JSON:
Claude Code:项目根目录
.mcp.jsonCursor:全局
~/.cursor/mcp.json,或项目目录.cursor/mcp.jsonReasonix:项目根目录
.mcp.json
{
"mcpServers": {
"cn-scraper": {
"command": "cn-scraper-mcp",
"args": []
}
}
}Trae
Trae 不同版本的配置文件位置可能不同。建议在设置中的 MCP 管理界面添加本地 stdio Server:名称填写 cn-scraper,命令填写 cn-scraper-mcp,参数留空。
如果客户端提示找不到命令,先用
where cn-scraper-mcp(Windows)或which cn-scraper-mcp(macOS/Linux)找到完整路径,再把command替换为该路径。
更多文档
常见问题
Q: 使用这个软件安全吗? 软件在你的电脑上本地运行,不经过项目方的中转服务器。Cookie 和浏览器 Profile 保存在本机,Cookie 值不会写入日志或通过 MCP 返回给 Agent;需要访问平台时,凭证只发送给对应的平台域名。
Q: 软件会读取或保存账号密码吗? 不会。登录发生在平台官方页面,由你自己扫码或输入密码;工具只在登录完成后通过 CDP 保存浏览器产生的 Cookie。
Q: Cookie 保存在什么地方?
Cookie 默认保存在 ~/.cn-scraper-cookies/,京东使用本地持久化 Chrome Profile。请像保护已登录浏览器一样保护这些文件,不要分享或提交到 Git。
Q: 怎么初始化 Cookie 最方便?
用 guided_login("平台名") 工具。它会自动打开 Chrome → 导航到登录页 → 等你扫码/输密码 → 登录后自动收割 Cookie 并保存。
Q: 合法吗? 仅用于学习和研究目的。批量抓取可能违反平台服务条款。风险自负。切勿用于垃圾信息、DDoS 或商业级大规模抓取。
许可证
MIT — 详见 LICENSE。
支持项目
如果这个项目帮你节省了时间,可以请作者喝杯咖啡:
致谢
curl_cffi — TLS 指纹伪装
FastMCP — MCP Server 框架
websockets — 异步 WebSocket
Made with ☕ and months of frustration at Chinese platform anti-bot walls.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceAn MCP server optimized for Chinese users that enables AI models to perform Bing searches and fetch webpage content without requiring an API key. It provides specialized tools for searching and scraping web data directly through supported AI environments like Claude or Cursor.Last updated595MIT
- AlicenseAqualityDmaintenanceMCP server enabling AI assistants to search, analyze, and generate content for Xiaohongshu (RedNote), China's leading lifestyle social media platform.Last updated67MIT
- Flicense-qualityBmaintenanceMCP server enabling AI agents to generate AI videos and images, analyze video content, and download videos from Douyin and Xiaohongshu.Last updated
- AlicenseAqualityCmaintenance这是一个面向中文圈的MCP服务器,将中国互联网常用能力(如地图、快递、RSS、B站等)封装为标准MCP工具,方便AI Agent安全调用。Last updated132MIT
Related MCP Connectors
Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.
MCP server for AI dialogue using various LLM models via AceDataCloud
Hosted MCP with 91 agent tools: X, domains, SEO, Maps, Trends, Search, YouTube, TikTok, and more.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/goesByhc/cn-scraper-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server