digital-ai-testing-mcp 2.3.4 → 2.4.0-beta.1

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.
@@ -0,0 +1,21 @@
1
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
+ export type SetupContext = 'client-config' | 'docker' | 'source';
3
+ /**
4
+ * Pure: the install path decides first (npx and npm installs are never containers); otherwise a container marker or an
5
+ * explicit MCP_DEPLOYMENT_MODE=docker (set by the published image) means Docker.
6
+ */
7
+ export declare function setupContext(opts: {
8
+ modulePath: string;
9
+ deploymentModeEnv?: string;
10
+ inContainer: boolean;
11
+ }): SetupContext;
12
+ export declare function detectSetupContext(): SetupContext;
13
+ /**
14
+ * The text every tool returns in setup mode. `namedProfiles` are DAI_PROFILE_* names that were found (no keys);
15
+ * `storeNote` says why the credential store did not supply a starting connection (never contains a key).
16
+ */
17
+ export declare function setupGuidance(missing: string[], ctx: SetupContext, namedProfiles?: string[], storeNote?: string): string;
18
+ /** Opens the server instructions in setup mode — clients read instructions before the agent plans. */
19
+ export declare function setupInstructionsBlock(missing: string[]): string;
20
+ export declare function setupRequiredResult(text: string): CallToolResult;
21
+ //# sourceMappingURL=setup-guidance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-guidance.d.ts","sourceRoot":"","sources":["../../src/utils/setup-guidance.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAIjE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,GAAG,YAAY,CAKzH;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAOjD;AAuBD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,GAAE,MAAM,EAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAuB5H;AAED,sGAAsG;AACtG,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAMhE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAEhE"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Setup mode — what the server says when it starts without credentials.
3
+ *
4
+ * Before: a missing DIGITAL_AI_BASE_URL / DIGITAL_AI_ACCESS_KEY made the process exit, and the client showed only
5
+ * "-32000 Failed to reconnect". Now the server starts, the server instructions open with a SETUP REQUIRED block, and
6
+ * every tool answers with the same instructions instead of running (index.ts passes `setupModeHandler` as the
7
+ * registerWithToolsets wrapper). Nothing calls the API in this state.
8
+ *
9
+ * The instructions depend on how the server was installed, because that decides where the variables go:
10
+ * client-config — npx / npm install: the `env` block of the server's entry in the AI client's configuration
11
+ * docker — the .env file passed with --env-file (or -e flags)
12
+ * source — a source checkout: the client's `env` block, or .env in the folder the server starts from
13
+ * The text never contains a credential value.
14
+ */
15
+ import { existsSync } from 'node:fs';
16
+ import { fileURLToPath } from 'node:url';
17
+ const CONFIG_DOCS = 'https://github.com/digitalai-opensource/digital-ai-testing-mcp#configuration';
18
+ /**
19
+ * Pure: the install path decides first (npx and npm installs are never containers); otherwise a container marker or an
20
+ * explicit MCP_DEPLOYMENT_MODE=docker (set by the published image) means Docker.
21
+ */
22
+ export function setupContext(opts) {
23
+ const p = opts.modulePath.replace(/\\/g, '/');
24
+ if (p.includes('/_npx/') || p.includes('/node_modules/digital-ai-testing-mcp/'))
25
+ return 'client-config';
26
+ if (opts.inContainer || opts.deploymentModeEnv?.trim().toLowerCase() === 'docker')
27
+ return 'docker';
28
+ return 'source';
29
+ }
30
+ export function detectSetupContext() {
31
+ return setupContext({
32
+ modulePath: fileURLToPath(import.meta.url),
33
+ // Read directly (not getDeploymentMode): its default is `docker`, and only an EXPLICIT value says anything here.
34
+ deploymentModeEnv: process.env.MCP_DEPLOYMENT_MODE,
35
+ inContainer: existsSync('/.dockerenv'),
36
+ });
37
+ }
38
+ function whereToSet(ctx) {
39
+ switch (ctx) {
40
+ case 'client-config':
41
+ return ("Add them to the `env` block of this server's entry in the AI client's MCP configuration (for example " +
42
+ 'claude_desktop_config.json, .vscode/mcp.json, .cursor/mcp.json, ~/.claude.json or ~/.codex/config.toml), ' +
43
+ 'together with MCP_DEPLOYMENT_MODE=local.');
44
+ case 'docker':
45
+ return ('Add them to the .env file the container is started with (--env-file), or pass them with -e. On Windows, write ' +
46
+ 'the .env path with forward slashes (C:/path/to/.env).');
47
+ case 'source':
48
+ return ("Add them to the `env` block of this server's entry in the AI client's MCP configuration, or to a .env file in " +
49
+ 'the folder the server starts from.');
50
+ }
51
+ }
52
+ /**
53
+ * The text every tool returns in setup mode. `namedProfiles` are DAI_PROFILE_* names that were found (no keys);
54
+ * `storeNote` says why the credential store did not supply a starting connection (never contains a key).
55
+ */
56
+ export function setupGuidance(missing, ctx, namedProfiles = [], storeNote) {
57
+ const lines = [
58
+ `SETUP REQUIRED — the Digital.ai Testing MCP server is not configured: ${missing.join(' and ')} ${missing.length === 1 ? 'is' : 'are'} not set, so no tool can run.`,
59
+ 'Tell the user what to do (below). Do not ask them to paste an access key into this chat.',
60
+ '',
61
+ `How to fix: ${whereToSet(ctx)} Then restart the AI client or reconnect this MCP server.`,
62
+ '',
63
+ ' DIGITAL_AI_BASE_URL=https://your-tenant.experitest.com',
64
+ ' DIGITAL_AI_ACCESS_KEY=<your access key>',
65
+ '',
66
+ 'The access key is in the Digital.ai Testing portal: click your name (top right) → Access Key. It belongs to the ' +
67
+ 'project selected in the portal.',
68
+ ];
69
+ if (namedProfiles.length > 0) {
70
+ lines.push('', `Named profiles were found (${namedProfiles.join(', ')}), but the default connection is required as well: set ` +
71
+ 'DIGITAL_AI_BASE_URL and DIGITAL_AI_ACCESS_KEY to the connection to use at start.');
72
+ }
73
+ if (storeNote)
74
+ lines.push('', storeNote);
75
+ lines.push('', `Configuration reference: ${CONFIG_DOCS}`);
76
+ return lines.join('\n');
77
+ }
78
+ /** Opens the server instructions in setup mode — clients read instructions before the agent plans. */
79
+ export function setupInstructionsBlock(missing) {
80
+ return (`SETUP REQUIRED: this server has no Digital.ai credentials (${missing.join(', ')} not set). Every tool returns ` +
81
+ 'setup instructions instead of running. Before anything else, tell the user the server needs configuring and give ' +
82
+ 'them those instructions (call get_server_info to get them).\n\n');
83
+ }
84
+ export function setupRequiredResult(text) {
85
+ return { content: [{ type: 'text', text }], isError: true };
86
+ }
87
+ //# sourceMappingURL=setup-guidance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-guidance.js","sourceRoot":"","sources":["../../src/utils/setup-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC,MAAM,WAAW,GAAG,8EAA8E,CAAC;AAEnG;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAA8E;IACzG,MAAM,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC9C,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;QAAE,OAAO,eAAe,CAAC;IACxG,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IACnG,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,YAAY,CAAC;QA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,CAAC,EAAE,EAAE,4BAA4B,WAAW,EAAE,CAAC,CAAC;IAC1D,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,sBAAsB,CAAC,OAAiB;IACtD,OAAO,CACL,8DAA8D,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,gCAAgC;QAChH,mHAAmH;QACnH,iEAAiE,CAClE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC9D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "digital-ai-testing-mcp",
3
- "version": "2.3.4",
3
+ "version": "2.4.0-beta.1",
4
4
  "description": "MCP server for Digital.ai Testing — device farm, app lifecycle, test runs, reporting and analytics, performance, live mobile and browser inspection, and test authoring",
5
5
  "keywords": [
6
6
  "mcp",
@@ -127,5 +127,8 @@
127
127
  },
128
128
  "overrides": {
129
129
  "minimatch": "^11.0.6"
130
+ },
131
+ "optionalDependencies": {
132
+ "@napi-rs/keyring": "2.1.2"
130
133
  }
131
134
  }