wechat-mcp-publisher
wechat-mcp-publisher
微信公众号草稿发布本地 MCP 工具。把「写好的 HTML → 公众号草稿箱」变成一次 LLM 工具调用:图片上传、正文内嵌图换微信 URL、封面素材、建草稿全部自动完成。
基于官方 mcp SDK(2.x MCPServer),stdio 传输,单账号,uv 管理依赖。
工具面(5 个)
工具 | 用途 |
| 图文草稿:吃 HTML(或 |
| 图片消息草稿:纯文本说明 + 1~20 张图(按序) |
| 分页查草稿箱 |
| 草稿详情(含正文) |
| 删除草稿(不连带删素材) |
access_token 由内部获取、缓存、失效自愈(stable_token + 40001/42001 自动刷新重试一次),不暴露为工具。错误统一转为带处置提示的中文信息(如 40164 提示加 IP 白名单、48001 提示需认证账号),且不含凭据。
Related MCP server: WeChat Official Account MCP Server
安装
uv sync
cp .env.example .env # 填入 WECHAT_APP_ID / WECHAT_APP_SECRET凭据获取:mp.weixin.qq.com → 设置与开发 → 基本配置。同一页面需把本机公网 IP 加入 IP 白名单,否则 token 获取报 40164。
已发布 PyPI 后也可免克隆直接运行(在含 .env 的目录):
uvx wechat-mcp-publisher
# 或 pip install wechat-mcp-publisher && wechat-mcp-publisher此时 MCP 客户端配置可简化为 "command": "uvx", "args": ["wechat-mcp-publisher"]。
接入 MCP 客户端
Claude Code(推荐,一条命令):
claude mcp add wechat-mcp-publisher -- uv run --directory /你的路径/wechat-mcp-publisher python -m wechat_mcp_publisher项目级配置(本仓库已内置 .mcp.json,Claude Code 在本仓库目录打开即生效,首次需在 /mcp 中确认信任):无需手动添加。
Claude Desktop / 其他客户端:把 examples/mcp-client-config.example.json 中的片段合入对应配置文件。
使用示例
对 LLM 说:
帮我把 /path/article.html 发成公众号图文草稿,封面用 /path/cover.jpg
或图片消息:
把这三张图 /a.jpg /b.jpg /c.jpg 发成图片消息草稿,说明文字:周末出片
真实 API 链路演示见 examples/simple_usage.py(token → 上传 → 建草稿,兼作真机冒烟)。
测试
uv run pytest全部接口经 responses mock,不需要真实账号即可跑通。
范围与已知限制
不做 markdown→HTML 转换:正文入口是 HTML,转换请用你已有的 md→html 工具完成
不做发布(
freepublish):当前只到草稿;发布留给账号认证后扩展个人未认证订阅号:素材/草稿接口会返回
48001,真机验证需已认证账号(开发与测试不受影响)HTML 微信兼容性:微信编辑器只认内联样式的 HTML 子集,排版适配由上游转换工具负责,本工具不校验不修复
素材堆积:删除草稿不会删除其占用的永久素材图片,长期使用需偶尔在公众号后台清理
单账号:凭据来自
.env,不提供多账号切换
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables saving articles to WeChat Official Account drafts with support for rich text, automatic image upload, and Markdown rendering including Mermaid diagrams.1
- 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 gradedqualityBmaintenanceBridges 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.821,300Apache 2.0
- FlicenseAqualityFmaintenanceEnables AI agents to publish articles to WeChat Official Account (微信公众号). Supports image upload, draft creation, and publishing via standardized MCP protocol.51
Related MCP Connectors
Publish Markdown or HTML to a shareable link from your AI assistant. OAuth, no API keys.
Publish HTML to private, unguessable, replace-in-place URLs from any MCP-compatible AI agent.
Publish to self-hosted WordPress from AI agents: markdown, images, SEO, and Notion sync.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- 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/weinh/wechat_mcp_publisher'
If you have feedback or need assistance with the MCP directory API, please join our Discord server