@creatoria/miniapp-mcp 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/capabilities/automator/handlers/connect.d.ts.map +1 -1
- package/dist/capabilities/automator/handlers/connect.js +40 -4
- package/dist/capabilities/automator/handlers/connect.js.map +1 -1
- package/dist/capabilities/automator/handlers/disconnect.d.ts.map +1 -1
- package/dist/capabilities/automator/handlers/disconnect.js +5 -2
- package/dist/capabilities/automator/handlers/disconnect.js.map +1 -1
- package/dist/capabilities/automator/handlers/launch.d.ts +5 -0
- package/dist/capabilities/automator/handlers/launch.d.ts.map +1 -1
- package/dist/capabilities/automator/handlers/launch.js +34 -4
- package/dist/capabilities/automator/handlers/launch.js.map +1 -1
- package/dist/capabilities/automator/schemas/launch.d.ts +3 -0
- package/dist/capabilities/automator/schemas/launch.d.ts.map +1 -1
- package/dist/capabilities/automator/schemas/launch.js +4 -0
- package/dist/capabilities/automator/schemas/launch.js.map +1 -1
- package/dist/capabilities/miniprogram/handlers/call-wx.d.ts.map +1 -1
- package/dist/capabilities/miniprogram/handlers/call-wx.js +5 -0
- package/dist/capabilities/miniprogram/handlers/call-wx.js.map +1 -1
- package/dist/capabilities/miniprogram/handlers/evaluate.d.ts.map +1 -1
- package/dist/capabilities/miniprogram/handlers/evaluate.js +5 -0
- package/dist/capabilities/miniprogram/handlers/evaluate.js.map +1 -1
- package/dist/capabilities/miniprogram/handlers/navigate.d.ts.map +1 -1
- package/dist/capabilities/miniprogram/handlers/navigate.js +5 -0
- package/dist/capabilities/miniprogram/handlers/navigate.js.map +1 -1
- package/dist/capabilities/miniprogram/handlers/page-stack.d.ts.map +1 -1
- package/dist/capabilities/miniprogram/handlers/page-stack.js +5 -0
- package/dist/capabilities/miniprogram/handlers/page-stack.js.map +1 -1
- package/dist/capabilities/miniprogram/handlers/screenshot.d.ts.map +1 -1
- package/dist/capabilities/miniprogram/handlers/screenshot.js +16 -2
- package/dist/capabilities/miniprogram/handlers/screenshot.js.map +1 -1
- package/dist/capabilities/miniprogram/handlers/system-info.d.ts.map +1 -1
- package/dist/capabilities/miniprogram/handlers/system-info.js +5 -0
- package/dist/capabilities/miniprogram/handlers/system-info.js.map +1 -1
- package/dist/config/defaults.d.ts +4 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +8 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/loader.d.ts +3 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +21 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/runtime/concurrency/mutex.d.ts +29 -0
- package/dist/runtime/concurrency/mutex.d.ts.map +1 -0
- package/dist/runtime/concurrency/mutex.js +46 -0
- package/dist/runtime/concurrency/mutex.js.map +1 -0
- package/dist/runtime/network/probe-port.d.ts +15 -0
- package/dist/runtime/network/probe-port.d.ts.map +1 -0
- package/dist/runtime/network/probe-port.js +33 -0
- package/dist/runtime/network/probe-port.js.map +1 -0
- package/dist/runtime/timeout/timeout.d.ts.map +1 -1
- package/dist/runtime/timeout/timeout.js +7 -5
- package/dist/runtime/timeout/timeout.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +3 -2
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/current/03-connect-screenshot-timeout-diagnosis.md +168 -0
- package/docs/current/04-toolchain-version-baseline.md +123 -0
- package/docs/current/README.md +3 -0
- package/package.json +2 -2
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# 工具链版本基线与超时配置说明
|
|
2
|
+
|
|
3
|
+
> 最后更新: 2026-05-31
|
|
4
|
+
> 版本: 0.3.0 (规划中)
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 工具链版本基线
|
|
9
|
+
|
|
10
|
+
| 组件 | 当前版本 | 状态 | 说明 |
|
|
11
|
+
|------|---------|------|------|
|
|
12
|
+
| miniprogram-automator | 0.12.1 (2023-11-07) | 已停更(约两年半,changelog 停在 0.12.0 / 2022-09) | 自动化能力仍可用,但不会有新特性 |
|
|
13
|
+
| 微信开发者工具 | v2.01.2510260 (2025-10) | 活跃迭代 | 推荐使用最新稳定版 |
|
|
14
|
+
| CLI auto 最低工具版本 | 1.05.2111232 | 最低要求 | 低于此版本不支持 auto 命令 |
|
|
15
|
+
| Node.js | >= 18.0.0 | 必需 | 运行时环境 |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## CLI 命令与路径
|
|
20
|
+
|
|
21
|
+
### 命令格式
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cli auto --project <path> --auto-port <port> [--auto-account <openid>]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### CLI 路径
|
|
28
|
+
|
|
29
|
+
**macOS:**
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
/Applications/wechatwebdevtools.app/Contents/MacOS/cli
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Windows:**
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
<安装路径>/cli.bat
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 启用自动化
|
|
42
|
+
|
|
43
|
+
在开发者工具中:**设置 → 安全 → 开启 CLI/HTTP 调用**。
|
|
44
|
+
|
|
45
|
+
默认自动化端口:`9420`。
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 超时配置说明
|
|
50
|
+
|
|
51
|
+
### 配置项一览
|
|
52
|
+
|
|
53
|
+
| 配置项 | SessionConfig 字段 | 默认值 | 作用范围 |
|
|
54
|
+
|--------|-------------------|--------|---------|
|
|
55
|
+
| 全局操作超时 | `timeout` | 30s | 导航、wait 等通用操作 |
|
|
56
|
+
| JS 执行超时 | `evaluateTimeout` | 5s | evaluate / wx 调用 |
|
|
57
|
+
| 启动超时 | `launchTimeout` | 60s | miniprogram_launch |
|
|
58
|
+
| 连接超时 | `connectTimeout` | 30s | miniprogram_connect |
|
|
59
|
+
| 截图超时 | `screenshotTimeout` | 10s | 普通截图;fullPage 截图基础超时也基于此值 |
|
|
60
|
+
|
|
61
|
+
### 配置方式
|
|
62
|
+
|
|
63
|
+
#### 方式一:.mcp.json 配置文件(推荐)
|
|
64
|
+
|
|
65
|
+
在项目根目录创建 `.mcp.json`,写入超时字段(单位:毫秒):
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"projectPath": "/path/to/miniprogram",
|
|
70
|
+
"cliPath": "/Applications/wechatwebdevtools.app/Contents/MacOS/cli",
|
|
71
|
+
"port": 9420,
|
|
72
|
+
"timeout": 30000,
|
|
73
|
+
"evaluateTimeout": 5000,
|
|
74
|
+
"launchTimeout": 60000,
|
|
75
|
+
"connectTimeout": 30000,
|
|
76
|
+
"screenshotTimeout": 10000,
|
|
77
|
+
"capabilities": ["core", "assert", "snapshot", "record", "network"]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### 方式二:CLI 参数
|
|
82
|
+
|
|
83
|
+
通过命令行参数传递项目路径和端口:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx -y @creatoria/miniapp-mcp --project-path /path/to/miniprogram --port 9420
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
超时参数可通过配置文件设置。
|
|
90
|
+
|
|
91
|
+
#### 方式三:环境变量
|
|
92
|
+
|
|
93
|
+
已确认支持的环境变量:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
export MCP_PROJECT_PATH=/path/to/miniprogram
|
|
97
|
+
export MCP_PORT=9420
|
|
98
|
+
export MCP_CAPABILITIES=core,assert,snapshot
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
超时相关配置可通过 `.mcp.json` 配置文件设置。
|
|
102
|
+
|
|
103
|
+
### 调优建议
|
|
104
|
+
|
|
105
|
+
- **网络慢 / 真机调试**:适当调大 `connectTimeout` 和 `launchTimeout`,避免连接阶段超时。
|
|
106
|
+
- **fullPage 截图慢**:fullPage 截图需要截取整个页面内容,耗时通常比普通截图更长,可调大 `screenshotTimeout`。
|
|
107
|
+
- **evaluate 执行慢**:如果小程序逻辑复杂,evaluate 可能需要更多时间,可调大 `evaluateTimeout`。
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 兼容性与影响
|
|
112
|
+
|
|
113
|
+
- `miniprogram-automator` SDK 已停更,但现有自动化功能仍然可用,不影响当前项目运行。
|
|
114
|
+
- 微信开发者工具处于活跃迭代中,新版本可能带来协议变化,需关注更新日志。
|
|
115
|
+
- CLI auto 命令要求开发者工具版本 >= 1.05.2111232,低于此版本需先升级。
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 相关文档
|
|
120
|
+
|
|
121
|
+
- [故障排查指南](../troubleshooting.md)
|
|
122
|
+
- [连接与截图超时诊断](./03-connect-screenshot-timeout-diagnosis.md)
|
|
123
|
+
- [微信小程序工具链版本调研](../../调研中/微信小程序工具链最新版本调研/README.md)
|
package/docs/current/README.md
CHANGED
|
@@ -222,5 +222,8 @@ Week 2-3: 架构迁移 (18-25h)
|
|
|
222
222
|
|
|
223
223
|
- [01-architecture-migration.md](./01-architecture-migration.md) - 架构迁移详细计划
|
|
224
224
|
- [02-screenshot-timeout-fix.md](./02-screenshot-timeout-fix.md) - 截图修复详细方案
|
|
225
|
+
- [03-connect-screenshot-timeout-diagnosis.md](./03-connect-screenshot-timeout-diagnosis.md) - 连接与截图超时问题诊断
|
|
226
|
+
- [04-toolchain-version-baseline.md](./04-toolchain-version-baseline.md) - 工具链版本基线与超时配置说明
|
|
227
|
+
- [../../调研中/微信小程序工具链最新版本调研/README.md](../../调研中/微信小程序工具链最新版本调研/README.md) - SDK/CLI/开发者工具版本调研
|
|
225
228
|
- [../directory-structure-and-code-style-best-practices.md](../directory-structure-and-code-style-best-practices.md) - 代码规范
|
|
226
229
|
- [../migration/](../migration/) - 历史迁移文档
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creatoria/miniapp-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "MCP server for WeChat Mini Program automation using miniprogram-automator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@9.0.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
66
66
|
"commander": "^12.1.0",
|
|
67
|
-
"miniprogram-automator": "
|
|
67
|
+
"miniprogram-automator": "0.12.1",
|
|
68
68
|
"zod": "^3.23.8"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|