xhs
小红书MCP服务 x-s x-t js逆向
claude mcp add --transport stdio jobsonlook-xhs-mcp uvx --from jobson-xhs-mcp xhs-mcp \ --env XHS_COOKIE="<your_xhs_cookie_here>"
How to use
This MCP server provides access to Xiaohongshu (XHS) data through a Model Context Protocol interface. It exposes tools to search notes, retrieve note content, fetch and post comments, and check cookie validity. The recommended workflow uses uvx to run the server in MCP client configurations: you supply your XHS cookie via the XHS_COOKIE environment variable so the server can authenticate with Xiaohongshu endpoints. Typical usage includes checking cookie validity, performing a home feed search, and retrieving or commenting on notes by URL. The server aims to avoid heavy browser automation by leveraging direct HTTP requests, enabling faster, lighter-weight interactions with the Xiaohongshu API.
How to install
Prerequisites:
- Python 3.12 or newer
- uv Python package (pip install uv)
- An XHS cookie obtained from an authenticated Xiaohongshu session
Option A: Using uvx (recommended)
- Ensure Python and uv are installed: pip install uv
- Create a MCP client configuration (example): { "mcpServers": { "xhs-mcp": { "command": "uvx", "args": [ "--from", "jobson-xhs-mcp", "xhs-mcp" ], "env": { "XHS_COOKIE": "<你的小红书cookie>" } } } }
- Save the config and run the MCP client using uvx with the provided config, ensuring XHS_COOKIE is set in the environment if not embedded in the config.
Option B: From source (manual setup)
- Install prerequisites: Node.js (for completeness in some workflows) and Python 3.12+, and uv: pip install uv
- Clone the repository and install dependencies if required by the project structure: git clone https://github.com/jobsonlook/xhs-mcp.git cd xhs-mcp
- Run the server using uv in directory mode (examples shown in the README): uv sync uv run xhs_mcp/main.py
- Configure MCP client as in Option A, replacing the command and arguments with the appropriate run command from your environment and ensuring XHS_COOKIE is set.
Prerequisites recap:
- Python 3.12+
- uv (pip install uv)
- Xiaohongshu cookie (XHS_COOKIE)
Additional notes
Tips and notes:
- The server relies on a valid XHS_COOKIE; cookies expire and must be refreshed by re-logging into Xiaohongshu and updating the environment variable or config.
- If uvx is not found, install it with: pip install uv, and ensure your PATH includes the uv executable.
- The exposed tools include: check_cookie(), home_feed(), search_notes(keywords), get_note_content(url), get_note_comments(url), and post_comment(comment, note_id).
- When passing URLs to get_note_content or get_note_comments, use the complete URL that includes any necessary xsec_token parameters.
- Keep your MCP client configuration secure since it contains cookie values and access controls.
- This MCP server avoids heavy headless browser usage by using direct HTTP-based interactions with Xiaohongshu endpoints.
Related MCP Servers
time
⏰ Time MCP Server: Giving LLMs Time Awareness Capabilities
mcp-manager
A web-based GUI tool for managing Model Context Protocol (MCP) servers in Claude and Cursor
unity-editor
An MCP server and client for LLMs to interact with Unity Projects
website-publisher
AI Website builder and publisher MCP. Quickly publish and deploy your AI generated code as real website URL. Support html, css, js, python etc.
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.
xgmem
Global Memory MCP server, that manage all projects data.