Xiaohongshu

An MCP server automating Xiaohongshu interactions via Selenium to search articles, view content, read and post comments.
  • python

16

GitHub Stars

python

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "cjpnice-xiaohongshu_mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/PATH/TO/PARENT/FOLDER/xiaohongshu_mcp",
        "run",
        "mcp_server.py"
      ],
      "env": {
        "UNKNOWN_ENV": "VALUE",
        "CHROME_DRIVER_PATH": "/PATH/TO/PARENT/FOLDER/chromedriver/chromedriver.exe"
      }
    }
  }
}

You can run an MCP server that automates Xiaohongshu interactions using Selenium, enabling you to search articles, view content, read and post comments, and manage sessions across restarts. This practical server setup helps streamline Xiaohongshu workflows and data gathering.

How to use

Start by launching the MCP server from your local machine, then connect with an MCP client to perform actions such as logging in, searching for articles, retrieving article content, and engaging with comments. You will log in once and then reuse the session, search for articles by keyword, open articles to view content and comments, scroll to load more results, and post comments on articles. Use the provided tools to automate repetitive tasks while respecting platform rate limits.

How to install

cd xiaohongshu_mcp
uv python pin 3.12
uv init --bare
uv venv
.venv\Scripts\activate # windows activate environment
source .venv/bin/activate # macOS/Linux activate environment
uv pip install -r requirements.txt

Configuration and run

Configure the MCP server to point to the local environment and start the server using the MCP runtime. You specify the directory where the server lives and the entry script that runs the MCP server.

{
  "mcpServers": {
    "xiaohongshu_mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/PATH/TO/PARENT/FOLDER/xiaohongshu_mcp",
        "run",
        "mcp_server.py"
      ],
      "env": {
        "CHROME_DRIVER_PATH": "/PATH/TO/PARENT/FOLDER/chromedriver/chromedriver.exe"
      }
    }
  }
}

Available tools and what they do

The server exposes a set of actions you can call through the MCP client to automate Xiaohongshu tasks. These include logging in, searching articles, getting the current page’s articles, fetching article content, viewing and posting comments, scrolling for more results, and closing the browser when finished.

Notes and best practices

  • You must manually log in on the first run by opening the browser window and completing the login flow. The session will be saved for subsequent runs.
  • Be mindful of Xiaohongshu’s rate limits; insert reasonable delays between actions to avoid triggering anti-bot defenses.
  • The server stores the login session locally to enable automatic restoration in future runs.

Troubleshooting

If you encounter issues, verify your environment is set up with Python 3.8+ and a compatible Chrome/ChromeDriver. Ensure the CHROME_DRIVER_PATH points to the correct ChromeDriver executable and that your virtual environment is active when installing dependencies.

Available tools

login

Launch the manual login flow in a browser to obtain and persist a login session.

search_articles

Search for articles by keyword and return a list including title, author, link, and like count.

get_current_page_articles

Retrieve the list of articles currently visible on the page, supporting page scrolling to load more results.

get_article_content

Fetch the full content of a specified article given its URL.

view_article_comments

Fetch comments for a given article URL, with a configurable limit.

post_comment

Post a new comment to a specified article.

scroll

Scroll the current page to load additional content.

close_browser

Close the browser instance and end the session.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational