home / mcp / xhs mcp server

XHS MCP Server

Provides an MCP server to search Xiaohongshu notes, fetch note contents, retrieve comments, and post comments.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "blbl147-xhs-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/Users/xxx/xhs-mcp",
        "run",
        "main.py"
      ],
      "env": {
        "XHS_COOKIE": "xxxx"
      }
    }
  }
}

You can run the Xiaohongshu MCP server to search notes, fetch note contents, retrieve comments, and post new comments by configuring a local MCP endpoint that executes a Python-based service through a lightweight runner. This setup avoids heavier browser automation and provides direct HTTP-like interactions for common Xiaohongshu actions.

How to use

Your MCP client will talk to the Xiaohongshu MCP server you configure. With it, you can search Xiaohongshu notes, retrieve the content of a specific note, fetch the notes’ comments, and publish new comments. Ensure you supply your Xiaohongshu login cookie as an environment variable so the server can access user-specific data.

How to install

Prerequisites you need to have installed on your system:

Node.js is not required for the MCP itself since the server runs as a Python process via a runner, but you will utilize a runner command in the configuration. The server configuration uses a Python-based entry point run by the uv runner.

Python 3.12 should be installed on your system to satisfy the runtime requirements.

Install the uv runner using Python’s package manager.

1. Environment

Prepare the following prerequisites on your machine.

2. Install dependencies

git clone [email protected]:jobsonlook/xhs-mcp.git

cd xhs-mcp
uv sync

3. Obtain Xiaohongshu cookie

Open Xiaohongshu in a web browser and log in. Retrieve your login cookie after signing in and prepare to set it in the MCP configuration as XHS_COOKIE.

4. Configure the MCP server

{
  "mcpServers": {
    "xhs-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/Users/xxx/xhs-mcp",
        "run",
        "main.py"
      ],
      "env": {
        "XHS_COOKIE": "xxxx"
      }
    }
  }
}

Available tools

search_notes

Search Xiaohongshu notes based on keywords or filters.

get_note_content

Retrieve the full content for a specific Xiaohongshu note by its ID.

get_comments

Fetch the list of comments for a given Xiaohongshu note.

post_comment

Submit a comment to a Xiaohongshu note on behalf of the authenticated user.