xhs mcp server
A Model Context Protocol (MCP) server to post xiaohongshu(rednote)
A Model Context Protocol (MCP) server to post xiaohongshu(rednote)
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
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.
env phone=YOUR_PHONE_NUMBER json_path=PATH_TO_STORE_YOUR_COOKIES uvx --from xhs_mcp_server@latest login
it will show:
使用cookies登录成功
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 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"
}
}
}
}
This mcp server is for research purpose only, please do not use it for commercial purpose.