xiaohongshu
小红书 Skill
通过本地 MCP 服务器访问小红书内容。
前置条件
需要部署 xiaohongshu-mcp 服务。
首次使用必须先登录:
cd /path/to/xiaohongshu-mcp
./xiaohongshu-login
登录成功后会保存 cookies 到 cookies/cookies.json。
启动服务
cd /path/to/xiaohongshu-mcp
./start.sh
服务会在后台运行,监听 http://localhost:18060/mcp。
可用功能
1. 搜索内容
curl -X POST http://localhost:18060/api/search \
-H "Content-Type: application/json" \
-d '{"keyword": "弥勒旅游"}'
返回搜索结果,包括帖子 ID、标题、用户信息、点赞数等。
2. 获取帖子详情
curl -X POST http://localhost:18060/api/feed/detail \
-H "Content-Type: application/json" \
-d '{
"note_id": "帖子ID",
"xsec_token": "从搜索结果获取"
}'
返回完整帖子内容,包括图片、文字、评论等。
3. 获取推荐列表
curl -X POST http://localhost:18060/api/feeds
返回小红书首页推荐内容。
4. 检查登录状态
curl http://localhost:18060/api/check-login
使用示例
搜索
# CLI 搜索
python3 scripts/xhs_search.py "弥勒旅游景点"
# 限制结果数
python3 scripts/xhs_search.py "美食推荐" 5
curl 工作流
# 1. 搜索
curl -X POST http://localhost:18060/api/search \
-H "Content-Type: application/json" \
-d '{"keyword": "弥勒旅游景点"}' | jq .
# 2. 获取帖子详情(从搜索结果中选择)
curl -X POST http://localhost:18060/api/feed/detail \
-H "Content-Type: application/json" \
-d '{
"note_id": "从搜索结果获取",
"xsec_token": "从搜索结果获取"
}' | jq .
工作流
- 启动服务:启动 xiaohongshu-mcp
- 搜索关键词:获取帖子列表
- 选择帖子:从列表中选择感兴趣的帖子
- 获取详情:使用
note_id和xsec_token获取完整内容 - 总结信息:提取关键信息(景点、拍摄机位、tips 等)
注意事项
- 首次使用必须登录:运行
./xiaohongshu-login - Cookies 过期:如果返回需要登录,重新运行登录工具
- 服务端口:默认 18060,确保端口未被占用
- 同时登录限制:小红书不允许同一账号在多个网页端登录
- 移动端不受影响:可以同时使用小红书 App
故障排查
| 问题 | 解决方法 |
|---|---|
| 服务无法启动 | lsof -i :18060 检查端口占用 |
| 搜索返回空结果 | curl http://localhost:18060/api/check-login 检查登录状态 |
| Cookies 过期 | 删除 cookies/cookies.json 后重新运行 ./xiaohongshu-login |
API 响应格式
搜索结果
{
"items": [
{
"id": "帖子ID",
"note_card": {
"display_title": "标题",
"user": { "nickname": "作者昵称" },
"interact_info": { "liked_count": "点赞数" }
},
"xsec_token": "用于获取详情的 token"
}
]
}
帖子详情
{
"note_card": {
"title": "标题",
"desc": "正文内容",
"image_list": [{ "url": "图片URL" }],
"interact_info": {
"liked_count": "点赞数",
"collected_count": "收藏数",
"comment_count": "评论数"
}
},
"comments": {
"comments": [
{ "content": "评论内容", "sub_comments": [] }
]
}
}
More from stvlynn/skills
create-sticker
Generate LINE-style stickers of a character with background removal. Creates creative, unique poses with consistent character design via Google Gemini, removes solid background to transparent PNG. Use when user asks for sticker, 贴纸, LINE sticker.
25searxng
Privacy-respecting web search powered by a local SearXNG instance. Use when searching the web, looking up information, researching topics, or needing quick answers. Supports multiple categories including general, images, videos, news, and more. Aggregates results from 70+ search engines without tracking.
14claude-code-operator
Operate and control Claude Code CLI from within Clawdbot. Allows spawning Claude Code processes, executing commands in Claude Code, managing sessions, and deploying projects using Claude Code's capabilities.
14qwen-asr
Speech-to-text using Qwen3-ASR-0.6B-4bit MLX model via a local FastAPI service. Transcribes audio files and URLs. Optimized for Apple Silicon. Use when user sends voice messages or audio that needs transcription.
12tsticker
Manage Telegram sticker packs via tsticker CLI. Init, push, sync, download, and trace sticker packs. Use when user wants to create/update Telegram sticker packs, push stickers to Telegram, sync packs, or manage sticker collections. Integrates with create-sticker for end-to-end sticker generation → publish workflow.
11qwen-tts
Text-to-speech using Qwen3-TTS CustomVoice MLX model. Supports 9 speakers and multiple emotion/style instructions. Optimized for Apple Silicon. Use when user wants audio speech output.
9