xiaohongshu-mcp-server
A Model Context Protocol (MCP) server for Xiaohongshu (Little Red Book) - China's leading lifestyle social media platform.
Publish image notes, search content, view note details, and manage your account - all through MCP tools that AI assistants can use directly.
How It Works
Uses Playwright to run a headless Chromium browser that:
- Loads your XHS session cookies
- Generates authentic API signatures via the XHS web app's built-in signing function
- Makes API calls through the browser's network context (bypasses anti-bot detection)
- Uploads images directly to XHS CDN
No browser automation of UI elements - all interactions go through XHS's internal API.
Tools
| Tool | Description |
|---|---|
check_login_status |
Check if you're logged in |
get_login_qrcode |
Generate QR code for login |
check_qrcode_status |
Poll QR scan status & save session |
reload_cookies |
Reload cookies from disk |
publish_content |
Publish an image note with title, text, images, and tags |
search_feeds |
Search XHS notes by keyword |
get_feed_detail |
Get full details of a note |
user_profile |
Get user profile information |
Installation
pip install xiaohongshu-mcp-server
playwright install chromium
For QR code image generation (optional):
pip install "xiaohongshu-mcp[qrcode]"
Quick Start
1. Start the server
HTTP mode (for Claude Code, Cursor, etc.):
xhs-mcp --transport http --port 18060
stdio mode (for Claude Desktop):
xhs-mcp --transport stdio
2. Login
Call the get_login_qrcode tool, scan the QR code with the Xiaohongshu app, then call check_qrcode_status with the returned qr_id and code. Cookies are saved to ~/.xhs-mcp/cookies.json and persist across restarts.
3. Use
Ask your AI assistant to publish a note, search for content, etc.
Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"xhs-mcp": {
"command": "xhs-mcp",
"args": ["--transport", "stdio"]
}
}
}
Claude Code
claude mcp add xhs-mcp --transport http http://localhost:18060/mcp
Then start the server: xhs-mcp
As a LaunchAgent (macOS auto-start)
Create ~/Library/LaunchAgents/com.xhs-mcp.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.xhs-mcp</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/your/venv/bin/xhs-mcp</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/xhs-mcp.log</string>
<key>StandardErrorPath</key>
<string>/tmp/xhs-mcp.err</string>
</dict>
</plist>
launchctl load ~/Library/LaunchAgents/com.xhs-mcp.plist
Example: Publish a Note
# Via MCP tool call
publish_content(
title="Hello XHS!",
content="My first post published via MCP.",
images=["/path/to/photo.jpg"],
tags=["MCP", "AI"]
)
Requirements
- Python 3.12+
- Chromium (installed via
playwright install chromium) - A Xiaohongshu account
License
MIT
Metadata
Release files for xiaohongshu-mcp-server 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xiaohongshu_mcp_server-0.1.1.tar.gz | 11.2 kB | Without provenance | Details for xiaohongshu_mcp_server-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xiaohongshu_mcp_server-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for xiaohongshu_mcp_server-0.1.1-py3-none-any.whl |
Total release size: 21.2 kB
Release files / xiaohongshu_mcp_server-0.1.1.tar.gz
| Download URL | xiaohongshu_mcp_server-0.1.1.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a650246e34e54922af75018ea929cf6fc1d2d9ac95d2202f9bc22cc02ee13441
|
|
BLAKE2b-256 checksum How to use checksums |
a29649c1b448ee502138668739a9a42f0f0b829db04443afbd05144b7195dad5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / xiaohongshu_mcp_server-0.1.1-py3-none-any.whl
| Download URL | xiaohongshu_mcp_server-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eafa136508bf59d57f0a9a320e87c574648d456ae07296f60abbfc3814fc8a40
|
|
BLAKE2b-256 checksum How to use checksums |
ab1c371e20760d052ec04df080bf541a081ed3b531378cc8200342bbd7cbfd22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for xiaohongshu-mcp-server 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.