mcp-server-wechat-mp
Allows AI to publish articles to WeChat Official Accounts, including uploading images, creating/managing drafts, and publishing to followers.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-wechat-mpPublish this article to my WeChat Official Account: ./article.md"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-server-wechat-mp
⚠️ This project has been archived. The functionality has been migrated to a lighter-weight OpenCode skill: wechat-mp-publisher — same capabilities, no MCP server process needed.
让 AI 直接发布文章到微信公众号的 MCP 服务器。
支持 Claude Code、OpenCode、Claude Desktop 等任何 MCP 客户端。
它能做什么
工具 | 功能 |
| 上传文章内图片,返回微信 CDN 链接 |
| 上传封面图,返回 |
| 创建文章草稿到草稿箱 |
| 删除草稿 |
| 发布草稿到粉丝 |
access token 自动管理(缓存 + 过期前 5 分钟自动刷新)
stdio 传输,兼容所有 MCP 客户端
Related MCP server: WeChat Official Account MCP
三步开始用
第一步:获取公众号密钥
打开 mp.weixin.qq.com,扫码登录你的公众号
左侧菜单 → 设置与开发 → 基本配置
找到 开发者ID(AppID) — 直接复制
找到 开发者密码(AppSecret) → 点「重置」→ 扫码确认 → 立刻复制保存(只显示一次!)
找到 IP白名单 → 点「查看」→ 添加你电脑的公网 IP
💡 不知道自己的公网 IP?终端执行
curl -s ifconfig.me即可。如果用了代理,需要加代理的 IP 和直连的 IP 都加上。
第二步:安装
git clone https://github.com/nxxxsooo/mcp-server-wechat-mp.git
cd mcp-server-wechat-mp
npm install
npm run build第三步:配置到你的 AI 工具
把下面的配置加到你的 MCP 配置文件里:
OpenCode → ~/.config/opencode/opencode.json 或 ~/.config/opencode/mcp.json
Claude Code → ~/.claude/mcp.json
Claude Desktop → ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"wechat-mp": {
"command": "node",
"args": ["/你的路径/mcp-server-wechat-mp/dist/index.js"],
"env": {
"WECHAT_APP_ID": "你的AppID",
"WECHAT_APP_SECRET": "你的AppSecret"
}
}
}
}⚠️
args里必须写绝对路径,不能用~或相对路径。
配置完重启你的 AI 工具,就能用了。
🤖 让 AI 帮你装
把下面这段话复制粘贴给你的 AI(Claude Code、OpenCode 等),它会自动帮你完成安装和配置:
帮我安装和配置 mcp-server-wechat-mp。
仓库地址:https://github.com/nxxxsooo/mcp-server-wechat-mp
步骤:
1. 把仓库 clone 到本地,运行 npm install && npm run build
2. 在我的 MCP 配置文件里添加 wechat-mp 服务器配置
3. 我会在你问我的时候提供 AppID 和 AppSecret
需要我提供的信息:
- 微信公众号 AppID(在 mp.weixin.qq.com → 设置与开发 → 基本配置)
- 微信公众号 AppSecret(同上,点「重置」获取)
- 我的公网 IP 需要加到公众号 IP 白名单(帮我用 curl -s ifconfig.me 查一下)
配置文件位置:
- OpenCode: ~/.config/opencode/mcp.json
- Claude Code: ~/.claude/mcp.json
- Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json
配置格式:
{
"mcpServers": {
"wechat-mp": {
"command": "node",
"args": ["<克隆路径>/dist/index.js"],
"env": {
"WECHAT_APP_ID": "<AppID>",
"WECHAT_APP_SECRET": "<AppSecret>"
}
}
}
}
注意:args 里必须用绝对路径。配置完帮我重启 AI 工具验证连接。用法示例
跟 AI 说:
帮我把这篇博客发到公众号:/path/to/article.mdAI 会自动:上传图片 → 转换格式 → 创建草稿 → 等你确认后发布。
工具参数详情
upload_article_image
上传文章正文里用的图片。微信要求文章内图片必须在微信 CDN 上,不能用外链。
参数 | 类型 | 必填 | 说明 |
| string | ✅ | 图片文件的绝对路径 |
返回:{ url: "https://mmbiz.qpic.cn/..." }
upload_cover_image
上传文章封面图。推荐尺寸 900×383(2.35:1),这是订阅号消息列表里的显示比例。
参数 | 类型 | 必填 | 说明 |
| string | ✅ | 图片文件的绝对路径 |
返回:{ media_id: "...", url: "..." }
create_draft
创建文章草稿,保存到公众号后台的草稿箱。
参数 | 类型 | 必填 | 说明 |
| string | ✅ | 文章标题 |
| string | ✅ | 文章 HTML 内容(必须全部内联样式) |
| string | ✅ | 封面图的 media_id |
| string | 作者名 | |
| string | 摘要,显示在订阅号消息列表 | |
| string | 原文链接 |
返回:{ draft_id: "..." }
⚠️ 微信会删除所有
class、id属性和外部 CSS。文章样式必须写成style="..."内联形式。
delete_draft
删除草稿箱里的草稿。
参数 | 类型 | 必填 | 说明 |
| string | ✅ | 要删除的草稿 media_id |
返回:{ deleted: true, media_id: "..." }
publish_draft
把草稿发布给粉丝。
参数 | 类型 | 必填 | 说明 |
| string | ✅ | 草稿的 media_id |
返回:{ publish_id: "..." }
常见问题
错误码 | 意思 | 怎么解决 |
| IP 不在白名单 | 去公众号后台 → 基本配置 → IP白名单,加上你的 IP |
| access token 无效 | 检查 AppID 和 AppSecret 是否正确 |
| 接口调用超限 | 等一会再试 |
| 图片太大 | 图片不能超过 10MB |
| MCP 连接断开 | 检查 |
技术架构
AI Agent(Claude / OpenCode)
↓ MCP 协议(stdio)
mcp-server-wechat-mp(TypeScript)
↓ HTTPS(axios)
api.weixin.qq.com
↓
草稿箱 → 发布 → 粉丝收到推送技术栈:TypeScript + MCP SDK + axios + form-data
License
ISC
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nxxxsooo/mcp-server-wechat-mp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server