Get content or let Claude Code do your own research
Let Claude Code call xiaohongshu-mcp to complete the release
1. Project positioning and purpose
- “MCP” here is a protocol/access method of the “Model Context Protocol”, which encapsulates Xiaohongshu’s operations into an MCP service for external clients (such as ChatGPT plugins, Claude, Cursor, etc. that support MCP) to make calls.
- To put it simply, it encapsulates various operations of Xiaohongshu (login, posting, searching, obtaining user information, leaving comments, etc.) into APIs/tools, allowing other tools or models to control Xiaohongshu “in natural language” without writing their own crawlers or interfaces.
- The project claims to be primarily used for “learning” purposes and prohibits illegal activities.
2. Main functions
This project provides the following core features:
| Function | Description |
|---|---|
| Login / Check Login Status | Log in to Xiaohongshu and determine whether you are currently logged in |
| Publish graphic content | You can post posts with titles, text descriptions, and pictures to Xiaohongshu |
| Publish video content | Support uploading video content and publishing it to Xiaohongshu (with title, description, tags, etc.) |
| Search for content | Search for the content of Xiaohongshu’s posts for given keywords |
| Get featured/homepage content | Get a list of recommended posts on the homepage of Xiaohongshu (feed list) |
| Get post details | Get the full content of your posts, interaction data, comments, and more with Post ID + xsec_token |
| Leave a comment | Comment on a post (post ID / xsec_token / comment content required) |
| Get the user homepage | Get a user’s Page information (nickname, fans, note list, etc.) |
In addition to this, it also supports being called by other clients in the way of MCP tools.
3. Architecture and technology stack
From the project structure and description:
- Use Go as the backend service language.
- Provides pre-compiled binaries as well as Docker images for deployment.
- The project contains modules such as ,
mcp_server.go,service.gohandlers_api.gotypes.goroutes.goetc., which is a typical web service + route + business logic split structure.app_server.go - Use headless browsers/browser automation (or similar technologies) to help with login, image/video uploads, etc. (because Xiaohongshu does not have an official open API for ordinary users to use in this way). This is evident in the README’s “Headless browser is automatically downloaded on first run”.
- Supports communication with external clients through MCP protocol (HTTP interface method). External clients can call these encapsulated tools.
4. How to use (overview)
The following is the basic usage process of this project (simplified version):
- Log in
Run the login tool to allow users to manually log in to Xiaohongshu to establish a login status (save cookies/sessions, etc.) - Start the MCP service
xiaohongshu-mcpStart the service (you can choose headless mode or interface mode), and the service listens to a port (such as 18060) as the MCP interface service by default. - Client access to MCP
Configure this MCP service in clients that support the MCP protocol (e.g. Claude Code, Cursor, VSCode plugin, etc.); In this way, these clients can call Xiaohongshu-related functions. - Call tools/interfaces
The following tools (APIs) can be called by the client or external programs:check_login_statuspublish_contentpublish_with_videolist_feedssearch_feedsget_feed_detailpost_comment_to_feeduser_profile
- Deployment method
- Run the precompiled binary directly
- Source code compilation
- Deploy with Docker / Docker Compose
- Debugging / Validation
Use something like MCP Inspector or curl to verify that the service is working properly.
5. Advantages and limitations/risks
Pros:
- For users, there are many hidden complexities (login, file upload, xsec_token management, etc.), and users operate Xiaohongshu as if they were calling ordinary APIs.
- It can be combined with AI models/tools to achieve the experience of “operating Xiaohongshu with natural language (posting, searching, obtaining data)”.
- It supports Docker and binary publishing, making it relatively easy to deploy.
Limitations / Risks / Points to be aware of:
- Account security: Using a browser to automatically log in (simulate the operation of an account) is at risk of being detected by Xiaohongshu’s risk control and the account being blocked or restricted.
- xsec_token and other security parameters: Some interfaces (such as obtaining post details and leaving comments) require
xsec_tokenparameters such as , which need to be obtained through the front-end/list interface; If the token is invalid or missing, the interface may not be called properly. - Dependence on front-end behavior: Because Xiaohongshu does not disclose the official complete API to the public, this method is essentially simulating user behavior or capturing/reverse. If Xiaohongshu’s front-end interface is upgraded or the encryption policy is changed, the project may expire or require maintenance at any time.
- Legality and Compliance: Although the author declares that it is used for learning purposes, if it is used for commercial operations, bulk brushing, illegal marketing, etc., there is a risk of copyright/terms of use/platform rules.
- Stability: Cookies may expire and login status may expire; Network fluctuations and reverse crawling mechanisms can cause requests to fail. The README also mentions that cookies expire and require a new login.
Project address: https://github.com/xpzouying/xiaohongshu-mcp
Article introduction: https://www.haha.ai/xiaohongshu-mcp
Tubing: