知乎MCP服务器

一种模型上下文协议服务器,允许用户使用大型语言模型自动生成文章,并直接发布到知乎(一个中国的问答平台)。

content-management-systemscommunicationapp-automation

3.8k 查看 · 2026-07-07 更新

简介

一种模型上下文协议服务器,允许用户使用大型语言模型自动生成文章,并直接发布到知乎(一个中国的问答平台)。

简介

一种模型上下文协议服务器,允许用户使用大型语言模型自动生成文章,并直接发布到知乎(一个中国的问答平台)。

Introduction to zh_mcp_server

A Model Context Protocol (MCP) server for publishing articles on Zhihu, allowing users to automatically generate and publish articles using large models.

Usage

1. Clone the Code

git https://github.com/Victorzwx/zh_mcp_server.git

2. Environment Setup Prerequisites

It is recommended to run in a Windows environment.

Python version required: >= 3.10

  • Method 1:

Ensure that the environment meets the requirements specified in requirements.txt.

  • selenium>=4.0.0
  • requests>=2.25.1
  • mcp>=0.1.0
  • webdriver-manager>=3.8.0 You can install these dependencies with the following command:

pip install -r requirements.txt

Then, install ChromeDriver. This project depends on Google Chrome, and the version number 134.0.6998.166 is provided as an example. You need to manually check the version of Google Chrome installed on your computer.

npx @puppeteer/browsers install chromedriver@134.0.6998.166

  • Method 2:

Run setup_environment.py. If this method fails, it might be due to an incorrect ChromeDriver version. It is recommended to reinstall using Method 1.

python setup_environment.py

3. Save Personal Cookies

Run the code to save cookies in the project folder:

python -m zh_mcp_server.login

  • Note that running this will automatically open Google Chrome.
  • Enter your phone number in Google Chrome and click to get the verification code.
  • Then, enter the verification code into the Terminal where you ran python -m zh_mcp_server.__login__. This is very important!

4. Configure MCP Service in MCP Client (e.g., Cherry Studio)

Run via Python:

"zh_mcp_server": { "command": "python", "args": [ "-m", "zh_mcp_server" ] }

After this, you can start using the service.

If you are using this MCP service through code, such as Java code based on Spring AI, you also need to add the encoding method to avoid generating garbled text:

"zh_mcp_server": { "command": "D:\aconda\python.exe", "args": [ "-m", "zh_mcp_server", "--encoding=utf-8" ], "env": { "PYTHONIOENCODING": "utf-8" } }

Debugging

If you need to debug the specific process of the large model calling this MCP service or visualize browser operations, you need to disable headless browser mode as follows:

poster = ZhuHuPoster(path, headless=True) ## Set to False if you want to debug

This code is located in server.py.

CSDN

My CSDN Account

WeChat

image

来源