文颜 MCP

caol64/wenyan-mcp
3 Stars 469 次浏览 更新于 2026-08-23

文颜 MCP Server 是一个基于模型上下文协议(Model Context Protocol, MCP)的服务器组件,支持将 Markdown 格式的文章发布至微信公众号草稿箱,并使用与文颜相同的主题系统进行排版。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "wenyan-mcp": {
      "args": [
        "run",
        "--rm",
        "-i",
        "-v",
        "/your/host/image/path:/mnt/host-downloads",
        "-e",
        "WECHAT_APP_ID=your_app_id",
        "-e",
        "WECHAT_APP_SECRET=your_app_secret",
        "-e",
        "HOST_IMAGE_PATH=/your/host/image/path",
        "wenyan-mcp"
      ],
      "command": "docker",
      "name": "公众号助手"
    }
  }
}

该服务需要配置环境变量:WECHAT_APP_ID、WECHAT_APP_SECRET

服务介绍

Wenyan MCP Server

logo

Overview

Wenyan MCP Server is a server component based on the Model Context Protocol (MCP) that supports publishing Markdown formatted articles to the WeChat Official Account draft box, using the same theme system as Wenyan for layout.

https://github.com/user-attachments/assets/2c355f76-f313-48a7-9c31-f0f69e5ec207

Use Cases:

Supported Theme Preview:

Features

  • List and select supported article themes
  • Use built-in themes to format Markdown content
  • Publish articles to the WeChat Official Account draft box
  • Automatically upload local or web images

Usage

Method One: Running Locally

Compilation

Ensure you have the Node.js environment installed:

bash
git clone https://github.com/caol64/wenyan-mcp.git
cd wenyan-mcp

npm install
npx tsc -b && npm run copy-assets

Integration with MCP Client

Add the following content to your MCP configuration file:

json
{
"mcpServers": {
"wenyan-mcp": {
"name": "Official Account Assistant",
"command": "node",
"args": [
"Your/path/to/wenyan-mcp/dist/index.js"
],
"env": {
"WECHAT_APP_ID": "your_app_id",
"WECHAT_APP_SECRET": "your_app_secret"
}
}
}
}

Notes:

  • WECHAT_APP_ID is the App ID from the WeChat Official Account platform.
  • WECHAT_APP_SECRET is the App Secret from the WeChat platform.

Suitable for deployment in a server environment or integration with a local AI toolchain.

Build the Image

bash
docker build -t wenyan-mcp .

Integration with MCP Client

Add the following content to your MCP configuration file:

json
{
"mcpServers": {
"wenyan-mcp": {
"name": "Official Account Assistant",
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-v", "/your/host/image/path:/mnt/host-downloads",
"-e", "WECHAT_APP_ID=your_app_id",
"-e", "WECHAT_APP_SECRET=your_app_secret",
"-e", "HOST_IMAGE_PATH=/your/host/image/path",
"wenyan-mcp"
]
}
}
}

Notes:

  • -v mounts the host directory so that the container can access local images. Ensure it matches the HOST_IMAGE_PATH environment variable. Place all local images used in your Markdown articles in this directory; Docker will automatically map them into the container. The container cannot read images outside of this directory.
  • -e injects environment variables into the Docker container:
  • WECHAT_APP_ID is the App ID from the WeChat Official Account platform.
  • WECHAT_APP_SECRET is the App Secret from the WeChat platform.
  • HOST_IMAGE_PATH is the host image directory.

WeChat Official Account IP Whitelist

Make sure to add the server IP to the WeChat Official Account platform's IP whitelist to ensure successful API calls for uploads.
For detailed configuration instructions, refer to: https://yuzhi.tech/docs/wenyan/upload


Configuration Explanation (Frontmatter)

To correctly upload articles, you need to add a frontmatter section at the beginning of each Markdown article, providing the title and cover fields:

md

title: Running a Large Language Model Locally (2) - Providing External Knowledge Bases to the Model
cover: /Users/lei/Downloads/result_image.jpg

  • title is the article title, required.

  • cover is the article cover, supporting both local paths and web images:

    • If there is at least one image in the body, it can be omitted, and one of the images will be used as the cover;
    • If there are no images in the body, the cover must be provided.

About Automatic Image Upload

  • Supported image paths:

    • Local path (e.g., /Users/lei/Downloads/result_image.jpg)
    • Web path (e.g., https://example.com/image.jpg)

Example Article Format

md

title: Running a Large Language Model Locally (2) - Providing External Knowledge Bases to the Model
description: Make your local large language models (LLMs) smarter! This guide shows how to use LangChain and RAG to let them retrieve data from external knowledge bases, improving answer accuracy.
cover: /Users/lei/Downloads/result_image.jpg

In the previous article, we showed how to run a large language model locally. This post will introduce how to make the model retrieve custom data from an external knowledge base, enhancing the accuracy of answers and making it appear more "intelligent."

Preparing the Model

Visit the Ollama model page, search for qwen, and we will use the "Qwen" model, which supports Chinese semantics, for our experiment.

---

If you need more feature extensions or have suggestions for feedback, feel free to raise an issue.

相关 MCP 服务