文颜 MCP Server
A Markdown formatting tool to apply themes and publish articles to WeChat Official Accounts.
文颜 MCP Server
「文颜」是一款多平台排版美化工具,让你将 Markdown 一键发布至微信公众号、知乎、今日头条等主流写作平台。
文颜现已推出多个版本:
- macOS App Store 版 - MAC 桌面应用
- Windows + Linux 版 - 跨平台桌面应用
- CLI 版本 - CI/CD 或脚本自动化发布公众号文章
- MCP 版本 - 让 AI 自动发布公众号文章
文颜 MCP Server 是一个基于模型上下文协议(Model Context Protocol, MCP)的服务器组件,支持将 Markdown 格式的文章发布至微信公众号草稿箱,并使用与 文颜 相同的主题系统进行排版。
https://github.com/user-attachments/assets/2c355f76-f313-48a7-9c31-f0f69e5ec207
使用场景:
功能
- 列出并选择支持的文章主题
- 使用内置主题对 Markdown 内容排版
- 发布文章到微信公众号草稿箱
- 自动上传本地或网络图片
主题效果
👉 内置主题预览
文颜采用了多个开源的 Typora 主题,在此向各位作者表示感谢:
使用方式
方式一:本地安装(推荐)
npm install -g @wenyan-md/mcp
与 MCP Client 集成
在你的 MCP 配置文件中加入以下内容:
{
"mcpServers": {
"wenyan-mcp": {
"name": "公众号助手",
"command": "wenyan-mcp",
"env": {
"WECHAT_APP_ID": "your_app_id",
"WECHAT_APP_SECRET": "your_app_secret"
}
}
}
}
说明:
WECHAT_APP_ID
微信公众号平台的 App IDWECHAT_APP_SECRET
微信平台的 App Secret
方式二:编译运行
编译
确保已安装 Node.js 环境:
git clone https://github.com/caol64/wenyan-mcp.git
cd wenyan-mcp
npm install
npx tsc -b
与 MCP Client 集成
在你的 MCP 配置文件中加入以下内容:
{
"mcpServers": {
"wenyan-mcp": {
"name": "公众号助手",
"command": "node",
"args": [
"Your/path/to/wenyan-mcp/dist/index.js"
],
"env": {
"WECHAT_APP_ID": "your_app_id",
"WECHAT_APP_SECRET": "your_app_secret"
}
}
}
}
说明:
WECHAT_APP_ID
微信公众号平台的 App IDWECHAT_APP_SECRET
微信平台的 App Secret
方式三:使用 Docker 运行(推荐)
适合部署到服务器环境,或与本地 AI 工具链集成。
构建镜像
docker build -t wenyan-mcp .
或者指定npm
镜像源。
docker build --build-arg NPM_REGISTRY=https://mirrors.cloud.tencent.com/npm/ -t wenyan-mcp .
与 MCP Client 集成
在你的 MCP 配置文件中加入以下内容:
{
"mcpServers": {
"wenyan-mcp": {
"name": "公众号助手",
"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"
]
}
}
}
说明:
-v
挂载宿主机目录,使容器内部可以访问本地图片。与环境变量HOST_IMAGE_PATH
保持一致。你的Markdown
文章内的本地图片应该都放置在该目录中,docker会自动将它们映射到容器内。容器无法读取在该目录以外的图片。-e
注入docker容器的环境变量:WECHAT_APP_ID
微信公众号平台的 App IDWECHAT_APP_SECRET
微信平台的 App SecretHOST_IMAGE_PATH
宿主机图片目录
微信公众号 IP 白名单
请务必将服务器 IP 加入公众号平台的 IP 白名单,以确保上传接口调用成功。 详细配置说明请参考:https://yuzhi.tech/docs/wenyan/upload
配置说明(Frontmatter)
为了可以正确上传文章,需要在每一篇 Markdown 文章的开头添加一段frontmatter
,提供title
、cover
两个字段:
---
title: 在本地跑一个大语言模型(2) - 给模型提供外部知识库
cover: /Users/lei/Downloads/result_image.jpg
---
-
title
是文章标题,必填。 -
cover
是文章封面,支持本地路径和网络图片:- 如果正文有至少一张图片,可省略,此时将使用其中一张作为封面;
- 如果正文无图片,则必须提供 cover。
关于图片自动上传
-
支持图片路径:
- 本地路径(如:
/Users/lei/Downloads/result_image.jpg
) - 网络路径(如:
https://example.com/image.jpg
)
- 本地路径(如:
示例文章格式
---
title: 在本地跑一个大语言模型(2) - 给模型提供外部知识库
cover: /Users/lei/Downloads/result_image.jpg
---
在[上一篇文章](https://babyno.top/posts/2024/02/running-a-large-language-model-locally/)中,我们展示了如何在本地运行大型语言模型。本篇将介绍如何让模型从外部知识库中检索定制数据,提升答题准确率,让它看起来更“智能”。
## 准备模型
访问 `Ollama` 的模型页面,搜索 `qwen`,我们使用支持中文语义的“[通义千问](https://ollama.com/library/qwen:7b)”模型进行实验。

如何调试
使用 Inspector 进行简单调试:
npx @modelcontextprotocol/inspector
启动成功出现类似提示:
🔗 Open inspector with token pre-filled:
http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=761c05058aa4f84ad02280e62d7a7e52ec0430d00c4c7a61492cca59f9eac299
(Auto-open is disabled when authentication is enabled)
访问以上链接即可打开调试页面。
- 正确填写启动命令
- 添加环境变量
- 点击 Connect
- 选择 Tools -> List Tools
- 选择要调试的接口
- 填入参数并点击 Run Tool
- 查看完整参数
赞助
如果您觉得这个项目不错,可以给我家猫咪买点罐头吃。喂猫❤️
License
Apache License Version 2.0
Related Servers
Context Savvy MCP
Transforms Claude Desktop into a memory-enabled AI assistant with persistent context, secure command execution, and intelligent workflow automation.
Agentify
A multi-client AI agent monitoring and control system with automatic task completion detection.
MCP Wait Timer Server
A simple tool to pause execution for a specified number of seconds.
TranscriptionTools
An MCP server for intelligent transcript processing, including formatting, repair, and summarization.
Leantime MCP Bridge
An MCP proxy bridge for the Leantime project management system, forwarding JSON-RPC messages with proper authentication.
Sequential Thinking
Dynamic and reflective problem-solving through thought sequences
GitHub Project Manager MCP
A GitHub-integrated project management server for Claude Desktop, requiring a personal access token.
Siri Shortcuts
List, open, and run shortcuts from the macOS Shortcuts app.
HubSpot MCP
Access and manage HubSpot CRM data through a standardized interface using the HubSpot API.
PeepIt
A macOS-only server for capturing and analyzing screenshots with local or cloud-based AI models.