appium-mcp 1.94.0 → 1.94.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/CHANGELOG.md +16 -0
- package/README.md +4 -2
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +22 -23
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/options.d.ts +15 -0
- package/dist/cli/options.d.ts.map +1 -0
- package/dist/cli/options.js +15 -0
- package/dist/cli/options.js.map +1 -0
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.d.ts.map +1 -1
- package/dist/cli/plugins.js +63 -34
- package/dist/cli/plugins.js.map +1 -1
- package/dist/create-server.d.ts.map +1 -1
- package/dist/create-server.js +2 -1
- package/dist/create-server.js.map +1 -1
- package/dist/documentation.js +7 -1
- package/dist/documentation.js.map +1 -1
- package/dist/server.d.ts +2 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +3 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/interactions/screen-recording.d.ts +1 -3
- package/dist/tools/interactions/screen-recording.d.ts.map +1 -1
- package/dist/tools/interactions/screen-recording.js +10 -5
- package/dist/tools/interactions/screen-recording.js.map +1 -1
- package/dist/transport.d.ts +11 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +9 -0
- package/dist/transport.js.map +1 -0
- package/package.json +1 -1
- package/server.json +2 -2
- package/src/cli/index.ts +29 -27
- package/src/cli/options.ts +16 -0
- package/src/cli/plugins.ts +71 -36
- package/src/create-server.ts +2 -1
- package/src/documentation.ts +7 -1
- package/src/server.ts +8 -4
- package/src/tools/interactions/screen-recording.ts +14 -8
- package/src/transport.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [1.94.2](https://github.com/appium/appium-mcp/compare/v1.94.1...v1.94.2) (2026-09-19)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* restrict screen recording scaling options ([#535](https://github.com/appium/appium-mcp/issues/535)) ([5302858](https://github.com/appium/appium-mcp/commit/53028586f5ea31d8d4b26c98b3fb5634e2199c37))
|
|
6
|
+
|
|
7
|
+
## [1.94.1](https://github.com/appium/appium-mcp/compare/v1.94.0...v1.94.1) (2026-09-18)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **docs:** find globally installed doc package with Homebrew node ([#537](https://github.com/appium/appium-mcp/issues/537)) ([c01d3d9](https://github.com/appium/appium-mcp/commit/c01d3d97f512025cb8203fd34841374165266983))
|
|
12
|
+
|
|
13
|
+
### Code Refactoring
|
|
14
|
+
|
|
15
|
+
* refactoring cli arguments ([#526](https://github.com/appium/appium-mcp/issues/526)) ([f3fcc0c](https://github.com/appium/appium-mcp/commit/f3fcc0ce3de2a34813c53149fa9e20d7214a60fc))
|
|
16
|
+
|
|
1
17
|
## [1.94.0](https://github.com/appium/appium-mcp/compare/v1.93.0...v1.94.0) (2026-09-10)
|
|
2
18
|
|
|
3
19
|
### Features
|
package/README.md
CHANGED
|
@@ -148,7 +148,7 @@ This will automatically configure the MCP server for use with Claude Code. Make
|
|
|
148
148
|
| Variable | Required | Description |
|
|
149
149
|
| ----------------------------------------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
150
150
|
| `CAPABILITIES_CONFIG` | Optional | Absolute path to a `capabilities.json` file with per-platform capability presets |
|
|
151
|
-
| `SCREENSHOTS_DIR` | Optional | Directory where screenshots and screen recordings are saved. Defaults to the
|
|
151
|
+
| `SCREENSHOTS_DIR` | Optional | Directory where screenshots and screen recordings are saved. Defaults to the system temp directory (`os.tmpdir()`) |
|
|
152
152
|
| `NO_UI` | Optional | Set to `true` or `1` to disable HTML UI components — faster responses, fewer tokens. See [NO_UI Mode](#no_ui-mode) |
|
|
153
153
|
| `APPIUM_MCP_APPS_ENABLED` | Optional | MCP Apps static UI mode. Enabled by default. Set to `false` or `0` to force the embedded UI compatibility fallback. See [MCP Apps Mode](#mcp-apps-mode) |
|
|
154
154
|
| `APPIUM_MCP_ON_CLIENT_DISCONNECT` | Optional | Session cleanup when the MCP client disconnects: `delete_all` (default) deletes **MCP-owned** Appium sessions (`safeDeleteAllSessions`); `skip` keeps those sessions across disconnects (e.g. HTTP/stream clients that reconnect). Attached/remote sessions are not removed by this path. See [MCP disconnect behavior](#mcp-disconnect-behavior). |
|
|
@@ -266,7 +266,7 @@ Tool calls are logged with argument **redaction** implemented via **`JSON.string
|
|
|
266
266
|
|
|
267
267
|
### Screenshots
|
|
268
268
|
|
|
269
|
-
Set the `SCREENSHOTS_DIR` environment variable to specify where screenshots are saved. If not set, screenshots are saved to the
|
|
269
|
+
Set the `SCREENSHOTS_DIR` environment variable to specify where screenshots are saved. If not set, screenshots are saved to the system temp directory (`os.tmpdir()`). Supports both absolute and relative paths (relative paths are resolved from the current working directory). The directory is created automatically if it doesn't exist.
|
|
270
270
|
|
|
271
271
|
### Screen Recording
|
|
272
272
|
|
|
@@ -277,6 +277,8 @@ Screen recordings are saved as MP4 files to the same directory as screenshots (`
|
|
|
277
277
|
|
|
278
278
|
To start recording, call `appium_screen_recording` with `action="start"`. You may provide `timeLimit` in seconds to limit the maximum recording duration, but the start call still returns immediately. To finalize the recording, save the video, and receive the file path, call `appium_screen_recording` again with `action="stop"`.
|
|
279
279
|
|
|
280
|
+
For iOS, `videoScale` accepts `width:height` with dimensions from 1 to 16384 (for example, `1280:720`). One dimension may be `-1` or `-2` to preserve the aspect ratio; `-2` also makes that dimension divisible by two. Scaling expressions and custom `videoFilters` are no longer supported by this MCP tool.
|
|
281
|
+
|
|
280
282
|
### AI Vision Element Finding
|
|
281
283
|
|
|
282
284
|
Configure AI-powered element finding using vision models. When enabled, a separate tool — **`appium_ai`** — is registered alongside `appium_find_element`. It exposes `action=find_element`, which locates UI elements from natural-language descriptions and returns a coordinate UUID (`ai-element:x,y:bbox`) that can be passed to `appium_gesture` (`tap` / `double_tap` / `long_press`).
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function runCli(args?: string[]): Promise<void>;
|
|
1
|
+
export declare function runCli(args?: readonly string[]): Promise<void>;
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAMA,wBAAsB,MAAM,CAAC,IAAI,GAAE,SAAS,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAa3F"}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,51 +1,50 @@
|
|
|
1
1
|
import log, { configureStdioTransportLogging } from '../logger.js';
|
|
2
|
+
import { DEFAULT_HTTP_STREAM_OPTIONS, TRANSPORT_TYPES } from '../transport.js';
|
|
3
|
+
import { CLI_COMMANDS, CLI_OPTIONS, CLI_VALUE_PREFIXES } from './options.js';
|
|
2
4
|
import { loadCliPlugins } from './plugins.js';
|
|
3
5
|
export async function runCli(args = process.argv.slice(2)) {
|
|
4
6
|
const command = args[0];
|
|
5
|
-
if (command ===
|
|
7
|
+
if (command === CLI_OPTIONS.help || command === CLI_OPTIONS.shortHelp || command === CLI_COMMANDS.help) {
|
|
6
8
|
printHelp();
|
|
7
9
|
return;
|
|
8
10
|
}
|
|
9
|
-
|
|
11
|
+
const useHttpStream = args.includes(CLI_OPTIONS.httpStream);
|
|
12
|
+
if (!useHttpStream) {
|
|
10
13
|
configureStdioTransportLogging();
|
|
11
14
|
}
|
|
12
|
-
await startServer(args);
|
|
15
|
+
await startServer(args, useHttpStream);
|
|
13
16
|
}
|
|
14
17
|
function printHelp() {
|
|
15
18
|
log.info(`Usage: appium-mcp [command] [options]
|
|
16
19
|
|
|
17
20
|
Options:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
${CLI_OPTIONS.httpStream} Start with httpStream transport
|
|
22
|
+
${CLI_VALUE_PREFIXES.port}<port> Port for httpStream transport (default: ${DEFAULT_HTTP_STREAM_OPTIONS.port})
|
|
23
|
+
${CLI_VALUE_PREFIXES.plugin}<module> Load a plugin from a local path or installed package (repeatable)
|
|
24
|
+
${CLI_OPTIONS.help} Show this help message`);
|
|
22
25
|
}
|
|
23
|
-
async function startServer(args) {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
+
async function startServer(args, useHttpStream) {
|
|
27
|
+
const port = args.find((arg) => arg.startsWith(CLI_VALUE_PREFIXES.port))?.split('=')[1] ||
|
|
28
|
+
String(DEFAULT_HTTP_STREAM_OPTIONS.port);
|
|
26
29
|
log.info('Starting MCP Appium MCP Server...');
|
|
27
30
|
try {
|
|
28
31
|
const plugins = await loadCliPlugins(args);
|
|
29
32
|
const { default: createDefaultServer } = await import('../server.js');
|
|
30
33
|
const server = await createDefaultServer(plugins);
|
|
34
|
+
const startOptions = useHttpStream
|
|
35
|
+
? {
|
|
36
|
+
transportType: TRANSPORT_TYPES.httpStream,
|
|
37
|
+
httpStream: { ...DEFAULT_HTTP_STREAM_OPTIONS, port: parseInt(port, 10) },
|
|
38
|
+
}
|
|
39
|
+
: { transportType: TRANSPORT_TYPES.stdio };
|
|
40
|
+
await server.start(startOptions);
|
|
31
41
|
if (useHttpStream) {
|
|
32
|
-
|
|
33
|
-
transportType: 'httpStream',
|
|
34
|
-
httpStream: {
|
|
35
|
-
endpoint: '/sse',
|
|
36
|
-
port: parseInt(port, 10),
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
log.info(`Server started with httpStream transport on http://localhost:${port}/sse`);
|
|
40
|
-
log.info('Waiting for client connections...');
|
|
42
|
+
log.info(`Server started with httpStream transport on http://localhost:${port}${DEFAULT_HTTP_STREAM_OPTIONS.endpoint}`);
|
|
41
43
|
}
|
|
42
44
|
else {
|
|
43
|
-
await server.start({
|
|
44
|
-
transportType: 'stdio',
|
|
45
|
-
});
|
|
46
45
|
log.info('Server started with stdio transport');
|
|
47
|
-
log.info('Waiting for client connections...');
|
|
48
46
|
}
|
|
47
|
+
log.info('Waiting for client connections...');
|
|
49
48
|
}
|
|
50
49
|
catch (error) {
|
|
51
50
|
log.error('Error starting server:', error);
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAC,8BAA8B,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAC,8BAA8B,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,EAAC,2BAA2B,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAE7E,OAAO,EAAC,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA0B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1E,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,OAAO,KAAK,WAAW,CAAC,IAAI,IAAI,OAAO,KAAK,WAAW,CAAC,SAAS,IAAI,OAAO,KAAK,YAAY,CAAC,IAAI,EAAE,CAAC;QACvG,SAAS,EAAE,CAAC;QACZ,OAAO;IACT,CAA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AC,KAAK,EAAC,CAAC;QAC3C,MAAM,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAEjC,IAAI,aAAa,EAAE,CAAC;YAClB,GAAG,CAAC,IAAI,CACN,gEAAgE,IAAI,GAAG,2BAA2B,CAAC,QAAQ,EAAE,CAC9G,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QAClD,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;IAChD,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,GAAG,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const CLI_COMMANDS: {
|
|
2
|
+
readonly help: "help";
|
|
3
|
+
};
|
|
4
|
+
export declare const CLI_OPTIONS: {
|
|
5
|
+
readonly help: "--help";
|
|
6
|
+
readonly shortHelp: "-h";
|
|
7
|
+
readonly httpStream: "--httpStream";
|
|
8
|
+
readonly port: "--port";
|
|
9
|
+
readonly plugin: "--plugin";
|
|
10
|
+
};
|
|
11
|
+
export declare const CLI_VALUE_PREFIXES: {
|
|
12
|
+
readonly port: "--port=";
|
|
13
|
+
readonly plugin: "--plugin=";
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/cli/options.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;CAEf,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const CLI_COMMANDS = {
|
|
2
|
+
help: 'help',
|
|
3
|
+
};
|
|
4
|
+
export const CLI_OPTIONS = {
|
|
5
|
+
help: '--help',
|
|
6
|
+
shortHelp: '-h',
|
|
7
|
+
httpStream: '--httpStream',
|
|
8
|
+
port: '--port',
|
|
9
|
+
plugin: '--plugin',
|
|
10
|
+
};
|
|
11
|
+
export const CLI_VALUE_PREFIXES = {
|
|
12
|
+
port: `${CLI_OPTIONS.port}=`,
|
|
13
|
+
plugin: `${CLI_OPTIONS.plugin}=`,
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/cli/options.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM;CACJ,CAAC;AAEX,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,cAAc;IAC1B,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,UAAU;CACV,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,GAAG,WAAW,CAAC,IAAI,GAAG;IAC5B,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,GAAG;CACxB,CAAC"}
|
package/dist/cli/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AppiumMcpPlugin } from '../core.js';
|
|
2
2
|
/** Load explicitly requested plugins in command-line order, relative to the caller. */
|
|
3
|
-
export declare function loadCliPlugins(args: string[], cwd?: string): Promise<AppiumMcpPlugin[]>;
|
|
3
|
+
export declare function loadCliPlugins(args: readonly string[], cwd?: string): Promise<AppiumMcpPlugin[]>;
|
|
4
4
|
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/cli/plugins.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/cli/plugins.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAmBhD,uFAAuF;AACvF,wBAAsB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,SAAgB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAS7G"}
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,59 +1,88 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import { isAbsolute, resolve as resolvePath } from 'node:path';
|
|
3
3
|
import { pathToFileURL } from 'node:url';
|
|
4
|
+
import { CLI_OPTIONS, CLI_VALUE_PREFIXES } from './options.js';
|
|
5
|
+
// Require a runtime check for every field in the plugin contract.
|
|
6
|
+
const PLUGIN_FIELD_TYPES = {
|
|
7
|
+
name: 'string',
|
|
8
|
+
version: 'string',
|
|
9
|
+
initialize: 'function',
|
|
10
|
+
register: 'function',
|
|
11
|
+
beforeCall: 'function',
|
|
12
|
+
afterCall: 'function',
|
|
13
|
+
destroy: 'function',
|
|
14
|
+
};
|
|
4
15
|
/** Load explicitly requested plugins in command-line order, relative to the caller. */
|
|
5
16
|
export async function loadCliPlugins(args, cwd = process.cwd()) {
|
|
17
|
+
const specifiers = parsePluginSpecifiers(args);
|
|
18
|
+
const requireFromCwd = createRequire(resolvePath(cwd, 'package.json'));
|
|
19
|
+
const plugins = [];
|
|
20
|
+
for (const specifier of specifiers) {
|
|
21
|
+
// Imports and constructors can have side effects, so preserve flag order.
|
|
22
|
+
plugins.push(await loadPlugin(specifier, cwd, requireFromCwd.resolve));
|
|
23
|
+
}
|
|
24
|
+
return plugins;
|
|
25
|
+
}
|
|
26
|
+
function parsePluginSpecifiers(args) {
|
|
6
27
|
const specifiers = [];
|
|
7
28
|
for (let index = 0; index < args.length; index++) {
|
|
8
29
|
const arg = args[index];
|
|
9
|
-
if (arg !==
|
|
30
|
+
if (arg !== CLI_OPTIONS.plugin && !arg.startsWith(CLI_VALUE_PREFIXES.plugin)) {
|
|
10
31
|
continue;
|
|
11
32
|
}
|
|
12
|
-
const specifier = arg ===
|
|
33
|
+
const specifier = arg === CLI_OPTIONS.plugin ? args[++index] : arg.slice(CLI_VALUE_PREFIXES.plugin.length);
|
|
13
34
|
if (!specifier?.trim() || specifier.startsWith('--')) {
|
|
14
|
-
throw new Error(
|
|
35
|
+
throw new Error(`${CLI_OPTIONS.plugin} requires a module path or an installed package name.`);
|
|
15
36
|
}
|
|
16
37
|
specifiers.push(specifier);
|
|
17
38
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
return specifiers;
|
|
40
|
+
}
|
|
41
|
+
function resolvePluginUrl(specifier, cwd, resolvePackage) {
|
|
42
|
+
let moduleSpecifier;
|
|
43
|
+
if (isAbsolute(specifier) || specifier.startsWith('.')) {
|
|
44
|
+
moduleSpecifier = resolvePath(cwd, specifier);
|
|
45
|
+
}
|
|
46
|
+
else if (URL.canParse(specifier)) {
|
|
47
|
+
moduleSpecifier = new URL(specifier).href;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
moduleSpecifier = resolvePackage(specifier);
|
|
51
|
+
}
|
|
52
|
+
const moduleURL = isAbsolute(moduleSpecifier) ? pathToFileURL(moduleSpecifier).href : moduleSpecifier;
|
|
53
|
+
if (!moduleURL.startsWith('file:')) {
|
|
54
|
+
throw new Error('Only local files and installed packages are supported.');
|
|
55
|
+
}
|
|
56
|
+
return moduleURL;
|
|
57
|
+
}
|
|
58
|
+
async function loadPlugin(specifier, cwd, resolvePackage) {
|
|
59
|
+
try {
|
|
60
|
+
const moduleURL = resolvePluginUrl(specifier, cwd, resolvePackage);
|
|
61
|
+
const module = (await import(moduleURL));
|
|
62
|
+
const exported = module.default;
|
|
63
|
+
const plugin = typeof exported === 'function' ? new exported() : exported;
|
|
64
|
+
assertPlugin(plugin);
|
|
65
|
+
return plugin;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
69
|
+
throw new Error(`Failed to load plugin "${specifier}": ${message}`, { cause: error });
|
|
41
70
|
}
|
|
42
|
-
return plugins;
|
|
43
71
|
}
|
|
44
72
|
function assertPlugin(plugin) {
|
|
45
73
|
if (typeof plugin !== 'object' || plugin === null) {
|
|
46
74
|
throw new Error('The default export must be an AppiumMcpPlugin object or a class with a no-argument constructor.');
|
|
47
75
|
}
|
|
48
76
|
const candidate = plugin;
|
|
49
|
-
for (const field of
|
|
50
|
-
|
|
51
|
-
|
|
77
|
+
for (const [field, expectedType] of Object.entries(PLUGIN_FIELD_TYPES)) {
|
|
78
|
+
const value = candidate[field];
|
|
79
|
+
if (expectedType === 'string') {
|
|
80
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
81
|
+
throw new Error(`The plugin must have a non-empty string "${field}".`);
|
|
82
|
+
}
|
|
52
83
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (candidate[hook] !== undefined && typeof candidate[hook] !== 'function') {
|
|
56
|
-
throw new Error(`Plugin "${candidate.name}" has an invalid "${hook}" hook; expected a function.`);
|
|
84
|
+
else if (value !== undefined && typeof value !== 'function') {
|
|
85
|
+
throw new Error(`Plugin "${candidate.name}" has an invalid "${field}" hook; expected a function.`);
|
|
57
86
|
}
|
|
58
87
|
}
|
|
59
88
|
}
|
package/dist/cli/plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/cli/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAE,OAAO,IAAI,WAAW,EAAC,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/cli/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAE,OAAO,IAAI,WAAW,EAAC,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAGvC,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAE7D,kEAAkE;AAClE,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,QAAQ;IACjB,UAAU,EAAE,UAAU;IACtB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,UAAU;IACtB,SAAS,EAAE,UAAU;IACrB,OAAO,EAAE,UAAU;CAGpB,CAAC;AAKF,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAuB,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAC/E,MAAM,UAAU,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,aAAa,CAAC,WAAW,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC;IACvE,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,0EAA0E;QAC1E,OAAO,CAAC,IAAI,CAAC,MAAM,UAAU,CAAC,SAAS,EAAE,GAA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MAAe;IACnC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,iGAAiG,CAAC,CAAC;IACrH,CAAC;IACD,MAAM,SAAS,GAAG,MAAiC,CAAC;IACpD,KAAK,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACvE,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,YAAY,KAAK,QAAQ,EAAE,CAAC;YAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC/C,MAAM,IAAI,KAAK,CAAC,4CAA4C,KAAK,IAAI,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAC9D,MAAM,IAAI,KAAK,CAAC,WAAW,SAAS,CAAC,IAAI,qBAAqB,KAAK,8BAA8B,CAAC,CAAC;QACrG,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-server.d.ts","sourceRoot":"","sources":["../src/create-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAKhC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAgB,KAAK,eAAe,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"create-server.d.ts","sourceRoot":"","sources":["../src/create-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAKhC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAgB,KAAK,eAAe,EAAC,MAAM,aAAa,CAAC;AA2BhE,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAE5B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,aAAa,CAAC,EAAE,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;IAEhD;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAQD;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,GAAE,4BAAiC,GAAG,OAAO,CAAC,OAAO,CAAC,CAuKxG"}
|
package/dist/create-server.js
CHANGED
|
@@ -22,6 +22,7 @@ import { safeDeleteAllSessions, listSessions } from './session-store.js';
|
|
|
22
22
|
import { initializeOpenTelemetry } from './telemetry/init.js';
|
|
23
23
|
import { installTelemetryWrappers } from './telemetry/wrapOperations.js';
|
|
24
24
|
import registerTools from './tools/index.js';
|
|
25
|
+
import { TRANSPORT_TYPES } from './transport.js';
|
|
25
26
|
const SERVER_VERSION = pkg.version;
|
|
26
27
|
const SERVER_INSTRUCTIONS = [
|
|
27
28
|
'Appium mobile automation through MCP. Defaults that avoid broken flows:',
|
|
@@ -193,7 +194,7 @@ export async function createAppiumMcpServer(options = {}) {
|
|
|
193
194
|
function wrapStartForStdioLogging(server) {
|
|
194
195
|
const originalStart = server.start.bind(server);
|
|
195
196
|
server.start = (async (startOptions) => {
|
|
196
|
-
if ((startOptions?.transportType ??
|
|
197
|
+
if ((startOptions?.transportType ?? TRANSPORT_TYPES.stdio) === TRANSPORT_TYPES.stdio) {
|
|
197
198
|
configureStdioTransportLogging();
|
|
198
199
|
}
|
|
199
200
|
return originalStart(startOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-server.js","sourceRoot":"","sources":["../src/create-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAEhC,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AACtD,OAAO,GAAG,EAAE,EAAC,8BAA8B,EAAC,MAAM,aAAa,CAAC;AAChE,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAC,aAAa,EAAuB,MAAM,aAAa,CAAC;AAChE,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAC,qBAAqB,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,aAAa,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-server.js","sourceRoot":"","sources":["../src/create-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAEhC,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AACtD,OAAO,GAAG,EAAE,EAAC,8BAA8B,EAAC,MAAM,aAAa,CAAC;AAChE,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAC,aAAa,EAAuB,MAAM,aAAa,CAAC;AAChE,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAC,qBAAqB,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,aA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C,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,wBAAwB,CAAC,MAAe;IAC/C,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,CAAC,KAAK,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;QACrC,IAAI,CAAC,YAAY,EAAE,aAAa,IAAI,eAAe,CAAC,KAAK,CAAC,KAAK,eAAe,CAAC,KAAK,EAAE,CAAC;YACrF,8BAA8B,EAAE,CAAC;QACnC,CAAC;QACD,OAAO,aAAa,CAAC,YAAY,CAAC,CAAC;IACrC,CAAC,CAAqB,CAAC;AACzB,CAAC;AAED,SAAS,8BAA8B;IACrC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9E,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;QACnB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,IAAI,GAAG,KAAK,YAAY,EAAE,CAAC;QACzB,GAAG,CAAC,IAAI,CAAC,oCAAoC,GAAG,+CAA+C,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
package/dist/documentation.js
CHANGED
|
@@ -109,9 +109,15 @@ async function resolveGlobalEntryUrl() {
|
|
|
109
109
|
const execDir = path.dirname(process.execPath);
|
|
110
110
|
// npm global roots by platform (each entry is a resolution starting point,
|
|
111
111
|
// so `<entry>/node_modules` is checked):
|
|
112
|
-
// - POSIX (nvm, system
|
|
112
|
+
// - POSIX (nvm, system): <prefix>/lib/node_modules
|
|
113
113
|
// - Windows (node.exe in <prefix>): <prefix>/node_modules
|
|
114
114
|
const paths = [path.join(execDir, '..', 'lib'), execDir];
|
|
115
|
+
// Homebrew runs node from <prefix>/Cellar/node/<version>/bin but installs global
|
|
116
|
+
// packages into <prefix>/lib/node_modules.
|
|
117
|
+
const cellarIndex = execDir.lastIndexOf(`${path.sep}Cellar${path.sep}`);
|
|
118
|
+
if (cellarIndex !== -1) {
|
|
119
|
+
paths.push(path.join(execDir.slice(0, cellarIndex), 'lib'));
|
|
120
|
+
}
|
|
115
121
|
const pkgJsonPath = require.resolve(`${PACKAGE_NAME}/package.json`, {
|
|
116
122
|
paths,
|
|
117
123
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentation.js","sourceRoot":"","sources":["../src/documentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAC,EAAE,EAAC,MAAM,iBAAiB,CAAC;AAGnC,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAEhD,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAC/C,MAAM,YAAY,GAAG,2BAA2B,CAAC;AAMjD,iEAAiE;AACjE,MAAM,UAAU,sBAAsB;IACpC,OAAO,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,IAAI,GAA+B,CAAC;IACpC,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,yBAAyB,EAAE,CAAC;IAC1C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,2EAA2E;QAC3E,GAAG,CAAC,KAAK,CAAC,GAAG,YAAY,mCAAmC,EAAE,GAAG,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,GAAG,CAAC,IAAI,CACN,GAAG,Y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E,WAAW,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAC9D,CAAC;QACD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,YAAY,eAAe,EAAE;YAClE,KAAK;SACN,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACzC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,CAG5D,CAAC;QACF,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,IAAI,GAAG,CAAC,IAAI,IAAI,UAAU,CAAC;QAC1G,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAY;IACpC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,CAAC;QAChE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAI,GAAwB,CAAC,IAAI,CAAC;IAC5C,OAAO,IAAI,KAAK,sBAAsB,IAAI,IAAI,KAAK,kBAAkB,CAAC;AACxE,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FastMCP } from 'fastmcp';
|
|
1
2
|
import type { AppiumMcpPlugin } from './core.js';
|
|
2
|
-
export default function createDefaultServer(additionalPlugins?: AppiumMcpPlugin[]): Promise<
|
|
3
|
+
export default function createDefaultServer(additionalPlugins?: readonly AppiumMcpPlugin[]): Promise<FastMCP>;
|
|
3
4
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,WAAW,CAAC;AAI/C,wBAA8B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAErC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,WAAW,CAAC;AAI/C,wBAA8B,mBAAmB,CAC/C,iBAAiB,GAAE,SAAS,eAAe,EAAO,GACjD,OAAO,CAAC,OAAO,CAAC,CAclB"}
|
package/dist/server.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { createAppiumMcpServer } from './create-server.js';
|
|
2
2
|
import { isDocumentationEnabled, loadDocumentationPlugin } from './documentation.js';
|
|
3
3
|
export default async function createDefaultServer(additionalPlugins = []) {
|
|
4
|
-
const plugins = [];
|
|
4
|
+
const plugins = [...additionalPlugins];
|
|
5
5
|
// Documentation tools (RAG docs query + skills) are opt-in. They live in a
|
|
6
6
|
// separate package only installed when the user sets
|
|
7
7
|
// APPIUM_MCP_DOCS_ENABLED. See ./documentation.ts for the full contract.
|
|
8
8
|
if (isDocumentationEnabled()) {
|
|
9
9
|
const documentationPlugin = await loadDocumentationPlugin();
|
|
10
10
|
if (documentationPlugin) {
|
|
11
|
-
plugins.
|
|
11
|
+
plugins.unshift(documentationPlugin);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
return
|
|
14
|
+
return createAppiumMcpServer({ plugins });
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAC,sBAAsB,EAAE,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAEnF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,mBAAmB,CAC/C,oBAAgD,EAAE;IAElD,MAAM,OAAO,GAAG,CAAC,GAAG,iBAAiB,CAAC,CAAC;IAEvC,2EAA2E;IAC3E,qDAAqD;IACrD,yEAAyE;IACzE,IAAI,sBAAsB,EAAE,EAAE,CAAC;QAC7B,MAAM,mBAAmB,GAAG,MAAM,uBAAuB,EAAE,CAAC;QAC5D,IAAI,mBAAmB,EAAE,CAAC;YACxB,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,OAAO,qBAAqB,CAAC,EAAC,OAAO,EAAC,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -10,9 +10,7 @@ export interface IOSRecordingOptions {
|
|
|
10
10
|
videoQuality?: 'low' | 'medium' | 'high' | 'photo' | number;
|
|
11
11
|
/** Frames per second. Default: 10. */
|
|
12
12
|
videoFps?: number;
|
|
13
|
-
/**
|
|
14
|
-
videoFilters?: string;
|
|
15
|
-
/** Scaling value (e.g. 1280:720). Ignored if videoFilters is set. @see https://trac.ffmpeg.org/wiki/Scaling */
|
|
13
|
+
/** Width:height, each 1–16384; one dimension may be -1 or -2 to preserve the aspect ratio. */
|
|
16
14
|
videoScale?: string;
|
|
17
15
|
/** Output pixel format. Run `ffmpeg -pix_fmts` for options. Use yuv420p with videoType=libx264 for QuickTime compatibility. */
|
|
18
16
|
pixelFormat?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen-recording.d.ts","sourceRoot":"","sources":["../../../src/tools/interactions/screen-recording.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAgB,OAAO,EAAC,MAAM,SAAS,CAAC;AAQpD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,YAAY,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAC5D,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"screen-recording.d.ts","sourceRoot":"","sources":["../../../src/tools/interactions/screen-recording.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAgB,OAAO,EAAC,MAAM,SAAS,CAAC;AAQpD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,YAAY,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAC5D,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8FAA8F;IAC9F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+HAA+H;IAC/H,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,4CAA4C;IAC5C,oBAAoB,CAAC,EAAE,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,OAAO,CAAC;CAC/E;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,gGAAgG;IAChG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAoDD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAuF7D"}
|
|
@@ -29,8 +29,16 @@ const screenRecordingSchema = z.object({
|
|
|
29
29
|
.describe('iOS only. Video quality preset. Default: medium.'),
|
|
30
30
|
videoFps: z.number().int().min(1).max(60).optional().describe('iOS only. Frames per second. Default: 10.'),
|
|
31
31
|
videoType: z.string().optional().describe('iOS only. Video codec to use (e.g. libx264).'),
|
|
32
|
-
|
|
33
|
-
videoScale: z
|
|
32
|
+
// XCUITest embeds this value in an FFmpeg filtergraph. Accept dimensions only.
|
|
33
|
+
videoScale: z
|
|
34
|
+
.string()
|
|
35
|
+
.regex(/^(?:[1-9]\d{0,4}|-[12]):(?:[1-9]\d{0,4}|-[12])(?![\s\S])/, 'Use width:height (e.g. 1280:720 or -2:720), without filter expressions.')
|
|
36
|
+
.refine((value) => {
|
|
37
|
+
const dimensions = value.split(':').map(Number);
|
|
38
|
+
return dimensions.every((dimension) => dimension <= 16384) && dimensions.some((dimension) => dimension > 0);
|
|
39
|
+
}, 'Dimensions must be 1–16384; only one dimension may be -1 or -2.')
|
|
40
|
+
.optional()
|
|
41
|
+
.describe('iOS only. Width:height, each 1–16384 (e.g. 1280:720); one may be -1 or -2 to preserve aspect ratio.'),
|
|
34
42
|
pixelFormat: z.string().optional().describe('iOS only. Output pixel format (e.g. yuv420p).'),
|
|
35
43
|
hardwareAcceleration: z
|
|
36
44
|
.enum(['videoToolbox', 'cuda', 'amf_dx11', 'qsv', 'vaapi'])
|
|
@@ -86,9 +94,6 @@ export default function screenRecording(server) {
|
|
|
86
94
|
}
|
|
87
95
|
iosOptions.videoType = args.videoType ?? 'libx264';
|
|
88
96
|
iosOptions.pixelFormat = args.pixelFormat ?? 'yuv420p';
|
|
89
|
-
if (args.videoFilters !== undefined) {
|
|
90
|
-
iosOptions.videoFilters = args.videoFilters;
|
|
91
|
-
}
|
|
92
97
|
if (args.videoScale !== undefined) {
|
|
93
98
|
iosOptions.videoScale = args.videoScale;
|
|
94
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen-recording.js","sourceRoot":"","sources":["../../../src/tools/interactions/screen-recording.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAE/B,OAAO,EAAC,EAAE,EAAC,MAAM,iBAAiB,CAAC;AAEnC,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,oBAAoB,IAAI,iBAAiB,EAAE,mBAAmB,IAAI,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AACpH,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAC,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"screen-recording.js","sourceRoot":"","sources":["../../../src/tools/interactions/screen-recording.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAE/B,OAAO,EAAC,EAAE,EAAC,MAAM,iBAAiB,CAAC;AAEnC,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,oBAAoB,IAAI,iBAAiB,EAAE,mBAAmB,IAAI,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AACpH,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAC,oBAAoB,EAAC,MAAM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AAC;oBAC5C,CAAC;oBACD,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;wBACpC,cAAc,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;oBAClD,CAAC;oBACD,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;wBACjC,cAAc,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;oBAC5C,CAAC;oBACD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;wBAC/B,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;oBACxC,CAAC;oBACD,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;wBACjC,cAAc,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;oBAC5C,CAAC;oBACD,OAAO,GAAG,cAAc,CAAC;gBAC3B,CAAC;gBAED,MAAM,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBACzC,OAAO,UAAU,CAAC,2BAA2B,CAAC,CAAC;YACjD,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACtB,OAAO,WAAW,CAAC,kCAAkC,IAAI,CAAC,MAAM,YAAY,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACvG,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FastMCP } from 'fastmcp';
|
|
2
|
+
export type ServerStartOptions = NonNullable<Parameters<FastMCP['start']>[0]>;
|
|
3
|
+
export declare const TRANSPORT_TYPES: {
|
|
4
|
+
readonly stdio: "stdio";
|
|
5
|
+
readonly httpStream: "httpStream";
|
|
6
|
+
};
|
|
7
|
+
export declare const DEFAULT_HTTP_STREAM_OPTIONS: {
|
|
8
|
+
readonly endpoint: "/sse";
|
|
9
|
+
readonly port: 8080;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAErC,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9E,eAAO,MAAM,eAAe;;;CAG4C,CAAC;AAEzE,eAAO,MAAM,2BAA2B;;;CAG0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,YAAY;CAC8C,CAAC;AAEzE,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,IAAI;CACsD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-mcp",
|
|
3
|
-
"version": "1.94.
|
|
3
|
+
"version": "1.94.2",
|
|
4
4
|
"description": "Intelligent MCP server providing AI assistants with powerful tools and resources for Appium mobile automation",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/appium/appium-mcp/issues"
|
package/server.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"name": "io.github.appium/appium-mcp",
|
|
4
4
|
"title": "MCP Appium - Mobile Development and Automation Server",
|
|
5
5
|
"description": "MCP server for Appium mobile automation on iOS and Android devices with test creation tools.",
|
|
6
|
-
"version": "1.94.
|
|
6
|
+
"version": "1.94.2",
|
|
7
7
|
"packages": [
|
|
8
8
|
{
|
|
9
9
|
"registryType": "npm",
|
|
10
10
|
"identifier": "appium-mcp",
|
|
11
|
-
"version": "1.94.
|
|
11
|
+
"version": "1.94.2",
|
|
12
12
|
"transport": {
|
|
13
13
|
"type": "stdio"
|
|
14
14
|
}
|
package/src/cli/index.ts
CHANGED
|
@@ -1,33 +1,38 @@
|
|
|
1
1
|
import log, {configureStdioTransportLogging} from '../logger.js';
|
|
2
|
+
import {DEFAULT_HTTP_STREAM_OPTIONS, TRANSPORT_TYPES} from '../transport.js';
|
|
3
|
+
import type {ServerStartOptions} from '../transport.js';
|
|
4
|
+
import {CLI_COMMANDS, CLI_OPTIONS, CLI_VALUE_PREFIXES} from './options.js';
|
|
2
5
|
import {loadCliPlugins} from './plugins.js';
|
|
3
6
|
|
|
4
|
-
export async function runCli(args: string[] = process.argv.slice(2)): Promise<void> {
|
|
7
|
+
export async function runCli(args: readonly string[] = process.argv.slice(2)): Promise<void> {
|
|
5
8
|
const command = args[0];
|
|
6
|
-
if (command ===
|
|
9
|
+
if (command === CLI_OPTIONS.help || command === CLI_OPTIONS.shortHelp || command === CLI_COMMANDS.help) {
|
|
7
10
|
printHelp();
|
|
8
11
|
return;
|
|
9
12
|
}
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
const useHttpStream = args.includes(CLI_OPTIONS.httpStream);
|
|
15
|
+
if (!useHttpStream) {
|
|
12
16
|
configureStdioTransportLogging();
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
await startServer(args);
|
|
19
|
+
await startServer(args, useHttpStream);
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
function printHelp(): void {
|
|
19
23
|
log.info(`Usage: appium-mcp [command] [options]
|
|
20
24
|
|
|
21
25
|
Options:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
${CLI_OPTIONS.httpStream} Start with httpStream transport
|
|
27
|
+
${CLI_VALUE_PREFIXES.port}<port> Port for httpStream transport (default: ${DEFAULT_HTTP_STREAM_OPTIONS.port})
|
|
28
|
+
${CLI_VALUE_PREFIXES.plugin}<module> Load a plugin from a local path or installed package (repeatable)
|
|
29
|
+
${CLI_OPTIONS.help} Show this help message`);
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
async function startServer(args: string[]): Promise<void> {
|
|
29
|
-
const
|
|
30
|
-
|
|
32
|
+
async function startServer(args: readonly string[], useHttpStream: boolean): Promise<void> {
|
|
33
|
+
const port =
|
|
34
|
+
args.find((arg) => arg.startsWith(CLI_VALUE_PREFIXES.port))?.split('=')[1] ||
|
|
35
|
+
String(DEFAULT_HTTP_STREAM_OPTIONS.port);
|
|
31
36
|
|
|
32
37
|
log.info('Starting MCP Appium MCP Server...');
|
|
33
38
|
|
|
@@ -36,26 +41,23 @@ async function startServer(args: string[]): Promise<void> {
|
|
|
36
41
|
const {default: createDefaultServer} = await import('../server.js');
|
|
37
42
|
const server = await createDefaultServer(plugins);
|
|
38
43
|
|
|
44
|
+
const startOptions: ServerStartOptions = useHttpStream
|
|
45
|
+
? {
|
|
46
|
+
transportType: TRANSPORT_TYPES.httpStream,
|
|
47
|
+
httpStream: {...DEFAULT_HTTP_STREAM_OPTIONS, port: parseInt(port, 10)},
|
|
48
|
+
}
|
|
49
|
+
: {transportType: TRANSPORT_TYPES.stdio};
|
|
50
|
+
await server.start(startOptions);
|
|
51
|
+
|
|
39
52
|
if (useHttpStream) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
endpoint: '/sse',
|
|
44
|
-
port: parseInt(port, 10),
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
log.info(`Server started with httpStream transport on http://localhost:${port}/sse`);
|
|
49
|
-
log.info('Waiting for client connections...');
|
|
53
|
+
log.info(
|
|
54
|
+
`Server started with httpStream transport on http://localhost:${port}${DEFAULT_HTTP_STREAM_OPTIONS.endpoint}`,
|
|
55
|
+
);
|
|
50
56
|
} else {
|
|
51
|
-
await server.start({
|
|
52
|
-
transportType: 'stdio',
|
|
53
|
-
});
|
|
54
|
-
|
|
55
57
|
log.info('Server started with stdio transport');
|
|
56
|
-
log.info('Waiting for client connections...');
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
+
log.info('Waiting for client connections...');
|
|
60
|
+
} catch (error: unknown) {
|
|
59
61
|
log.error('Error starting server:', error);
|
|
60
62
|
process.exit(1);
|
|
61
63
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const CLI_COMMANDS = {
|
|
2
|
+
help: 'help',
|
|
3
|
+
} as const;
|
|
4
|
+
|
|
5
|
+
export const CLI_OPTIONS = {
|
|
6
|
+
help: '--help',
|
|
7
|
+
shortHelp: '-h',
|
|
8
|
+
httpStream: '--httpStream',
|
|
9
|
+
port: '--port',
|
|
10
|
+
plugin: '--plugin',
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
export const CLI_VALUE_PREFIXES = {
|
|
14
|
+
port: `${CLI_OPTIONS.port}=`,
|
|
15
|
+
plugin: `${CLI_OPTIONS.plugin}=`,
|
|
16
|
+
} as const;
|
package/src/cli/plugins.ts
CHANGED
|
@@ -3,47 +3,82 @@ import {isAbsolute, resolve as resolvePath} from 'node:path';
|
|
|
3
3
|
import {pathToFileURL} from 'node:url';
|
|
4
4
|
|
|
5
5
|
import type {AppiumMcpPlugin} from '../core.js';
|
|
6
|
+
import {CLI_OPTIONS, CLI_VALUE_PREFIXES} from './options.js';
|
|
7
|
+
|
|
8
|
+
// Require a runtime check for every field in the plugin contract.
|
|
9
|
+
const PLUGIN_FIELD_TYPES = {
|
|
10
|
+
name: 'string',
|
|
11
|
+
version: 'string',
|
|
12
|
+
initialize: 'function',
|
|
13
|
+
register: 'function',
|
|
14
|
+
beforeCall: 'function',
|
|
15
|
+
afterCall: 'function',
|
|
16
|
+
destroy: 'function',
|
|
17
|
+
} as const satisfies {
|
|
18
|
+
[Key in keyof AppiumMcpPlugin]-?: NonNullable<AppiumMcpPlugin[Key]> extends string ? 'string' : 'function';
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type ResolvePackage = (specifier: string) => string;
|
|
22
|
+
type PluginConstructor = new () => unknown;
|
|
6
23
|
|
|
7
24
|
/** Load explicitly requested plugins in command-line order, relative to the caller. */
|
|
8
|
-
export async function loadCliPlugins(args: string[], cwd = process.cwd()): Promise<AppiumMcpPlugin[]> {
|
|
25
|
+
export async function loadCliPlugins(args: readonly string[], cwd = process.cwd()): Promise<AppiumMcpPlugin[]> {
|
|
26
|
+
const specifiers = parsePluginSpecifiers(args);
|
|
27
|
+
const requireFromCwd = createRequire(resolvePath(cwd, 'package.json'));
|
|
28
|
+
const plugins: AppiumMcpPlugin[] = [];
|
|
29
|
+
for (const specifier of specifiers) {
|
|
30
|
+
// Imports and constructors can have side effects, so preserve flag order.
|
|
31
|
+
plugins.push(await loadPlugin(specifier, cwd, requireFromCwd.resolve));
|
|
32
|
+
}
|
|
33
|
+
return plugins;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function parsePluginSpecifiers(args: readonly string[]): string[] {
|
|
9
37
|
const specifiers: string[] = [];
|
|
10
38
|
for (let index = 0; index < args.length; index++) {
|
|
11
39
|
const arg = args[index];
|
|
12
|
-
if (arg !==
|
|
40
|
+
if (arg !== CLI_OPTIONS.plugin && !arg.startsWith(CLI_VALUE_PREFIXES.plugin)) {
|
|
13
41
|
continue;
|
|
14
42
|
}
|
|
15
|
-
const specifier = arg ===
|
|
43
|
+
const specifier = arg === CLI_OPTIONS.plugin ? args[++index] : arg.slice(CLI_VALUE_PREFIXES.plugin.length);
|
|
16
44
|
if (!specifier?.trim() || specifier.startsWith('--')) {
|
|
17
|
-
throw new Error(
|
|
45
|
+
throw new Error(`${CLI_OPTIONS.plugin} requires a module path or an installed package name.`);
|
|
18
46
|
}
|
|
19
47
|
specifiers.push(specifier);
|
|
20
48
|
}
|
|
21
49
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
return specifiers;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function resolvePluginUrl(specifier: string, cwd: string, resolvePackage: ResolvePackage): string {
|
|
54
|
+
let moduleSpecifier: string;
|
|
55
|
+
if (isAbsolute(specifier) || specifier.startsWith('.')) {
|
|
56
|
+
moduleSpecifier = resolvePath(cwd, specifier);
|
|
57
|
+
} else if (URL.canParse(specifier)) {
|
|
58
|
+
moduleSpecifier = new URL(specifier).href;
|
|
59
|
+
} else {
|
|
60
|
+
moduleSpecifier = resolvePackage(specifier);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const moduleURL = isAbsolute(moduleSpecifier) ? pathToFileURL(moduleSpecifier).href : moduleSpecifier;
|
|
64
|
+
if (!moduleURL.startsWith('file:')) {
|
|
65
|
+
throw new Error('Only local files and installed packages are supported.');
|
|
66
|
+
}
|
|
67
|
+
return moduleURL;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function loadPlugin(specifier: string, cwd: string, resolvePackage: ResolvePackage): Promise<AppiumMcpPlugin> {
|
|
71
|
+
try {
|
|
72
|
+
const moduleURL = resolvePluginUrl(specifier, cwd, resolvePackage);
|
|
73
|
+
const module = (await import(moduleURL)) as {default?: unknown};
|
|
74
|
+
const exported = module.default;
|
|
75
|
+
const plugin = typeof exported === 'function' ? new (exported as PluginConstructor)() : exported;
|
|
76
|
+
assertPlugin(plugin);
|
|
77
|
+
return plugin;
|
|
78
|
+
} catch (error: unknown) {
|
|
79
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
80
|
+
throw new Error(`Failed to load plugin "${specifier}": ${message}`, {cause: error});
|
|
45
81
|
}
|
|
46
|
-
return plugins;
|
|
47
82
|
}
|
|
48
83
|
|
|
49
84
|
function assertPlugin(plugin: unknown): asserts plugin is AppiumMcpPlugin {
|
|
@@ -51,14 +86,14 @@ function assertPlugin(plugin: unknown): asserts plugin is AppiumMcpPlugin {
|
|
|
51
86
|
throw new Error('The default export must be an AppiumMcpPlugin object or a class with a no-argument constructor.');
|
|
52
87
|
}
|
|
53
88
|
const candidate = plugin as Record<string, unknown>;
|
|
54
|
-
for (const field of
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (
|
|
61
|
-
throw new Error(`Plugin "${candidate.name}" has an invalid "${
|
|
89
|
+
for (const [field, expectedType] of Object.entries(PLUGIN_FIELD_TYPES)) {
|
|
90
|
+
const value = candidate[field];
|
|
91
|
+
if (expectedType === 'string') {
|
|
92
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
93
|
+
throw new Error(`The plugin must have a non-empty string "${field}".`);
|
|
94
|
+
}
|
|
95
|
+
} else if (value !== undefined && typeof value !== 'function') {
|
|
96
|
+
throw new Error(`Plugin "${candidate.name}" has an invalid "${field}" hook; expected a function.`);
|
|
62
97
|
}
|
|
63
98
|
}
|
|
64
99
|
}
|
package/src/create-server.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {safeDeleteAllSessions, listSessions} from './session-store.js';
|
|
|
25
25
|
import {initializeOpenTelemetry} from './telemetry/init.js';
|
|
26
26
|
import {installTelemetryWrappers} from './telemetry/wrapOperations.js';
|
|
27
27
|
import registerTools from './tools/index.js';
|
|
28
|
+
import {TRANSPORT_TYPES} from './transport.js';
|
|
28
29
|
|
|
29
30
|
const SERVER_VERSION = pkg.version as `${number}.${number}.${number}`;
|
|
30
31
|
|
|
@@ -267,7 +268,7 @@ export async function createAppiumMcpServer(options: CreateAppiumMcpServerOption
|
|
|
267
268
|
function wrapStartForStdioLogging(server: FastMCP): void {
|
|
268
269
|
const originalStart = server.start.bind(server);
|
|
269
270
|
server.start = (async (startOptions) => {
|
|
270
|
-
if ((startOptions?.transportType ??
|
|
271
|
+
if ((startOptions?.transportType ?? TRANSPORT_TYPES.stdio) === TRANSPORT_TYPES.stdio) {
|
|
271
272
|
configureStdioTransportLogging();
|
|
272
273
|
}
|
|
273
274
|
return originalStart(startOptions);
|
package/src/documentation.ts
CHANGED
|
@@ -125,9 +125,15 @@ async function resolveGlobalEntryUrl(): Promise<string | null> {
|
|
|
125
125
|
const execDir = path.dirname(process.execPath);
|
|
126
126
|
// npm global roots by platform (each entry is a resolution starting point,
|
|
127
127
|
// so `<entry>/node_modules` is checked):
|
|
128
|
-
// - POSIX (nvm, system
|
|
128
|
+
// - POSIX (nvm, system): <prefix>/lib/node_modules
|
|
129
129
|
// - Windows (node.exe in <prefix>): <prefix>/node_modules
|
|
130
130
|
const paths = [path.join(execDir, '..', 'lib'), execDir];
|
|
131
|
+
// Homebrew runs node from <prefix>/Cellar/node/<version>/bin but installs global
|
|
132
|
+
// packages into <prefix>/lib/node_modules.
|
|
133
|
+
const cellarIndex = execDir.lastIndexOf(`${path.sep}Cellar${path.sep}`);
|
|
134
|
+
if (cellarIndex !== -1) {
|
|
135
|
+
paths.push(path.join(execDir.slice(0, cellarIndex), 'lib'));
|
|
136
|
+
}
|
|
131
137
|
const pkgJsonPath = require.resolve(`${PACKAGE_NAME}/package.json`, {
|
|
132
138
|
paths,
|
|
133
139
|
});
|
package/src/server.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import type {FastMCP} from 'fastmcp';
|
|
2
|
+
|
|
1
3
|
import type {AppiumMcpPlugin} from './core.js';
|
|
2
4
|
import {createAppiumMcpServer} from './create-server.js';
|
|
3
5
|
import {isDocumentationEnabled, loadDocumentationPlugin} from './documentation.js';
|
|
4
6
|
|
|
5
|
-
export default async function createDefaultServer(
|
|
6
|
-
|
|
7
|
+
export default async function createDefaultServer(
|
|
8
|
+
additionalPlugins: readonly AppiumMcpPlugin[] = [],
|
|
9
|
+
): Promise<FastMCP> {
|
|
10
|
+
const plugins = [...additionalPlugins];
|
|
7
11
|
|
|
8
12
|
// Documentation tools (RAG docs query + skills) are opt-in. They live in a
|
|
9
13
|
// separate package only installed when the user sets
|
|
@@ -11,9 +15,9 @@ export default async function createDefaultServer(additionalPlugins: AppiumMcpPl
|
|
|
11
15
|
if (isDocumentationEnabled()) {
|
|
12
16
|
const documentationPlugin = await loadDocumentationPlugin();
|
|
13
17
|
if (documentationPlugin) {
|
|
14
|
-
plugins.
|
|
18
|
+
plugins.unshift(documentationPlugin);
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
return
|
|
22
|
+
return createAppiumMcpServer({plugins});
|
|
19
23
|
}
|
|
@@ -21,9 +21,7 @@ export interface IOSRecordingOptions {
|
|
|
21
21
|
videoQuality?: 'low' | 'medium' | 'high' | 'photo' | number;
|
|
22
22
|
/** Frames per second. Default: 10. */
|
|
23
23
|
videoFps?: number;
|
|
24
|
-
/**
|
|
25
|
-
videoFilters?: string;
|
|
26
|
-
/** Scaling value (e.g. 1280:720). Ignored if videoFilters is set. @see https://trac.ffmpeg.org/wiki/Scaling */
|
|
24
|
+
/** Width:height, each 1–16384; one dimension may be -1 or -2 to preserve the aspect ratio. */
|
|
27
25
|
videoScale?: string;
|
|
28
26
|
/** Output pixel format. Run `ffmpeg -pix_fmts` for options. Use yuv420p with videoType=libx264 for QuickTime compatibility. */
|
|
29
27
|
pixelFormat?: string;
|
|
@@ -78,8 +76,19 @@ const screenRecordingSchema = z.object({
|
|
|
78
76
|
.describe('iOS only. Video quality preset. Default: medium.'),
|
|
79
77
|
videoFps: z.number().int().min(1).max(60).optional().describe('iOS only. Frames per second. Default: 10.'),
|
|
80
78
|
videoType: z.string().optional().describe('iOS only. Video codec to use (e.g. libx264).'),
|
|
81
|
-
|
|
82
|
-
videoScale: z
|
|
79
|
+
// XCUITest embeds this value in an FFmpeg filtergraph. Accept dimensions only.
|
|
80
|
+
videoScale: z
|
|
81
|
+
.string()
|
|
82
|
+
.regex(
|
|
83
|
+
/^(?:[1-9]\d{0,4}|-[12]):(?:[1-9]\d{0,4}|-[12])(?![\s\S])/,
|
|
84
|
+
'Use width:height (e.g. 1280:720 or -2:720), without filter expressions.',
|
|
85
|
+
)
|
|
86
|
+
.refine((value) => {
|
|
87
|
+
const dimensions = value.split(':').map(Number);
|
|
88
|
+
return dimensions.every((dimension) => dimension <= 16384) && dimensions.some((dimension) => dimension > 0);
|
|
89
|
+
}, 'Dimensions must be 1–16384; only one dimension may be -1 or -2.')
|
|
90
|
+
.optional()
|
|
91
|
+
.describe('iOS only. Width:height, each 1–16384 (e.g. 1280:720); one may be -1 or -2 to preserve aspect ratio.'),
|
|
83
92
|
pixelFormat: z.string().optional().describe('iOS only. Output pixel format (e.g. yuv420p).'),
|
|
84
93
|
hardwareAcceleration: z
|
|
85
94
|
.enum(['videoToolbox', 'cuda', 'amf_dx11', 'qsv', 'vaapi'])
|
|
@@ -144,9 +153,6 @@ export default function screenRecording(server: FastMCP): void {
|
|
|
144
153
|
}
|
|
145
154
|
iosOptions.videoType = args.videoType ?? 'libx264';
|
|
146
155
|
iosOptions.pixelFormat = args.pixelFormat ?? 'yuv420p';
|
|
147
|
-
if (args.videoFilters !== undefined) {
|
|
148
|
-
iosOptions.videoFilters = args.videoFilters;
|
|
149
|
-
}
|
|
150
156
|
if (args.videoScale !== undefined) {
|
|
151
157
|
iosOptions.videoScale = args.videoScale;
|
|
152
158
|
}
|
package/src/transport.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type {FastMCP} from 'fastmcp';
|
|
2
|
+
|
|
3
|
+
export type ServerStartOptions = NonNullable<Parameters<FastMCP['start']>[0]>;
|
|
4
|
+
|
|
5
|
+
export const TRANSPORT_TYPES = {
|
|
6
|
+
stdio: 'stdio',
|
|
7
|
+
httpStream: 'httpStream',
|
|
8
|
+
} as const satisfies Record<string, ServerStartOptions['transportType']>;
|
|
9
|
+
|
|
10
|
+
export const DEFAULT_HTTP_STREAM_OPTIONS = {
|
|
11
|
+
endpoint: '/sse',
|
|
12
|
+
port: 8080,
|
|
13
|
+
} as const satisfies NonNullable<ServerStartOptions['httpStream']>;
|