- Home
- MCP servers
- WeChat Mini Program
WeChat Mini Program
- typescript
73
GitHub Stars
typescript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"yfmeii-weapp-dev-mcp": {
"command": "npx",
"args": [
"-y",
"@yfme/weapp-dev-mcp"
],
"env": {
"WEAPP_WS_ENDPOINT": "ws://localhost:9420",
"WEAPP_AUTO_ACCOUNT": "YOUR_ACCOUNT_ID",
"WEAPP_DEVTOOLS_PORT": "9420",
"WEAPP_AUTOMATOR_MODE": "launch",
"WEAPP_DEVTOOLS_TICKET": "YOUR_TICKET",
"WEAPP_DEVTOOLS_TIMEOUT": "60000",
"WECHAT_DEVTOOLS_CLI_PATH": "/Applications/wechatwebdevtools.app/Contents/MacOS/cli"
}
}
}
}This MCP server provides automation for WeChat Mini Programs by running a local client that connects to the WeChat DevTools WebSocket interface. You can navigate, inspect, and interact with mini program pages through MCP tools, enabling AI-assisted testing and automation within the WeChat ecosystem.
How to use
To use this MCP server with an MCP client, start the server and point the client to the local WebSocket endpoint. Begin by launching the WeChat DevTools in automation mode, then start the MCP server via the configured command. Once connected, you can navigate pages, capture screenshots, fetch logs, interact with elements, and call WeChat APIs from within the mini program.
How to install
Prerequisites you must have installed before starting include the WeChat DevTools with command-line access, Node.js 18 or newer, and npm. You also need a mini program project that you can open in the developer tools.
Install the MCP package from npm and run it using the recommended method. You can use either a quick npx command or install globally and run the server as a local executable. The following steps show the standard workflow for end users.
# Quick start with npx
npx -y @yfme/weapp-dev-mcp
# Or install globally and run
npm install -g @yfme/weapp-dev-mcp
weapp-dev-mcp
# Or run as a project dependency
npm install --save-dev @yfme/weapp-dev-mcp
npx weapp-dev-mcp
# Note: Directly running node dist/index.js is only recommended when actively developing this repository.
Configuration and startup notes
Configure your MCP client to connect to the server using a local command that launches the MCP server. In the example below, the server is started via npx and loads the WeChat Mini Program MCP client. The client should point to the WebSocket endpoint at ws://localhost:9420.
Available tools
mp_ensureConnection
Ensure the automation session is ready and optionally force reconnect or override connection settings
mp_navigate
Navigate within the mini program using navigateTo, redirectTo, reLaunch, switchTab, or navigateBack
mp_screenshot
Capture a screenshot and return it or save to disk
mp_callWx
Call WeChat Mini Program API methods such as wx.showToast
mp_getLogs
Fetch console logs from the mini program, with an option to clear after retrieval
mp_currentPage
Retrieve the current page information including path, query, size, and scroll position; withData returns page data as well
page_getElement
Get a single page element by selector and return a summary (tagName, text, value, size, offset); optional withWxml returns full outerWxml
page_getElements
Get multiple page elements by selector and return summaries; optional withWxml returns full outerWxml for each element
page_waitElement
Wait for an element to appear on the page; not applicable for elements inside custom components
page_waitTimeout
Wait for a specified amount of time in milliseconds
page_getData
Get the current page data object, with optional path selection
page_setData
Update the current page data using setData
page_callMethod
Call methods exposed by the current page instance
element_tap
Tap a WXML element using a CSS selector
element_input
Input text into an element such as input or textarea
element_callMethod
Call a custom component instance method
element_getData
Get data rendered by a custom component instance
element_setData
Set data rendered by a custom component instance
element_getInnerElement
Get inner element by selector within a component; optional withWxml for full outerWXML
element_getInnerElements
Get inner elements array within a component; optional withWxml for full outerWXML
element_getWxml
Retrieve WXML of an element (inner or outer)
element_getStyles
Get CSS style values for specified properties
element_scrollTo
Scroll a scroll-view component to a given x/y position
element_getAttributes
Get element attributes by names
element_getBoundingClientRect
Get element bounds relative to the viewport, accounting for CSS transforms