xpzouying/xiaohongshu-mcp

MCP for xiaohongshu.com

xiaohongshu‑mcp – AI‑driven bridge to 小红书 (Xiaohongshu)

What it is – A self‑hosted service that implements the Model Context Protocol (MCP) and lets AI assistants (Claude Code, Cursor, VS Code, Open Claw, etc.) read from and write to the Chinese social platform Xiaohongshu. It exposes a set of JSON‑RPC tools (login, publish posts, search, comment, like, collect, fetch user profiles, …) that can be called from any MCP‑compatible client.


Core capabilities

Tool What it does
check_login_status Returns whether a Xiaohongshu account is logged in.
get_login_qrcode Generates a QR‑code (Base64) for interactive login.
publish_content Publish a text‑plus‑image post (title, body, image URLs or local paths, optional tags, schedule, visibility, product links).
publish_with_video Publish a video post (title, body, local video file, optional tags, schedule, visibility).
list_feeds Retrieve the home‑page recommendation feed.
search_feeds Search Xiaohongshu by keyword with sorting, type, time‑range filters, etc.
get_feed_detail Get full post details, including author info, interaction counts and comments.
post_comment_to_feed / reply_comment_in_feed Add a comment or reply to a specific comment.
like_feed / favorite_feed Like/un‑like or collect/un‑collect a post.
user_profile Fetch a user’s profile and their public notes.

Getting started

1. Choose a deployment method

Method Who it’s for
Pre‑built binaries – download the appropriate xiaohongshu-mcp and xiaohongshu-login executables from the Releases page (macOS Apple Silicon, Windows x64, Linux x64).
Docker – pull the official image xpzouying/xiaohongshu-mcp and run it (exposes port 18060, mounts ./data for cookies and ./images for uploaded media).
Build from source – requires Go 1.22+; set GOPROXY to a Chinese mirror, then go build ./cmd/mcp and go build ./cmd/login.

2. Log in once

# run the login helper (choose the binary that matches your OS)
./xiaohongshu-login-<platform>

A headless Chromium instance opens, you scan the QR‑code or enter credentials. The tool saves cookies under data/ so subsequent MCP calls are authenticated.

3. Start the MCP server

# default headless (no UI)
./xiaohongshu-mcp-<platform>
# or with a visible browser for debugging
./xiaohongshu-mcp-<platform> -headless=false

The service listens at http://localhost:18060/mcp.

4. (Optional) Secure the endpoint

Set an environment variable AUTH_TOKEN=your‑secret or start the binary with -token=your‑secret. Clients must then send Authorization: Bearer <token>.


Connecting an AI client (example with Claude Code)

claude mcp add --transport http xiaohongshu-mcp http://localhost:18060/mcp
claude mcp list   # should show the server as connected

Now any Claude prompt can invoke the tools, e.g.

帮我检查小红书登录状态

The assistant will call check_login_status and report the result.

Similar steps exist for Cursor (.cursor/mcp.json), VS Code (.vscode/mcp.json), Open Claw (via MCPorter), Google Gemini CLI, Cline, etc.


Typical workflow examples

  • Publish a picture post
    帮我写一篇关于春天的笔记,标题《春日漫步》,内容随意,配图 /Users/me/Pictures/flowers.jpg,使用 xiaohongshu-mcp 发布。
    
  • Search for food‑related notes
    在小红书上搜索“川菜”,只要图文笔记,按最新排序,使用 xiaohongshu-mcp。
    
  • Automated commenting
    给笔记 123456 的评论 987654 回复‘谢谢分享’,使用 xiaohongshu-mcp。
    

Community & support

  • Issues & troubleshooting – see issue #56 for a curated list of common Docker/Windows problems.
  • Docker image – pulls from Docker Hub; the repo includes a docker-compose.yml for one‑click start.
  • Contributing – see CONTRIBUTING.md; the project follows the All‑Contributors model (31 contributors).
  • Donations – all proceeds go to charity (see DONATIONS.md).

License & disclaimer

The README notes that the software is for learning/automation purposes only; misuse (spam, illegal content) is prohibited. No explicit license badge is shown, so check the repository’s LICENSE file for the exact terms.


TL;DR

xiaohongshu-mcp is a Go‑based, Docker‑ready MCP server that lets modern AI assistants act on Xiaohongshu – logging in, posting images or videos, searching, commenting, liking, and fetching user data – all via a standard JSON‑RPC interface. Install via binary, Docker, or source, log in once, start the server, and point any MCP‑compatible AI tool at http://localhost:18060/mcp.

Related

  • Project
  • Project
  • Project
  • Project
  • Project