Install
openclaw skills install xiaohongshu-aio小红书MCP服务下载、启动、重启、检测,小红书多账号管理、登录、状态检查、内容发布、小红书笔记和视频发布、点赞评论操作和用户信息查询等需要调用本技能。当用户需要从小红书获取笔记和视频数据、用户数据、发布笔记或视频时需要调用本技能。
openclaw skills install xiaohongshu-aio本技能提供完整的小红书账号管理和内容操作功能,基于小红书 MCP 服务器 API。
cd xiaohongshu-aio
uv sync
uv run xhs --help
uv tool install xiaohongshu-aioxhs mcp download 下载 MCP 服务器xhs mcp start 启动 MCP 服务器xhs mcp status 检查 MCP 服务器状态执行任何操作前,都需要先检查 MCP 服务器是否运行:
xhs mcp status
xhs login status确保 MCP 服务器已登录xhs account add(自动检测用户名)xhs account add --username 账号名称 --notes "备注"xhs account switch --username 账号名称xhs login status 确认切换成功xhs account listxhs account currentxhs login statusxhs login qrcodexhs login status 确认登录成功xhs login logoutxhs publish "标题" "内容" "图片URL1" "图片URL2" --tags 标签1 标签2
xhs publish "视频标题" "视频内容" "视频文件路径" --is-video
xhs feed search --keyword "关键词"xhs feed detail --feed-id "feed_id" --xsec-token "token"
xhs interact like "feed_id" "token"xhs interact comment "feed_id" "token" --content "评论内容"
xhs account list - 列出所有账号xhs account add [--username 用户名] [--notes 备注] - 添加账号xhs account remove --username 用户名 - 删除账号xhs account switch --username 用户名 - 切换账号xhs account import [--username 用户名] - 导入 cookiesxhs account current - 获取当前账号xhs login status [--base-url URL] - 检查登录状态xhs login qrcode [--base-url URL] - 获取登录二维码xhs login logout [--base-url URL] - 登出xhs publish 标题 内容 媒体文件... [--tags 标签...] [--is-video] [--base-url URL] - 发布笔记或视频内容xhs feed list [--base-url URL] - 列出推荐笔记xhs feed search --keyword 关键词 [--base-url URL] - 搜索笔记xhs feed detail --feed-id ID --xsec-token 令牌 [--base-url URL] - 获取笔记详情xhs interact like feed_id 令牌 [--unlike] [--base-url URL] - 点赞/取消点赞xhs interact favorite feed_id 令牌 [--unfavorite] [--base-url URL] - 收藏/取消收藏xhs interact comment feed_id 令牌 --content 内容 [--base-url URL] - 发表评论xhs user me [--base-url URL] - 获取当前用户资料xhs user profile --user-id ID --xsec-token 令牌 [--base-url URL] - 获取其他用户资料xhs mcp download - 下载 MCP 服务器xhs mcp test - 检查 MCP 服务器是否运行xhs mcp start - 启动 MCP 服务器xhs mcp stop - 停止 MCP 服务器xhs mcp status - 检查 MCP 服务器状态xhs mcp restart - 重启 MCP 服务器xhs --help - 显示帮助信息xhs 命令名['user', 'feed', 'interact', 'mcp'] --help 查看详细帮助XHS_MCP_BASE_URL - MCP 服务器地址(优先)XHS_BASE_URL - MCP 服务器地址(备用)XHS_TIMEOUT - HTTP 请求超时时间XHS_VERIFY_SSL - 是否验证 SSL 证书user_cookies.jsoncookies.jsonuser_cookies.json 文件| 问题 | 解决方案 |
|---|---|
| 无法连接服务器 | 检查 MCP 服务器是否运行,地址是否正确、重启 MCP 服务器 |
| 登录失败 | 确保二维码扫描及时,检查账号状态 |
| 发布失败 | 检查内容是否符合平台规范,文件是否可访问 |
| 账号切换失败 | 检查账号是否存在,重启 MCP 服务器 |
失败时重启 MCP 服务器:
xhs mcp restart
检查登录状态
xhs login status
如未登录,获取二维码
xhs login qrcode
扫码登录后确认
xhs login status
添加账号
xhs account add
发布内容
xhs publish "我的第一篇笔记" "这是内容" "https://example.com/image.jpg" --tags 测试 小红书
搜索相关内容
xhs feed search --keyword "咖啡"