Skip to main content
Glama

wechatmp-mcp

An MCP server that drives the WeChat Official Account back office from an MCP client: build an image message or a rich-text article from a title, a cover image, the body text and local inline images, then keep it as a draft or publish it straight from the editor — with a human in the loop for every irreversible step.

English | Simplified Chinese

  • No MCP SDK — a hand-written JSON-RPC 2.0 layer, standard library only at the protocol level.

  • Two transports: stdio (default) and Streamable HTTP.

  • Tool text is bilingual. MCP exposes exactly one description per tool and registries ingest that same string, so each description holds an English block followed by a Chinese block; argument descriptions use the shorter english / Chinese form. The same applies to the server instructions and to server.json, so a marketplace listing shows both languages.

  • The login session lives inside a persistent Playwright profile. The server never reads, exports or logs a cookie, a storage entry or a usable token.

mp_status ──► mp_account_login (scan) ──► mp_publish_material ──► mp_list_drafts
                                             kind=tietu│article        │
                                                   │                  ├─► mp_publish_draft ─┐
                                     action=draft ─┤                  │   (confirm)        │
                                   action=publish ┤                  └─► mp_delete_draft   │
                                                  │             (confirm)                  ▼
                                    admin scans a QR ──► ~2 min ──► mp_list_published
                                                                       (the proof)

A note on the console's language: every label, hint and error on mp.weixin.qq.com is Chinese. The exact literals are kept as module constants in src/wxmp/tietu.py, src/wxmp/article.py and src/wxmp/drafts.py, so there is one place to update them when the console changes. This document describes them in English.

Status: what is actually verified

This project was carved out of a hand-run session on a live account (an unverified personal subscription account) and then re-verified on the same machine. Honesty about coverage matters more than a feature list.

Area

State

Browser launch (system Edge, persistent profile), console login detection, QR screenshot, redirect → token extraction, token masking in every reply

verified on a live account

mp_create_tietu end to end: upload, cover hint, title, description, save draft, draft id

verified — one image attached through the uploader input, the cover hint appeared, title and description typed, draft id returned

mp_publish_material with kind=tietu, action=draft

verified on draft 100000219 — the unified entry point builds the same image message and reports the new draft id

mp_publish_material with kind=article, action=draft

verified on draft 100000232 — title, two body paragraphs, one inline picture, 作者 and 摘要 written, 封面 set through the image library, draft id returned; reopening the draft showed the title, both paragraphs, the inline picture and a real mmbiz.qpic.cn cover

Cover of a 图文 (the console has no local cover upload)

verified through 从图片库选择: the picker's 上传文件 input takes the local file, the new entry arrives already ticked, 下一步 → 编辑封面 (2.35:1 / 1:1) → 确认, and the saved draft renders the cover as a 235x100 CSS background image

Inline pictures inside a 图文 body

verified — the toolbar 图片 → 本地上传 file input inserts the picture at the caret (.ProseMirror img went 0 → 2, the editor adds a wrapper node, so the count is a floor)

Draft box listing, cards keyed by data-appid

verified; the console normalises the image-message tab filter to the article value (0) whenever that tab is empty, and both the requested and the landed value are reported

Opening an existing draft in its composer

verified — it is the URL the console itself redirects to after saving a draft

mp_delete_draft end to end

verified on draft 100000205 — the card's icon row is hover-only and textless, so each icon is hovered until its tooltip reads "delete" (index 0; index 2 is "edit"); the confirmation is a popover, not a modal, and the id was gone from the list afterwards

mp_publish_draft with action=publish

verified once, end to end, on draft 100000210 → msgid 1000000021: the publish dialog was submitted, the admin scanned a QR page, the console then reported "this draft is being published, do not repeat the operation", finished in the background about two minutes after the scan, closed the editor tab itself, the draft disappeared from the draft box and publish records grew from 20 to 21 entries

Publish records (mp_list_published)

verified — the payload is an escaped JSON string whose entries are {publish_type, publish_info} wrappers; counters read total 21 / publish 1 / masssend 20 and the newest entry reproduces msgid 1000000021, sent_status 3/3/0, msg_status 2, and its public URL

action=schedule

mechanics verified, submission NOT verified — the switch, the time picker (today, HH:MM) and the footer submit were all driven and the console's own pre-flight checks ran, but no publish-record entry appeared afterwards. verified is therefore false and the reply says so

Account quotas as reported by the console

observed: one mass-send left (daily 1/1), is_admin true, is_force_not_masssend 0, time_send_oper_left 20, face_check_resp.need_check false, user_publish_mode 1

Rich-text article composition (kind=article)

draft path verified (see above). The article publish was never submitted: it needs the admin scan and produces public content, so action=publish for a 图文 is implemented but unproven

Group-send preview, asset library management

not implemented

Bilingual tool text (English + Chinese in one description, arguments as english / Chinese)

enforced by the test suite — a tool or argument that loses either language fails selftest

Correction (important). An earlier revision of this file claimed that publishing needed no QR scan, because the automation only ever saw the "being published" text. The account owner confirmed they scanned a QR page on that run. Publishing is gated by an admin scan; the server screenshots that page, waits for the human, and only trusts a new publish-record entry as proof.

Anything in the "not verified" rows may need selector work on your account. The error payload always carries the page URL (token masked), a screenshot path and what was clicked, so a failure is diagnosable instead of silent.

Related MCP server: mcp-server-wechat-mp

Requirements

  • Python 3.10+

  • A WeChat Official Account you can log into with the WeChat app

  • A browser: Microsoft Edge (default) or Chrome. playwright install is not required when you use an installed browser via WXMP_BROWSER_CHANNEL.

Install

git clone https://github.com/xiaobinger/wechatmp-mcp
cd wechatmp-mcp
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e .

First run: log in once

The login is manual by design — nobody should be typing a console password into a tool, and the QR flow is what the console itself offers.

  1. Call mp_status. It opens https://mp.weixin.qq.com/ in the controlled browser and reports logged_in: false plus the login markers it saw.

  2. Call mp_account_login with timeout_s (default 180). It writes a PNG of the QR code into out/ and waits.

    • Scan the QR that is visible in the browser window (the PNG is a fallback for unattended setups; set WXMP_DEVICE_SCALE=2 if you need a higher-resolution PNG).

    • The call returns as soon as the console redirects with a session token.

  3. The session is stored in WXMP_PROFILE_DIR and reused by later calls until the console expires it. If it expires, the call says so and the QR appears again.

The profile directory contains live login cookies. It is git-ignored; keep it that way and treat the whole directory as a secret.

Its location is resolved from the package, never from the process working directory: an MCP client may start the server anywhere, and a cwd-relative profile would silently create a second, empty profile whose console answer is "not logged in" even though the real one still holds the session. Point WXMP_PROFILE_DIR at the same directory in every client to keep one shared login.

Tools

Tool

Confirmation

What it does

server_health

—

Version, protocol versions, registered tools, browser settings, profile state.

mp_status

—

Opens the console root, reports logged_in, the masked token, the account nickname when readable.

mp_account_login

—

QR screenshot + poll until the scan completes.

mp_publish_material

action=publish needs confirm=true

The one-call entry point. Takes a title, a cover, the body (text plus ![](/abs/path.png) lines) and kind=tietu|article, then either saves a draft or publishes straight from the editor — never "save, then publish from the draft box".

mp_create_tietu

action=publish or action=schedule needs confirm=true

Uploads 1–20 local images, writes title (≤64) and description (≤1000), then stops at a draft, publishes now, or schedules for later. Kept for multi-image galleries; mp_publish_material covers the same ground with one schema.

mp_list_drafts

—

Lists the draft box (kind=tietu or kind=article).

mp_publish_draft

required

Opens the draft, presses publish, confirms the dialog, then publishes or schedules it. Irreversible and public.

mp_delete_draft

required

Deletes a draft and reports whether it disappeared from the list.

mp_list_published

—

Reads publish records with msgid, title, public URL, send time and status counters. Read-only; this is the proof of a publish.

Publishing: three actions, one human step

action is the single knob:

action

What happens

Result flags

draft (default)

Only "save as draft" is pressed

state=draft, verified=true when a draft id came back

publish

Publish → dialog → admin scans the QR page → the console works in the background

verified=true only if a new msgid appears in publish records within wait_publish_s (default 180 s); measured landing time was about two minutes after the scan

schedule

Publish → turn on scheduling → write HH:MM (today) → dialog submit

state=scheduled_unverified, verified=false — the submission never produced a publish-record entry

wait_publish_s=0 skips the polling and answers at once with verified=false. Nothing is ever reported as published from page text alone.

mp_publish_material details

{
  "kind": "article",              // "tietu" (image message) | "article" (图文)
  "title": "…",                   // 标题, ≤64 characters
  "cover": "E:\\pics\\cover.png",  // required for article, optional for tietu
  "content": "第一段\n![](E:\\pics\\inline.png)\n第二段",
  "images": [],                   // extra pictures (tietu: gallery, ≤20 with cover)
  "author": "…",                  // 作者 (article only)
  "digest": "…",                  // 摘要 (article only, clipped to 120)
  "action": "draft",              // "draft" (default) | "publish"
  "confirm": false                // must be true for action=publish
}
  • tietu: the gallery is cover + images (≤20). content becomes the description (≤1000 characters, newlines are paragraphs).

  • content cap. The body/description is refused above 50000 characters with -32602, never silently trimmed. That ceiling is the server's own guard against a runaway prompt (config.CONTENT_MAX_CHARS), not a console limit; the 1000-character description clip is the only real editor limit.

  • article: content is the body. A line that is exactly ![](/abs/path.png) or [[img:/abs/path.png]] becomes an inline picture inserted at the caret through the toolbar's 图片 → 本地上传; every other line becomes a paragraph. cover is mandatory (see below).

  • Cover. The console offers no local cover upload at all: the 封面 slot's menu holds 从正文选择 / 从图片库选择 / 微信扫码上传 / 一键生成封面. The server uploads the file through 从图片库选择 → 上传文件, keeps the entry ticked, presses 下一步, waits for the 编辑封面 confirm to become clickable, presses 确认, then saves and reopens the draft to read the cover back.

    • The picker is a list of file names, not a thumbnail grid, and the item click is a toggle: right after the upload the new entry is already ticked, so clicking its name again unticks it and 下一步 turns grey. That took a live run down (100000245 saved with no cover), which is why the code now reads the selection state instead of clicking blindly.

    • In the composer the cover preview is 0x0 with url("") for a while even on a good save, and the empty slot's text 「拖拽或选择封面」 never disappears — neither can be used as a signal. cover_ok therefore only reflects the reopened draft (measured: 235x100 with a mmbiz.qpic.cn background).

  • action=publish presses the editor's own 发表 → confirms the dialog → the admin scans the QR page → verified only when a new msgid shows up in publish records. For a 图文 this path is implemented but not yet proven (publishing creates public content, so it was never submitted here).

mp_create_tietu details

  • images: absolute paths, png/jpg/jpeg/gif/webp, ≤10 MB each (override with WXMP_MAX_IMAGE_BYTES). The first image becomes the cover.

  • description: newlines become paragraphs. Text longer than 1000 characters is clipped before it is typed. The counter the console shows is returned as desc_counter — it is not a 1:1 character count (995 typed characters including paragraph breaks measured 807/1000).

  • The upload path matters. The editor has two file inputs: the one owned by the image-library picker is inert here — handing it a file sends no request and leaves the composer empty. Only the webuploader input behind "upload from local" actually uploads, after which the cover hint appears. The menu only exists after the add tile is clicked, so the flow clicks the tile first, then sets the files. If the uploader ever refuses, the server falls back to the image-library picker (which attaches images already in the asset library, newest first) and says so in upload.method.

  • The description is typed with insert_text, never through the OS clipboard. HTML clipboard flavours were measured to garble CJK text in that editor.

MCP client configuration

mcp.entry.json in this repository is a ready-made stdio entry:

{
  "wxmp": {
    "command": "python",
    "args": ["-m", "wxmp", "--transport", "stdio"],
    "env": { "PYTHONIOENCODING": "utf-8", "PYTHONUTF8": "1" }
  }
}

Use the absolute path of the interpreter you installed into, e.g. E:\path\to\wechatmp-mcp\.venv\Scripts\python.exe.

Streamable HTTP instead of stdio:

wxmp --transport http --host 127.0.0.1 --port 8790 --path /mcp --token <secret>

GET /mcp answers 405 by design (no server-initiated stream); POST accepts JSON-RPC requests, notifications and batches.

Environment variables

Variable

Default

Meaning

WXMP_PROFILE_DIR

./.state/profile

Playwright profile holding the login. Secret.

WXMP_OUT_DIR

./out

Screenshots: login QR, composer, publish evidence, the admin scan page.

WXMP_BROWSER_CHANNEL

msedge

Installed browser to drive (msedge, chrome). Empty ⇒ bundled Chromium, which needs playwright install chromium.

WXMP_HEADLESS

0

1 runs without a window. Not recommended: scanning needs one.

WXMP_CDP_URL

—

Attach to an already-running Chrome (http://127.0.0.1:9222) instead of launching.

WXMP_TIMEOUT_MS

30000

Default action timeout.

WXMP_LOGIN_TIMEOUT

180

Default mp_account_login wait.

WXMP_DEVICE_SCALE

1

Device pixel ratio; 2 doubles screenshot resolution.

WXMP_VIEWPORT_W/H

1280 / 900

Window size.

WXMP_SLOW_MO

0

Milliseconds of delay per Playwright action, for watching a run.

WXMP_MAX_IMAGE_BYTES

10485760

Per-image size cap.

WXMP_HTTP_TOKEN

—

Bearer token for the HTTP transport.

WXMP_LOG_LEVEL

WARNING

Logging level; logs go to stderr, never stdout.

Safety model

  • Manual login only. The server screenshots the QR and polls the redirect. It never handles a password, a cookie or a session token value.

  • Tokens are masked. A nine-digit console token is reported with its first and last two digits only, everywhere, including in URLs inside error payloads.

  • A human scans before anything goes public. After the publish dialog the console shows a QR page; the server screenshots it into out/, waits scan_wait_s (default 120 s) for the scan and never clicks it itself.

  • Irreversible actions need confirm=true: publishing, deleting, and mp_create_tietu / mp_publish_material with action=publish. Without it the call is refused before the browser is touched, and the draft stays exactly as it was.

  • Drafts by default. Creating an image message or a 图文 saves a draft; publishing is always a separate, explicit step.

  • verified means publish records, not page text. A publish is only reported as verified when a new msgid appears in that list.

  • A 图文 cover is proven, not assumed. cover_ok is only true when the saved draft was reopened and its cover rendered a real mmbiz.qpic.cn picture; a composer preview that still reads url("") proves nothing and never counts.

  • Evidence on disk. Every state-changing call writes a full-page PNG into out/, so a publish can be audited afterwards.

  • Serialised browser access. One Playwright session per process; a second request waits instead of opening a second browser.

Troubleshooting

Symptom

What it means

mp_status says logged_in: false while you logged in before

The profile it opened is not the one holding the session. Check settings.profile_dir in server_health and point WXMP_PROFILE_DIR there.

The publish call returns verified: false

The scan was not completed, the publish is still queued, or the list was read too early. Re-run mp_list_published before assuming failure.

The publish call returns needs_scan: true

That is the expected path. Open the browser window, scan the QR, then re-read publish records.

action=schedule returns scheduled_unverified

Expected for now: the submission never produced a publish-record entry. Verify in the console before relying on it.

The image never reaches the composer

The uploader input did not accept the file; the reply's upload block says which method was tried. A modal on the page (unverified account, new-device check) is the usual cause.

A 图文 reply has cover_ok: false

The reopened draft showed no cover picture. Re-open the draft and pick the 封面 by hand before publishing — the console refuses to publish without one. cover.pick / cover.crop_confirm say which step did not land.

the 保存为草稿 button was not found

A cover modal was still on screen and swallowed the click; error_data.open_dialogs names it. The code now dismisses those dialogs first, so seeing this means a new modal appeared — report its wording.

Execution context was destroyed in the logs

The console navigated or closed the tab mid-call. The publish path tolerates it; the publish record is still the proof.

Tests

python tests/selftest.py    # 108 offline checks: protocol, registry, validation,
                            # confirmation gates, masking, URL building, helpers,
                            # publish actions, publish-record parsing, the
                            # bilingual tool-text contract, the 图文 block rules
python tests/ci_smoke.py    # 15 checks including a real stdio subprocess handshake

Both are offline: no browser, no network, no console session. They also run on Linux, so they are safe as CI gates.

Layout

src/wxmp/
  app.py         transport-agnostic Application: bytes in, JSON out
  protocol.py    JSON-RPC 2.0 / MCP method table (2024-11-05 … 2025-06-18)
  registry.py    tool decorator, schema validation, call_tool
  config.py      env-driven settings and console URLs
  security.py    confirmation gates, image checks, token masking
  browser.py     Playwright session, persistent profile, thread re-binding
  console.py     login detection, QR capture, token extraction
  tietu.py       image-message flow: upload, title, description, save,
                 publish / schedule, admin-scan wait
  article.py     图文 flow: title, body blocks, inline pictures, 作者 / 摘要,
                 封面 through the image library, and the draft re-read
  drafts.py      draft box: list, open, publish, delete
  records.py     publish records: the read-only proof that a publish happened
  tools/         the nine MCP tools
  transports/    stdio + Streamable HTTP
tests/           selftest.py, ci_smoke.py

License

MIT. This is unofficial automation of a private console; it is not affiliated with or endorsed by Tencent, and using it may be subject to the platform's terms. Run it against an account you own.

Available Tools

9 tools
mp_account_loginA

Start the QR-code login: opens the console, writes a screenshot of the QR code into the out/ directory and waits for a human to scan it with WeChat. Returns as soon as the console redirects with a session token. The login is manual by design — no credential is ever handled by the server. Limits: timeout_s is 15-600 seconds (default 180); when it runs out the call raises LoginRequired and the reply carries the QR path, so call it again rather than retrying blindly. If the profile already holds a session the call returns immediately with already_logged_in=true.

【中文】启动扫码登录:打开后台、把二维码截图存到 out/ 目录,然后等人用微信扫。控制台一旦带着 session token 跳转就立即返回。登录按设计只能人工完成,服务端从不接触任何凭据。限制:timeout_s 取值 15–600 秒(默认 180);超时会抛 LoginRequired,回包里带二维码路径,所以再调一次即可,不要盲目重试。如果 profile 里已有会话,会立刻返回 already_logged_in=true。

Inputs: timeout_s. Returns: object

mp_create_tietuA

Create a 贴图 (image message) in the WeChat Official Account console: upload one or more local PNG/JPEG images, write the title and the description, save it as a DRAFT, and optionally publish or schedule it in the same call. action=draft (default) stops at the draft; action=publish submits it immediately; action=schedule submits it for now+schedule_minutes. Publishing is irreversible and publicly visible, so it needs confirm=true, and the console then shows a 扫码 page the human must scan with WeChat before the message goes out. verified=true only once a new entry appears in 发表记录. Limits, enforced before the browser is touched: • images is required, 1-20 files, each a local gif/jpeg/jpg/png/webp file given as an absolute path that exists, at most 10 MB each (raise WXMP_MAX_IMAGE_BYTES to allow bigger files); the first one becomes the cover. • title is required, 1-64 characters; empty or longer is rejected with -32602. • description is clipped to 1000 characters and the reply reports desc_clipped=true; the console's own counter is returned as desc_counter and is not a 1:1 character count. • action=publish or action=schedule needs confirm=true. • schedule_minutes is 1-10080, but the time picker only offers today, so a large value cannot be honoured — keep it within the same day. Reply fields: appmsgid, state, verified (a NEW msgid in 发表记录), warning.

【中文】在公众号后台创建一条贴图:上传 1–20 张本地 PNG/JPEG 图片、写入标题和描述、存成草稿,并可在同一次调用里直接发布或定时发布。action=draft(默认)停在草稿;action=publish 立即提交;action=schedule 提交到 schedule_minutes 分钟之后。发布不可撤销且公开可见,需要 confirm=true;随后控制台会出现扫码页,必须由管理员用微信扫过,内容才会发出去。只有发表记录里出现新条目,verified 才会是 true。硬性要求(在碰浏览器之前就校验):• images 必填,1–20 个文件,每个都要是本地 gif/jpeg/jpg/png/webp 文件,必须写绝对路径且文件存在,单张最多 10 MB(要更大就调 WXMP_MAX_IMAGE_BYTES);第一张作封面。• title 必填,1–64 个字符;空或超长返回 -32602。• description 超过 1000 字截断,回包给 desc_clipped=true;控制台自己的计数以 desc_counter 返回,它和字数不是 1:1。• action=publish 或 action=schedule 需要 confirm=true。• schedule_minutes 范围 1–10080,但时间选择器只提供今天,所以太大的值无法兑现——请控制在同一天内。回包字段:appmsgid、state、verified(发表记录里出现新 msgid)、warning。

Inputs: title (required), images (required), action, confirm, +4 more. Returns: object

mp_delete_draftA

Delete a draft from the 草稿箱. IRREVERSIBLE: requires confirm=true. The console asks 确定删除? in a popover and notes that 删除该内容不会删除已发表的内容, so an already published message stays up — this server cannot recall one. Reports whether the id disappeared from the list afterwards. Limits: appmsgid must be the integer id from mp_list_drafts / mp_publish_material, not the title; kind selects which console tab is used; publishing and deleting need confirm=true and are refused with -32602 before anything is opened.

【中文】从草稿箱删除一条草稿。不可撤销:需要 confirm=true。控制台会用气泡问「确定删除?」,并提示「删除该内容不会删除已发表的内容」,所以已经发出去的内容不会因此下线——本服务也无法召回它。会回报该 id 之后是否从列表里消失。硬性要求:appmsgid 必须是 mp_list_drafts / mp_publish_material 返回的整数 id,不是标题;kind 决定用哪个后台标签页;发表和删除都需要 confirm=true,否则在打开任何页面之前就返回 -32602。

Inputs: appmsgid (required), kind, confirm. Returns: object

mp_list_draftsA

List the drafts in 草稿箱. Returns draft ids (from each card's data-appid), titles, the 更新于 footer and a state hint. item_show_type=8 selects the 贴图 tab and is honoured while that tab holds drafts; when it is empty the console normalises the value to 0 (文章), so both the requested and the landed value are reported. The ids feed mp_publish_draft and mp_delete_draft. Limits: count is 1-20 (default 10) and only the first page is read, so a busy 草稿箱 needs further calls with a smaller count; ids are integers and must be passed as such, never as a title.

【中文】列出草稿箱里的草稿。返回草稿 id(取自每张卡片的 data-appid)、标题、「更新于」页脚和一个状态提示。item_show_type=8 选贴图标签页,只要该标签页有草稿就生效;该标签页为空时控制台会把值规范成 0(文章),所以请求值和实际落地的值都会报出来。这些 id 供 mp_publish_draft 和 mp_delete_draft 使用。限制:count 取值 1–20(默认 10),且只读第一页,草稿多时要再调一次并换小一点的 count;id 是整数,必须按整数传,不能传标题。

Inputs: kind, count. Returns: object

mp_list_publishedA

List 发表记录 (already published items) — NOT the 草稿箱. Read-only. Reads /cgi-bin/appmsgpublish?sub=list and returns the counters (total / publish / masssend), plus per-item msgid, title, public content_url, sent_at, the sent_status counters and msg_status. This is the only honest way to confirm a publish: the composer only shows 「该草稿正在发表」 while the item appears here about two minutes after the admin scan. Limits: count is 1-50 (default 20) and one response is one page; msgid is the integer the other publish tools never return — it is what proves a publish, not the draft's appmsgid.

【中文】列出发表记录(已经发出去的内容)——不是草稿箱。只读。读取 /cgi-bin/appmsgpublish?sub=list,返回计数(total / publish / masssend),以及每条的 msgid、标题、公开链接 content_url、发送时间 sent_at、发送状态计数和 msg_status。这是确认「真的发出去了」唯一可靠的方式:编辑器里只会显示「该草稿正在发表」,而内容要等管理员扫码后约 2 分钟才会出现在这里。限制:count 取值 1–50(默认 20),一次响应就是一页;msgid 是整数,别和草稿的 appmsgid 搞混——证明发表的是 msgid。

Inputs: count. Returns: object

mp_publish_draftA

Publish or schedule an existing draft. IRREVERSIBLE and publicly visible: requires confirm=true, and the human must have approved this exact draft id. Opens the draft in the composer, presses 发表, waits for the confirmation dialog (发表贴图无需开启群发通知 / 定时发表) and presses its 发表 button. action=publish submits now, action=schedule turns on 定时发表 and submits for now+schedule_minutes. After submitting, the console shows a 扫码 page that the admin must scan with WeChat; the item then lands in 发表记录 about two minutes later. verified=true only when a NEW msgid appears in that list, so wait_publish_s controls how long the call polls for it. Limits: appmsgid must be the integer id from mp_list_drafts / mp_publish_material, not the title; kind selects which console tab is used; publishing and deleting need confirm=true and are refused with -32602 before anything is opened.

【中文】发布或定时发布一条已有草稿。不可撤销且公开可见:需要 confirm=true,并且必须由人确认过这个具体的 draft id。它会打开草稿编辑器、点发表、等确认弹窗(发表贴图无需开启群发通知 / 定时发表)再点弹窗里的发表按钮。action=publish 立即提交;action=schedule 打开定时发表,提交到 schedule_minutes 分钟之后。提交后控制台会出现扫码页,必须由管理员用微信扫,约 2 分钟后内容才落到发表记录。只有发表记录里出现「新」msgid 时 verified=true,wait_publish_s 控制轮询多久。硬性要求:appmsgid 必须是 mp_list_drafts / mp_publish_material 返回的整数 id,不是标题;kind 决定用哪个后台标签页;发表和删除都需要 confirm=true,否则在打开任何页面之前就返回 -32602。

Inputs: appmsgid (required), kind, action, confirm, +3 more. Returns: object

mp_publish_materialA

Create one piece of material in the WeChat Official Account console from a title, a cover image and a body, then keep it as a draft or publish it straight from the editor. kind=tietu builds a 贴图 (image message): cover plus any extra images become the gallery, content is the description. kind=article builds a 图文 article: cover is the 封面 chosen through the console's image library (the console has no local cover upload), content is the body, and a line that is just or [[img:/path/to.png]] inserts that local image at that point of the body; author and digest fill 作者 and 摘要. action=draft (default) stops at 草稿箱; action=publish submits from the same editor with the console's own 发表 control, needs confirm=true, and then shows the admin 扫码 page that a human must scan with WeChat. verified=true only when a NEW msgid appears in 发表记录 — for action=publish with wait_publish_s>0 only. Limits, enforced before the browser is touched: • title is required, 1-64 characters as the console counts them (one CJK ideograph is one character); an empty or longer title is rejected with error code -32602 instead of being trimmed. • content is refused above 50000 characters with -32602 (the server's own guard, not a console limit); for tietu it is the description and is clipped to 1000 characters — the reply reports desc_clipped=true; for article it is the body, one paragraph per line, and an inline picture needs a whole line of its own. • author is clipped to 64 characters, digest to 120 — both report clipped/requested_chars. • cover and images must each be a local gif/jpeg/jpg/png/webp file given as an absolute path that exists, at most 10 MB each (raise WXMP_MAX_IMAGE_BYTES to allow bigger files). • for tietu the gallery is cover + images and holds at most 20 pictures; kind=article requires cover, and there images are appended to the body after the text. • action=publish also needs confirm=true and wait_publish_s in 0-900. • kind=article with action=publish is implemented but never submitted against the live console, so treat verified=false there as unproven. Reply fields to branch on: appmsgid (null means no draft id was reported), state=draft|published|pending|unknown, verified, cover_ok (article only; true only when the reopened draft showed the cover), and warning (non-empty means a human should look before publishing).

【中文】用标题、封面图和正文在公众号后台做一份素材,然后存草稿或直接从编辑器发表。kind=tietu 做贴图:封面加上额外图片就是图集,content 是描述。kind=article 做图文:封面走后台的图片库(后台没有本地封面入口),content 是正文,某一行只有 或 [[img:/path/to.png]] 时,就在那里插入这张本地图片;author 和 digest 分别填作者和摘要。action=draft(默认)停在草稿箱;action=publish 用后台自己的发表按钮从同一个编辑器直接提交,需要 confirm=true,之后会出现扫码页,必须由人用微信扫。只有发表记录里出现「新」msgid 才 verified=true——仅限 action=publish 且 wait_publish_s>0 的情况。硬性要求(在碰浏览器之前就校验):• title 必填,1–64 个字符,按后台计数口径(一个汉字算一个);空标题或超长直接返回错误码 -32602,不会悄悄截断。• content:服务端硬上限 50000 个字符;tietu 时是描述,超过 1000 字会被截断,回包给 desc_clipped=true;article 时是正文,一行一段,插图必须单独占一行。• author 超过 64 字截断,digest 超过 120 字截断,回包分别给 clipped / requested_chars。• cover 和 images 里的每一项都必须是本地 gif/jpeg/jpg/png/webp 文件,必须写绝对路径且文件存在,单张最多 10 MB(要更大就调 WXMP_MAX_IMAGE_BYTES)。• tietu 的图集 = cover + images,最多 20 张;kind=article 必须给 cover,images 会接在正文文字之后。• action=publish 还需要 confirm=true,wait_publish_s 取值 0–900。• kind=article 配 action=publish 代码写了但没在真机提交过,那里的 verified=false 只代表未证实。回包该看哪些字段:appmsgid(null 表示没拿到草稿 id)、state=draft|published|pending|unknown、verified、cover_ok(仅图文,只有重开草稿看到封面才为 true)、warning(非空表示发表前该让人看一眼)。

Inputs: kind (required), title (required), cover, action, +7 more. Returns: object

mp_statusA

Check whether the WeChat Official Account console session is still valid. Opens the console root in the controlled browser and reports login state, the masked session token, the account nickname when it can be read, and the profile directory in use. Call this before any other mp_* tool.

【中文】检查公众号后台的会话是否仍然有效。在受控浏览器里打开后台首页,回报登录状态、打码后的会话 token、能读到时的账号昵称,以及当前使用的 profile 目录。调用其它任何 mp_* 工具之前,先调它。

Inputs: screenshot. Returns: object

server_healthA

Report server version, supported MCP protocol versions, the registered tools and the browser configuration (profile directory, channel, headless mode, console limits). Use it to diagnose a client that cannot reach the console.

【中文】报告服务版本、支持的 MCP 协议版本、已注册的工具,以及浏览器配置(profile 目录、浏览器通道、无头模式、控制台限制)。客户端连不上后台时用它排查。

Inputs: no named parameters. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 9 tools

    Disambiguation3/5

    Most tools are distinct (status, login, list_drafts, publish_draft, delete_draft, list_published), but mp_create_tietu and mp_publish_material(kind=tietu) largely do the same thing — create an image message draft from a title, description and images — with only subtle differences (extra images, article support). An agent could easily pick the wrong one, and the extremely verbose descriptions add noise rather than cleanly separating them.

    Naming Consistency4/5

    Nearly all tools follow an mp_ + verb_noun snake_case convention (mp_list_drafts, mp_publish_draft, mp_delete_draft, mp_list_published). Deviations are minor: mp_status uses no verb, mp_account_login is noun-based, and server_health drops the mp_ prefix, but the overall pattern stays readable.

    Tool Count4/5

    At 9 tools the set is well within a reasonable scope for a WeChat console automation server, and each covers a lifecycle step. The only blemish is that mp_create_tietu is essentially a narrower duplicate of mp_publish_material(kind=tietu), so one tool arguably doesn't earn its separate place.

    Completeness4/5

    The lifecycle is well covered: session check, QR login, list/create/publish/delete drafts, create material (tietu and article), and verify publishes via 发表记录. The main gap is there is no update/edit-draft tool, so an agent cannot modify an existing draft's content without deleting and recreating it.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers