@mobileaidev/ai-app-bridge 0.2.12 → 0.2.13
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
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# AI App Bridge CLI
|
|
2
2
|
|
|
3
|
+
AI App Bridge CLI/MCP supports Android native apps, Android WebView/H5/CDP,
|
|
4
|
+
Flutter apps on Android and iOS, iOS native apps via `AiAppBridgeIOS` plus
|
|
5
|
+
WebDriverAgent/XCUITest, WKWebView, and desktop Web Bridge sessions.
|
|
6
|
+
|
|
7
|
+
Command domains:
|
|
8
|
+
|
|
9
|
+
- `core`: `status`, `tree`, `uia-tree`, `screenshot`, `logs`, `network`, `state`, `events`
|
|
10
|
+
- `app`: `install-apk`, `clear-app-data`, `launch-*`, `freeze-app`, `thaw-app`, `permission-*`, `appops-set`
|
|
11
|
+
- `action`: `tap`, `tap-text`, `tap-uia-text`, `input-text`, `swipe`, `keyevent`, `wait-text`, `keyboard-state`, `hide-keyboard`
|
|
12
|
+
- `flutter`: `flutter-tree`, `flutter-nodes`, `flutter-action`, `tap-flutter-text`, `input-flutter-text`, `scroll-flutter`
|
|
13
|
+
- `webview`: `h5-*`, `flutter-h5-*`, `webview-pages`, `webview-network`, `webview-console`
|
|
14
|
+
- `ios`: `ios-devices`, `ios-doctor`, `ios-setup`, `ios-*` runtime evidence, WDA tree/tap/input/swipe, WKWebView, and Flutter iOS
|
|
15
|
+
- `web`: `web-session-start`, `web-sessions`, `web-status`, `web-dom`, `web-logs`, `web-network`, `web-state`, `web-events`, `web-command`, `web-click`, `web-input`, `web-wait`, `web-scroll`
|
|
16
|
+
- `diagnostics` / `advanced`: `logcat`, `smoke`, `batch`, `forward`, `remove-forward`
|
|
17
|
+
|
|
18
|
+
For MCP clients, the default surface is compact: call `capabilities` to discover
|
|
19
|
+
domains, commands, and options, then call `run` with the selected command.
|
|
20
|
+
|
|
3
21
|
```bash
|
|
4
22
|
npm install -g @mobileaidev/ai-app-bridge
|
|
5
23
|
|
|
@@ -19,9 +37,10 @@ ai-app-bridge ios-setup --device-id <device-or-udid> --bundle-id <ios.bundle.id>
|
|
|
19
37
|
ai-app-bridge ios-status --device-id <device-or-udid> --bundle-id <ios.bundle.id>
|
|
20
38
|
ai-app-bridge ios-tap --bundle-id <ios.bundle.id> --tap-x 120 --tap-y 360 --wda-url <wda-url-from-setup>
|
|
21
39
|
ai-app-bridge ios-input --bundle-id <ios.bundle.id> --accessibility-id sample_text_field --clear-first --text "hello" --wda-url <wda-url-from-setup>
|
|
40
|
+
ai-app-bridge-mcp # then run web-session-start / web-* commands through MCP
|
|
22
41
|
ai-app-bridge thaw-app --package-name io.github.mobileaidev.aiappbridge.sample
|
|
23
42
|
ai-app-bridge freeze-app --package-name io.github.mobileaidev.aiappbridge.sample
|
|
24
|
-
ai-app-bridge-mcp
|
|
43
|
+
ai-app-bridge-mcp --help
|
|
25
44
|
```
|
|
26
45
|
|
|
27
46
|
AI agents, model clients, automation frameworks, and IDE MCP clients reading
|
|
@@ -37,12 +56,13 @@ refresh the session.
|
|
|
37
56
|
MCP defaults to a compact tool surface to avoid loading every command schema
|
|
38
57
|
into the model context:
|
|
39
58
|
|
|
40
|
-
- `capabilities` lists
|
|
59
|
+
- `capabilities` lists supported targets, command domains, command names, and optional argument names.
|
|
41
60
|
- `run` executes a selected command with command-specific arguments.
|
|
42
61
|
|
|
43
|
-
This keeps install, data reset, launch, UI, Flutter, WebView,
|
|
44
|
-
|
|
45
|
-
|
|
62
|
+
This keeps install, data reset, launch, UI action, Flutter, WebView/H5/CDP,
|
|
63
|
+
iOS, Web Bridge, logcat, network, permission, smoke, batch, and port-forward
|
|
64
|
+
capabilities discoverable without exposing dozens of full schemas at session start.
|
|
65
|
+
Set `AI_APP_BRIDGE_MCP_SURFACE=full` before launching
|
|
46
66
|
`ai-app-bridge-mcp` only when a client needs the legacy one-tool-per-command
|
|
47
67
|
surface.
|
|
48
68
|
|
package/bin/ai-app-bridge.js
CHANGED
|
@@ -22,6 +22,15 @@ const defaults = {
|
|
|
22
22
|
|
|
23
23
|
const helpText = `Usage: ai-app-bridge <command> [options]
|
|
24
24
|
|
|
25
|
+
Supports:
|
|
26
|
+
Android native apps; Android WebView/H5/CDP; Flutter apps on Android and iOS;
|
|
27
|
+
iOS native apps via AiAppBridgeIOS + WebDriverAgent/XCUITest; WKWebView;
|
|
28
|
+
desktop Web Bridge sessions through ai-app-bridge-mcp.
|
|
29
|
+
|
|
30
|
+
MCP discovery:
|
|
31
|
+
ai-app-bridge-mcp exposes a compact capability index by default.
|
|
32
|
+
Call capabilities, then run a command from core/app/action/flutter/webview/ios/web/diagnostics/advanced.
|
|
33
|
+
|
|
25
34
|
Commands:
|
|
26
35
|
status Read bridge status and app/device metadata.
|
|
27
36
|
tree Read the Android View tree from the in-app bridge.
|
|
@@ -84,6 +93,23 @@ Flutter commands:
|
|
|
84
93
|
flutter-h5-wait Wait for Flutter H5 text or selector.
|
|
85
94
|
flutter-h5-scroll Scroll Flutter H5 content.
|
|
86
95
|
|
|
96
|
+
Web Bridge MCP commands:
|
|
97
|
+
web-provider-status Read desktop Web Bridge provider status.
|
|
98
|
+
web-session-start Start the Web Bridge WebSocket session server.
|
|
99
|
+
web-connect-info Read endpoint/token for browser SDK clients.
|
|
100
|
+
web-sessions List connected Web Bridge SDK sessions.
|
|
101
|
+
web-status Read Web Bridge session status.
|
|
102
|
+
web-dom Read or refresh Web Bridge DOM snapshots.
|
|
103
|
+
web-logs Read Web Bridge log records.
|
|
104
|
+
web-network Read Web Bridge network records.
|
|
105
|
+
web-state Read Web Bridge state records.
|
|
106
|
+
web-events Read Web Bridge event records.
|
|
107
|
+
web-command Run a whitelisted browser SDK command.
|
|
108
|
+
web-click Click a DOM element through the browser SDK.
|
|
109
|
+
web-input Set text in a DOM input through the browser SDK.
|
|
110
|
+
web-wait Wait for text or selector through the browser SDK.
|
|
111
|
+
web-scroll Scroll a Web Bridge DOM target.
|
|
112
|
+
|
|
87
113
|
Device/action commands:
|
|
88
114
|
tap Tap device coordinates through ADB.
|
|
89
115
|
tap-text Tap a visible node by exact text or content description.
|
|
@@ -4555,4 +4581,3 @@ module.exports = {
|
|
|
4555
4581
|
waitTextConditionsMet,
|
|
4556
4582
|
withFileLock,
|
|
4557
4583
|
};
|
|
4558
|
-
|
package/bin/mcp-server.js
CHANGED
|
@@ -12,12 +12,62 @@ const nodeBinary = process.env.AI_APP_BRIDGE_NODE || process.execPath;
|
|
|
12
12
|
const supportedProtocolVersions = ['2025-06-18', '2024-11-05'];
|
|
13
13
|
const defaultProtocolVersion = supportedProtocolVersions[0];
|
|
14
14
|
const mcpSurface = (process.env.AI_APP_BRIDGE_MCP_SURFACE || 'compact').toLowerCase();
|
|
15
|
+
const supportedTargets = [
|
|
16
|
+
'Android native apps',
|
|
17
|
+
'Android WebView/H5/CDP',
|
|
18
|
+
'Flutter apps on Android and iOS',
|
|
19
|
+
'iOS native apps via AiAppBridgeIOS + WebDriverAgent/XCUITest',
|
|
20
|
+
'WKWebView',
|
|
21
|
+
'desktop Web Bridge sessions',
|
|
22
|
+
];
|
|
23
|
+
const commandDomains = {
|
|
24
|
+
core: 'status, tree, uia-tree, screenshot, logs, network, state, events',
|
|
25
|
+
app: 'install-apk, clear-app-data, launch-*, freeze-app/thaw-app, permission-*, appops-set',
|
|
26
|
+
action: 'tap, tap-text, tap-uia-text, input-text, swipe, keyevent, wait-text, keyboard-state, hide-keyboard',
|
|
27
|
+
flutter: 'flutter-tree, flutter-nodes, flutter-action, tap/input/scroll Flutter controls',
|
|
28
|
+
webview: 'h5-*, flutter-h5-*, webview-pages, webview-network, webview-console',
|
|
29
|
+
ios: 'ios-devices, ios-doctor, ios-setup, ios runtime evidence, ios-uia-tree/tap/input/swipe, ios-h5-*, ios-flutter-*',
|
|
30
|
+
web: 'web-session-start, web-sessions, web-status, web-dom, web-logs, web-network, web-state, web-events, web-command, web-click, web-input, web-wait, web-scroll',
|
|
31
|
+
diagnostics: 'logcat, smoke',
|
|
32
|
+
advanced: 'batch, forward, remove-forward',
|
|
33
|
+
};
|
|
34
|
+
const supportedTargetsText = `AI App Bridge supports ${supportedTargets.join('; ')}.`;
|
|
35
|
+
const commandDomainsText = `Command domains: ${Object.entries(commandDomains).map(([domain, summary]) => `${domain}(${summary})`).join('; ')}.`;
|
|
36
|
+
const discoveryText = 'Default MCP surface is compact: call capabilities to discover domains, commands, and options, then call run with the selected command and arguments.';
|
|
15
37
|
const serverInstructions = [
|
|
16
|
-
|
|
17
|
-
|
|
38
|
+
supportedTargetsText,
|
|
39
|
+
commandDomainsText,
|
|
40
|
+
discoveryText,
|
|
41
|
+
'Prefer AI App Bridge over raw adb, devicectl, or browser-specific scripts when inspecting UI, text, WebView/WKWebView, logs, network, app install, launch, permissions, or app-level Web evidence.',
|
|
18
42
|
'Always pass packageName for Android app-specific commands, or pass an explicit port. For iOS, pass bundleId plus deviceId when more than one iPhone is connected.',
|
|
43
|
+
'For Web Bridge sessions, start the provider, connect the browser SDK, then pass sessionId and targetId when needed.',
|
|
19
44
|
'Use freeze-app/thaw-app only as an optional stabilization control for dynamic or transient screens: thaw before reads/actions/captures, freeze after evidence capture only when it helps reasoning, and thaw before the next operation or before finishing so the app is not left frozen.',
|
|
20
45
|
].join(' ');
|
|
46
|
+
const mcpHelpText = `Usage: ai-app-bridge-mcp [--help]
|
|
47
|
+
|
|
48
|
+
${supportedTargetsText}
|
|
49
|
+
|
|
50
|
+
${commandDomainsText}
|
|
51
|
+
|
|
52
|
+
MCP surface:
|
|
53
|
+
compact (default) exposes only capabilities and run.
|
|
54
|
+
full/legacy exposes one tool per command; set AI_APP_BRIDGE_MCP_SURFACE=full.
|
|
55
|
+
|
|
56
|
+
Discovery:
|
|
57
|
+
1. Call capabilities with optional domain or command filters.
|
|
58
|
+
2. Call run with a command name from capabilities.
|
|
59
|
+
3. Put command-specific options in arguments.
|
|
60
|
+
|
|
61
|
+
Target ids:
|
|
62
|
+
Android app commands require packageName or explicit port.
|
|
63
|
+
iOS app commands use bundleId; add deviceId when multiple devices exist and wdaUrl for WDA actions.
|
|
64
|
+
Web Bridge commands use sessionId; add targetId for multi-target pages.
|
|
65
|
+
|
|
66
|
+
Examples:
|
|
67
|
+
capabilities { "domain": "webview", "includeOptions": true }
|
|
68
|
+
run { "command": "screenshot", "packageName": "com.example.app" }
|
|
69
|
+
run { "command": "web-session-start", "arguments": { "webPort": 18180 } }
|
|
70
|
+
`;
|
|
21
71
|
const iosProvider = new IOSBridgeProvider();
|
|
22
72
|
const webProvider = new WebBridgeProvider();
|
|
23
73
|
|
|
@@ -185,18 +235,20 @@ function toolDefinitions() {
|
|
|
185
235
|
|
|
186
236
|
function compactToolDefinitions() {
|
|
187
237
|
return [
|
|
188
|
-
bridgeTool('capabilities',
|
|
189
|
-
domain: { type: 'string', description: 'Optional domain filter
|
|
190
|
-
command: { type: 'string', description: 'Optional command name for detailed arguments, such as install-apk, launch-app, tree, input-text, webview-network, ios-setup, or
|
|
238
|
+
bridgeTool('capabilities', `List AI App Bridge capability domains and commands across Android, iOS, Flutter, WebView/H5/CDP, and Web Bridge targets. ${commandDomainsText}`, {
|
|
239
|
+
domain: { type: 'string', description: 'Optional domain filter: core, app, action, flutter, webview, ios, web, diagnostics, or advanced.' },
|
|
240
|
+
command: { type: 'string', description: 'Optional command name for detailed arguments, such as install-apk, launch-app, tree, input-text, webview-network, ios-setup, ios-tap, web-session-start, or web-command.' },
|
|
191
241
|
includeOptions: { type: 'boolean', description: 'Include per-command argument names. Defaults to false to keep output compact.' },
|
|
192
242
|
}),
|
|
193
|
-
bridgeTool('run', 'Run an AI App Bridge command
|
|
194
|
-
command: { type: 'string', description: 'Command name from capabilities, using CLI form such as status, install-apk, launch-app, input-text, webview-network, ios-doctor, ios-setup, ios-status, ios-tap, or web-
|
|
243
|
+
bridgeTool('run', 'Run an AI App Bridge command from capabilities. Pass packageName/port for Android app commands, bundleId/deviceId for iOS app commands, and sessionId/targetId for Web Bridge commands.', {
|
|
244
|
+
command: { type: 'string', description: 'Command name from capabilities, using CLI form such as status, install-apk, launch-app, input-text, webview-network, ios-doctor, ios-setup, ios-status, ios-tap, web-session-start, web-status, or web-command.' },
|
|
195
245
|
packageName: { type: 'string', description: 'Target Android package for app-specific commands. Strongly recommended.' },
|
|
196
246
|
serial: { type: 'string', description: 'ADB serial when multiple devices are connected.' },
|
|
197
247
|
port: { type: 'number', description: 'Explicit bridge port when packageName discovery is not available.' },
|
|
198
248
|
bundleId: { type: 'string', description: 'Target iOS app bundle identifier for ios-* commands.' },
|
|
199
249
|
deviceId: { type: 'string', description: 'iOS devicectl identifier, UDID, serial number, or device name.' },
|
|
250
|
+
sessionId: { type: 'string', description: 'Target Web Bridge SDK session id for web-* commands.' },
|
|
251
|
+
targetId: { type: 'string', description: 'Optional Web Bridge target id for multi-target pages.' },
|
|
200
252
|
iosHost: { type: 'string', description: 'iOS runtime host or CoreDevice tunnel IP.' },
|
|
201
253
|
iosPort: { type: 'number', description: 'iOS runtime port when auto-discovery is unavailable.' },
|
|
202
254
|
runtimeUrl: { type: 'string', description: 'Explicit iOS runtime base URL.' },
|
|
@@ -635,7 +687,9 @@ function capabilityPayload(args = {}) {
|
|
|
635
687
|
return {
|
|
636
688
|
ok: true,
|
|
637
689
|
surface: mcpSurface === 'full' || mcpSurface === 'legacy' ? 'full' : 'compact',
|
|
638
|
-
|
|
690
|
+
supportedTargets,
|
|
691
|
+
commandDomains,
|
|
692
|
+
usage: `${supportedTargetsText} ${discoveryText} Use run with one of these command names. Prefer packageName for Android app commands, bundleId/deviceId for iOS, and sessionId/targetId for Web Bridge sessions.`,
|
|
639
693
|
domains,
|
|
640
694
|
};
|
|
641
695
|
}
|
|
@@ -1225,12 +1279,19 @@ function writeLog(text) {
|
|
|
1225
1279
|
}
|
|
1226
1280
|
|
|
1227
1281
|
if (require.main === module) {
|
|
1282
|
+
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
1283
|
+
process.stdout.write(`${mcpHelpText}\n`);
|
|
1284
|
+
process.exit(0);
|
|
1285
|
+
}
|
|
1228
1286
|
startServer();
|
|
1229
1287
|
}
|
|
1230
1288
|
|
|
1231
1289
|
module.exports = {
|
|
1232
1290
|
buildBridgeCliArgs,
|
|
1291
|
+
commandDomains,
|
|
1292
|
+
mcpHelpText,
|
|
1233
1293
|
readNextMessage,
|
|
1234
1294
|
runBatch,
|
|
1235
1295
|
startServer,
|
|
1296
|
+
supportedTargets,
|
|
1236
1297
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobileaidev/ai-app-bridge",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Desktop CLI and MCP server for AI App Bridge.",
|
|
3
|
+
"version": "0.2.13",
|
|
4
|
+
"description": "Desktop CLI and MCP server for AI App Bridge across Android, iOS, Flutter, WebView, and Web targets.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/mobileAiDev/ai-app-bridge.git",
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ai-app-bridge-use
|
|
3
|
-
description: 使用 AI App Bridge MCP 观察、操作、验证和调试 Android、
|
|
3
|
+
description: 使用 AI App Bridge MCP 观察、操作、验证和调试 Android native、Android WebView/H5/CDP、Flutter、iOS native + WDA/XCUITest、WKWebView 和桌面 Web Bridge。能力域包括 core/status/tree/screenshot/logs/network/state/events,app/install/clear-data/launch/freeze/thaw/permissions/appops,action/tap/input/swipe/keyevent/wait/keyboard,flutter/widget/action,webview/H5/CDP,ios/devices/setup/runtime/WDA/H5/flutter,web/session/DOM/logs/network/events/command,diagnostics/logcat/smoke,advanced/batch/port-forward。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# AI App Bridge Use
|
|
7
7
|
|
|
8
|
+
## 能力总览
|
|
9
|
+
|
|
10
|
+
AI App Bridge 支持 Android native apps、Android WebView/H5/CDP、Flutter apps、iOS native apps via `AiAppBridgeIOS` + WebDriverAgent/XCUITest、WKWebView,以及桌面 Web Bridge sessions。
|
|
11
|
+
|
|
12
|
+
默认 MCP surface 只有 `capabilities` 和 `run`;先用 `capabilities` 查 domain、command 和 options,再用 `run` 执行。
|
|
13
|
+
|
|
14
|
+
目标标识:Android 用 `packageName` 或显式 `port`;iOS 用 `bundleId`,多设备加 `deviceId`,full-control 加 `wdaUrl`;Web 用 `sessionId`,多 target 加 `targetId`。
|
|
15
|
+
|
|
16
|
+
命令域:
|
|
17
|
+
- `core`: `status`/`tree`/`uia-tree`/`screenshot`/`logs`/`network`/`state`/`events`
|
|
18
|
+
- `app`: `install-apk`/`clear-app-data`/`launch-*`/`freeze-app`/`thaw-app`/`permission-*`/`appops-set`
|
|
19
|
+
- `action`: `tap`/`tap-text`/`tap-uia-text`/`input-text`/`swipe`/`keyevent`/`wait-text`/`keyboard-*`
|
|
20
|
+
- `flutter`: `flutter-tree`/`flutter-nodes`/`flutter-action`/`tap-flutter-text`/`input-flutter-text`/`scroll-flutter`
|
|
21
|
+
- `webview`: `h5-*`/`flutter-h5-*`/`webview-pages`/`webview-network`/`webview-console`
|
|
22
|
+
- `ios`: `ios-devices`/`ios-doctor`/`ios-setup`/`ios-status`/`ios-tree`/`ios-uia-tree`/`ios-tap`/`ios-input`/`ios-swipe`/`ios-h5-*`/`ios-flutter-*`
|
|
23
|
+
- `web`: `web-session-start`/`web-sessions`/`web-status`/`web-dom`/`web-logs`/`web-network`/`web-state`/`web-events`/`web-command`/`web-click`/`web-input`/`web-wait`/`web-scroll`
|
|
24
|
+
- `diagnostics`/`advanced`: `logcat`/`smoke`/`batch`/`forward`/`remove-forward`
|
|
25
|
+
|
|
8
26
|
## Agent 快速流程
|
|
9
27
|
|
|
10
28
|
1. 确认目标:Android 使用 `packageName`,iOS 使用 `bundleId`,真机多设备场景传 `deviceId`/UDID;Web 使用 `sessionId`,多 target 时加 `targetId`。没有目标 id 时先从上下文、构建配置或前台 app/session 线索推断。面向具体 app/session 的命令必须传目标 id,只有无法发现 bridge 端口时才传 `port`、`runtimeUrl` 或先启动 Web session。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "AI App Bridge Use"
|
|
3
|
-
short_description: "
|
|
4
|
-
default_prompt: "使用 $ai-app-bridge-use
|
|
3
|
+
short_description: "Android/iOS/Flutter/Web 全域观察、操作、验证能力索引。"
|
|
4
|
+
default_prompt: "使用 $ai-app-bridge-use 观察、操作和验证 Android native、Android WebView/H5/CDP、Flutter、iOS native/WKWebView/WDA/XCUITest 或桌面 Web Bridge;先用 capabilities 查 core/app/action/flutter/webview/ios/web/diagnostics/advanced,再用 run 执行。Android 传 packageName,iOS 传 bundleId/deviceId 并在 full-control 时使用 WDA,Web 先建立 sessionId,只有移动端动态画面需要稳定证据时才使用 freeze/thaw。"
|