xiaohongshu-mcp
Provides tools for interacting with Xiaohongshu/RedNote: logging in via QR code, checking login status, searching notes, reading note details and body content, and fetching comments including nested replies.
Click on "Deploy 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., "@xiaohongshu-mcpSearch Xiaohongshu for 'best coffee shops in Shanghai' and summarize the top 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.
xiaohongshu-mcp
小红书(RedNote)MCP server。扫码登录一次(Playwright 持久化浏览器 Profile,登录态长期保存),之后 AI 即可在任意会话里直接搜索笔记、读正文、拉评论——适合「搜攻略、对比方案」这类任务。
工具
工具 | 作用 |
| 弹出浏览器窗口显示登录二维码,立即返回(不阻塞等待扫码);后台检测登录并自动跑一次搜索验证 |
| 查看登录状态;扫码完成后调用它取回登录与验证结果 |
| 关键词搜索,返回标题/作者/点赞数/ |
| 按 |
| 拉笔记评论(含楼中楼),攻略类笔记评论区常有重要补充 |
Related MCP server: RednoteMCP
安装
要求:Node ≥ 18,本机装有 Google Chrome(或 Edge;都没有则 npx playwright install chromium)。
git clone https://github.com/Richard-Zhang1019/xiaohongshu-mcp.git ~/xiaohongshu-mcp
cd ~/xiaohongshu-mcp
npm install
node index.js --self-test # 可选:本地自检注册到 MCP 客户端
ZCode(~/.zcode/cli/config.json):
{
"mcp": {
"servers": {
"xiaohongshu": {
"command": "node",
"args": ["/绝对路径/xiaohongshu-mcp/index.js"]
}
}
}
}Claude Code / 其他兼容 mcpServers 格式的客户端同理。
使用
对 AI 说「调用 xiaohongshu 的 login」,弹出 Chrome 窗口后用小红书 App 扫码;
扫完后说「check_login」,确认登录成功(后台会自动验证一次搜索链路);
之后直接说需求,例如:「在小红书分别搜 A 和 B 两个攻略,各读几篇笔记和热评,帮我对比」。
登录态保存在 ~/.xiaohongshu-mcp/browser-profile;删除该目录即登出。
实现要点
搜索主路线:像真人一样在页面搜索框输入提交,拦截页面自己发出的签名 XHR 拿结构化 JSON。这是唯一稳定可靠的路线——外部复刻签名请求(即使
x-s/x-t合法)会被网关以 500 "invoker failed" 拒绝,且登录后立刻发这类请求会触发风控、导致 session 快速失效。备选路线:页面上下文内
window._webmsxyw签名直调;兜底:搜索结果页 DOM 提取。笔记正文从笔记页
__INITIAL_STATE__严格按 note_id 索引提取(map 里会混入相关推荐笔记,不能取第一个 key);评论 API 失败时降级为笔记页首屏提取。登录判定用页面自证(搜索框 placeholder),不信 cookie:
web_session存在但 session 被服务端失效时所有接口一律 500。判定固定在首页做(等 hydration 完成)。点赞数标准化("1.2万" → 12000、"999+" → 999)。
默认有头模式(工具调用时会短暂弹出 Chrome 窗口,这是不被风控的关键);设
XHS_HEADLESS=1可切无头。浏览器实例共享复用、空闲 10 分钟自动回收;工具调用串行化;进程退出时
-9强杀浏览器防泄漏。部分设计参考了 cn-scraper-mcp 的小红书实现,感谢其踩坑经验。
诊断
npm run self-test # 端到端:登录判定 + UI 搜索全链路(与 MCP 工具调用同路径)License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
搜索笔记、浏览首页推荐、查看笔记内容与评论,并发表你的评论。直接在工作流中与小红书内容互动,高效跟进话题。
XHS search/details, PGY, comments/replies, users/ID resolution/posts, transcript
Reddit posts, comments, keyword search and historical archives as tools. Runs on Apify.
X (Twitter) search, profiles and trends, YouTube search, video stats and comments, TikTok comments.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables automated interaction with Xiaohongshu (Little Red Book) platform including searching posts, retrieving content and comments, and posting AI-generated comments with persistent login support.453-
- FlicenseNot gradedqualityDmaintenanceEnables automated interaction with Xiaohongshu (Little Red Book) to search for notes, retrieve content or comments, and post targeted smart comments. It utilizes Playwright to manage browser-based tasks such as secure login and automated engagement.126-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to search and collect data from Xiaohongshu/REDnote, including notes, comments, and user info, with dual-layer anti-detection and persistent login.21-
- AlicenseAqualityCmaintenanceEnables AI assistants to interact with Xiaohongshu (Little Red Book) through browser automation, including searching notes, fetching recommendations and details, publishing image-text posts, and liking/favoriting content.954 npm1ISC