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.
README.md
1# XHS AI Toolkit23<p align="center">4<b>Make AI understand your Xiaohongshu (RedNote)</b>5</p>67<p align="center">8<a href="README_CN.md">简体中文</a> | English9</p>1011<p align="center">12<img alt="License" src="https://img.shields.io/badge/license-MIT-blue.svg">13<img alt="Platform" src="https://img.shields.io/badge/platform-Linux%20%7C%20macOS-lightgrey.svg">14<img alt="Python" src="https://img.shields.io/badge/python-3.10+-green.svg">15<img alt="MCP" src="https://img.shields.io/badge/MCP-compatible-purple.svg">16</p>1718---1920AI-powered toolkit for **Xiaohongshu (小红书 / RedNote)** that turns your favorite posts into AI memory.2122- **MCP Integration** — Search, browse, comment via AI assistants23- **Trend Tracking** — Auto-generate topic reports with engagement analytics24- **Memory Export** — Convert your liked/saved posts into AI-searchable knowledge base2526Built on [xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp) and [XHS-Downloader](https://github.com/JoeanAmier/XHS-Downloader).2728## Features2930| Feature | Description |31|---------|-------------|32| Search | Search posts by keywords |33| Feed | Get homepage recommendations |34| Post Details | Fetch post content, comments, engagement stats |35| Comment | Post comments to notes |36| User Profile | Get user info and their posts |37| Trend Tracking | Auto-generate topic analysis reports |38| Long Image Export | Export posts as annotated JPG long images |39| Memory Export | Export liked/saved posts as Markdown for AI memory |4041## Quick Start4243### 1. Install xiaohongshu-mcp4445Download from [GitHub Releases](https://github.com/xpzouying/xiaohongshu-mcp/releases):4647```bash48# Linux x6449wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-mcp-linux-amd64.tar.gz50wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-login-linux-amd64.tar.gz5152# macOS ARM53wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-mcp-darwin-arm64.tar.gz54wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-login-darwin-arm64.tar.gz55```5657Install:5859```bash60mkdir -p ~/.local/bin61tar -xzf xiaohongshu-mcp-*.tar.gz -C ~/.local/bin/62tar -xzf xiaohongshu-login-*.tar.gz -C ~/.local/bin/6364cd ~/.local/bin65mv xiaohongshu-mcp-* xiaohongshu-mcp66mv xiaohongshu-login-* xiaohongshu-login67chmod +x xiaohongshu-mcp xiaohongshu-login68```6970### 2. Install This Toolkit7172```bash73# Clone to OpenClaw workspace74git clone https://github.com/zhjiang22/openclaw-xhs.git75cp -r openclaw-xhs ~/.openclaw/workspace/skills/xiaohongshu7677# Or use symlink78ln -s /path/to/openclaw-xhs ~/.openclaw/workspace/skills/xiaohongshu7980# Verify installation81cd ~/.openclaw/workspace/skills/xiaohongshu/scripts82./install-check.sh83```8485### 3. Login (Get Cookies)8687**Option A: Desktop Environment**8889```bash90./login.sh # Opens browser, scan QR code with Xiaohongshu app91```9293**Option B: Headless Server**9495Get cookies on your local machine, then copy to server:9697```bash98# On local machine with GUI99./xiaohongshu-login100# Cookies saved to /tmp/cookies.json101102# Copy to server103scp /tmp/cookies.json user@server:~/.xiaohongshu/cookies.json104```105106### 4. Start Service107108```bash109./start-mcp.sh # Headless mode110./start-mcp.sh --headless=false # Show browser (debug)111```112113Service runs at `http://localhost:18060/mcp`.114115#### Server Deployment (Headless Linux)116117On servers without a desktop environment, the underlying browser requires a virtual display.118`start-mcp.sh` **auto-detects** the environment — if no display is found, it starts Xvfb automatically. Just install it first:119120```bash121# Debian/Ubuntu122sudo apt-get install -y xvfb123124# CentOS/RHEL125sudo yum install -y xorg-x11-server-Xvfb126```127128No extra configuration needed. The script handles:129- Detecting the `DISPLAY` environment variable130- Auto-starting `Xvfb :99` when no display is available131- Cleaning up Xvfb when `stop-mcp.sh` is called132133> **Note**: Without Xvfb, login and search will fail on headless servers. See [Issue #3](https://github.com/zhjiang22/openclaw-xhs/issues/3).134135## Usage136137### Basic Commands138139```bash140./status.sh # Check login status141./search.sh "coffee" # Search posts142./recommend.sh # Get recommendations143./post-detail.sh <id> <token> # Get post details144./comment.sh <id> <token> "Great post!" # Comment145./user-profile.sh <user_id> <xsec_token> # Get user profile146```147148### Trend Tracking149150Auto-search trending posts and generate analysis reports:151152```bash153./track-topic.sh "AI" --limit 10154./track-topic.sh "travel" --limit 5 --output report.md155./track-topic.sh "iPhone" --limit 5 --feishu # Export to Feishu156```157158### MCP Tools159160| Tool | Description |161|------|-------------|162| `check_login_status` | Check login status |163| `search_feeds` | Search posts |164| `list_feeds` | Get homepage feed |165| `get_feed_detail` | Get post details & comments |166| `post_comment_to_feed` | Post comment |167| `user_profile` | Get user profile |168| `like_feed` | Like/unlike post |169| `favorite_feed` | Save/unsave post |170| `publish_content` | Publish image post |171| `publish_with_video` | Publish video post |172173### Long Image Export174175Export posts as annotated JPG long images (white background, black text):176177```bash178# Prepare posts.json179cat > posts.json << 'EOF'180[181{182"title": "Post title",183"author": "Author",184"stats": "13k likes 100 saves",185"desc": "Post summary",186"images": ["https://...webp"],187"per_image_text": {"1": "Caption for 2nd image"}188}189]190EOF191192./export-long-image.sh --posts-file posts.json -o output.jpg193```194195Requires: Python 3.10+, Pillow (`pip install Pillow`)196197## Memory Export (Turn Likes into AI Memory)198199Export your liked/saved posts as a searchable knowledge base for AI assistants.200201### 1. Install XHS-Downloader202203```bash204git clone https://github.com/JoeanAmier/XHS-Downloader.git205cd XHS-Downloader206pip install -r requirements.txt207```208209### 2. Extract Post Links (Tampermonkey Script)2102111. Install [Tampermonkey](https://www.tampermonkey.net/)2122. Install [XHS-Downloader UserScript](https://raw.githubusercontent.com/JoeanAmier/XHS-Downloader/refs/heads/master/static/XHS-Downloader.js)2133. Go to Xiaohongshu web → Profile → Liked/Saved2144. Click Tampermonkey menu → "Extract liked posts" or "Extract saved posts"2155. Links auto-copied to clipboard2166. Paste into `links.md`217218### 3. Download & Export219220```bash221# Copy helper scripts222cp tools/xhs-downloader/*.py /path/to/XHS-Downloader/223224# Download posts225cd /path/to/XHS-Downloader226python batch_download.py links.md227228# Export to workspace229python export_to_workspace.py230# Output: ~/.openclaw/workspace/xhs-memory/231```232233### 4. Configure OpenClaw Memory Search234235Edit `~/.openclaw/openclaw.json`:236237```json238{239"memorySearch": {240"extraPaths": [241"~/.openclaw/workspace/xhs-memory"242]243}244}245```246247Now your AI assistant can search your Xiaohongshu favorites!248249## Project Structure250251```252openclaw-xhs/253├── README.md # English docs254├── README_CN.md # Chinese docs255├── LICENSE256├── SKILL.md # Skill manifest257├── scripts/ # MCP wrapper scripts258│ ├── install-check.sh259│ ├── start-mcp.sh260│ ├── stop-mcp.sh261│ ├── login.sh262│ ├── mcp-call.sh263│ ├── status.sh264│ ├── search.sh265│ ├── recommend.sh266│ ├── post-detail.sh267│ ├── comment.sh268│ ├── user-profile.sh269│ ├── track-topic.sh270│ ├── track-topic.py271│ ├── export-long-image.sh272│ └── export-long-image.py273└── tools/274└── xhs-downloader/ # Memory export tools275├── README.md276├── batch_download.py277├── export_memory.py278└── export_to_workspace.py279```280281## Security282283This project implements the following security measures:284285- **Cookie protection**: Cookie files are copied with `600` permissions (owner-only read/write)286- **Injection prevention**: All shell scripts use `jq` to build JSON payloads instead of string interpolation, preventing shell injection287- **Tool name validation**: MCP tool names are restricted to alphanumeric characters and underscores288- **Path validation**: Cross-skill script calls validate that target paths are within allowed directories289- **Third-party content**: Content fetched from Xiaohongshu is user-generated; exercise appropriate caution290291292## Disclaimer293294This project is a **wrapper layer** for [xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp).295296- Does NOT contain xiaohongshu-mcp source code297- Users must download xiaohongshu-mcp binaries separately298- Scripts communicate via HTTP protocol only299300## Acknowledgments301302- [@xpzouying](https://github.com/xpzouying) — [xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp)303- [@JoeanAmier](https://github.com/JoeanAmier) — [XHS-Downloader](https://github.com/JoeanAmier/XHS-Downloader) (GPL-3.0)304305## License306307MIT License (wrapper scripts only)308309**Note:** xiaohongshu-mcp has no declared license. Please respect the author's terms.310311---312313<p align="center">314<b>If this project helps you, please give it a ⭐!</b>315</p>316