weapp-agent-mcp — Claude Code MCP server: setup
This MCP server lets coding agents drive WeChat DevTools for Mini Program debugging, page interaction, and small regression checks.
claude mcp add --env WEAPP_WS_ENDPOINT=<WEAPP_WS_ENDPOINT> --env WEAPP_AUTOMATOR_MODE=<WEAPP_AUTOMATOR_MODE> --env WEAPP_PROJECT_PATH=<WEAPP_PROJECT_PATH> --env WECHAT_DEVTOOLS_CLI_PATH=<WECHAT_DEVTOOLS_CLI_PATH> --env WEAPP_DEVTOOLS_PORT=<WEAPP_DEVTOOLS_PORT> --transport stdio weapp-agent-mcp -- npx -y @chaixueyuan/weapp-agent-mcpWhat weapp-agent-mcp does
weapp-agent-mcp exposes WeChat DevTools actions to an agent through MCP. It can capture screenshots and page state, navigate between routes, find elements, interact with them, and check visible UI conditions. Short test flows can run through mp_runScenario, with a Markdown result produced by mp_generateScenarioReport.
The server wraps miniprogram-automator and includes connection checks plus recovery tools such as mp_healthCheck and mp_recoverConnection. Stable qa-* selectors help keep page checks usable after UI changes. Screenshot handling is serial, so concurrent capture is outside its intended use; long flows are better split into shorter scenarios.
You need WeChat DevTools with automation and its service port enabled, Node.js 18+, npm, and a Mini Program project that DevTools can open. Without those DevTools settings, the MCP server cannot control the app.
What it helps with
- inspect whether Mini Program elements are visible
- capture the current page and its UI state
- run a short regression flow after a UI change
- create a Markdown report from a scenario
- recover a dropped DevTools connection
Example prompts for the agent
- Check the sign-in screen with
mp_screenshot, then verify the main button withpage_expectVisible. - Capture
page_snapshotfor the current route and assert the expected navigation. - Run a short flow with
mp_runScenarioand create its Markdown report withmp_generateScenarioReport.
How to install weapp-agent-mcp
Platform CLI
claude mcp add --env WEAPP_WS_ENDPOINT=<WEAPP_WS_ENDPOINT> --env WEAPP_AUTOMATOR_MODE=<WEAPP_AUTOMATOR_MODE> --env WEAPP_PROJECT_PATH=<WEAPP_PROJECT_PATH> --env WECHAT_DEVTOOLS_CLI_PATH=<WECHAT_DEVTOOLS_CLI_PATH> --env WEAPP_DEVTOOLS_PORT=<WEAPP_DEVTOOLS_PORT> --transport stdio weapp-agent-mcp -- npx -y @chaixueyuan/weapp-agent-mcpReplace <…> with your own values. 10 more environment variables are in the server README
Platform CLI
codex mcp add weapp-agent-mcp --env WEAPP_WS_ENDPOINT=<WEAPP_WS_ENDPOINT> --env WEAPP_AUTOMATOR_MODE=<WEAPP_AUTOMATOR_MODE> --env WEAPP_PROJECT_PATH=<WEAPP_PROJECT_PATH> --env WECHAT_DEVTOOLS_CLI_PATH=<WECHAT_DEVTOOLS_CLI_PATH> --env WEAPP_DEVTOOLS_PORT=<WEAPP_DEVTOOLS_PORT> -- npx -y @chaixueyuan/weapp-agent-mcpReplace <…> with your own values. 10 more environment variables are in the server README
Config file
{
"mcpServers": {
"weapp-agent-mcp": {
"command": "npx",
"args": [
"-y",
"@chaixueyuan/weapp-agent-mcp"
],
"env": {
"WEAPP_WS_ENDPOINT": "<WEAPP_WS_ENDPOINT>",
"WEAPP_AUTOMATOR_MODE": "<WEAPP_AUTOMATOR_MODE>",
"WEAPP_PROJECT_PATH": "<WEAPP_PROJECT_PATH>",
"WECHAT_DEVTOOLS_CLI_PATH": "<WECHAT_DEVTOOLS_CLI_PATH>",
"WEAPP_DEVTOOLS_PORT": "<WEAPP_DEVTOOLS_PORT>"
}
}
}
}Replace <…> with your own values. 10 more environment variables are in the server README
Config file
{
"servers": {
"weapp-agent-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@chaixueyuan/weapp-agent-mcp"
],
"env": {
"WEAPP_WS_ENDPOINT": "<WEAPP_WS_ENDPOINT>",
"WEAPP_AUTOMATOR_MODE": "<WEAPP_AUTOMATOR_MODE>",
"WEAPP_PROJECT_PATH": "<WEAPP_PROJECT_PATH>",
"WECHAT_DEVTOOLS_CLI_PATH": "<WECHAT_DEVTOOLS_CLI_PATH>",
"WEAPP_DEVTOOLS_PORT": "<WEAPP_DEVTOOLS_PORT>"
}
}
}
}Replace <…> with your own values. 10 more environment variables are in the server README
Platform CLI
gemini mcp add -e WEAPP_WS_ENDPOINT=<WEAPP_WS_ENDPOINT> -e WEAPP_AUTOMATOR_MODE=<WEAPP_AUTOMATOR_MODE> -e WEAPP_PROJECT_PATH=<WEAPP_PROJECT_PATH> -e WECHAT_DEVTOOLS_CLI_PATH=<WECHAT_DEVTOOLS_CLI_PATH> -e WEAPP_DEVTOOLS_PORT=<WEAPP_DEVTOOLS_PORT> weapp-agent-mcp npx -y @chaixueyuan/weapp-agent-mcpReplace <…> with your own values. 10 more environment variables are in the server README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about weapp-agent-mcp
How do I install weapp-agent-mcp in Claude Code?
Run `claude mcp add weapp-agent-mcp -e WEAPP_AUTO_ACCOUNT=<WEAPP_AUTO_ACCOUNT> -e WEAPP_DEVTOOLS_TICKET=<WEAPP_DEVTOOLS_TICKET> -- npx -y @chaixueyuan/weapp-agent-mcp`. Then configure access to WeChat DevTools and its connection settings.
What does weapp-agent-mcp do?
It gives an agent MCP tools for driving WeChat DevTools, including page navigation, screenshots, element actions, UI assertions, and short scenario runs.
What is required before using the MCP server?
Install WeChat DevTools, enable automation and its service port, and have Node.js 18+, npm, and a Mini Program project that can be opened in DevTools.