Weapp MCP Server

Agent-first MCP server for WeChat Mini Program debugging & automation via WeChat DevTools.

Local serverstdio

What is the Weapp MCP server?

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.

What you get

如果你已经在用 Claude Code / Cursor / Codex 等 agent 写小程序,传统的 miniprogram-automator 脚本式调用不够顺手 — 你得让 agent 写 node 脚本、跑、读输出、再调整。本项目把自动化能力直接暴露成 agent 工具调用,让 agent 在对话中可以:

Setting it up

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.

What the assistant can call

Once Weapp is connected, these are the calls the assistant has available:

  • 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 — 聚合连接、页面、项目路径和日志监听状态,判断当前是否健康、是否需要恢复

Configuration and credentials

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.

Before you rely on it

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Weapp.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the weapp mcp server does with a few real requests.

Choosing this one

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.

Available tools

ToolWhat 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列出微信开发者工具中的最近项目,方便选择项目目录

How to install the Weapp MCP server

{
  "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.

Configuration

VariableDescriptionRequired
WEAPP_WS_ENDPOINTConfiguration value read at startup.Optional
WEAPP_AUTOMATOR_MODEConfiguration value read at startup.Optional
WEAPP_PROJECT_PATHFilesystem location the server is allowed to use.Optional
WECHAT_DEVTOOLS_CLI_PATHFilesystem location the server is allowed to use.Optional
WEAPP_DEVTOOLS_PORTConfiguration value read at startup.Optional
WEAPP_AUTOLAUNCHConfiguration value read at startup.Optional

Example prompts to try

  • Use Weapp to mp diagnoseConnection.
  • Use Weapp to mp ensureConnection.
  • Use Weapp to mp navigate.

Frequently asked questions

It connects Weapp to MCP-compatible AI assistants such as Claude and Cursor, exposing 14 tools (mp_diagnoseConnection, mp_ensureConnection, mp_navigate, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Weapp directly.