@mgcrea/mcp-ios-simulator 0.4.0 → 0.4.2
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 +12 -4
- package/dist/cli.js +1 -1
- package/dist/{config-HmqayUrt.js → config-BA3aCrX9.js} +292 -81
- package/dist/config-BA3aCrX9.js.map +1 -0
- package/dist/index.d.ts +89 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/scripts/wda.sh +2 -2
- package/dist/config-HmqayUrt.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -48,6 +48,18 @@ declare class LaunchCaptures {
|
|
|
48
48
|
*/
|
|
49
49
|
running(capture: Capture): boolean;
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* One TCP listener in the runner port range, and the simulator it runs inside
|
|
53
|
+
* when it runs inside one.
|
|
54
|
+
*
|
|
55
|
+
* `udid` is absent for anything on the host — a dev server that happens to sit
|
|
56
|
+
* on 8100 is still worth knowing about, because a runner cannot bind there.
|
|
57
|
+
*/
|
|
58
|
+
type RunnerListener = {
|
|
59
|
+
pid: number;
|
|
60
|
+
port: number;
|
|
61
|
+
udid?: string;
|
|
62
|
+
};
|
|
51
63
|
/**
|
|
52
64
|
* `xcrun simctl` — Apple's own simulator tool, and the half of this server that
|
|
53
65
|
* needs nothing installed and nothing signed.
|
|
@@ -247,6 +259,17 @@ export declare class Simctl {
|
|
|
247
259
|
*
|
|
248
260
|
* A successful capture also writes a `Note: No display specified…` line to
|
|
249
261
|
* stderr, so non-empty stderr is not a failure here.
|
|
262
|
+
*
|
|
263
|
+
* A device with two displays — the iPhone Duo, iOS 27.1 runtime — makes the
|
|
264
|
+
* bare call fail outright: exit 22, "Cannot choose between 2 displays.
|
|
265
|
+
* Specify one with --display". Only then is it retried on `--display=primary`,
|
|
266
|
+
* so a single-display simulator and Xcode 26 never see the flag. Primary
|
|
267
|
+
* rather than whichever is lit, because it is the display WebDriverAgent
|
|
268
|
+
* addresses when no `currentDisplayId` is set: a capture of the other one
|
|
269
|
+
* would put every tap read off it in the wrong coordinate space. On an open
|
|
270
|
+
* Duo that display is black (appium/appium-xcuitest-driver#3012); driving
|
|
271
|
+
* the inner one means selecting it in WDA too, which nothing here does yet.
|
|
272
|
+
* The `internal` alias the help text offers fails on the Duo with exit 22.
|
|
250
273
|
*/
|
|
251
274
|
screenshotPng(udid: string): Promise<string>;
|
|
252
275
|
/**
|
|
@@ -361,6 +384,7 @@ export declare class SimulatorClient implements ScreenHost<SimulatorSummary> {
|
|
|
361
384
|
private readonly wdaClients;
|
|
362
385
|
/** `simctl list` is ~80ms and most tools want it twice; 2s collapses that. */
|
|
363
386
|
private cache;
|
|
387
|
+
private runnerCache;
|
|
364
388
|
private profiles;
|
|
365
389
|
constructor(opts: SimulatorClientOptions);
|
|
366
390
|
listSimulators(opts?: {
|
|
@@ -429,21 +453,54 @@ export declare class SimulatorClient implements ScreenHost<SimulatorSummary> {
|
|
|
429
453
|
/** The capture lane that needs no runner — the whole reason this server is cheap to start. */
|
|
430
454
|
screenshotPng(target: SimulatorSummary): Promise<string>;
|
|
431
455
|
/**
|
|
432
|
-
* Where WebDriverAgent is
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
* port. That is also the trap — several booted simulators contend for the
|
|
437
|
-
* same one, and WebDriverAgent scans 8100-8199 when `USE_PORT` is unset, so a
|
|
438
|
-
* second runner comes up healthy on 8101 and a server pointed at 8100 drives
|
|
439
|
-
* the first simulator while reporting success. `ios_simulator_diagnostics`
|
|
440
|
-
* reports which simulator actually owns the port.
|
|
456
|
+
* Where WebDriverAgent is *configured* to be: IOS_SIMULATOR_WDA_URL, or the
|
|
457
|
+
* base port on loopback. Which runner a call actually reaches is decided per
|
|
458
|
+
* simulator by `runnerUrl`; this is only the fallback when nothing better is
|
|
459
|
+
* known.
|
|
441
460
|
*/
|
|
442
461
|
wdaUrl(): string;
|
|
443
462
|
/** The simulator `resolveTarget` falls back to when no hint is given. */
|
|
444
463
|
get defaultSimulatorId(): string | undefined;
|
|
464
|
+
/** Where runner ports are allocated from, and the fallback when no owner is known. */
|
|
445
465
|
get wdaPort(): number;
|
|
446
|
-
|
|
466
|
+
/**
|
|
467
|
+
* Every listener in the runner ranges, attributed to its simulator. Cached
|
|
468
|
+
* for 2s: every UI call asks, and lsof plus ps costs tens of milliseconds.
|
|
469
|
+
*/
|
|
470
|
+
listRunners(opts?: {
|
|
471
|
+
fresh?: boolean;
|
|
472
|
+
}): Promise<RunnerListener[]>;
|
|
473
|
+
/** Called once a runner is started, so the next call looks again. */
|
|
474
|
+
forgetRunners(): void;
|
|
475
|
+
/** The first port nothing listens on, from the base port up. */
|
|
476
|
+
freeRunnerPort(): Promise<number>;
|
|
477
|
+
/** The port of this simulator's own runner, when it has one. */
|
|
478
|
+
ownRunnerPort(target: SimulatorSummary): Promise<number | undefined>;
|
|
479
|
+
/**
|
|
480
|
+
* Which runner a call for this simulator goes to.
|
|
481
|
+
*
|
|
482
|
+
* A simulator shares the host's network stack, so every runner is a host
|
|
483
|
+
* loopback port, and one server process — Bastion runs one for every session
|
|
484
|
+
* on the Mac — sees all of them. A fixed port therefore meant one simulator
|
|
485
|
+
* per process, and worse, a second simulator's calls went to the first one's
|
|
486
|
+
* runner while every tool reported success.
|
|
487
|
+
*
|
|
488
|
+
* So the owner is looked up rather than assumed: the simulator's own runner
|
|
489
|
+
* wherever it listens; failing that the configured URL, *unless* that is
|
|
490
|
+
* known to be another simulator's, which is refused. Not knowing the owner
|
|
491
|
+
* (lsof saw nothing) keeps the configured URL, which is the behaviour from
|
|
492
|
+
* before ownership was checked.
|
|
493
|
+
*/
|
|
494
|
+
runnerUrl(target: SimulatorSummary): Promise<string>;
|
|
495
|
+
/**
|
|
496
|
+
* The WebDriverAgent client for one simulator, one per UDID so each keeps its
|
|
497
|
+
* own session. The URL is resolved on every request, so a runner restarted on
|
|
498
|
+
* another port is followed without a server restart.
|
|
499
|
+
*/
|
|
500
|
+
wda(target: SimulatorSummary): WdaClient;
|
|
501
|
+
/** The configured URL, unchecked — for diagnostics with no single target. */
|
|
502
|
+
wdaConfigured(): WdaClient;
|
|
503
|
+
private wdaClient;
|
|
447
504
|
}
|
|
448
505
|
/**
|
|
449
506
|
* There are no credentials here, and unlike the device server there is barely
|
|
@@ -578,6 +635,28 @@ export declare const START_RUNNER_TOOL_REMEDY: string;
|
|
|
578
635
|
export declare const startRunnerRemedy: (allowWrites: boolean) => string;
|
|
579
636
|
/** What to do when WebDriverAgent does not answer at all. */
|
|
580
637
|
export declare const wdaUnavailableRemedy: (allowWrites: boolean) => string;
|
|
638
|
+
/**
|
|
639
|
+
* The target has no runner of its own, and the port this server would fall
|
|
640
|
+
* back to is another simulator's.
|
|
641
|
+
*
|
|
642
|
+
* Refused rather than forwarded, because the failure it prevents does not look
|
|
643
|
+
* like one: the other runner answers healthily, a tap lands on someone else's
|
|
644
|
+
* screen, and the UI tree that comes back describes an app the caller never
|
|
645
|
+
* launched.
|
|
646
|
+
*/
|
|
647
|
+
export declare class RunnerBelongsElsewhereError extends IosError$1 {
|
|
648
|
+
readonly name = "RunnerBelongsElsewhereError";
|
|
649
|
+
constructor(opts: {
|
|
650
|
+
target: {
|
|
651
|
+
name: string;
|
|
652
|
+
id: string;
|
|
653
|
+
};
|
|
654
|
+
owner: string;
|
|
655
|
+
port: number;
|
|
656
|
+
freePort: number;
|
|
657
|
+
allowWrites: boolean;
|
|
658
|
+
});
|
|
659
|
+
}
|
|
581
660
|
/** No simulator matched, or several did and none was named. */
|
|
582
661
|
export declare class SimulatorNotFoundError extends IosError$1 {
|
|
583
662
|
readonly name = "SimulatorNotFoundError";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["IosError"],"sources":["../src/client/logs.ts","../src/client/simctl.ts","../src/client/shape.ts","../src/client/simulator.ts","../src/config.ts","../src/tools/runner.ts","../src/server.ts","../src/client/display.ts","../src/client/errors.ts","../src/build-info.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAkBY;EACV;EACA;EACA;;EAEA;EACA;EACA;;;KAIU,gBAAgB;cAcf;mBAIkB;mBAHZ;UACT;EAER,YAA6B,QAAO;UAE5B;;;;;;EASR,OAAO,SAAS;EAKhB,KAAK,0BAA0B,+BAA+B;;;;;;EAgB9D,QAAQ,SAAS;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["IosError"],"sources":["../src/client/logs.ts","../src/client/runners.ts","../src/client/simctl.ts","../src/client/shape.ts","../src/client/simulator.ts","../src/config.ts","../src/tools/runner.ts","../src/server.ts","../src/client/display.ts","../src/client/errors.ts","../src/build-info.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAkBY;EACV;EACA;EACA;;EAEA;EACA;EACA;;;KAIU,gBAAgB;cAcf;mBAIkB;mBAHZ;UACT;EAER,YAA6B,QAAO;UAE5B;;;;;;EASR,OAAO,SAAS;EAKhB,KAAK,0BAA0B,+BAA+B;;;;;;EAgB9D,QAAQ,SAAS;;;;;;;;;KCtEP;EAAmB;EAAa;EAAc;;;;;;;;;;;;;;;;;;;;KCuB9C;EACV;EACA;;EAEA;EACA;EACA,OAAO;EACP,SAAS;;KAGC;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;KAGU;EACV;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;;;KAIU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;qBAqBW,mBAAgB;EAExB;EAAiB;EAAe;;;;;;;;;;;qBA4DxB,sBAAmB;qBAmBnB;mBACM;mBACA;;UAET;;;;;;UAMA;EAER,YAAY,MAAM;;UAOJ;;;;;UAUA;;;;;;;;;;;UAqBA;EAwBR,eAAe,QAAQ,eAAe;EAKtC,gBAAgB,QAAQ;EAMxB,mBAAmB,QAAQ;EAS3B,KAAK,eAAe;;;;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EAElB,YAAY;IACV;MAAU;MAAc;;IACxB;IACA;IACA;IACA;;;;qBAmBS,+BAA+BA;WACxB;EAElB,YAAY,iBAAiB;;;;;;;;;;qBAalB,gCAAgCA;WACzB;EAElB,YAAY,cAAc;;;;;;;;;qBAiBf,gCAAgCA;WACzB;EAElB,YAAY,cAAc;;;qBAUf,4BAA4BA;WACrB;EAElB,YAAY;;;qBASD;KCrID;EACV;EACA;EACA;EACA;;qBAGW,YAAY"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { P as BUILD_INFO, g as CommandError, _ as CommandTimeoutError, v as EMPTY_SCREENSHOT_REMEDY, y as IosError, b as RunnerBelongsElsewhereError, x as RuntimeUnavailableError, r as SERVER_NAME, i as SERVER_VERSION, S as START_RUNNER_SCRIPT_REMEDY, C as START_RUNNER_TOOL_REMEDY, s as Simctl, o as SimulatorClient, w as SimulatorNotBootedError, T as SimulatorNotFoundError, E as TIMEOUT_REMEDY, D as TOOLCHAIN_REMEDY, O as ToolchainError, k as WdaError, A as WdaUnavailableError, j as WritesDisabledError, c as assertNotBulkTarget, a as createServer, t as defaultConfigPath, n as loadConfig, l as parseSimctlError, p as pngDimensions, m as readScreenProfile, M as startRunnerRemedy, u as summarizeApps, d as summarizeDevices, h as toDisplayInfo, f as toListRow, N as wdaUnavailableRemedy } from "./config-BA3aCrX9.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgcrea/mcp-ios-simulator",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Model Context Protocol server for driving iOS Simulators: screenshots, UI tree, taps, app lifecycle and device staging",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ios",
|
|
@@ -66,10 +66,10 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@modelcontextprotocol/client": "^2.4.0",
|
|
69
|
-
"@types/node": "^26.6.
|
|
69
|
+
"@types/node": "^26.6.6",
|
|
70
70
|
"oxfmt": "^0.75.0",
|
|
71
71
|
"oxlint": "^1.90.0",
|
|
72
|
-
"tsdown": "^0.23.
|
|
72
|
+
"tsdown": "^0.23.4",
|
|
73
73
|
"tsx": "^4.23.15",
|
|
74
74
|
"typescript": "^7.0.2",
|
|
75
75
|
"vite": "^8.3.5",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=22"
|
|
80
80
|
},
|
|
81
|
-
"packageManager": "pnpm@12.
|
|
81
|
+
"packageManager": "pnpm@12.16.1"
|
|
82
82
|
}
|
package/scripts/wda.sh
CHANGED
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
# USE_PORT same thing, for people driving xcodebuild by hand
|
|
21
21
|
# NODE node binary (default: node off PATH)
|
|
22
22
|
# WDA_DIR checkout location (default: ~/.cache/mcp-ios-simulator/WebDriverAgent)
|
|
23
|
-
# WDA_REF git tag to pin (default: v16.
|
|
23
|
+
# WDA_REF git tag to pin (default: v16.15.3)
|
|
24
24
|
set -euo pipefail
|
|
25
25
|
|
|
26
26
|
WDA_DIR="${WDA_DIR:-$HOME/.cache/mcp-ios-simulator/WebDriverAgent}"
|
|
27
|
-
WDA_REF="${WDA_REF:-v16.
|
|
27
|
+
WDA_REF="${WDA_REF:-v16.15.3}"
|
|
28
28
|
DERIVED="${WDA_DIR}/.build"
|
|
29
29
|
PORT="${USE_PORT:-${IOS_SIMULATOR_WDA_PORT:-8100}}"
|
|
30
30
|
# Not always on PATH: a host that embeds its own runtime leaves nothing called
|