Xiaohongshu MCP Server
An MCP server that enables AI assistants to interact with Xiaohongshu to publish image notes, search content, and manage account details. It uses Playwright to securely handle session authentication and API signatures through the platform's internal network context.
README
xiaohongshu-mcp-server
<!-- mcp-name: io.github.shanyang-me/xiaohongshu-mcp -->
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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。