Provides comprehensive automation tools for Xiaohongshu (Little Red Book) social media platform, including user authentication, content publishing (images and videos with titles, descriptions, and tags), content discovery through feeds and search, note details retrieval, and commenting functionality
xhs-mcp
简体中文 | English
xhs-mcp
提供统一的命令行入口 xhs-cli
,并内置 MCP 服务器子命令。用于小红书(xiaohongshu.com)的 Model Context Protocol(MCP)服务器与 CLI 工具,支持登录、发布、搜索、推荐等自动化能力(基于 Puppeteer)。
📦 NPM 信息
包名:
xhs-mcp
运行 CLI(推荐):
npx xhs-cli <subcommand>
启动 MCP:
npx xhs-cli mcp [--mode stdio|http] [--port 3000]
✨ 功能
认证:登录、登出、状态检查
发布:图文发布(标题≤20、内容≤1000、最多18图)
发现:推荐、搜索、详情、评论
自动化:Puppeteer 驱动、无头模式、Cookie 管理
📋 可用工具
xhs_auth_login
、xhs_auth_logout
、xhs_auth_status
xhs_discover_feeds
、xhs_search_note
、xhs_get_note_detail
xhs_comment_on_note
xhs_publish_content
(统一发布接口:type
、title
、content
、media_paths
、tags
)图片:1-18个图片文件
视频:恰好1个视频文件
🚀 快速开始(MCP)
Stdio 模式(默认)
首次运行提示:如果未安装 Puppeteer 浏览器,先执行
npx xhs-cli browser # 自动检查并安装 Chromium,显示可执行路径 # 或 npx puppeteer browsers install chrome输出示例:
{ "success": true, "message": "Chromium is ready", "data": { "installed": true, "executablePath": "/path/to/chromium" } }
验证 MCP 连接:
HTTP 模式
HTTP 服务器支持:
Streamable HTTP (协议版本 2025-03-26) - 端点:
/mcp
SSE (协议版本 2024-11-05) - 端点:
/sse
和/messages
健康检查 - 端点:
/health
详细文档请参考:HTTP Transports
🧰 CLI 子命令
🔧 客户端接入(Cursor)
Stdio 模式
.cursor/mcp.json
:
HTTP 模式
.cursor/mcp.json
:
或者使用 HTTP 客户端直接连接:
⚠️ 注意事项
标题≤20、内容≤1000、图片≤18
避免同账号多端同时网页登录
合理控制发帖频率
🙏 致谢
基于 xiaohongshu-mcp 重构与扩展(TypeScript、Puppeteer、MCP 优化、日志清理、NPM 发布)。
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Enables interaction with Xiaohongshu (Little Red Book) platform through automated browser operations. Supports authentication, content publishing, search, discovery, and commenting using Puppeteer-based automation.