Agent-first MCP server for WeChat Mini Program debugging & automation via WeChat DevTools.
Weapp MCP server exists for a simple reason — assistants are far more useful when they can act on Weapp directly instead of describing what you should do. Agent-first MCP server for WeChat Mini Program debugging & automation via WeChat DevTools.
如果你已经在用 Claude Code / Cursor / Codex 等 agent 写小程序,传统的 miniprogram-automator 脚本式调用不够顺手 — 你得让 agent 写 node 脚本、跑、读输出、再调整。本项目把自动化能力直接暴露成 agent 工具调用,让 agent 在对话中可以:
The server ships on npm as @chaixueyuan/weapp-agent-mcp, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.
Once Weapp is connected, these are the calls the assistant has available:
mp_diagnoseConnection — 只诊断当前连接目标,不启动 IDE、不修改项目状态mp_ensureConnection — 确保自动化会话就绪,是连接链路默认入口;失败后再按返回指引诊断或恢复mp_navigate — 在小程序内导航,支持 navigateTo、redirectTo、reLaunch、switchTab 或 navigateBackmp_screenshot — 捕获屏幕截图并返回(或保存到磁盘)mp_callWx — 调用微信小程序 API 方法(如 wx.showToast)mp_evaluate — 向小程序 AppService 注入并执行函数代码,适合做显式运行时读取mp_pollUntil — 轮询 AppService 条件,命中后可执行动作并采集前后状态快照mp_getLogs — 获取小程序控制台日志,支持按 type、contains、since、limit 过滤,并返回日志监听状态(如 listenerAttached、lastLogAt、sessionId)mp_runScenario — 按顺序执行一组最小测试步骤,当前支持 navigate、tap、input、waitRoute、expect*、snapshot、getLogs、screenshotmp_generateScenarioReport — 执行 scenario 并输出 markdown 报告;可选写入 outputPath,适合产出轻量回归测试记录,并可引用截图路径mp_currentPage — 获取当前页面信息(路径、查询参数、尺寸和滚动位置),withData 为 true 时额外返回页面数据mp_healthCheck — 聚合连接、页面、项目路径和日志监听状态,判断当前是否健康、是否需要恢复You will need 6 environment variables: WEAPP_WS_ENDPOINT, WEAPP_AUTOMATOR_MODE, WEAPP_PROJECT_PATH, WECHAT_DEVTOOLS_CLI_PATH, WEAPP_DEVTOOLS_PORT, WEAPP_AUTOLAUNCH. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.
This sits in the browser automation group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Weapp's toolset — mp_diagnoseConnection, mp_ensureConnection, mp_navigate and 11 more — is a fair guide to whether it matches your workflow. It is maintained by Chaixueyuan; worth a glance at recent repository activity before you build anything load-bearing on it.
This entry was verified against Weapp's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.
| Tool | What it does |
|---|---|
| mp_diagnoseConnection | 只诊断当前连接目标,不启动 IDE、不修改项目状态 |
| mp_ensureConnection | 确保自动化会话就绪,是连接链路默认入口;失败后再按返回指引诊断或恢复 |
| mp_navigate | 在小程序内导航,支持 navigateTo、redirectTo、reLaunch、switchTab 或 navigateBack |
| mp_screenshot | 捕获屏幕截图并返回(或保存到磁盘) |
| mp_callWx | 调用微信小程序 API 方法(如 wx.showToast) |
| mp_evaluate | 向小程序 AppService 注入并执行函数代码,适合做显式运行时读取 |
| mp_pollUntil | 轮询 AppService 条件,命中后可执行动作并采集前后状态快照 |
| mp_getLogs | 获取小程序控制台日志,支持按 type、contains、since、limit 过滤,并返回日志监听状态(如 listenerAttached、lastLogAt、sessionId) |
| mp_runScenario | 按顺序执行一组最小测试步骤,当前支持 navigate、tap、input、waitRoute、expect*、snapshot、getLogs、screenshot |
| mp_generateScenarioReport | 执行 scenario 并输出 markdown 报告;可选写入 outputPath,适合产出轻量回归测试记录,并可引用截图路径 |
| mp_currentPage | 获取当前页面信息(路径、查询参数、尺寸和滚动位置),withData 为 true 时额外返回页面数据 |
| mp_healthCheck | 聚合连接、页面、项目路径和日志监听状态,判断当前是否健康、是否需要恢复 |
| mp_recoverConnection | 按标准顺序执行恢复,并返回恢复动作、恢复前后状态与最新 health |
| mp_listProjects | 列出微信开发者工具中的最近项目,方便选择项目目录 |
{
"mcpServers": {
"weapp-agent-mcp": {
"command": "npx",
"args": [
"-y",
"@chaixueyuan/weapp-agent-mcp"
],
"env": {
"WEAPP_WS_ENDPOINT": "ws://localhost:9420"
}
}
}
}Configuration as documented by the project. Restart the client after saving.
| Variable | Description | Required |
|---|---|---|
| WEAPP_WS_ENDPOINT | Configuration value read at startup. | Optional |
| WEAPP_AUTOMATOR_MODE | Configuration value read at startup. | Optional |
| WEAPP_PROJECT_PATH | Filesystem location the server is allowed to use. | Optional |
| WECHAT_DEVTOOLS_CLI_PATH | Filesystem location the server is allowed to use. | Optional |
| WEAPP_DEVTOOLS_PORT | Configuration value read at startup. | Optional |
| WEAPP_AUTOLAUNCH | Configuration value read at startup. | Optional |
Microsoft's official browser automation server — drive a real browser through the accessibility tree, no screenshots needed.
Industrial-strength web extraction — render, scrape, crawl and search entire sites into clean markdown.
The original Chromium automation reference server — simple, screenshot-driven browser control.
Give your coding agent the full DevTools toolbox: traces, network, console, heap snapshots and Lighthouse.
Puppeteer-powered browser control that drives pages from the accessibility tree instead of pixels.
Cloud browsers for AI agents — automation sessions that run in Browserbase's fleet, not on your machine.