WeChat Mini Program Dev MCP
This server enables AI assistants to automate testing and interaction with WeChat Mini Programs through MCP tools, similar to Playwright but specialized for the WeChat ecosystem.
Application Management
Establish and manage automation sessions with WeChat Developer Tools via WebSocket or CLI launch
Navigate within mini programs using
navigateTo,redirectTo,reLaunch,switchTab, andnavigateBackCapture screenshots of the current viewport
Call WeChat Mini Program API methods (e.g.,
wx.showToast)Retrieve and optionally clear console logs
Get current page information including path, query parameters, dimensions, scroll position, and data
Page Operations
Query single or multiple elements using CSS selectors
Wait for elements to appear or for specific timeouts
Get and set page data objects using the
setDatamechanismCall methods exposed on page instances
Element Interactions
Simulate tap/click events and text input on WXML elements
Get element properties: WXML (inner/outer), styles, attributes, size, and bounding rectangles
Query nested elements within other elements (element.$ and element.$$)
Scroll
scroll-viewcomponents to specific positions
Custom Component Support
Access elements inside custom components using
innerSelectorparameterCall methods and get/set rendering data on custom component instances (requires automator 0.6.0+ and base library 2.9.0+)
Flexible Configuration
Configure connection mode, CLI path, ports, timeouts, and authentication via environment variables
Override connection settings on individual tool calls
Launch new Developer Tools instances or connect to existing ones
Automates WeChat Developer Tools for WeChat Mini Programs, enabling navigation, inspection, and manipulation of mini-program pages, elements, and components through the miniprogram-automator API.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@WeChat Mini Program Dev MCPnavigate to the user profile page and take a screenshot"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
WeChat Mini Program MCP Server
A FastMCP-based server that automates WeChat Developer Tools via miniprogram-automator. This server provides MCP tools that allow AI assistants to navigate, inspect, and manipulate mini program pages—similar to playwright-mcp, but tailored for the WeChat ecosystem.
Prerequisites
WeChat Developer Tools installed with command-line access (
cli/cli.bat) enabled.Node.js 18+ and
npminstalled locally.A mini program project that can be opened in the Developer Tools.
Related MCP server: weapp-agent-mcp
Quick Start (npm package)
@yfme/weapp-dev-mcp has been published to npm. Regular users do not need to clone the repository or manually execute node dist/index.js.
Run with npx
npx -y @yfme/weapp-dev-mcpInstall globally or in a project
npm install -g @yfme/weapp-dev-mcp
weapp-dev-mcpOr as a project dependency:
npm install --save-dev @yfme/weapp-dev-mcp
npx weapp-dev-mcpOnly when developing within this repository is it recommended to run
node dist/index.jsdirectly. General users should start via the npm package method above.
MCP Client Integration
Configuration
To use this server in Claude Desktop or other MCP clients, add the following to your configuration file:
{
"mcpServers": {
"weapp-dev": {
"command": "npx",
"args": [
"-y",
"@yfme/weapp-dev-mcp"
],
"env": {
"WEAPP_WS_ENDPOINT": "ws://localhost:9420"
}
}
}
}Claude Code Auto-Approval for Tools
Since calling MCP tools via Claude Code triggers tool permission requests, the connection state between the MCP and WeChat Developer Tools might be lost. Because retrieving console output is highly dependent on the connection state, it may be impossible to obtain output logs coherently. Therefore, it is recommended to add permissions manually:
Create a .claude/settings.local.json file in your project directory, or add the following content to an existing file to allow direct tool calls without confirmation, or add the specific tools you wish to allow without confirmation as needed:
{
"permissions": {
"allow": [
"mcp__weapp-dev-mcp__mp_ensureConnection",
"mcp__weapp-dev-mcp__mp_navigate",
"mcp__weapp-dev-mcp__mp_screenshot",
"mcp__weapp-dev-mcp__mp_callWx",
"mcp__weapp-dev-mcp__mp_getLogs",
"mcp__weapp-dev-mcp__mp_currentPage",
"mcp__weapp-dev-mcp__mp_listProjects",
"mcp__weapp-dev-mcp__mp_setDefaultProject",
"mcp__weapp-dev-mcp__page_getElement",
"mcp__weapp-dev-mcp__page_getElements",
"mcp__weapp-dev-mcp__page_waitElement",
"mcp__weapp-dev-mcp__page_waitTimeout",
"mcp__weapp-dev-mcp__page_getData",
"mcp__weapp-dev-mcp__page_setData",
"mcp__weapp-dev-mcp__page_callMethod",
"mcp__weapp-dev-mcp__element_tap",
"mcp__weapp-dev-mcp__element_input",
"mcp__weapp-dev-mcp__element_callMethod",
"mcp__weapp-dev-mcp__element_getData",
"mcp__weapp-dev-mcp__element_setData",
"mcp__weapp-dev-mcp__element_getInnerElement",
"mcp__weapp-dev-mcp__element_getInnerElements",
"mcp__weapp-dev-mcp__element_getWxml",
"mcp__weapp-dev-mcp__element_getStyles",
"mcp__weapp-dev-mcp__element_scrollTo",
"mcp__weapp-dev-mcp__element_getAttributes",
"mcp__weapp-dev-mcp__element_getBoundingClientRect"
]
}
}Note: The tool name format is
mcp__<server_name>__<tool_name>. Please ensure the server name matches the one in your MCP configuration.
Starting WeChat Developer Tools
Before using the MCP server, you must start the WeChat Developer Tools and enable the WebSocket service.
💡 Before you begin:
Open WeChat Developer Tools.
Go to Settings → Security Settings → Service Port.
Enable "HTTP Debugging" and "Automation Testing".
Start via Command Line
Use the command line to start WeChat Developer Tools and automatically enable the WebSocket service:
macOS/Linux:
/Applications/wechatwebdevtools.app/Contents/MacOS/cli auto --project /path/to/your/project --auto-port 9420Windows:
"C:\Program Files (x86)\Tencent\微信web开发者工具\cli.bat" auto --project C:\path\to\your\project --auto-port 9420Where:
--projectspecifies the path to the mini program project directory (please replace with the actual project path).--auto-portspecifies the WebSocket service port (default is 9420).
⚠️ Warning Due to sandbox mechanisms, some clients do not allow MCP to access the WeChat Developer Tools CLI outside of the project directory, so only the WebSocket service method is introduced here.
Environment Variable Configuration
Control how the automation tool connects to WeChat Developer Tools via environment variables:
Variable | Description |
| [Recommended] The WebSocket endpoint of the running Developer Tools. When set, the server uses |
| Path to the WeChat Developer Tools CLI (optional if the default path works). |
| Force |
| Preferred port when launching Developer Tools (falls back to an available port). |
| Launch timeout in milliseconds (default 30000). |
| Passed to |
| Passed to |
| Set to |
| Additional CLI arguments at launch (space-separated). |
| Working directory passed to the Developer Tools process. |
| Set to |
| Set to |
| Launch timeout in milliseconds (default 45000). |
| Connection timeout in milliseconds (default 45000). |
| Mini program project path (optional). |
Note: When launching Developer Tools (
launchmode), you must provide the mini program project directory via MCP tool parameters: provide it viaconnection.projectPathbefore performing operations (e.g., viamp_ensureConnection). Once established, this value will persist in subsequent calls.
Tool calls can override most of these defaults via the connection object.
Available Tools
Application Tools
mp_ensureConnection– Ensures the automation session is ready; optionally force reconnect or override connection settings.mp_navigate– Navigate within the mini program; supportsnavigateTo,redirectTo,reLaunch,switchTab, ornavigateBack.mp_screenshot– Capture a screenshot and return it (or save to disk).mp_callWx– Call WeChat Mini Program API methods (e.g.,wx.showToast).mp_getLogs– Retrieve mini program console logs, optionally clearing them after retrieval.mp_currentPage– Get current page information (path, query parameters, dimensions, scroll position); returns page data ifwithDatais true.mp_listProjects– List recent projects in WeChat Developer Tools for easy selection of project directories.mp_setDefaultProject– Set the default mini program project path; once set, the next connection will automatically use this project.
Page Tools
page_getElement– Get a page element via selector, returns element summary (tagName, text, value, size, offset); setwithWxml: trueto additionally return the full outerWxml; supports [index=N] syntax to select the Nth element.page_getElements– Get an array of page elements via selector, returns summary for each; setwithWxml: trueto additionally return the full outerWxml for each; supports [index=N] syntax.page_waitElement– Wait for an element to appear on the page (⚠️ not applicable to elements inside custom components); supports [index=N] syntax; adds timeout and retry interval parameters.page_waitTimeout– Wait for a specified number of milliseconds.page_getData– Get the data object of the current page, can specify a path (supports nested paths like 'user.name').page_setData– Update the current page's data usingsetData; adds a verify option to confirm if data was actually updated successfully.page_callMethod– Call a method exposed on the current page instance.
Element Tools
element_tap– Simulate a tap on a WXML element via CSS selector; supports [index=N] syntax to select the Nth element; supports x/y coordinate offset tapping; enhanced stability: waits for element interactivity, automatically verifies if the page path changed after tapping.element_input– Input text into an element (applicable toinputandtextareacomponents).element_callMethod– Call a method on a custom component instance.element_getData– Get rendering data of a custom component instance.element_setData– Set rendering data of a custom component instance.element_getInnerElement– Get an element inside an element (equivalent toelement.$(selector)), returns element summary; setwithWxml: trueto additionally return the full outerWxml.element_getInnerElements– Get an array of elements inside an element (equivalent toelement.$$(selector)), returns element summary; setwithWxml: trueto additionally return the full outerWxml for each.element_getWxml– Get element WXML (inner or outer).element_getStyles– Get CSS style values of an element,namesparameter is an array of style names (e.g.,['color', 'fontSize']).element_scrollTo– Scroll ascroll-viewcomponent to a specified position (x, y).element_getAttributes– Get attribute values of an element,namesparameter is an array of attribute names (e.g.,['class', 'id', 'data-index']).element_getBoundingClientRect– Get the bounding rectangle information of an element relative to the viewport (left, top, width, height, right, bottom), considering CSS transforms (currently only supports ID and class selectors).
Each tool accepts an optional connection block to override environment defaults (project path, CLI path, WebSocket endpoint, etc.).
Usage Tips
General Tips
Before connecting, enable automation in WeChat Developer Tools (
Settings → Security Settings → Service Port).It is recommended to call
mp_ensureConnectionfirst to verify the connection and view system/page details.Using
WEAPP_AUTOCLOSE=trueis suitable for stateless, one-off interactions.Always use absolute paths when navigating (starting with
/):/pages/mine/mine.Use
switchTabfor tabBar pages, andnavigateTofor regular pages.
Operating Custom Components
There are two ways to operate custom components:
Method 1: Use the innerSelector parameter (Recommended)
Applicable to tools like element_tap, element_input, element_getWxml, etc.:
{
"selector": "#my-component",
"innerSelector": ".inner-button"
}selector: The selector for the custom component.innerSelector: The selector for the element inside the component.
Method 2: Use element inner query tools
Applicable to element_getInnerElement and element_getInnerElements:
{
"selector": "#my-component",
"targetSelector": ".inner-button"
}Limitations
page_waitElementdoes not apply to elements inside custom components. Please usepage_waitTimeoutin conjunction with element query tools for polling checks.
AutoLaunch Feature
When WEAPP_AUTOLAUNCH=true is configured, the MCP server can automatically detect and launch WeChat Developer Tools:
Auto-detect port: Detects if a service is running on port 9420.
Launch if no service: If the port is not occupied, it automatically calls the CLI to launch the Developer Tools.
Project selection:
If a default project is configured, it is used automatically.
If no default project exists, it automatically lists recent projects for selection.
Supports entering a project number (e.g.,
1) or the full path.
Configuration Example
{
"mcpServers": {
"weapp-dev": {
"command": "npx",
"args": ["-y", "weapp-dev-mcp"],
"env": {
"WEAPP_AUTOLAUNCH": "true",
"WEAPP_PROJECT_PATH": "D:\\path\\to\\your\\project"
}
}
}
}Workflow
Upon first connection,
WEAPP_AUTOLAUNCH=trueis detected.Checks if a service is running on port 9420.
If no service, automatically launches Developer Tools (using
cli.bat auto --project <path> --auto-port 9420).Waits 45 seconds for the Developer Tools to be ready.
Establishes a WebSocket connection.
Subsequent connections automatically reuse the existing connection.
Tip: After setting a default project using
mp_setDefaultProject, you do not need to select the project again for the next connection.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI coding assistants to debug and analyze WeChat MiniApp JavaScript code via Chrome DevTools Protocol. Supports network interception, breakpoint debugging, script analysis, and runtime inspection for reverse engineering purposes.19149MIT
- AlicenseAqualityAmaintenanceMCP server for WeChat Mini Program debugging and automation, enabling agents to perform UI operations, screenshots, and regression testing through natural language commands.4418414MIT
- AlicenseNot gradedqualityCmaintenanceEnables automated testing of WeChat mini-programs via Model Context Protocol, providing tools for connecting to WeChat Developer Tools, querying and interacting with page elements, making assertions, navigating, and debugging.30371MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to automate WeChat mini-programs via launch or connect modes, providing a stable interaction tree for observation and operation.15MIT
Related MCP Connectors
Live browser debugging for AI assistants — DOM, console, network via MCP.
AI-powered browser automation — navigate, click, fill forms, and extract data from any website.
A paid remote MCP for AI agent browser DevTools MCP, built to return verdicts, receipts, usage logs,
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/yfmeii/weapp-dev-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server