mcp-weapp
Automates WeChat Mini Program DevTools on macOS, enabling page navigation, screenshots, WXML element lookup and interaction, scrolling, JS evaluation, page data inspection, console log collection, and project builds.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp-weapp
MCP server for WeChat Mini Program DevTools automation on macOS.
让 Claude 直接操控微信开发者工具模拟器——导航页面、截图、点击元素、读取 console 日志、执行 JS、构建项目。
前置要求
macOS(唯一支持平台)
Python 3.10+
微信开发者工具已安装(
/Applications/wechatwebdevtools.app)
Related MCP server: wechat-devtools-mcp
安装
git clone https://github.com/merlinhong/mcp-weapp.git
cd mcp-weapp
pip install -e .配置
在你的小程序项目根目录创建或修改 .mcp.json:
{
"mcpServers": {
"weapp": {
"command": "python3",
"args": ["-m", "mcp_weapp"],
"env": {
"WEAPP_PROJECT": "/Users/you/my-miniprogram"
}
}
}
}如果
python3不是 3.10+,请改为python3.11或python3.12。
重要:使用前必须手动打开微信开发者工具
mcp-weapp 不负责启动微信开发者工具 GUI,只负责建立自动化连接。使用前请:
手动打开微信开发者工具
打开
WEAPP_PROJECT指向的小程序项目确保已登录微信开发者账号
然后在 Claude 对话中调用 weapp_enable_auto 建立连接。
工具列表
工具 | 说明 |
| 启用自动化模式,建立 WebSocket 连接(必须第一个调用) |
| 导航到指定页面(非 Tab 页) |
| 切换到 Tab 页面(底部导航栏) |
| 返回上一页 |
| 重启并打开指定页面(清空页面栈) |
| 获取当前页面信息(path、query、pageId) |
| 截取模拟器画面(Claude 可直接视觉分析) |
| 查找 WXML 元素(支持 .class、#id、tag) |
| 查找所有匹配元素 |
| 点击元素 |
| 获取元素文本内容 |
| 页面滚动到指定位置 |
| 在 App 上下文执行 JS |
| 读取页面 data(setData 数据) |
| 开启 console 日志收集 |
| 获取并清空已收集的 console 日志 |
| 执行 |
环境变量
变量 | 默认值 | 说明 |
| — | 必填,小程序项目根目录绝对路径 |
|
| cli 可执行文件路径 |
|
| WebSocket auto-port(通常不需要改) |
| 自动发现 | 微信 HTTP API 端口,留空则自动检测 |
|
| WebSocket 握手超时(秒) |
|
| 单次 RPC 调用超时(秒) |
|
| 重连最大次数(指数退避:1s, 2s, 4s...) |
|
| 连接失败时是否自动启动 cli auto |
|
| console log 缓冲条数上限 |
典型工作流
weapp_enable_auto # 1. 建立连接
weapp_navigate /pages/xxx # 2. 导航到目标页面
weapp_screenshot # 3. 截图验证 UI
weapp_enable_log # 4. 开启日志收集
weapp_tap_element .btn # 5. 点击按钮
weapp_get_console_log # 6. 检查 console 错误开发
pip install -e ".[dev]"
pytest tests/单测不依赖微信开发者工具,可离线运行。
License
MIT — 详见 LICENSE 文件。
Contributing
欢迎提交 Issue 和 Pull Request,请先阅读 CONTRIBUTING.md。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
The cloud Mac alone, with Xcode, for AI agents: run commands, build and test, use the screen.
Let Claude, ChatGPT and other agents use your Android phone: see the screen, tap, type, open apps.
Cloud iPhones and Macs with Xcode for AI agents: build, run and test iOS apps, use the screen.
Open a React Native app in a simulated phone: read the screen, tap, type, set device state.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables AI assistants to automate WeChat Developer Tools for mini programs, allowing navigation, inspection, and manipulation of pages and components through the miniprogram-automator API.2771 npm176MIT
- AlicenseAqualityAmaintenanceWraps the WeChat DevTools CLI as an MCP service, enabling AI in editors to call WeChat CLI commands for mini-program development, testing, debugging, and automation.7171MIT
- AlicenseBqualityDmaintenanceEnables AI assistants to control WeChat mini-programs running in WeChat Developer Tools through MCP tools. Provides automation capabilities for launching, navigating, querying, and interacting with pages and elements.611MIT
- -licenseNot gradedqualityNot gradedmaintenanceEnables AI agents to debug and control WeChat Mini Programs through WeChat DevTools, including direct automator operations and CLI-backed features like screenshots, logs, previews, and uploads.-