weapp-driver-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| WEAPP_LOG_BUFFER | No | The number of console/exception entries kept in the ring buffer. | 2000 |
| WEAPP_OUTPUT_DIR | No | The directory where mp_screenshot writes files when save_to is used. | <cwd>/weapp-output |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Drives a WeChat mini program through WeChat DevTools for end-to-end testing. Start with mp_launch (needs project_path), then observe with mp_page and mp_query, act with mp_element_action, wait with mp_wait, navigate with mp_navigate, and assert with mp_expect. Call mp_close when done so the DevTools window is released.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| mp_launchA | Start WeChat DevTools for a project through its automation CLI and attach to it. Launching takes 15-60 seconds and needs DevTools installed, signed in, and with its service port enabled (设置 → 安全设置 → 服务端口). Only one session can run at a time; launching the same project again reuses it. Call mp_close when finished so the DevTools window is closed. |
| mp_closeA | Detach from the mini program and close the DevTools window this server launched. Idempotent: calling it with no session reports "not_running" instead of failing. |
| mp_statusA | Report whether a session is running, which project and automation endpoint it drives, which wx methods are currently mocked, and where the console log cursor stands. Call this instead of guessing after an error. |
| mp_pageA | Describe the current page: route path and query, page data (optionally one branch via data_path), viewport size, scroll offset and the page stack. Pass include ["wxml"] to see the markup when a selector cannot be guessed from what is on screen. Large data is truncated with an explicit marker. |
| mp_queryA | List elements matching a selector on the current page, with tag name, class and clipped text for each. Use this to inspect what is on screen before acting, and to choose an index when a selector matches several elements. Returns the total match count separately from the listed page of results. |
| mp_element_actionA | Act on one element of the current page: tap, longpress, input text, trigger an event, send a raw touch, scroll a scroll-view, swipe a swiper, slide a slider, or call a custom component method. The element is re-resolved from its selector on every call, so actions are replayable; a miss reports the neighbouring elements that did render. Returns the action result and the page you are on afterwards. |
| mp_element_readA | Read one or more fields from one element of the current page. Every field is read in a single call to avoid a round trip per attribute. Attribute, property and style reads report |
| mp_waitA | Wait until an element appears or disappears, an element text contains a string, the page reaches a path, or a page data path equals a value — with a hard deadline. On timeout it reports what was observed last, so you can tell a slow render from a wrong expectation. Use this instead of sleeping a fixed time before an assertion. |
| mp_navigateA | Route the mini program (navigate_to, redirect_to, re_launch, switch_tab, navigate_back) and wait until the app actually lands. Returns as soon as the expected path is observed, instead of sleeping a fixed interval, so a fast transition costs milliseconds. A navigation that never lands reports a timeout with the page it was stuck on. |
| mp_screenshotA | Capture the current mini program screen and return it inline as an image, so it can be inspected directly. Optionally save a copy under the configured output directory. Screenshots are the fastest way to diagnose a layout or state problem that DOM reads do not explain. |
| mp_consoleA | Read console messages and uncaught exceptions captured since the session started. Supports incremental reading with since_seq, filtering by kind, and clearing. The buffer is bounded; |
| mp_wxA | Call a wx API inside the running mini program, or mock one so it returns a fixed result (or runs a function) without touching the network. This is the only request control the WeChat automator exposes: it replaces wx API results, it does not intercept HTTP. Mocks persist for the session; restore or restore_all removes them. |
| mp_expectA | Evaluate one assertion against the running app and report pass/fail with the observed value. A failed assertion is a normal result, not an error: check |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 13 tools
Tools split cleanly along lifecycle (mp_launch/mp_close/mp_status), inspection (mp_page/mp_query/mp_element_read/mp_screenshot/mp_console), and action (mp_element_action/mp_navigate/mp_wx) lines. The closest pairs are mp_query vs mp_element_read (list vs read fields) and mp_wait vs mp_expect (wait-until vs assert), but the descriptions clearly delineate them.
Every tool shares the mp_ prefix and snake_case, with a consistent mp_element_* compound for element-scoped tools. Minor deviation: the style mixes verbs (mp_launch, mp_wait, mp_navigate) with nouns (mp_page, mp_status, mp_console), so the pattern is predictable in format but not strictly verb_noun.
13 tools is squarely in the well-scoped range for a browser-style automation driver. Each tool maps to a distinct capability (session control, DOM inspection, interaction, navigation, waiting, assertions, diagnostics) with no filler.
The surface covers the full automation lifecycle: launch/attach, inspect page and elements, act, wait, navigate, screenshot, console capture, wx API mocking, and assertions, with explicit notes on the HTTP-interception limitation. Minor gaps remain around arbitrary in-page JS evaluation and multi-session/multi-project work, though mp_wx and mp_expect cover much of what one would reach for.