@layervai/qurl-mcp 0.4.0 → 0.4.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.
Files changed (74) hide show
  1. package/README.md +5 -1
  2. package/dist/client.d.ts +111 -22
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +161 -77
  5. package/dist/client.js.map +1 -1
  6. package/dist/index.js +3 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/prompts/secure-a-service.d.ts +16 -4
  9. package/dist/prompts/secure-a-service.d.ts.map +1 -1
  10. package/dist/prompts/secure-a-service.js +7 -15
  11. package/dist/prompts/secure-a-service.js.map +1 -1
  12. package/dist/server.d.ts +7 -3
  13. package/dist/server.d.ts.map +1 -1
  14. package/dist/server.js +8 -0
  15. package/dist/server.js.map +1 -1
  16. package/dist/tools/_shared.d.ts +4 -2
  17. package/dist/tools/_shared.d.ts.map +1 -1
  18. package/dist/tools/_shared.js +15 -3
  19. package/dist/tools/_shared.js.map +1 -1
  20. package/dist/tools/batch-create.d.ts +31 -339
  21. package/dist/tools/batch-create.d.ts.map +1 -1
  22. package/dist/tools/batch-create.js +1 -0
  23. package/dist/tools/batch-create.js.map +1 -1
  24. package/dist/tools/create-qurl.d.ts +37 -234
  25. package/dist/tools/create-qurl.d.ts.map +1 -1
  26. package/dist/tools/create-qurl.js +25 -28
  27. package/dist/tools/create-qurl.js.map +1 -1
  28. package/dist/tools/delete-qurl.d.ts +3 -21
  29. package/dist/tools/delete-qurl.d.ts.map +1 -1
  30. package/dist/tools/delete-qurl.js +18 -5
  31. package/dist/tools/delete-qurl.js.map +1 -1
  32. package/dist/tools/extend-qurl.d.ts +34 -188
  33. package/dist/tools/extend-qurl.d.ts.map +1 -1
  34. package/dist/tools/get-qurl.d.ts +34 -184
  35. package/dist/tools/get-qurl.d.ts.map +1 -1
  36. package/dist/tools/get-qurl.js +3 -2
  37. package/dist/tools/get-qurl.js.map +1 -1
  38. package/dist/tools/list-qurl-sessions.d.ts +44 -0
  39. package/dist/tools/list-qurl-sessions.d.ts.map +1 -0
  40. package/dist/tools/list-qurl-sessions.js +33 -0
  41. package/dist/tools/list-qurl-sessions.js.map +1 -0
  42. package/dist/tools/list-qurls.d.ts +36 -318
  43. package/dist/tools/list-qurls.d.ts.map +1 -1
  44. package/dist/tools/list-qurls.js +41 -18
  45. package/dist/tools/list-qurls.js.map +1 -1
  46. package/dist/tools/mint-link.d.ts +34 -301
  47. package/dist/tools/mint-link.d.ts.map +1 -1
  48. package/dist/tools/mint-link.js +12 -9
  49. package/dist/tools/mint-link.js.map +1 -1
  50. package/dist/tools/output-schemas.d.ts +266 -1109
  51. package/dist/tools/output-schemas.d.ts.map +1 -1
  52. package/dist/tools/output-schemas.js +96 -20
  53. package/dist/tools/output-schemas.js.map +1 -1
  54. package/dist/tools/resolve-qurl.d.ts +4 -36
  55. package/dist/tools/resolve-qurl.d.ts.map +1 -1
  56. package/dist/tools/resolve-qurl.js +2 -2
  57. package/dist/tools/resolve-qurl.js.map +1 -1
  58. package/dist/tools/revoke-qurl-token.d.ts +40 -0
  59. package/dist/tools/revoke-qurl-token.d.ts.map +1 -0
  60. package/dist/tools/revoke-qurl-token.js +40 -0
  61. package/dist/tools/revoke-qurl-token.js.map +1 -0
  62. package/dist/tools/terminate-qurl-sessions.d.ts +40 -0
  63. package/dist/tools/terminate-qurl-sessions.d.ts.map +1 -0
  64. package/dist/tools/terminate-qurl-sessions.js +64 -0
  65. package/dist/tools/terminate-qurl-sessions.js.map +1 -0
  66. package/dist/tools/update-qurl-token.d.ts +141 -0
  67. package/dist/tools/update-qurl-token.d.ts.map +1 -0
  68. package/dist/tools/update-qurl-token.js +75 -0
  69. package/dist/tools/update-qurl-token.js.map +1 -0
  70. package/dist/tools/update-qurl.d.ts +41 -263
  71. package/dist/tools/update-qurl.d.ts.map +1 -1
  72. package/dist/tools/update-qurl.js +56 -7
  73. package/dist/tools/update-qurl.js.map +1 -1
  74. package/package.json +4 -3
package/README.md CHANGED
@@ -35,7 +35,7 @@ Replace `lv_live_xxx` with your actual API key. The key must have the appropriat
35
35
  | Tool | Description | Required Scope |
36
36
  |------|-------------|----------------|
37
37
  | `create_qurl` | Create a secure, policy-bound link to a protected resource | `qurl:write` |
38
- | `resolve_qurl` | Resolve an access token to get the target URL and open firewall access | `qurl:resolve` |
38
+ | `resolve_qurl` | Resolve an access token to get the target URL and grant network access | `qurl:resolve` |
39
39
  | `list_qurls` | List active qURLs with optional pagination | `qurl:read` |
40
40
  | `get_qurl` | Get details of a specific qURL by resource ID | `qurl:read` |
41
41
  | `delete_qurl` | Revoke a qURL, immediately invalidating the link | `qurl:write` |
@@ -43,6 +43,10 @@ Replace `lv_live_xxx` with your actual API key. The key must have the appropriat
43
43
  | `update_qurl` | Update expiration, tags, or description on an active qURL | `qurl:write` |
44
44
  | `mint_link` | Mint a new access link for an existing protected resource | `qurl:write` |
45
45
  | `batch_create_qurls` | Create multiple qURLs in a single call | `qurl:write` |
46
+ | `revoke_qurl_token` | Revoke one qURL token without revoking sibling tokens on the resource | `qurl:write` |
47
+ | `update_qurl_token` | Update expiry, label, policy, or session limits on one qURL token | `qurl:write` |
48
+ | `list_qurl_sessions` | List active access sessions for a qURL resource | `qurl:read` |
49
+ | `terminate_qurl_sessions` | Terminate one or all active sessions for a qURL resource | `qurl:write` |
46
50
 
47
51
  ## Available Resources
48
52
 
package/dist/client.d.ts CHANGED
@@ -1,33 +1,53 @@
1
1
  /**
2
2
  * qURL API client for the MCP server.
3
+ *
4
+ * The exported `QURLClient` is a thin adapter over the published
5
+ * `@layervai/qurl` SDK: the SDK owns all HTTP, retry, and error-parsing
6
+ * behavior, and this file translates between the SDK's surface and the local
7
+ * domain types/`IQURLClient` contract the tools, resources, and output schemas
8
+ * are written against (`{ data }` wrapping, the `qurls` field name, and the
9
+ * `QURLAPIError` error class).
3
10
  */
4
11
  export interface QURLClientConfig {
5
12
  apiKey: string;
6
13
  baseURL: string;
7
14
  }
15
+ export interface TombstoneInfo {
16
+ tombstoned_at: string;
17
+ final_access_count?: number;
18
+ }
8
19
  export interface AccessToken {
9
20
  qurl_id: string;
10
21
  label?: string;
11
- status: "active" | "consumed" | "expired" | "revoked";
12
- one_time_use: boolean;
13
- max_sessions: number;
14
- session_duration: number;
15
- use_count: number;
22
+ status: "active" | "consumed" | "expired" | "revoked" | "unknown";
23
+ one_time_use?: boolean;
24
+ max_sessions?: number;
25
+ session_duration?: number;
26
+ use_count?: number;
16
27
  qurl_site?: string;
17
28
  access_policy?: AccessPolicy;
18
- created_at: string;
19
- expires_at: string;
29
+ created_at?: string;
30
+ expires_at?: string;
31
+ }
32
+ export interface SessionData {
33
+ session_id: string;
34
+ qurl_id?: string;
35
+ src_ip?: string;
36
+ user_agent?: string;
37
+ created_at?: string;
38
+ last_seen_at?: string;
20
39
  }
21
40
  export interface QURL {
22
41
  resource_id: string;
23
42
  qurl_site?: string;
24
- target_url: string;
43
+ target_url?: string;
25
44
  description?: string;
26
45
  tags?: string[];
27
46
  expires_at: string;
28
47
  created_at: string;
29
- status: "active" | "revoked";
48
+ status: "active" | "revoked" | "expired" | "unknown";
30
49
  custom_domain?: string | null;
50
+ slug?: string;
31
51
  preserve_host?: boolean;
32
52
  qurl_count?: number;
33
53
  qurls?: AccessToken[];
@@ -36,9 +56,11 @@ export interface CreateQURLData {
36
56
  qurl_id: string;
37
57
  resource_id: string;
38
58
  qurl_link: string;
59
+ branded_domain?: string;
39
60
  qurl_site: string;
40
61
  expires_at: string;
41
62
  label?: string;
63
+ type?: string;
42
64
  }
43
65
  export interface AIAgentPolicy {
44
66
  block_all?: boolean;
@@ -55,6 +77,8 @@ export interface AccessPolicy {
55
77
  ai_agent_policy?: AIAgentPolicy;
56
78
  }
57
79
  export interface CreateQURLInput {
80
+ /** Resource type for integrations that are allowed to mint non-url qURLs. Defaults to "url". */
81
+ type?: string;
58
82
  target_url: string;
59
83
  label?: string;
60
84
  expires_in?: string;
@@ -87,6 +111,10 @@ export interface UpdateQURLInput {
87
111
  expires_at?: string;
88
112
  tags?: string[];
89
113
  description?: string;
114
+ }
115
+ export interface UpdateResourceInput {
116
+ tags?: string[];
117
+ description?: string;
90
118
  custom_domain?: string;
91
119
  preserve_host?: boolean;
92
120
  }
@@ -108,6 +136,14 @@ export interface MintLinkInput {
108
136
  export interface BatchCreateInput {
109
137
  items: CreateQURLInput[];
110
138
  }
139
+ export interface UpdateQurlTokenInput {
140
+ extend_by?: string;
141
+ expires_at?: string;
142
+ label?: string;
143
+ access_policy?: AccessPolicy;
144
+ max_sessions?: number;
145
+ session_duration?: string;
146
+ }
111
147
  export interface ListQURLsOutput {
112
148
  data: QURL[];
113
149
  meta: {
@@ -147,14 +183,18 @@ export interface QuotaOutput {
147
183
  };
148
184
  }
149
185
  export interface MintLinkOutput {
186
+ qurl_id: string;
150
187
  qurl_link: string;
188
+ branded_domain?: string;
151
189
  expires_at: string;
190
+ type?: string;
152
191
  }
153
192
  export type BatchItemResult = {
154
193
  index: number;
155
194
  success: true;
156
195
  resource_id: string;
157
196
  qurl_link: string;
197
+ branded_domain?: string;
158
198
  qurl_site: string;
159
199
  expires_at: string;
160
200
  } | {
@@ -175,6 +215,20 @@ export interface BatchCreateOutput {
175
215
  request_id?: string;
176
216
  };
177
217
  }
218
+ export interface SessionListOutput {
219
+ data: SessionData[];
220
+ meta?: {
221
+ request_id?: string;
222
+ };
223
+ }
224
+ export interface SessionTerminateOutput {
225
+ data: {
226
+ terminated: number;
227
+ };
228
+ meta?: {
229
+ request_id?: string;
230
+ };
231
+ }
178
232
  export interface IQURLClient {
179
233
  /**
180
234
  * Create a new qURL. Returns `CreateQURLData` — the ephemeral create-time
@@ -197,6 +251,9 @@ export interface IQURLClient {
197
251
  updateQURL(id: string, input: UpdateQURLInput): Promise<{
198
252
  data: QURL;
199
253
  }>;
254
+ updateResource(id: string, input: UpdateResourceInput): Promise<{
255
+ data: QURL;
256
+ }>;
200
257
  extendQURL(id: string, input: ExtendQURLInput): Promise<{
201
258
  data: QURL;
202
259
  }>;
@@ -210,6 +267,13 @@ export interface IQURLClient {
210
267
  data: MintLinkOutput;
211
268
  }>;
212
269
  batchCreate(input: BatchCreateInput): Promise<BatchCreateOutput>;
270
+ revokeQurlToken(resourceId: string, qurlId: string): Promise<void>;
271
+ updateQurlToken(resourceId: string, qurlId: string, input: UpdateQurlTokenInput): Promise<{
272
+ data: AccessToken;
273
+ }>;
274
+ listResourceSessions(resourceId: string): Promise<SessionListOutput>;
275
+ terminateResourceSession(resourceId: string, sessionId: string): Promise<void>;
276
+ terminateAllResourceSessions(resourceId: string): Promise<SessionTerminateOutput>;
213
277
  }
214
278
  /**
215
279
  * Error thrown by `QURLClient` for any API or pre-flight failure.
@@ -225,31 +289,46 @@ export declare class QURLAPIError extends Error {
225
289
  type?: string | undefined;
226
290
  instance?: string | undefined;
227
291
  requestId?: string | undefined;
228
- constructor(statusCode: number, code: string, message: string, type?: string | undefined, instance?: string | undefined, requestId?: string | undefined);
292
+ tombstone?: TombstoneInfo | undefined;
293
+ constructor(statusCode: number, code: string, message: string, type?: string | undefined, instance?: string | undefined, requestId?: string | undefined, tombstone?: TombstoneInfo | undefined);
229
294
  }
230
295
  /**
231
296
  * Shared message for the missing-API-key condition. Emitted both at boot
232
- * (stderr warning in `index.ts`) and on every API call from `request()`.
297
+ * (stderr warning in `index.ts`) and on every API call (the lazy `sdk` getter
298
+ * throws it when no key is configured).
233
299
  * Keeping a single string means a user grepping logs/transcripts hits the
234
300
  * same phrase from both sites, and the CI introspection probe has a stable
235
301
  * substring to assert against.
236
302
  */
237
303
  export declare const MISSING_API_KEY_MESSAGE = "QURL_API_KEY is not set. Set it in the MCP server environment and restart to make API calls.";
304
+ /**
305
+ * Adapter implementing {@link IQURLClient} over the `@layervai/qurl` SDK.
306
+ *
307
+ * The SDK owns HTTP, retries, and error parsing. This class only translates
308
+ * shapes (re-wraps the SDK's unwrapped returns into `{ data }`, renames
309
+ * `access_tokens` → `qurls`, reshapes list/batch/session envelopes) and maps
310
+ * the SDK's `QURLError` subclasses onto `QURLAPIError`.
311
+ */
238
312
  export declare class QURLClient implements IQURLClient {
239
- private apiKey;
240
- private baseURL;
313
+ private readonly apiKey;
314
+ private readonly baseURL;
315
+ /**
316
+ * Constructed lazily on first API call. The SDK constructor throws on an
317
+ * empty key, but `index.ts` deliberately boots the server keyless so MCP
318
+ * introspection (tools/list, resources/list, prompts/list) works without a
319
+ * configured key — the missing-key error must defer to the first real call.
320
+ */
321
+ private _sdk?;
241
322
  constructor(config: QURLClientConfig);
242
323
  /**
243
- * Issue an HTTP request and parse the JSON response.
244
- *
245
- * `passthroughStatuses` lets a caller opt certain non-2xx codes out of the
246
- * default throw-on-error path and receive the parsed body instead. This is
247
- * used by `batchCreate`, where the API returns a structured BatchCreateResponse
248
- * on HTTP 400 (all items rejected) — throwing would drop the per-item errors.
324
+ * Lazily build the SDK client. Throws the typed `missing_api_key` error
325
+ * (status 0) when no key is configured, matching the pre-SDK behavior that
326
+ * `withMissingApiKeyHandler` and the CI introspection probe rely on. Note
327
+ * the SDK option is `baseUrl` (lowercase) vs. the MCP config's `baseURL`.
249
328
  */
250
- private request;
251
- private parseJSON;
252
- private qurlPath;
329
+ private get sdk();
330
+ /** Run an SDK call, translating its errors into `QURLAPIError`. */
331
+ private call;
253
332
  createQURL(input: CreateQURLInput): Promise<{
254
333
  data: CreateQURLData;
255
334
  }>;
@@ -261,6 +340,9 @@ export declare class QURLClient implements IQURLClient {
261
340
  updateQURL(id: string, input: UpdateQURLInput): Promise<{
262
341
  data: QURL;
263
342
  }>;
343
+ updateResource(id: string, input: UpdateResourceInput): Promise<{
344
+ data: QURL;
345
+ }>;
264
346
  extendQURL(id: string, input: ExtendQURLInput): Promise<{
265
347
  data: QURL;
266
348
  }>;
@@ -274,5 +356,12 @@ export declare class QURLClient implements IQURLClient {
274
356
  data: MintLinkOutput;
275
357
  }>;
276
358
  batchCreate(input: BatchCreateInput): Promise<BatchCreateOutput>;
359
+ revokeQurlToken(resourceId: string, qurlId: string): Promise<void>;
360
+ updateQurlToken(resourceId: string, qurlId: string, input: UpdateQurlTokenInput): Promise<{
361
+ data: AccessToken;
362
+ }>;
363
+ listResourceSessions(resourceId: string): Promise<SessionListOutput>;
364
+ terminateResourceSession(resourceId: string, sessionId: string): Promise<void>;
365
+ terminateAllResourceSessions(resourceId: string): Promise<SessionTerminateOutput>;
277
366
  }
278
367
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IACtD,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,IAAI;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,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AE,IAAI,CAAA;KAAE,CAAC;IAI/E,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;IAIvE,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,aAAa,CAAA;KAAE,CAAC;IAIlE,QAAQ,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC;IAI1C,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,CAAC;IAI9E,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAkBhE,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlE,eAAe,CACnB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC;IAa3B,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAUpE,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9E,4BAA4B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;CASxF"}
package/dist/client.js CHANGED
@@ -1,6 +1,14 @@
1
1
  /**
2
2
  * qURL API client for the MCP server.
3
+ *
4
+ * The exported `QURLClient` is a thin adapter over the published
5
+ * `@layervai/qurl` SDK: the SDK owns all HTTP, retry, and error-parsing
6
+ * behavior, and this file translates between the SDK's surface and the local
7
+ * domain types/`IQURLClient` contract the tools, resources, and output schemas
8
+ * are written against (`{ data }` wrapping, the `qurls` field name, and the
9
+ * `QURLAPIError` error class).
3
10
  */
11
+ import { QURLClient as SDKQURLClient, QURLError } from "@layervai/qurl";
4
12
  // --- Error class ---
5
13
  /**
6
14
  * Error thrown by `QURLClient` for any API or pre-flight failure.
@@ -16,28 +24,86 @@ export class QURLAPIError extends Error {
16
24
  type;
17
25
  instance;
18
26
  requestId;
19
- constructor(statusCode, code, message, type, instance, requestId) {
27
+ tombstone;
28
+ constructor(statusCode, code, message, type, instance, requestId, tombstone) {
20
29
  super(message);
21
30
  this.statusCode = statusCode;
22
31
  this.code = code;
23
32
  this.type = type;
24
33
  this.instance = instance;
25
34
  this.requestId = requestId;
35
+ this.tombstone = tombstone;
26
36
  this.name = "QURLAPIError";
27
37
  }
28
38
  }
29
39
  /**
30
40
  * Shared message for the missing-API-key condition. Emitted both at boot
31
- * (stderr warning in `index.ts`) and on every API call from `request()`.
41
+ * (stderr warning in `index.ts`) and on every API call (the lazy `sdk` getter
42
+ * throws it when no key is configured).
32
43
  * Keeping a single string means a user grepping logs/transcripts hits the
33
44
  * same phrase from both sites, and the CI introspection probe has a stable
34
45
  * substring to assert against.
35
46
  */
36
47
  export const MISSING_API_KEY_MESSAGE = "QURL_API_KEY is not set. Set it in the MCP server environment and restart to make API calls.";
48
+ // --- SDK adapter helpers ---
49
+ /**
50
+ * Translate an error thrown by the SDK into the `QURLAPIError` the MCP tools
51
+ * branch on. Two consumers depend on the exact fields: `delete-qurl` checks
52
+ * `statusCode === 404`, and `withMissingApiKeyHandler` checks
53
+ * `code === "missing_api_key"`. A `QURLAPIError` we raised ourselves (the
54
+ * missing-key pre-flight) passes through untouched; anything that isn't a
55
+ * `QURLError` is returned as-is.
56
+ */
57
+ function translateError(err) {
58
+ if (err instanceof QURLAPIError)
59
+ return err;
60
+ if (err instanceof QURLError) {
61
+ return new QURLAPIError(err.status, err.code,
62
+ // `QURLError.detail` is non-optional and always populated (the SDK falls
63
+ // back to `title` when the API omits detail), so it carries the same
64
+ // human-readable text the old client's detail/title/message chain did.
65
+ err.detail, err.type, err.instance, err.requestId,
66
+ // 410 tombstone metadata: the SDK's QURLError does not currently surface
67
+ // it, so this is always undefined. Kept for forward-compat and because
68
+ // QURLAPIError carries the field; no MCP tool reads it today.
69
+ err.tombstone);
70
+ }
71
+ return err;
72
+ }
73
+ /**
74
+ * Map an SDK resource read (`QURL`/`Resource`) onto the MCP's `QURL` shape.
75
+ * The only structural difference is the field name for the nested tokens:
76
+ * the SDK exposes `access_tokens`, the MCP's output schemas validate `qurls`.
77
+ * When the SDK omits `access_tokens`, the key is dropped entirely rather than
78
+ * surfaced as `qurls: undefined`.
79
+ */
80
+ function mapResource(raw) {
81
+ const { access_tokens, ...rest } = raw;
82
+ // Drop the key for both `undefined` and a defensive `null`.
83
+ const mapped = access_tokens === undefined || access_tokens === null
84
+ ? rest
85
+ : { ...rest, qurls: access_tokens };
86
+ return mapped;
87
+ }
37
88
  // --- Client implementation ---
89
+ /**
90
+ * Adapter implementing {@link IQURLClient} over the `@layervai/qurl` SDK.
91
+ *
92
+ * The SDK owns HTTP, retries, and error parsing. This class only translates
93
+ * shapes (re-wraps the SDK's unwrapped returns into `{ data }`, renames
94
+ * `access_tokens` → `qurls`, reshapes list/batch/session envelopes) and maps
95
+ * the SDK's `QURLError` subclasses onto `QURLAPIError`.
96
+ */
38
97
  export class QURLClient {
39
98
  apiKey;
40
99
  baseURL;
100
+ /**
101
+ * Constructed lazily on first API call. The SDK constructor throws on an
102
+ * empty key, but `index.ts` deliberately boots the server keyless so MCP
103
+ * introspection (tools/list, resources/list, prompts/list) works without a
104
+ * configured key — the missing-key error must defer to the first real call.
105
+ */
106
+ _sdk;
41
107
  constructor(config) {
42
108
  // `?? ""` defends against JS callers that hand in `undefined` (the TS
43
109
  // type forbids it, but `JSON.parse`'d configs and other dynamic call
@@ -45,112 +111,130 @@ export class QURLClient {
45
111
  // stray `QURL_API_KEY=" "`) takes the typed `missing_api_key` path
46
112
  // instead of being sent over the wire as a server-side 401.
47
113
  this.apiKey = (config.apiKey ?? "").trim();
48
- this.baseURL = config.baseURL.replace(/\/$/, "");
114
+ // `?? ""` mirrors the apiKey guard above: a JS caller passing `undefined`
115
+ // for baseURL (the TS type forbids it; index.ts always supplies a default)
116
+ // gets the default-empty path rather than a raw TypeError from `.replace`.
117
+ this.baseURL = (config.baseURL ?? "").replace(/\/$/, "");
49
118
  }
50
119
  /**
51
- * Issue an HTTP request and parse the JSON response.
52
- *
53
- * `passthroughStatuses` lets a caller opt certain non-2xx codes out of the
54
- * default throw-on-error path and receive the parsed body instead. This is
55
- * used by `batchCreate`, where the API returns a structured BatchCreateResponse
56
- * on HTTP 400 (all items rejected) — throwing would drop the per-item errors.
120
+ * Lazily build the SDK client. Throws the typed `missing_api_key` error
121
+ * (status 0) when no key is configured, matching the pre-SDK behavior that
122
+ * `withMissingApiKeyHandler` and the CI introspection probe rely on. Note
123
+ * the SDK option is `baseUrl` (lowercase) vs. the MCP config's `baseURL`.
57
124
  */
58
- async request(method, path, body, passthroughStatuses = []) {
125
+ get sdk() {
59
126
  if (!this.apiKey) {
60
127
  throw new QURLAPIError(0, "missing_api_key", MISSING_API_KEY_MESSAGE);
61
128
  }
62
- const url = `${this.baseURL}${path}`;
63
- const headers = {
64
- Authorization: `Bearer ${this.apiKey}`,
65
- };
66
- if (body !== undefined) {
67
- headers["Content-Type"] = "application/json";
129
+ if (!this._sdk) {
130
+ this._sdk = new SDKQURLClient({ apiKey: this.apiKey, baseUrl: this.baseURL });
68
131
  }
69
- const response = await fetch(url, {
70
- method,
71
- headers,
72
- body: body !== undefined ? JSON.stringify(body) : undefined,
73
- });
74
- const text = await response.text();
75
- // Handle empty 2xx responses (e.g., 204 No Content from DELETE).
76
- // Only deleteQURL hits this path — T is void there, so undefined is correct.
77
- if (!text && response.ok) {
78
- return undefined;
79
- }
80
- const json = this.parseJSON(text, response.status);
81
- if (!response.ok && !passthroughStatuses.includes(response.status)) {
82
- // Trust boundary: we cast the parsed error body to the RFC 7807 shape
83
- // the API documents. The fallback chain below tolerates missing fields,
84
- // so a malformed error response still degrades to `HTTP ${status}`.
85
- const error = json.error;
86
- const meta = json.meta;
87
- throw new QURLAPIError(response.status, error?.code ?? "unknown", error?.detail ?? error?.title ?? error?.message ?? `HTTP ${response.status}`, error?.type, error?.instance, meta?.request_id);
88
- }
89
- return json;
132
+ return this._sdk;
90
133
  }
91
- parseJSON(text, status) {
134
+ /** Run an SDK call, translating its errors into `QURLAPIError`. */
135
+ async call(fn) {
92
136
  try {
93
- return JSON.parse(text);
137
+ return await fn(this.sdk);
94
138
  }
95
- catch {
96
- throw new QURLAPIError(status, "parse_error", `Failed to parse response: ${text.slice(0, 200)}`);
139
+ catch (err) {
140
+ throw translateError(err);
97
141
  }
98
142
  }
99
- qurlPath(id) {
100
- return `/v1/qurls/${encodeURIComponent(id)}`;
101
- }
143
+ // Casts at the SDK boundary are kept as tight as the compiler allows:
144
+ // inputs pass through unannotated where the MCP type is structurally
145
+ // assignable to the SDK type (a genuine drift then fails to compile), and
146
+ // outputs use a single `as` (not `as unknown as`) so a grossly incompatible
147
+ // SDK return is still rejected. `mapResource`'s `QURL`/`Resource` → MCP
148
+ // `QURL` conversion is the one place a double cast is genuinely required.
149
+ // The tools additionally validate every `structuredContent` against their
150
+ // zod `outputSchema`, so any residual response drift surfaces at runtime.
102
151
  async createQURL(input) {
103
- return this.request("POST", "/v1/qurls", input);
152
+ return this.call(async (sdk) => ({ data: (await sdk.create(input)) }));
104
153
  }
105
154
  async getQURL(id) {
106
- return this.request("GET", this.qurlPath(id));
155
+ return this.call(async (sdk) => ({ data: mapResource(await sdk.get(id)) }));
107
156
  }
108
157
  async listQURLs(input) {
109
- const params = new URLSearchParams();
110
- if (input?.limit !== undefined)
111
- params.set("limit", String(input.limit));
112
- if (input?.cursor)
113
- params.set("cursor", input.cursor);
114
- if (input?.status)
115
- params.set("status", input.status);
116
- if (input?.created_after)
117
- params.set("created_after", input.created_after);
118
- if (input?.created_before)
119
- params.set("created_before", input.created_before);
120
- if (input?.expires_before)
121
- params.set("expires_before", input.expires_before);
122
- if (input?.expires_after)
123
- params.set("expires_after", input.expires_after);
124
- if (input?.sort)
125
- params.set("sort", input.sort);
126
- if (input?.q)
127
- params.set("q", input.q);
128
- const query = params.toString();
129
- return this.request("GET", `/v1/qurls${query ? `?${query}` : ""}`);
158
+ return this.call(async (sdk) => {
159
+ const out = await sdk.list(input);
160
+ // The SDK's list envelope is `{ qurls, next_cursor, has_more }` and does
161
+ // not surface `meta.page_size` / `meta.request_id` (both optional in the
162
+ // output schema), so they are intentionally absent here.
163
+ return {
164
+ data: out.qurls.map(mapResource),
165
+ meta: { next_cursor: out.next_cursor, has_more: out.has_more },
166
+ };
167
+ });
130
168
  }
131
169
  async deleteQURL(id) {
132
- await this.request("DELETE", this.qurlPath(id));
170
+ await this.call((sdk) => sdk.delete(id));
133
171
  }
134
172
  async updateQURL(id, input) {
135
- return this.request("PATCH", this.qurlPath(id), input);
173
+ return this.call(async (sdk) => ({ data: mapResource(await sdk.update(id, input)) }));
174
+ }
175
+ async updateResource(id, input) {
176
+ return this.call(async (sdk) => ({ data: mapResource(await sdk.updateResource(id, input)) }));
136
177
  }
137
178
  async extendQURL(id, input) {
138
- // ExtendQURLInput is a strict subset of UpdateQURLInput (just extend_by),
139
- // so we delegate to updateQURL rather than duplicating the PATCH call.
140
- return this.updateQURL(id, input);
179
+ return this.call(async (sdk) => ({ data: mapResource(await sdk.extend(id, input)) }));
141
180
  }
142
181
  async resolveQURL(input) {
143
- return this.request("POST", "/v1/resolve", input);
182
+ return this.call(async (sdk) => ({ data: (await sdk.resolve(input)) }));
144
183
  }
145
184
  async getQuota() {
146
- return this.request("GET", "/v1/quota");
185
+ return this.call(async (sdk) => ({ data: (await sdk.getQuota()) }));
147
186
  }
148
187
  async mintLink(id, input) {
149
- return this.request("POST", `${this.qurlPath(id)}/mint_link`, input);
188
+ return this.call(async (sdk) => ({ data: (await sdk.mintLink(id, input)) }));
150
189
  }
151
190
  async batchCreate(input) {
152
- // 400 carries per-item errors (see request() JSDoc).
153
- return this.request("POST", "/v1/qurls/batch", input, [400]);
191
+ return this.call(async (sdk) => {
192
+ // The SDK passes through HTTP 400 (all items failed) as a populated
193
+ // BatchCreateOutput rather than throwing, so the all-failed case still
194
+ // reaches here with `failed > 0` — matching the old passthrough behavior
195
+ // that batch-create.ts depends on.
196
+ const out = await sdk.batchCreate(input);
197
+ return {
198
+ data: {
199
+ succeeded: out.succeeded,
200
+ failed: out.failed,
201
+ results: out.results,
202
+ },
203
+ meta: { request_id: out.request_id },
204
+ };
205
+ });
206
+ }
207
+ async revokeQurlToken(resourceId, qurlId) {
208
+ await this.call((sdk) => sdk.revokeResourceQurl(resourceId, qurlId));
209
+ }
210
+ async updateQurlToken(resourceId, qurlId, input) {
211
+ return this.call(async (sdk) => ({
212
+ // The SDK types this input as an extend_by-XOR-expires_at discriminated
213
+ // union; the MCP's UpdateQurlTokenInput allows both fields and enforces
214
+ // the XOR via a zod refinement in update-qurl-token.ts, so bridge here.
215
+ data: (await sdk.updateResourceQurl(resourceId, qurlId, input)),
216
+ }));
217
+ }
218
+ async listResourceSessions(resourceId) {
219
+ return this.call(async (sdk) => {
220
+ const out = await sdk.listResourceSessions(resourceId);
221
+ return {
222
+ data: out.sessions,
223
+ meta: { request_id: out.request_id },
224
+ };
225
+ });
226
+ }
227
+ async terminateResourceSession(resourceId, sessionId) {
228
+ await this.call((sdk) => sdk.terminateResourceSession(resourceId, sessionId));
229
+ }
230
+ async terminateAllResourceSessions(resourceId) {
231
+ return this.call(async (sdk) => {
232
+ const out = await sdk.terminateAllResourceSessions(resourceId);
233
+ return {
234
+ data: { terminated: out.terminated },
235
+ meta: { request_id: out.request_id },
236
+ };
237
+ });
154
238
  }
155
239
  }
156
240
  //# sourceMappingURL=client.js.map