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 화이트리스트에 추가해야 합니다. 그렇지 않으면 토큰 획득 시 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모든 API는 responses mock으로 처리되므로 실제 계정 없이도 실행할 수 있습니다.
범위 및 알려진 제한 사항
markdown→HTML 변환은 하지 않습니다: 본문 입력은 HTML이며, 변환은 이미 사용 중인 md→html 도구로 완료하세요.
발행은 하지 않습니다(
freepublish): 현재 초안까지만 지원합니다. 발행은 계정 인증 후 확장하도록 남겨 둡니다.개인 미인증 구독 계정: 소재/초안 API는
48001을 반환합니다. 실기기 검증에는 인증된 계정이 필요합니다(개발과 테스트에는 영향 없음).HTML 微信 호환성: 微信 편집기는 인라인 스타일 HTML 하위 집합만 인식합니다. 레이아웃 적응은 상위 변환 도구가 담당하며, 이 도구는 검증하거나 수정하지 않습니다.
소재 누적: 초안을 삭제해도 해당 초안이 차지하는 영구 소재 이미지는 삭제되지 않습니다. 장기간 사용 시 가끔 공식 계정 백엔드에서 정리해야 합니다.
단일 계정: 자격 증명은
.env에서 가져오며, 다중 계정 전환은 제공하지 않습니다.
Available Tools
5 toolscreate_news_draftA
创建图文草稿(news),成功返回 {"media_id": ..., "title": ..., "cover_url": ...}。
参数:
title: 文章标题(必填)
content: 正文。支持两种形态——HTML 字符串,或本地 .html 文件路径
(若该路径存在则自动读取文件,否则按 HTML 内容处理)
cover: 封面图片(必填):本地文件路径或 http(s) URL,自动上传为封面素材
author: 作者名(可选)
digest: 摘要(可选,留空时微信自动截取正文)
content_source_url: 原文链接(可选)
正文 HTML 中的 <img> 会自动上传到微信并替换 src 为微信托管的 URL;
已指向微信域名(mmbiz.qpic.cn / mp.weixin.qq.com)的图片保持不变。
Inputs: cover (required), title (required), content (required), author, +2 more. Returns: object
create_newspic_draftA
创建图片消息草稿(newspic),成功返回 {"media_id": ..., "title": ..., "image_count": ...}。
参数:
title: 消息标题(必填)
images: 1~20 张图片,按传入顺序展示;每项为本地文件路径或 http(s) URL
content: 图片下方的纯文字说明(可选,注意不是 HTML)
与图文消息不同:图片消息的 content 是纯文本,图片本体在 images 中,
全部经永久素材接口上传后按序组装。
Inputs: title (required), images (required), content. Returns: object
delete_draftA
删除指定草稿,成功返回 {"media_id": ..., "deleted": true}。
注意:删除草稿不会连带删除其占用的永久素材图片(微信行为)。
参数:
media_id: 草稿 ID
Inputs: media_id (required). Returns: object
get_draftA
查询草稿详情(含 news_item 全部字段:标题、正文 HTML、封面等)。
参数:
media_id: 草稿 ID(由 create_news_draft / create_newspic_draft 返回,或从 list_drafts 获取)
Inputs: media_id (required). Returns: object
list_draftsA
分页查询草稿箱列表,返回 {"total": 总数, "offset": 当前偏移, "items": [{media_id, title, update_time}]}。
参数:
offset: 起始位置(默认 0)
count: 每页数量(默认 20,最大 20)
Inputs: count, offset. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
The two create tools are clearly separated by draft type (newspic vs news) with distinct parameter semantics, while list, get, and delete have unambiguous scopes. No two tools appear to overlap in purpose.
Most tools follow a verb_noun snake_case pattern such as list_drafts, get_draft, and delete_draft. The create tools also align with verb+type+draft, though 'newspic' vs 'news' is a slightly non-parallel naming choice.
Five tools is well-scoped for a draft-management server: two creation variants plus standard list, get, and delete operations. Each tool earns its place without unnecessary overlap or bloat.
The set covers create, read/list, and delete for drafts, but lacks an update_draft operation, forcing agents to delete and recreate to modify content. Additionally, despite the 'publisher' name, there is no publish/send tool, leaving a notable gap in the apparent domain.
Maintenance
Related MCP Connectors
Publish HTML or markdown from your agent as a shareable link, with password or work-email walls. No key needed to start: your agent can create the account and verify the email right from the chat, then publish.
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.
Publish AI-generated HTML & Markdown to a hosted, shareable URL via MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables saving articles to WeChat Official Account drafts with support for rich text, automatic image upload, and Markdown rendering including Mermaid diagrams.1MIT
- 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.110 npm1,358Apache 2.0
- AlicenseAqualityFmaintenanceEnables AI agents to publish articles to WeChat Official Account (微信公众号). Supports image upload, draft creation, and publishing via standardized MCP protocol.51ISC