Content
# 🌺 Xiaohongshu MCP Toolkit
[](LICENSE)
A powerful automation toolkit for Xiaohongshu, supporting integration with AI clients (such as Claude Desktop) via the MCP protocol for intelligent content creation and publishing.
## ✨ Key Features
- 🍪 **Cookie Management**: Securely obtain, validate, and manage Xiaohongshu login credentials
- 🤖 **MCP Protocol Support**: Seamless integration with AI clients like Claude Desktop
- 📝 **Automated Publishing**: Supports automated publishing of image-text notes
- 🔍 **Content Search**: Search Xiaohongshu notes
- 👤 **User Information**: Retrieve user profiles
- 🎯 **Unified Interface**: One tool to meet all LLM automation needs for Xiaohongshu
## 📋 Feature List
- [x] **Image-Text Publishing** - Supports publishing image-text notes
- [ ] **Video Publishing** - Supports publishing video notes (in development)
## 🚀 Quick Start
### One-Click Installation (Recommended)
```bash
# Download and run the installation script
curl -sSL https://raw.githubusercontent.com/aki66938/xiaohongshu-mcp-toolkit/main/install.sh | bash
# Or run manually
git clone https://github.com/aki66938/xiaohongshu-mcp-toolkit.git
cd xiaohongshu-mcp-toolkit
bash install.sh
```
### Download and Use
1. Download the version suitable for your operating system from the [Releases page](https://github.com/aki66938/xhs-toolkit/releases/latest)
2. Unzip and run:
```bash
# macOS/Linux
chmod +x xhs-toolkit
./xhs-toolkit status
# Windows
xhs-toolkit.exe status
```
### Run from Source
```bash
git clone https://github.com/aki66938/xiaohongshu-mcp-toolkit.git
cd xiaohongshu-mcp-toolkit
pip install -r requirements.txt
python xhs_toolkit.py status
```
## 📋 Environment Requirements
- **Browser**: Google Chrome
- **Driver**: ChromeDriver (`brew install chromedriver`)
## 🛠️ User Guide
### 1. Create Configuration File
Copy and edit the configuration file:
```bash
cp env_example.txt .env
vim .env # Edit configuration
```
**Required Configuration**:
```bash
# Path to Chrome browser
CHROME_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
# Path to ChromeDriver
WEBDRIVER_CHROME_DRIVER="/opt/homebrew/bin/chromedriver"
# Phone number (for login)
phone="Your phone number"
# Cookies storage path
json_path="./xhs/cookies"
```
### 2. Obtain Login Credentials
```bash
./xhs-toolkit cookie save
```
Log in to Xiaohongshu in the popped-up browser, and press Enter to save after completion.
### 3. Start MCP Server
```bash
./xhs-toolkit server start
```
### 4. Configure Claude Desktop
Add the following to `~/.claude_desktop_config.json`:
```json
{
"mcpServers": {
"xiaohongshu": {
"command": "curl",
"args": [
"-N",
"-H", "Accept: text/event-stream",
"http://localhost:8000/sse"
]
}
}
}
```
## 🔧 Main Functions
### MCP Tool List
| Tool Name | Function Description | Parameters |
|-----------|----------------------|------------|
| `test_connection` | Test connection | None |
| `search_xiaohongshu_notes` | Search notes | keyword, limit |
| `publish_xiaohongshu_note` | Publish notes | title, content, tags, images |
| `get_xiaohongshu_user_info` | Get user information | user_id |
### Quick Publishing
```bash
# Command line publishing
./xhs-toolkit publish "Title" "Content" --tags "Life, Sharing"
# Publish via Claude (recommended)
# In Claude: Please publish a Xiaohongshu note, title: "Today's Share", content: "..."
```
## 🎯 Use Cases
- **Content Creators**: Batch publishing, data analysis
- **Marketing**: Brand promotion, user analysis
- **AI Integration**: Collaborate with Claude to create content
## 🔐 Security Commitment
- ✅ **Local Storage**: All data is stored locally
- ✅ **Open Source Transparency**: Code is fully open source and auditable
- ✅ **User Control**: You have complete control over your data
## 🛠️ Common Commands
```bash
# Check status
./xhs-toolkit status
# Cookie management
./xhs-toolkit cookie save # Get cookies
./xhs-toolkit cookie validate # Validate cookies
# Server management
./xhs-toolkit server start # Start server
./xhs-toolkit server start --port 8080 # Custom port
./xhs-toolkit server stop # Stop server
./xhs-toolkit server status # Check server status
```
## ⚠️ Important Notes
- **ASGI errors can be ignored**: ASGI errors that occur when stopping the server with `Ctrl+C` are normal and do not affect functionality
- **Recommended stopping method**: Use the `./xhs-toolkit server stop` command to gracefully stop the server
- **Process cleanup**: ChromeDriver processes will be automatically cleaned up upon stopping
## 🐛 Issue Feedback
- Check [Issues](https://github.com/aki66938/xhs-toolkit/issues)
- Create a [New Issue](https://github.com/aki66938/xhs-toolkit/issues/new)
## 📄 License
This project is open source under the [MIT License](LICENSE).
---
<div align="center">
Made with ❤️ for content creators
</div>