Project description

install chromedriver find out your chrome version like "134.0.6998.166". download it

npx @puppeteer/browsers install [email protected]

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

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

["PATHTOYOURIMAGE.jpg"]

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

start the server

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"
            }
        }
    }
}

Note

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