wechat-editor
Provides tools to inspect and edit the currently open WeChat Official Account draft in Microsoft Edge: read fields and body HTML, edit title/author/summary, replace unique passages, append or replace body text, adjust banners/captions/credits, inspect layout, capture screenshots, preview device sizes, and save the draft.
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., "@wechat-editor Replace the last paragraph in my WeChat draft with 'Thanks for reading!'"
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.
WeChat Draft Editor for Edge and MCP
English | 简体中文
Edit a WeChat Official Account article from a local AI agent while keeping the draft open in Microsoft Edge. Click the extension on the article you want to work on, then ask your agent to read a section, replace a paragraph, or check how a caption wraps on a phone. The extension uses your existing editor session. Saving a draft is an explicit tool call; publication stays in the WeChat interface.
AI Agent (MCP Client) ──stdio──▶ agent.py ──Windows Named Pipe──▶ bridge.py (Native Host) ──Native Messaging──▶ Edge Extension (mp.weixin.qq.com)Install on Windows
You need Windows, Microsoft Edge, and Python 3.10 or newer on your PATH. Install uv if you plan to connect an MCP client. The command-line client and native host use only the Python standard library.
Download both ZIP files from the latest release. Extract the Edge ZIP into a permanent folder named
extensionand the MCP ZIP into a separate folder namedmcp. If you cloned the repository instead, use itsextensiondirectory and run the following commands from the repository root.Open
edge://extensions, enable Developer mode, click Load unpacked, and select the extracted folder containingmanifest.json. Copy the extension ID that Edge displays.Open PowerShell in the folder containing
install.ps1and register the native host for your Windows user:.\install.ps1 -ExtensionId (Read-Host 'Paste the extension ID from Edge')Open an article in the WeChat Official Account editor at
mp.weixin.qq.com. Click the extension icon on that tab. When its badge reads ON, verify the connection in the same PowerShell window:python bridge.py status python bridge.py regionsThe first command reports readiness and the article title. The second reads the title, author, summary and body, including which fields are writable. Check the title before making your first edit.
Related MCP server: MCP WeChat Official Accounts Spider
Connect an AI agent
For Codex, run this from the folder containing agent.py, then start a new Codex session:
codex mcp add wechat-editor -- uv run --locked --script "$PWD\agent.py"For another stdio MCP client, set the command to uv and pass the arguments shown below. Replace the example script path with its absolute path on your machine. Keep agent.py.lock, bridge.py, and device_preview.py beside the script. On first launch, uv installs the locked dependencies.
{
"mcpServers": {
"wechat-editor": {
"command": "uv",
"args": ["run", "--locked", "--script", "C:/Tools/wechat-editor/mcp/agent.py"]
}
}
}Try this read-only request first:
Read the connected draft and tell me its title. Find the last photo caption and show me how it wraps on an iPhone 13 in portrait orientation.
For an edit, quote the exact passage and its replacement. Ask the agent to read the edited paragraph back before saving. Local passage replacement requires a unique match, which helps preserve surrounding images and formatting.
Tools
Task | MCP tools and behavior |
Inspect the draft |
|
Edit text |
|
Adjust supported templates |
|
Inspect the live editor |
|
Preview the article at another size |
|
Save |
|
Use the CLI without an agent
The CLI accepts UTF-8 text files via --file for text operations, or structured JSON arguments via --payload. For example, to append a paragraph, read it back, and then save:
python bridge.py append --file paragraph.txt
python bridge.py read
python bridge.py saveExamples using --payload (PowerShell 7.3+ with standard native argument passing):
python bridge.py layout --payload '{"offset":40}'
python bridge.py replace_passage --payload '{"oldText":"Original phrase","newText":""}'
python bridge.py fit_caption --payload '["First phrase ","second phrase"]'
python bridge.py align_creditsUse python bridge.py --help for the full list of browser operations. Device emulation runs in the MCP server, which reuses a headless Edge process and closes each isolated browser context after its screenshot.
Connection and upgrades
Switch articles: click the extension on the new editor tab. Clicking it again on the connected tab disconnects it. Reconnect after refreshing the page.
ERR badge: hover over the icon for the reason. For host-registration errors, rerun the installer with the ID currently shown in Edge. If multiple editor regions match, place the caret in the article body and reconnect.
Base Python path: the installer records the base Python executable when run inside a standard virtual environment. Keep that base installation available.
Key rotation: to replace a potentially exposed key, disconnect the extension, run
.\install.ps1 -ExtensionId <extension-id> -RotateKey, then reconnect. Regular reinstalls preserve the key.Upgrade: extract the new files into their existing folders, reload the extension in Edge, rerun the host installer, and restart the MCP session. Keeping the unpacked extension at the same path helps preserve its ID. See CHANGELOG.md for version-specific upgrade notes (such as the v0.5 protocol change).
How it works
The MCP server (agent.py) and CLI send requests through an authenticated Windows named pipe. Edge launches bridge.py as a Native Messaging host and restricts access to the extension ID registered by the installer. The host registration, scripts, and generated authentication key live under the current Windows user in %LOCALAPPDATA%\WxDraftAgent.
The extension binds requests to the selected tab and document. extension/editor.js, extension/editor-support.js, and extension/templates.js locate article fields and apply supported edits. device_preview.py handles alternative viewport rendering.
Security, privacy, and disclaimer
Local-only bridge: All communication between Edge, the native host, and the MCP server stays on your local machine over an authenticated Windows named pipe. The installer restricts NTFS permissions on
%LOCALAPPDATA%\WxDraftAgentand its key file to the installing Windows user.Isolated device preview:
device_preview.pysanitizes draft HTML into a sandboxed page with a strict Content Security Policy (default-src 'none') and allows only HTTPS image requests tommbiz.qpic.cnandmmbiz.qlogo.cnwith redirects blocked.Data shared with your AI agent: This project collects no telemetry and contacts no author-hosted servers. However, any draft text, HTML, or screenshots requested through MCP tools are sent to the MCP client and AI model provider you configure.
Timeout safety: After a write timeout, read the current draft before retrying because the editor may already have applied the change.
Non-affiliation: This is an independent open-source project and is not affiliated with, endorsed by, or supported by Tencent or WeChat. Changes to the WeChat Official Account editor DOM may require extension updates.
Development and contributing
Issues and pull requests are welcome. From a source checkout on Windows, install the locked runtime and development dependencies and run the validation suite:
$env:UV_DEFAULT_INDEX = 'https://pypi.org/simple'
uv lock --check --script agent.py
python tests/check_locks.py
uv sync --locked
uv run --locked ruff check .
uv run --locked ruff format --check .
node --test tests/worker.test.cjs
uv run --locked python -m unittest discover -s tests -vThe browser tests require Microsoft Edge. For the worker tests, use Node 22 or later. If the default uv cache is inaccessible, set UV_CACHE_DIR to a writable user directory. Windows CI also runs ./tests/installer.ps1 under both Windows PowerShell and PowerShell 7 against a temporary profile and registry subtree. Keep the PEP 723 runtime requirements in agent.py and the dependencies in pyproject.toml in sync when updating agent.py.lock and uv.lock.
Commit messages
Use Conventional Commits with an imperative subject, for example fix(bridge): discard expired replies or test(editor): cover caption wrapping. Use chore(release): prepare vX.Y.Z for release preparation. Describe incompatible protocol changes in the commit body and the release notes.
License
Released under the MIT License.
Available Tools
14 toolsmp_align_creditsC
在包含图文和排版两行的署名区域对齐分隔线。
Inputs: no named parameters.
mp_check_statusC
检查已连接的编辑页。
Inputs: no named parameters.
mp_device_previewB
按设备视口在独立 Edge 中重排草稿正文并返回 JPEG。可指定唯一段落和横屏。
Inputs: device, passage, landscape.
mp_fit_bannerC
对唯一匹配的背景图横幅标题设置左右内边距 8px、字距 0px。
Inputs: title (required).
mp_fit_captionC
按短语排列图注。各段拼接后必须与已有图注完全匹配。
Inputs: phrases (required).
mp_get_draftB
读取当前图文的标题、正文和 HTML。
Inputs: no named parameters.
mp_get_layoutA
读取浏览器布局、图片加载统计和最多 40 个段落框(编辑器视口 CSS 像素)。
Inputs: offset.
mp_get_regionsB
结构化读取当前图文的 title、author、summary、body 及各字段可写状态。
Inputs: no named parameters.
mp_replace_passageB
局部替换唯一匹配的正文文字,并核对写入结果。
Inputs: new_text (required), old_text (required).
mp_save_draftB
点击当前编辑页的保存草稿按钮。返回值表示点击已执行。
Inputs: no named parameters.
mp_set_fieldB
设置当前图文的一项元数据并回读;先用 mp_get_regions 检查 writable。
Inputs: text (required), field (required).
mp_show_passageA
将包含指定唯一文字的段落滚动到视口中,供截图查看。
Inputs: text (required).
mp_visual_verifyA
返回已连接编辑页的当前可见画面(JPEG)。请在对应窗口显示该标签页。
Inputs: no named parameters.
mp_write_bodyB
写入分段纯文本。append 追加,replace 替换全文。
Inputs: text (required), mode.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Most tools have clearly distinct purposes: reading state (mp_check_status, mp_get_draft, mp_get_regions, mp_get_layout), writing (mp_write_body, mp_set_field, mp_replace_passage), and verification (mp_visual_verify, mp_device_preview). The main overlaps are mp_get_draft vs mp_get_regions (both return title/body, one adds field metadata) and mp_write_body vs mp_replace_passage (whole-body write vs local replace), which descriptions do partially clarify.
All tools share the mp_ prefix and mostly follow a verb_noun pattern (check_status, get_draft, set_field, write_body, show_passage, align_credits, fit_caption, replace_passage, save_draft). Minor deviations exist: mp_visual_verify and mp_device_preview lead with an adjective/noun rather than a verb, but the set remains predictable.
14 tools is within a reasonable range for a page-editing automation server, and each maps to a concrete operation. A few highly specialized formatting tools (mp_align_credits, mp_fit_caption, mp_fit_banner) feel niche, but they correspond to real editorial tasks.
The surface covers reading, metadata/body writing, layout inspection, visual and device verification, and saving. However, there is no image upload/insertion tool, no way to create a new draft or article, and no publish/export step, which are notable gaps for a WeChat article editor workflow.
Maintenance
Related MCP Connectors
Create, edit, preview, publish, and manage web pages from MCP-capable AI clients.
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Draft, edit, organise, schedule and publish a Writavo Site's content from any AI assistant.
Let your AI agent publish to your own YouTube, Instagram, X, LinkedIn and more, with a preview.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables reading and extracting content from WeChat public account articles using browser automation, allowing AI models to analyze and summarize WeChat articles through natural language requests.466MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to crawl, access, and analyze WeChat Official Account articles using Selenium and the Model Context Protocol. It provides specialized tools for dynamic content retrieval, image processing, and automated article analysis.1Apache 2.0
- AlicenseAqualityFmaintenanceEnables AI agents to publish articles to WeChat Official Account (微信公众号). Supports image upload, draft creation, and publishing via standardized MCP protocol.51ISC
- AlicenseAqualityDmaintenanceEnables publishing HTML articles and image messages to WeChat Official Account drafts via LLM tool calls, with automatic image upload and URL replacement.51MIT