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 "Deploy 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 Server
三步开始用
第一步:获取公众号密钥
打开 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
Available Tools
5 toolscreate_draftA
Create a new article draft (saves to Draft Box).
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Article title | |
| author | No | Author name (optional) | |
| digest | No | Article digest/summary (optional) | |
| content | Yes | Article HTML content | |
| thumb_media_id | Yes | Media ID of cover image | |
| content_source_url | No | Original source URL (optional) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden of disclosing behavior. It does mention that the draft is saved to Draft Box, but it omits important details such as requirements for thumb_media_id (e.g., being previously uploaded via upload_cover_image) and what the response contains. The disclosure is minimal but not misleading.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is one concise sentence that is front-loaded with the key action and context. Every word contributes value, with no repetition or filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool lacks an output schema and the description does not explain return values or the draft's role in the broader workflow (e.g., that it can later be published via publish_draft). The description is adequate for a basic create operation but leaves out useful contextual connections to sibling tools.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with all six parameters described in the input schema. The description adds no additional parameter-level meaning, so the baseline of 3 applies. It does not clarify relationships between parameters (e.g., thumb_media_id must be from a cover upload), but the schema already defines each parameter's role.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly specifies the action ('Create'), the resource ('a new article draft'), and the context ('saves to Draft Box'). This distinguishes it from sibling tools like publish_draft and delete_draft, making its purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'saves to Draft Box' implies the tool is for creating drafts, not publishing, which gives clear usage context. However, it does not explicitly state when not to use it or mention alternatives like publish_draft, though sibling names provide inferable guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
delete_draftB
Delete a draft from the Draft Box.
| Name | Required | Description | Default |
|---|---|---|---|
| media_id | Yes | Draft Media ID to delete |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description alone must disclose behavioral traits. It only states the action (delete) without mentioning permanence, permission requirements, or consequences, leaving critical transparency gaps for a destructive operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The single-sentence description is extremely concise, front-loaded, and contains no filler or repetition, earning a top conciseness score.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
While the tool is simple and the parameter is fully documented, the description lacks essential context such as whether deletion is permanent or irreversible. Given that this is a mutation tool with no annotations, the description should provide more behavioral context to be complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema provides 100% coverage with 'Draft Media ID to delete,' and the description adds no further parameter meaning, matching the baseline for full schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb 'Delete' and identifies the resource as 'a draft from the Draft Box,' clearly distinguishing it from sibling tools like create_draft, publish_draft, and image uploads.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The intended use is implied by the description—use when you need to delete a draft—but there is no explicit guidance on when not to use it or alternatives compared to sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
publish_draftC
Publish a draft by its Media ID (Freepublish).
| Name | Required | Description | Default |
|---|---|---|---|
| media_id | Yes | Draft Media ID |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
There are no annotations, and the description only states the action without disclosing side effects, reversibility, or required permissions. For a state-changing operation, this is a significant gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence, making it very concise. However, the '(Freepublish)' parenthetical adds potentially confusing jargon without clear benefit.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter tool, the description covers the basic mechanism, but it lacks any context about consequences of publishing, expected outcomes, or error conditions. With no output schema and no annotations, the description is not fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already provides a description for media_id ('Draft Media ID'), and the description repeats this by saying 'by its Media ID.' With 100% schema coverage, the description adds no additional semantic value, so baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Publish a draft') and the method ('by its Media ID'), distinguishing it from sibling tools like create_draft and delete_draft. The parenthetical '(Freepublish)' is ambiguous but does not obscure the core purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use publish_draft versus the sibling tools. It does not mention prerequisites (e.g., draft must exist) or situations where publishing would be inappropriate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
upload_article_imageA
Upload an image for use INSIDE article content (returns URL).
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the image file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses that the tool returns a URL, which is important for invoking it, but does not mention potential file restrictions, overwrite behavior, or authentication requirements. For a simple upload, this is adequate but not rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single, front-loaded sentence delivers the essential information (action, context, return value) without unnecessary words. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a one-parameter upload tool with no output schema, the description sufficiently covers purpose and expected result. It does not detail file format limits or edge cases, but the simplicity of the tool and clear schema make this adequate for an agent to select and invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema provides 100% coverage of the single parameter (filePath) with a clear description ('Absolute path to the image file'). The tool description adds no additional parameter-level semantics, so the baseline of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states a specific action ('Upload'), resource ('an image'), and context ('for use INSIDE article content'), plus the return value ('returns URL'). This distinguishes it from the sibling upload_cover_image by emphasizing 'inside' content.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'INSIDE article content' implies this tool is for inline images rather than cover images, but it does not explicitly name alternatives or state when not to use it. The guidance is implied, not directly stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
upload_cover_imageA
Upload an image for use as article COVER/THUMBNAIL (returns media_id).
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the image file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, and the description only states return value (media_id). It does not disclose side effects, authentication requirements, file constraints, or whether this replaces an existing cover. For a mutation tool, this is insufficient behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, front-loaded with verb and purpose, no redundant words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter upload with return value specified, the description is mostly complete, but lacks any note on integration with draft creation or image validation limits.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Input schema has 100% coverage for the single filePath parameter, so the description adds no extra meaning. Baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description uses specific verb 'Upload' + resource 'image' with clear purpose 'article COVER/THUMBNAIL', and distinguishes from sibling upload_article_image by specifying the use case.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
States the specific use case (cover/thumbnail) which implicitly guides selection, but does not explicitly mention when not to use or alternative tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v1.0.0- First observed
create_draft - First observed
delete_draft - First observed
publish_draft - First observed
upload_article_image - First observed
upload_cover_image
TDQS
Scored across 5 tools
Each tool targets a distinctly different purpose: uploading article images vs cover images, and creating, publishing, or deleting drafts. No two tools could be confused.
All tool names follow a consistent verb_noun pattern with lowercase underscores: upload_article_image, upload_cover_image, create_draft, publish_draft, delete_draft. The pattern is uniform and predictable.
Five tools is well-scoped for a WeChat MP article management server, covering the essential operations without unnecessary bloat.
The server covers the primary lifecycle of draft management (create, publish, delete) and image uploads. Minor gaps exist, such as no update draft or list drafts, but these are workable.
Maintenance
Related MCP Connectors
Connect any AI agent to 11+ social platforms: schedule, publish & track posts via hosted MCP.
MCP server for QPost — lets AI agents publish video and image posts to YouTube, TikTok, Instagram.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Publish and share access-controlled Markdown documents from any MCP-enabled AI tool.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI applications to manage WeChat Official Accounts through standardized tools for authentication, media uploads, draft creation, article publishing, and permanent material management.117 npm63MIT
- FlicenseNot gradedqualityDmaintenanceEnables management of WeChat Official Accounts by supporting draft creation, image uploads, and content publishing via the MCP protocol. It provides tools for interacting with the WeChat API, including secure token caching and draft list management.-
- AlicenseNot gradedqualityCmaintenanceBridges AI writing and content platforms by enabling AI agents to format Markdown and publish posts directly to WeChat Official Accounts with automatic image handling. It supports conversational theme management and streamlined drafting to eliminate the need for manual copy-pasting between editors.91 npm1,313Apache 2.0
- FlicenseAqualityDmaintenanceEnables AI agents to control WeChat through MCP protocol, including sending messages, managing contacts, and searching messages.10-