Wechat Devtools MCP
Enables 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.
README
@purea/wechat-devtools-mcp
基于微信官方 miniprogram-automator SDK 封装的 MCP 服务器, 将微信小程序自动化能力暴露为 MCP 工具,供 AI 助手通过 stdio 调用,控制微信开发者工具中运行的小程序。
使用前提
- 微信开发者工具开启「设置 -> 安全设置 -> 服务端口」(CLI/HTTP 调用)
- 小程序已编译(uni-app 项目请先执行
uni build,projectPath指向unpackage/dist/build/mp-weixin;原生小程序指向含project.config.json的目录)
MCP 客户端配置示例
已发布至 npmjs,直接通过 npx 拉起:
{
"mcpServers": {
"Wechat Devtools Mcp": {
"command": "npx",
"args": ["-y", "@purea/wechat-devtools-mcp@latest"],
"env": {},
"disabled": false
}
}
}
可通过 args 追加默认参数,作为 launch / connect 工具参数的默认值(工具参数传入时优先):
| 参数 | 说明 |
|---|---|
--projectPath= |
小程序项目路径(缺省自动探测当前工作区) |
--cliPath= |
微信开发者工具 CLI 路径(缺省自动探测默认安装位置) |
--timeout= |
启动最长等待时间(ms),默认 30000 |
--port= |
自动化 WebSocket 端口 |
--account= |
用户 openid(多账号调试) |
--ticket= |
开发者工具登录票据 |
--trust-project |
自动信任项目 |
{
"mcpServers": {
"Wechat Devtools Mcp": {
"command": "npx",
"args": [
"-y",
"@purea/wechat-devtools-mcp@latest",
"--projectPath=E:/MyProgram/demo/unpackage/dist/build/mp-weixin",
"--cliPath=C:/Program Files (x86)/Tencent/微信web开发者工具/cli.bat",
"--trust-project"
],
"env": {},
"disabled": false
}
}
}
提供的能力
- 连接 / 生命周期:
launch/connect/status/disconnect/close/release_handles - 小程序级操作:
page_stack/navigate_to/redirect_to/navigate_back/re_launch/switch_tab/current_page/system_info/evaluate/page_scroll_to/screenshot/ 票据(get_ticket/set_ticket/refresh_ticket)/ wx 方法(call_wx_method/mock_wx_method/restore_wx_method) - 页面级操作:
page_query/page_query_all/page_query_xpath/page_query_xpath_all/page_call_method/page_wait_for/page_data/page_set_data/page_size/page_scroll_top - 元素级操作:
element_query/element_tap/element_input/element_text/element_trigger等 25 个 - 运行日志:
console_messages/exception_messages/clear_event_logs
说明
- 句柄数量有上限(页面 500 / 元素 1000),超出后按 FIFO 淘汰最旧句柄;也可随时用
release_handles手动清理。 status在连接失效时返回connected: false并附带原因,而不是直接报错。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.