rednote-crawler
Provides tools for searching Xiaohongshu (REDnote) notes, collecting note details and comments via browser automation.
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., "@rednote-crawlersearch for 'skincare routine' notes"
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.
rednote-crawler
中文
小红书 (Xiaohongshu / REDnote) 数据采集框架 + MCP 服务。
基于 Playwright 实现真实浏览器自动化,具备双层反检测能力(playwright-stealth + browserforge)。通过 MCP 协议将采集能力暴露为标准工具,让 AI 助手(Claude Desktop / Code / Cursor)直接调用。
功能特性
MCP 服务:AI 助手可直接搜索小红书、采集笔记详情和评论
多种 Transport:stdio(本地)/ SSE(远程部署)/ Streamable HTTP
关键词搜索采集(瀑布流自动滚动加载)
笔记详情采集(标题、正文、互动数据、标签、图片/视频)
评论采集(Top N 评论,含用户信息和 IP 属地)
双层反检测(playwright-stealth 环境级 + browserforge 指纹级)
登录状态持久化(扫码登录后自动保存,下次启动免登录)
数据输出:JSON(原始完整)+ Excel/xlsx(3 个 Sheet 结构化)
生产级稳定性:超时控制、浏览器崩溃自动恢复、登录态失效检测
环境要求
Python 3.10+
uv 包管理器
快速开始
# 1. 克隆仓库
git clone https://github.com/yangsijie666/xiaohongshu-crawler.git && cd xiaohongshu-crawler
# 2. 安装依赖
uv sync
# 3. 安装浏览器
uv run playwright install chromium
# 4. 首次登录(扫码)
uv run python scripts/verify_login.py
# 5. 运行采集
uv run python main.pyMCP 服务使用
方式一:stdio 模式(推荐,本地集成)
在 Claude Desktop 配置文件中添加(Mac: ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"rednote-crawler": {
"command": "uv",
"args": ["run", "--directory", "/path/to/rednote-crawler", "python", "mcp_server.py"],
"env": {}
}
}
}方式二:SSE 模式(远程部署)
# 服务器端启动
uv run python mcp_server.py --transport sse --host 0.0.0.0 --port 8000客户端配置:
{
"mcpServers": {
"rednote-crawler": {
"url": "http://your-server:8000/sse"
}
}
}方式三:Streamable HTTP 模式
uv run python mcp_server.py --transport streamable-http --host 0.0.0.0 --port 8000MCP 工具列表
工具 | 说明 | 耗时 |
| 检查登录状态 | 5-10s |
| 关键词搜索笔记(max_count 1-50) | 30-90s |
| 采集笔记详情 + 评论 | 15-60s |
| 完整流程:搜索→详情→评论→存储 | 2-15min |
| 查询本地已保存数据 | <1s |
命令参考
命令 | 说明 |
| 安装/同步项目依赖 |
| 安装 Chromium 浏览器 |
| 运行完整采集流程 |
| 启动 MCP 服务(stdio) |
| 启动 MCP 服务(SSE) |
| 验证/完成登录 |
| 验证反检测效果 |
| 验证搜索采集 |
| 验证笔记详情+评论采集 |
| 运行测试 + 覆盖率 |
配置说明
编辑 config/settings.yaml:
配置项 | 默认值 | 说明 |
|
| 搜索关键词列表 |
|
| 每个关键词最多采集笔记数 |
|
| 每条笔记最多采集评论数 |
|
| 滚动后等待时间(秒) |
|
| 页面加载超时(秒) |
|
| 笔记之间随机延迟范围(秒) |
|
| 搜索之间随机延迟范围(秒) |
|
| 是否无头模式 |
|
| 输出目录 |
|
| 是否保存原始 JSON |
|
| 是否保存 Excel |
输出格式
data/
├── raw/
│ ├── {keyword}_{timestamp}.json # 搜索结果
│ └── notes_{keyword}_{timestamp}.json # 笔记详情+评论
└── processed/
└── {keyword}_{timestamp}.xlsx # Excel 工作簿
├── Sheet 1: 搜索结果 (8 列)
├── Sheet 2: 笔记详情 (13 列)
└── Sheet 3: 评论数据 (8 列)项目结构
mcp_server.py # MCP 服务入口(支持 stdio / SSE / HTTP)
main.py # CLI 采集入口
src/
├── session.py # MCP 会话管理(浏览器生命周期 + 并发锁)
├── errors.py # 统一错误格式
├── stealth.py # 反检测配置(指纹生成 + stealth 注入)
├── browser.py # Playwright 浏览器生命周期管理
├── auth.py # 登录 & 会话管理
├── search.py # 搜索结果采集(瀑布流滚动)
├── note.py # 笔记详情采集(含重试逻辑)
├── comment.py # 评论采集(Top N)
├── parser.py # 页面数据解析
└── storage.py # 数据存储(JSON + Excel/xlsx)
scripts/ # 验证脚本
config/ # YAML 配置
tests/ # 测试套件依赖
包 | 用途 |
playwright | 浏览器自动化 (async API) |
playwright-stealth | 反检测补丁 |
browserforge | 真实浏览器指纹生成 |
mcp[cli] | MCP 协议 SDK |
uvicorn | ASGI 服务器(SSE/HTTP transport) |
starlette | ASGI 框架(SSE/HTTP transport) |
pyyaml | YAML 配置加载 |
openpyxl | Excel 工作簿生成 |
许可证
MIT
Related MCP server: Xiaohongshu (RedBook) MCP Server
English
Xiaohongshu (REDnote) data collection framework + MCP server.
Built on Playwright for real browser automation with dual-layer anti-detection (playwright-stealth + browserforge). Exposes collection capabilities as standard MCP tools for AI assistants (Claude Desktop / Code / Cursor).
Features
MCP Server: AI assistants can directly search REDnote, collect note details and comments
Multiple Transports: stdio (local) / SSE (remote) / Streamable HTTP
Keyword search with infinite scroll auto-loading
Note detail collection (title, content, engagement metrics, tags, images/videos)
Comment collection (Top N comments with user info and IP location)
Dual-layer anti-detection (environment-level + fingerprint-level)
Persistent login state (auto-saved after QR code scan)
Output: JSON (raw) + Excel/xlsx (3-sheet structured)
Production-grade reliability: timeout control, browser crash auto-recovery, login expiry detection
Requirements
Python 3.10+
uv package manager
Quick Start
# 1. Clone
git clone <repo-url> && cd rednote-crawler
# 2. Install dependencies
uv sync
# 3. Install browser
uv run playwright install chromium
# 4. First login (QR code scan)
uv run python scripts/verify_login.py
# 5. Run collection
uv run python main.pyMCP Server Usage
Option A: stdio Mode (Recommended, Local Integration)
Add to Claude Desktop config (Mac: ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"rednote-crawler": {
"command": "uv",
"args": ["run", "--directory", "/path/to/rednote-crawler", "python", "mcp_server.py"],
"env": {}
}
}
}Option B: SSE Mode (Remote Deployment)
# Start on server
uv run python mcp_server.py --transport sse --host 0.0.0.0 --port 8000Client config:
{
"mcpServers": {
"rednote-crawler": {
"url": "http://your-server:8000/sse"
}
}
}Option C: Streamable HTTP Mode
uv run python mcp_server.py --transport streamable-http --host 0.0.0.0 --port 8000MCP Tools
Tool | Description | Latency |
| Check login status | 5-10s |
| Search notes by keyword (max_count 1-50) | 30-90s |
| Collect note details + comments | 15-60s |
| Full pipeline: search → details → comments → save | 2-15min |
| Query locally saved data files | <1s |
CLI Reference
Command | Description |
| Start MCP server (stdio) |
| Start MCP server (SSE) |
| SSE with custom host/port |
| Run full collection pipeline |
| Login via QR code |
| Run tests with coverage |
Project Structure
mcp_server.py # MCP server entry (stdio / SSE / HTTP)
main.py # CLI collection entry
src/
├── session.py # MCP session (browser lifecycle + concurrency lock)
├── errors.py # Unified error format
├── stealth.py # Anti-detection (fingerprint + stealth injection)
├── browser.py # Playwright browser lifecycle
├── auth.py # Login & session management
├── search.py # Search collection (infinite scroll)
├── note.py # Note detail collection (with retry)
├── comment.py # Comment collection (Top N)
├── parser.py # Page data parsing
└── storage.py # Data storage (JSON + Excel/xlsx)License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- 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/yangsijie666/xiaohongshu-crawler'
If you have feedback or need assistance with the MCP directory API, please join our Discord server