Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Search, analyze, and interact with Xiaohongshu (RedNote/小红书) content via a local MCP server and shell scripts.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: xiaohongshu3description: |4小红书(RedNote)内容工具。使用场景:5- 搜索小红书笔记并获取详情6- 获取首页推荐列表7- 获取帖子详情(正文、图片、互动数据、评论)8- 发表评论 / 回复评论9- 获取用户主页和笔记列表10- 点赞、收藏帖子11- 发布图文或视频笔记12- 热点话题跟踪与分析报告13- 帖子导出为长图14触发词示例:15- "搜一下小红书上的XX"16- "跟踪一下小红书上的XX热点"17- "分析小红书上关于XX的讨论"18- "小红书XX话题报告"19- "生成XX的小红书舆情报告"20---2122# 小红书 MCP Skill2324基于 [xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp) 封装的 shell 脚本工具集。2526## 前置条件2728```bash29cd scripts/30./install-check.sh # 检查依赖(xiaohongshu-mcp、jq、python3)31./start-mcp.sh # 启动 MCP 服务(默认端口 18060)32./status.sh # 确认已登录33```3435未登录时需扫码:`mcp-call.sh get_login_qrcode` 获取二维码,用小红书 App 扫码。3637服务端口可通过 `MCP_URL` 环境变量覆盖(默认 `http://localhost:18060/mcp`)。3839## 核心数据流4041**重要:** 大多数操作需要 `feed_id` + `xsec_token` 配对。这两个值从搜索/推荐/用户主页结果中获取,**不可自行构造**。4243```44search_feeds / list_feeds / user_profile45│46▼47返回 feeds 数组,每个 feed 包含:48├── id → 用作 feed_id49├── xsecToken → 用作 xsec_token50└── noteCard → 标题、作者、封面、互动数据51│52▼53get_feed_detail(feed_id, xsec_token)54│55▼56返回完整笔记: 正文、图片列表、评论列表57评论中包含 comment_id、user_id(用于回复评论)58```5960## 脚本参考6162| 脚本 | 用途 | 参数 |63|------|------|------|64| `search.sh <关键词>` | 搜索笔记 | 关键词 |65| `recommend.sh` | 首页推荐 | 无 |66| `post-detail.sh <feed_id> <xsec_token>` | 帖子详情+评论 | 从搜索结果获取 |67| `comment.sh <feed_id> <xsec_token> <内容>` | 发表评论 | 从搜索结果获取 |68| `user-profile.sh <user_id> <xsec_token>` | 用户主页+笔记 | 从搜索结果获取 |69| `track-topic.sh <话题> [选项]` | 热点分析报告 | `--limit N` `--output file` `--feishu` |70| `export-long-image.sh` | 帖子导出长图 | `--posts-file json -o output.jpg` |71| `mcp-call.sh <tool> [json_args]` | 通用 MCP 调用 | 见下方工具表 |72| `start-mcp.sh` | 启动服务 | `--headless=false` `--port=N` |73| `stop-mcp.sh` | 停止服务 | 无 |74| `status.sh` | 检查登录 | 无 |75| `install-check.sh` | 检查依赖 | 无 |7677## MCP 工具详细参数7879### search_feeds — 搜索笔记8081```json82{"keyword": "咖啡", "filters": {"sort_by": "最新", "note_type": "图文", "publish_time": "一周内"}}83```8485filters 可选字段:86- `sort_by`: 综合 | 最新 | 最多点赞 | 最多评论 | 最多收藏87- `note_type`: 不限 | 视频 | 图文88- `publish_time`: 不限 | 一天内 | 一周内 | 半年内89- `search_scope`: 不限 | 已看过 | 未看过 | 已关注90- `location`: 不限 | 同城 | 附近9192### get_feed_detail — 帖子详情9394```json95{"feed_id": "...", "xsec_token": "...", "load_all_comments": true, "limit": 20}96```9798- `load_all_comments`: false(默认) 返回前10条,true 滚动加载更多99- `limit`: 加载评论上限(仅 load_all_comments=true 时生效),默认 20100- `click_more_replies`: 是否展开二级回复,默认 false101- `reply_limit`: 跳过回复数超过此值的评论,默认 10102- `scroll_speed`: slow | normal | fast103104### post_comment_to_feed — 发表评论105106```json107{"feed_id": "...", "xsec_token": "...", "content": "写得真好!"}108```109110### reply_comment_in_feed — 回复评论111112```json113{"feed_id": "...", "xsec_token": "...", "content": "谢谢!", "comment_id": "...", "user_id": "..."}114```115116`comment_id` 和 `user_id` 从 get_feed_detail 返回的评论列表中获取。117118### user_profile — 用户主页119120```json121{"user_id": "...", "xsec_token": "..."}122```123124`user_id` 从 feed 的 `noteCard.user.userId` 获取,`xsec_token` 使用该 feed 的 `xsecToken`。125126### like_feed — 点赞/取消127128```json129{"feed_id": "...", "xsec_token": "..."}130{"feed_id": "...", "xsec_token": "...", "unlike": true}131```132133### favorite_feed — 收藏/取消134135```json136{"feed_id": "...", "xsec_token": "..."}137{"feed_id": "...", "xsec_token": "...", "unfavorite": true}138```139140### publish_content — 发布图文141142```json143{"title": "标题(≤20字)", "content": "正文(≤1000字)", "images": ["/path/to/img.jpg"], "tags": ["美食","旅行"]}144```145146- `images`: 至少1张,支持本地路径或 HTTP URL147- `tags`: 可选,话题标签148- `schedule_at`: 可选,定时发布(ISO8601,1小时~14天内)149150### publish_with_video — 发布视频151152```json153{"title": "标题", "content": "正文", "video": "/path/to/video.mp4"}154```155156### 其他工具157158| 工具 | 参数 | 说明 |159|------|------|------|160| `check_login_status` | 无 | 检查登录状态 |161| `list_feeds` | 无 | 获取首页推荐 |162| `get_login_qrcode` | 无 | 获取登录二维码(Base64 PNG) |163| `delete_cookies` | 无 | 删除 cookies,重置登录 |164165## 热点跟踪166167自动搜索 → 拉取详情 → 生成 Markdown 报告。168169```bash170./track-topic.sh "DeepSeek" --limit 5171./track-topic.sh "春节旅游" --limit 10 --output report.md172./track-topic.sh "iPhone 16" --limit 5 --feishu # 导出飞书173```174175报告包含:概览统计、热帖详情(正文+热评)、评论关键词、趋势分析。176177## 长图导出178179将帖子导出为白底黑字的 JPG 长图。180181```bash182./export-long-image.sh --posts-file posts.json -o output.jpg183```184185posts.json 格式:186```json187[{188"title": "标题", "author": "作者", "stats": "1.3万赞",189"desc": "正文摘要", "images": ["https://..."],190"per_image_text": {"1": "第2张图的说明"}191}]192```193194依赖:Python 3.10+、Pillow。195196## 注意事项197198- Cookies 有效期约 30 天,过期需重新扫码199- 首次启动会下载 headless 浏览器(~150MB)200- 同一账号避免多客户端同时操作201- 发布限制:标题≤20字符,正文≤1000字符,日发布≤50条202- Linux 服务器无桌面环境需安装 xvfb(`apt-get install xvfb`,脚本自动管理)203