zh mcp server
A Model Context Protocol (MCP) server for Zhihu to publish articles, through which users can automatically generate articles and publish articles on Zhihu with large models.
A Model Context Protocol (MCP) server for Zhihu to publish articles, through which users can automatically generate articles and publish articles on Zhihu with large models.
A Model Context Protocol (MCP) server for automatically generating and publishing articles on Zhihu. Users can leverage this service to collaborate with large language models for article generation and direct publishing on Zhihu.
• Method 1:
Python version >= 3.10
Install required dependencies from requirements.txt: • selenium>=4.0.0 • requests>=2.25.1 • mcp>=0.1.0 • webdriver-manager>=3.8.0
Install using: pip install -r requirements.txt
Then install ChromeDriver (this project requires Google Chrome). Replace 134.0.6998.166 with your local Chrome browser version: npx @puppeteer/browsers install [email protected]
• Method 2:
Run setup_environment.py. If failed, ChromeDriver version might be incorrect - try Method 1 instead: python setup_environment.py
git clone https://github.com/Victorzwx/zh_mcp_server.git
Initialize and save personal cookies in the project folder: python -m zh_mcp_server.login
• A Chrome browser will auto-launch
• Enter your mobile account and request verification code
• Input the received code in the Terminal running python -m zh_mcp_server.__login__
- this is crucial!
Run via Python: "zh_mcp_server": { "command": "python", "args": [ "-m", "zh_mcp_server" ] }
For code integration (e.g., Java Spring AI), add encoding configuration to prevent garbled text: "zh_mcp_server": { "command": "D:acondapython.exe", "args": [ "-m", "zh_mcp_server", "--encoding=utf-8" ], "env": { "PYTHONIOENCODING": "utf-8" } }
To debug model interactions or visualize browser operations, disable headless mode in server.py: poster = ZhuHuPoster(path, headless=True) ## Set to False for debugging