Skip to main content

Install the prerequisites

  1. install chromedriver find out your chrome version like "136.0.7103.92". download it
npx @puppeteer/browsers install chromedriver@136.0.7103.92

copy the chromedriver to your path or add it in your path

Note: if you find that xhs_mcp_server does not work and even does not open the chrome. It is usually the problem of chromedriver. Try to use the new version of chromedriver.

Login

run the following command in your terminal. Note PATH_TO_STORE_YOUR_COOKIES is an avaliable path, for example /Users/Bruce/ . Your should use the absolute path. This MCP server will store your cookie in this path.

env phone=YOUR_PHONE_NUMBER json_path=PATH_TO_STORE_YOUR_COOKIES uvx --from xhs_mcp_server@latest login

it will show:

无效的cookies,已清理
请输入验证码: 

and you need to input the verification code in the terminal and press enter.

Check it

env phone=YOUR_PHONE_NUMBER json_path=PATH_TO_STORE_YOUR_COOKIES uvx --from xhs_mcp_server@latest login

it will show:

使用cookies登录成功

Inspector

start the inspector by following command in terminal:

npx @modelcontextprotocol/inspector -e phone=YOUR_PHONE_NUMBER -e json_path=PATH_TO_STORE_YOUR_COOKIES uvx xhs_mcp_server@latest

you can use a local image, type in its path in the inspector

["PATH\TO\YOUR\IMAGE.jpg"]

it will show an error, but it is ok, the post will be sent. Error Request timed out

Start the server

Optional install mode: install the server as a tool

use

uv tool install xhs_mcp_server

Call the server as a tool directly (without installing it)

start the server by following command:

env phone=YOUR_PHONE_NUMBER json_path=PATH_TO_STORE_YOUR_COOKIES uvx xhs_mcp_server@latest

or you can add following json into your config file

{
    "mcpServers": {
        "xhs-mcp-server": {
            "command": "uvx",
            "args": [
                "xhs_mcp_server@latest"
            ],
            "env": {
                "phone": "YOUR_PHONE_NUMBER",
                "json_path":"PATH_TO_STORE_YOUR_COOKIES"
            }
        }
    }
}

If this server cannot be started, you can use the install mode above and modify the command (remove @latest) as

env phone=YOUR_PHONE_NUMBER json_path=PATH_TO_STORE_YOUR_COOKIES uvx xhs_mcp_server

or

{
    "mcpServers": {
        "xhs-mcp-server": {
            "command": "uvx",
            "args": [
                "xhs_mcp_server"
            ],
            "env": {
                "phone": "YOUR_PHONE_NUMBER",
                "json_path":"PATH_TO_STORE_YOUR_COOKIES"
            }
        }
    }
}

Fast mode or slow mode

In default, this server works as the fast mode, which means it will send the post very fast. But sometimes your network maybe slow, and the server will send the post very fast, so it may cause some errors. You can use the slow mode to avoid this problem.

If you want to use the slow mode, you can start the server by following command

env phone=YOUR_PHONE_NUMBER json_path=PATH_TO_STORE_YOUR_COOKIES slow_mode=true uvx xhs_mcp_server@latest

or you can add the following json into your config file

{
    "mcpServers": {
        "xhs-mcp-server": {
            "command": "uvx",
            "args": [
                "xhs_mcp_server@latest"
            ],
            "env": {
                "phone": "YOUR_PHONE_NUMBER",
                "json_path":"PATH_TO_STORE_YOUR_COOKIES",
                "slow_mode":"true"
            }
        }
    }
}

Note

This mcp server is for research purpose only, please do not use it for commercial purpose.

Contact

godot.lzl@alibaba-inc.com

Metadata

Release files for xhs-mcp-server 0.2.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for xhs-mcp-server 0.2.8
File Interpreter ABI Platform
xhs_mcp_server-0.2.8-py3-none-any.whl Python 3 none any Details

Release files / xhs_mcp_server-0.2.8-py3-none-any.whl

Download URL xhs_mcp_server-0.2.8-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
095be2d8975c1dd788b57bcde4c3c721b7e60716f1168697053be79b6fe3491e
BLAKE2b-256 checksum
How to use checksums
ec3b91a7e42adec8da78f3383d77cab3475d126d65f0d077d873a330812a9530
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

0.2.8 This release

1 release file

0.2.7

1 release file

0.2.6

1 release file

0.2.5

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page