Xiaohongshu MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/FrancoSbaffi/xhs-mcp.git
cd xhs-mcp
pip install -r requirements.txt
python -m playwright install chromium
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add xhs-mcp -- node "<FULL_PATH_TO_XHS_MCP>/dist/index.js"

Replace <FULL_PATH_TO_XHS_MCP>/dist/index.js with the actual folder you prepared in step 1.

README.md

Publish photo notes to Xiaohongshu automatically using Playwright

xhs-mcp 🍠

An MCP server that lets your AI agent publish notes to Xiaohongshu (RedNote / 小纒书) automatically using Playwright browser automation.

Features

  • πŸ“Έ Publish photo notes with title, body, and image
  • πŸ€– MCP-compatible β€” works with Claude, Cursor, and any MCP-supported agent
  • πŸ” Session persistence β€” log in once, post forever
  • 🧠 Human-like typing to avoid bot detection

Requirements

  • Python 3.10+
  • macOS (tested on macOS with Apple Silicon)

Installation

1. Clone the repo

git clone https://github.com/FrancoSbaffi/xhs-mcp.git
cd xhs-mcp

2. Install dependencies

pip install -r requirements.txt

3. Install Chromium

python -m playwright install chromium

4. Set up your session (first time only)

Run the login script and log in manually in the browser that opens:

python post.py

Once logged in, press ENTER in the terminal. Your session will be saved to session/auth.json.

Usage

Option A β€” Run standalone

Edit content/texto.txt with your post content (first line = title, rest = body). Add your image as content/imagen.jpg. Then run:

python post.py

Option B β€” Use as MCP server with Claude

Add this to your Claude MCP config (claude_desktop_config.json):

{
  "mcpServers": {
    "xiaohongshu": {
      "command": "python3.11",
      "args": ["/absolute/path/to/xhs-mcp/server.py"]
    }
  }
}

Then in Claude, you can say:

"Post this to my Xiaohongshu: title 'Hello World', body 'This is my first automated post', image at /path/to/image.jpg"

MCP Tool Reference

post_note

Parameter Type Description
title string Post title (max 20 characters)
body string Post body text
image_path string Absolute path to image (jpg/png)

Project Structure

xhs-mcp/
β”œβ”€β”€ post.py          # Standalone posting script
β”œβ”€β”€ server.py        # MCP server
β”œβ”€β”€ requirements.txt # Dependencies
β”œβ”€β”€ content/         # Default content folder
β”‚   β”œβ”€β”€ texto.txt    # Post text (title on first line)
β”‚   └── imagen.jpg   # Post image
└── session/         # Saved login session (git ignored)
    └── auth.json

Important Notes

  • ⚠️ This project uses browser automation and is not affiliated with Xiaohongshu
  • ⚠️ Use responsibly β€” avoid posting at high frequency
  • ⚠️ Session may expire and require re-login
  • πŸ”’ Never commit session/auth.json to GitHub β€” it contains your login credentials

.gitignore

Make sure to add this before pushing:

session/
.env

License

MIT

Tools (1)

post_notePublishes a photo note to Xiaohongshu with a title, body, and image.

Configuration

claude_desktop_config.json
{"mcpServers": {"xiaohongshu": {"command": "python3.11", "args": ["/absolute/path/to/xhs-mcp/server.py"]}}}

Try it

β†’Post this to my Xiaohongshu: title 'My Travel Diary', body 'Exploring the city today!', image at /Users/me/photos/city.jpg
β†’Create a new Xiaohongshu post with the title 'Tech Update' and body 'AI is evolving fast' using the image at /path/to/image.png
β†’Publish a note to my RedNote account titled 'Healthy Recipes' with the content 'Try this salad' and the image located at /home/user/recipe.jpg

Frequently Asked Questions

What are the key features of Xiaohongshu MCP?

Publish photo notes with title, body, and image. MCP-compatible for use with Claude and other agents. Session persistence for automated posting. Human-like typing simulation to avoid bot detection.

What can I use Xiaohongshu MCP for?

Automating social media content distribution for influencers. Scheduling regular updates to Xiaohongshu from local content files. Integrating AI-generated content directly into social media workflows.

How do I install Xiaohongshu MCP?

Install Xiaohongshu MCP by running: git clone https://github.com/FrancoSbaffi/xhs-mcp.git && cd xhs-mcp && pip install -r requirements.txt && python -m playwright install chromium

What MCP clients work with Xiaohongshu MCP?

Xiaohongshu MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Xiaohongshu MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare