@extentos/mcp-server 0.2.0 → 0.4.0

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.
@@ -9,4 +9,28 @@ export interface McpContent {
9
9
  }
10
10
  export declare function okResponse(payload: unknown): McpContent;
11
11
  export declare function errorResponse(error: StandardError, extra?: Record<string, unknown>): McpContent;
12
+ export interface AuthRequiredBody {
13
+ error?: {
14
+ code?: string;
15
+ message?: string;
16
+ fixHint?: string;
17
+ retryable?: boolean;
18
+ };
19
+ userCode?: unknown;
20
+ verificationUrl?: unknown;
21
+ deviceCode?: unknown;
22
+ expiresInSeconds?: unknown;
23
+ pollIntervalSeconds?: unknown;
24
+ tier?: unknown;
25
+ meterRemaining?: unknown;
26
+ }
27
+ /**
28
+ * Build the canonical `auth_required` tool response from a backend 402 body.
29
+ * Shared by every account-gated tool (createSimulatorSession,
30
+ * generateConnectionModule) so the device-code surface — userCode /
31
+ * verificationUrl / deviceCode / poll timing — is identical everywhere. `extra`
32
+ * carries tool-specific fields (e.g. createSimulatorSession's autoOpen/autoLink
33
+ * status).
34
+ */
35
+ export declare function surfaceAuthRequired(body: AuthRequiredBody, extra?: Record<string, unknown>): McpContent;
12
36
  //# sourceMappingURL=response.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/tools/response.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,UAAU;IACzB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAIvD;AAED,wBAAgB,aAAa,C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M,GAClC,UAAU,CAoBZ"}
@@ -16,4 +16,30 @@ export function errorResponse(error, extra) {
16
16
  isError: true,
17
17
  };
18
18
  }
19
+ /**
20
+ * Build the canonical `auth_required` tool response from a backend 402 body.
21
+ * Shared by every account-gated tool (createSimulatorSession,
22
+ * generateConnectionModule) so the device-code surface — userCode /
23
+ * verificationUrl / deviceCode / poll timing — is identical everywhere. `extra`
24
+ * carries tool-specific fields (e.g. createSimulatorSession's autoOpen/autoLink
25
+ * status).
26
+ */
27
+ export function surfaceAuthRequired(body, extra = {}) {
28
+ return errorResponse({
29
+ code: body.error?.code ?? "account_required",
30
+ message: body.error?.message ?? "Sign in to Extentos to continue.",
31
+ fixHint: body.error?.fixHint ?? "Sign in to continue.",
32
+ retryable: body.error?.retryable ?? true,
33
+ }, {
34
+ status: "auth_required",
35
+ userCode: body.userCode,
36
+ verificationUrl: body.verificationUrl,
37
+ deviceCode: body.deviceCode,
38
+ expiresInSeconds: body.expiresInSeconds,
39
+ pollIntervalSeconds: body.pollIntervalSeconds,
40
+ tier: body.tier,
41
+ meterRemaining: body.meterRemaining,
42
+ ...extra,
43
+ });
44
+ }
19
45
  //# sourceMappingURL=response.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/tools/response.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gFAAgF;AAUhF,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KACpE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAoB,EAAE,KAA+B;IACjF,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,CA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gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,GAAG,KAAK;KACT,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extentos/mcp-server",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Extentos MCP server — deterministic tools for building Meta-glasses apps.",
5
5
  "type": "module",
6
6
  "bin": {