home / mcp / xhs mcp server

XHS MCP Server

Provides a unified MCP server and CLI to automate Xiaohongshu interactions including login, publish, search, and discovery.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "algovate-xhs-mcp": {
      "url": "http://localhost:3000/mcp",
      "headers": {
        "XHS_ENABLE_LOGGING": "true"
      }
    }
  }
}

You can run a unified MCP server and CLI to automate Xiaohongshu interactions, including login, publishing content, discovery, searching, and notes management. This MCP server provides both a local stdio interface and an HTTP server option for remote clients to connect and issue commands.

How to use

You will run the MCP server locally and choose between two connection methods: a standard input/output (stdio) interface for direct local use or an HTTP server for remote clients. The stdio mode starts a local process that you interact with directly through the command line. The HTTP mode runs a server you can connect to over HTTP, suitable for external tooling or your own automation scripts.

Common workflows include authenticating, publishing content (images or videos), discovering feeds, searching notes, and managing your notes. The MCP server integrates with Puppeteer to drive a headless browser for automation, handles cookies, and supports both local image paths and image URLs for publishing.

How to install

Prerequisites: you need Node.js and npm installed on your system. Ensure you have standard command line tools available.

Install and run the MCP server in stdio mode (default) using the following command.

npx xhs-mcp mcp

If you want to enable verbose logging for debugging, prepend the environment variable when starting.

XHS_ENABLE_LOGGING=true npx xhs-mcp mcp

To start an HTTP server, which serves the MCP endpoint over HTTP, use the HTTP mode and optionally specify a port.

npx xhs-mcp mcp --mode http

If you want to serve on a custom port, specify it like this.

npx xhs-mcp mcp --mode http --port 8080

Available tools

login

Authenticate the user, store session cookies, and enable subsequent actions.

logout

Clear session data and end the authenticated session.

status

Check the current authentication state and session validity.

publish_content

Publish content using a unified interface for images or videos, with optional tags.

publish_image

Publish an image-based post using local files or image URLs.

publish_video

Publish a video-based post with a title and description.

feeds

Discover recommended feeds and content streams.

search

Search for notes or content using keywords.

get_note_detail

Fetch detailed information for a specific note.

usernote_list

List notes owned by the authenticated user.

usernote_delete

Delete a user's note by ID or delete the last published note.

comment_on_note

Post a comment on a specific feed item or note.