XHS CLIBLOCK
用于小红书(xiaohongshu.com)的 Model Context Protocol(MCP)服务器与 CLI 工具,支持登录、发布、搜索、推荐等自动化能力
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
简体中文 | English
xhs-mcp 提供统一的命令行入口 xhs-mcp,并内置 MCP 服务器子命令。用于小红书(xiaohongshu.com)的 Model Context Protocol(MCP)服务器与 CLI 工具,支持登录、发布、搜索、推荐等自动化能力(基于 Puppeteer)。
[](https://www.npmjs.com/package/xhs-mcp) [](https://www.npmjs.com/package/xhs-mcp) [](https://opensource.org/licenses/MIT)
📦 NPM 信息
- 包名:
xhs-mcp - 运行 CLI(推荐):
npx xhs-mcp - 启动 MCP:
npx xhs-mcp mcp [--mode stdio|http] [--port 3000]
✨ 功能
- 认证:登录、登出、状态检查
- 发布:图文和视频发布
- 图文发布:标题≤20字符(40显示单位)、内容≤1000、最多18图
- 视频发布:支持 MP4、MOV、AVI、MKV、WebM、FLV、WMV 格式
- ⭐ 新功能: 支持图片 URL 自动下载(HTTP/HTTPS)
- ⭐ 新功能: 标题宽度精确验证(CJK字符2单位,ASCII字符1单位)
- 支持本地图片路径
- 支持 URL 和本地路径混合使用
- 智能缓存机制,避免重复下载
- 发现:推荐、搜索、详情、评论
- 用户笔记:列表查看、删除管理
- 自动化:Puppeteer 驱动、无头模式、Cookie 管理
- 验证:发布功能验证脚本,支持 HTML 报告生成
📋 可用工具
xhs_auth_login、xhs_auth_logout、xhs_auth_statusxhs_discover_feeds、xhs_search_note、xhs_get_note_detailxhs_comment_on_notexhs_get_user_notes、xhs_delete_note(用户笔记管理)xhs_publish_content(统一发布接口:type、title、content、media_paths、tags)- 图片发布:1-18个图片文件或URL
- 视频发布:恰好1个视频文件
- 混合使用:支持图片URL和本地路径混合
🚀 快速开始(MCP)
Stdio 模式(默认)
npx xhs-mcp mcp # 调试日志 XHS_ENABLE_LOGGING=true npx xhs-mcp mcp
首次运行提示:如果未安装 Puppeteer 浏览器,先执行 ``bash npx xhs-mcp browser # 自动检查并安装 Chromium,显示可执行路径 # 或 npx puppeteer browsers install chrome`输出示例:`json { "success": true, "message": "Chromium is ready", "data": { "installed": true, "executablePath": "/path/to/chromium" } }``
验证 MCP 连接:
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | npx xhs-mcp mcpHTTP 模式
# 启动 HTTP 服务器(默认端口 3000) npx xhs-mcp mcp --mode http # 指定端口 npx xhs-mcp mcp --mode h
063850d768d4OBSERVED · 2026-10-08Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control.
claude mcp add xhs-mcp -- npx -y [email protected]
{
"mcpServers": {
"xhs-mcp": {
"command": "npx",
"args": [
"-y",
"[email protected]"
]
}
}
}Exposed tools (10)
7 read · 2 write · 1 destructive. Blast radius: 1 tool can delete or overwrite — an agent that can be talked into calling a tool can be talked into calling this one.
| Tool | Risk | Description |
|---|---|---|
xhs_auth_login | write | Start XiaoHongShu login process. |
xhs_auth_logout | read | Logout from XiaoHongShu (clears saved cookies). |
xhs_auth_status | read | Check XiaoHongShu login status (fast check with browser). |
xhs_comment_on_note | read | Comment on a note. |
xhs_delete_note | destructive | Delete a user note by ID or delete the last published note. |
xhs_discover_feeds | read | Get home page feed list. |
xhs_get_note_detail | read | Get detailed information about a specific note. |
xhs_get_user_notes | read | Get current user notes list. |
xhs_publish_content | write | Publish content to XiaoHongShu (supports both images and videos). |
xhs_search_note | read | Search for notes by keyword. |
Trust audit
BLOCKgrade D · trust 69/100 Do not install this without reading the findings. The audit found something that could harm you or your machine.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | FAIL |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | WARN |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- declared (6 observation(s))
- Network
- declared (2 observation(s))
- Shell
- declared (2 observation(s))
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (11)
exec(command, { timeout: 60000 }, (error, stdout, stderr) => {.option('--with-deps', 'Install OS-level dependencies as well (may require sudo)')xhs_delete_note
.cursorindexingignore
import { Config, LoginResult, StatusResult } from '../../shared/types';} from '../../shared/errors';
import { BaseService } from '../../shared/base.service';import { deleteCookiesFile } from '../../shared/cookies';import { isLoggedIn, getLoginStatusWithProfile } from '../../shared/xhs.utils';@modelcontextprotocol/sdk, commander, cors, express, node-fetch, puppeteer, string-width, @babel/core
system use found in code, not declared in the description
Gates applied: no_behavioural_pass.
063850d768d4full audit observations/trust-audit/mcp-server/algovate__xhs-cli.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-08 | 063850d768d4 | BLOCK | D | 69 | first audit |
Questions
What is the XHS CLI MCP server?
用于小红书(xiaohongshu.com)的 Model Context Protocol(MCP)服务器与 CLI 工具,支持登录、发布、搜索、推荐等自动化能力
What tools does XHS CLI expose?
10 in total: 7 read-only, 2 that write, and 1 that can delete or overwrite (xhs_delete_note). Every one is listed on this page with its risk.
Is XHS CLI safe to connect to an agent?
No — not without reading the findings first. The audit graded it D (69/100) and found 2 critical or high issues in the source. Each one is listed on this page with the file and line it is on. Separately from the audit: 1 of its tools can destroy data, so scope the token you give it to what you actually need.
What credentials does XHS CLI need?
No credential environment variables were found in its source, so it appears to need none.
How does XHS CLI run?
It speaks sse, stdio and streamable-http, so it runs as a local process your client starts. It is published on npm as xhs-mcp at 0.8.13.
How current is this page?
The grade is for one exact copy of the source (063850d768d4), read on 2026-10-08. The repository is watched and re-audited when it changes.