@lovable.dev/mcp-js 3.3.1 → 3.5.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.
Files changed (78) hide show
  1. package/README.internal.md +38 -12
  2. package/README.md +140 -12
  3. package/dist/THIRD_PARTY_NOTICES +75 -0
  4. package/dist/apps-CWG3rGhB.js +132 -0
  5. package/dist/apps-DyoDrwfi.cjs +185 -0
  6. package/dist/{authorize-CoaAw6wg.d.cts → authorize--W1XtwdB.d.cts} +1 -1
  7. package/dist/{authorize-BV62MDan.d.ts → authorize-DpNYioXM.d.ts} +1 -1
  8. package/dist/{base-Cx0spfMk.d.ts → base-Ce9JYirF.d.ts} +1 -1
  9. package/dist/{base-CzWe8AD1.d.cts → base-qEX8YVcD.d.cts} +1 -1
  10. package/dist/cli/check-server.cjs +1 -1
  11. package/dist/cli/check-server.js +1 -1
  12. package/dist/cli/extract-manifest.cjs +1 -1
  13. package/dist/cli/extract-manifest.js +1 -1
  14. package/dist/{cors-3HjrsmEW.cjs → cors-B_Oui5La.cjs} +1 -1
  15. package/dist/{cors-CNNmKKIg.js → cors-D83r8WUF.js} +1 -1
  16. package/dist/dist-CIu-UFye.js +6738 -0
  17. package/dist/dist-CqY2qXpc.cjs +6738 -0
  18. package/dist/{errors-CIpFAb6i.js → errors-CfaxXr2T.js} +15 -2
  19. package/dist/{errors-C97I7VOC.cjs → errors-xJ_7Su1K.cjs} +20 -1
  20. package/dist/index.cjs +2 -1
  21. package/dist/index.d.cts +6 -2
  22. package/dist/index.d.ts +6 -2
  23. package/dist/index.js +2 -2
  24. package/dist/{io-D7cpdBJO.d.ts → io-BEpyfk4G.d.ts} +1 -1
  25. package/dist/{io-CaBSlPwS.cjs → io-CUnV4kTL.cjs} +12 -2
  26. package/dist/{io-DC-Y6R61.d.cts → io-Di5ljvZY.d.cts} +1 -1
  27. package/dist/{io-CahnhUhA.js → io-STpVLkbi.js} +13 -3
  28. package/dist/{mcp-DC8AoD18.js → mcp-BgIFUoo1.js} +110 -49
  29. package/dist/{mcp-DlWLIwX9.cjs → mcp-DpI0wwnW.cjs} +110 -49
  30. package/dist/mcp-app.d.ts +4 -0
  31. package/dist/{package-B488glmj.cjs → package-CuCho6-k.cjs} +1 -1
  32. package/dist/{package-CukfP_vq.js → package-Cz6Z5F_X.js} +1 -1
  33. package/dist/protocols/mcp/index.cjs +1 -1
  34. package/dist/protocols/mcp/index.d.cts +3 -3
  35. package/dist/protocols/mcp/index.d.ts +3 -3
  36. package/dist/protocols/mcp/index.js +1 -1
  37. package/dist/protocols/oauth-metadata.cjs +1 -1
  38. package/dist/protocols/oauth-metadata.d.cts +3 -3
  39. package/dist/protocols/oauth-metadata.d.ts +3 -3
  40. package/dist/protocols/oauth-metadata.js +1 -1
  41. package/dist/src-D7RtXSV0.cjs +311 -0
  42. package/dist/src-sWQwyLwS.js +310 -0
  43. package/dist/stacks/supabase/index.cjs +2 -2
  44. package/dist/stacks/supabase/index.d.cts +1 -1
  45. package/dist/stacks/supabase/index.d.ts +1 -1
  46. package/dist/stacks/supabase/index.js +2 -2
  47. package/dist/stacks/supabase/vite.cjs +10 -1
  48. package/dist/stacks/supabase/vite.d.cts +1 -1
  49. package/dist/stacks/supabase/vite.d.ts +1 -1
  50. package/dist/stacks/supabase/vite.js +21 -12
  51. package/dist/stacks/tanstack/index.cjs +33 -2
  52. package/dist/stacks/tanstack/index.d.cts +7 -4
  53. package/dist/stacks/tanstack/index.d.ts +7 -4
  54. package/dist/stacks/tanstack/index.js +33 -2
  55. package/dist/stacks/tanstack/vite.cjs +995 -15
  56. package/dist/stacks/tanstack/vite.d.cts +1 -1
  57. package/dist/stacks/tanstack/vite.d.ts +1 -1
  58. package/dist/stacks/tanstack/vite.js +1001 -21
  59. package/dist/testing/browser/LICENSE.ext-apps +218 -0
  60. package/dist/testing/browser/host.ts +151 -0
  61. package/dist/testing/browser/sandbox.ts +137 -0
  62. package/dist/testing/browser.cjs +382 -0
  63. package/dist/testing/browser.d.cts +46 -0
  64. package/dist/testing/browser.d.ts +46 -0
  65. package/dist/testing/browser.js +381 -0
  66. package/dist/testing/index.cjs +2 -1
  67. package/dist/testing/index.d.cts +2 -1
  68. package/dist/testing/index.d.ts +2 -1
  69. package/dist/testing/index.js +2 -1
  70. package/dist/testing/server.cjs +36 -0
  71. package/dist/testing/server.d.cts +6 -2
  72. package/dist/testing/server.d.ts +6 -2
  73. package/dist/testing/server.js +36 -1
  74. package/dist/{tool-result-DcNioyiI.js → tool-result-BG-HsSQu.js} +8 -1
  75. package/dist/{tool-result-rU-PpNNi.cjs → tool-result-BQcr7VV-.cjs} +8 -1
  76. package/dist/{types-z7T5bBIU.d.cts → types-B_dVw-zM.d.cts} +55 -1
  77. package/dist/{types-z7T5bBIU.d.ts → types-B_dVw-zM.d.ts} +55 -1
  78. package/package.json +66 -25
@@ -1,8 +1,9 @@
1
1
  const require_schema = require("./schema-DNMsvJwE.cjs");
2
2
  const require_logger = require("./logger-C-Hdu57K.cjs");
3
- const require_errors = require("./errors-C97I7VOC.cjs");
4
- const require_cors = require("./cors-3HjrsmEW.cjs");
5
- const require_tool_result = require("./tool-result-rU-PpNNi.cjs");
3
+ const require_apps = require("./apps-DyoDrwfi.cjs");
4
+ const require_errors = require("./errors-xJ_7Su1K.cjs");
5
+ const require_cors = require("./cors-B_Oui5La.cjs");
6
+ const require_tool_result = require("./tool-result-BQcr7VV-.cjs");
6
7
  let _modelcontextprotocol_sdk_server_zod_compat_js = require("@modelcontextprotocol/sdk/server/zod-compat.js");
7
8
  let _modelcontextprotocol_server = require("@modelcontextprotocol/server");
8
9
  //#region src/core/content.ts
@@ -116,18 +117,18 @@ function createGatedHandler(gate) {
116
117
  const MODERN_PROTOCOL_VERSION = "2026-07-28";
117
118
  const NO_OPERATIONS = {
118
119
  listTools: false,
120
+ exposeApps: false,
119
121
  calledTools: /* @__PURE__ */ new Set()
120
122
  };
121
- function collectRequestOperations(value, calledTools) {
123
+ function collectRequestOperations(value, operations) {
122
124
  if (Array.isArray(value)) {
123
- let listTools = false;
124
- for (const item of value) listTools = collectRequestOperations(item, calledTools) || listTools;
125
- return listTools;
125
+ for (const item of value) collectRequestOperations(item, operations);
126
+ return;
126
127
  }
127
- if (!isPlainObject(value)) return false;
128
- if (value.method === "tools/list") return true;
129
- if (value.method === "tools/call" && isPlainObject(value.params) && typeof value.params.name === "string") calledTools.add(value.params.name);
130
- return false;
128
+ if (!isPlainObject(value)) return;
129
+ if (value.method === "tools/list") operations.listTools = true;
130
+ if (value.method === "initialize" || value.method === "server/discover" || value.method === "resources/list" || value.method === "resources/read" && isPlainObject(value.params) && typeof value.params.uri === "string" && URL.canParse(value.params.uri) && new URL(value.params.uri).protocol === "ui:") operations.exposeApps = true;
131
+ if (value.method === "tools/call" && isPlainObject(value.params) && typeof value.params.name === "string") operations.calledTools.add(value.params.name);
131
132
  }
132
133
  /** Marks a failure in app-owned `createAppContext` or `enabled` code so telemetry
133
134
  * can attribute it to the author rather than to the transport. */
@@ -146,15 +147,17 @@ async function withAppContextError(run) {
146
147
  }
147
148
  async function classifyRequest(request, maxRequestBodySize) {
148
149
  try {
149
- const body = await (0, _modelcontextprotocol_server.readRequestBody)(request.clone(), maxRequestBodySize);
150
+ const body = await (0, _modelcontextprotocol_server.readRequestBody)(request, maxRequestBodySize);
150
151
  if (body.tooLarge) return { operations: NO_OPERATIONS };
151
152
  const parsedBody = JSON.parse(body.text);
152
- const calledTools = /* @__PURE__ */ new Set();
153
+ const operations = {
154
+ listTools: false,
155
+ exposeApps: false,
156
+ calledTools: /* @__PURE__ */ new Set()
157
+ };
158
+ collectRequestOperations(parsedBody, operations);
153
159
  return {
154
- operations: {
155
- listTools: collectRequestOperations(parsedBody, calledTools),
156
- calledTools
157
- },
160
+ operations,
158
161
  parsedBody
159
162
  };
160
163
  } catch {
@@ -324,11 +327,50 @@ function adaptToolCallback(tool, auth, recorder, protocol, appContext) {
324
327
  return {
325
328
  content: result.content ?? [],
326
329
  structuredContent: result.structuredContent,
327
- isError: result.isError
330
+ isError: result.isError,
331
+ _meta: result._meta
328
332
  };
329
333
  };
330
334
  }
331
- const SKILL_CACHE = {
335
+ function appResourceMeta(app) {
336
+ const ui = {};
337
+ if (app.csp) ui.csp = app.csp;
338
+ if (app.permissions) ui.permissions = app.permissions;
339
+ if (app.domain !== void 0) ui.domain = app.domain;
340
+ if (app.prefersBorder !== void 0) ui.prefersBorder = app.prefersBorder;
341
+ return Object.keys(ui).length > 0 ? { ui } : void 0;
342
+ }
343
+ function registerApps(server, apps) {
344
+ for (const app of apps) {
345
+ const uri = require_apps.appResourceUri(app.name);
346
+ const meta = appResourceMeta(app);
347
+ const withMeta = meta ? { _meta: meta } : {};
348
+ server.registerResource(app.name, uri, {
349
+ title: app.title,
350
+ description: app.description,
351
+ mimeType: require_apps.APP_RESOURCE_MIME_TYPE,
352
+ cacheHint: PRIVATE_CACHE,
353
+ ...withMeta
354
+ }, () => ({ contents: [{
355
+ uri,
356
+ mimeType: require_apps.APP_RESOURCE_MIME_TYPE,
357
+ text: app.html,
358
+ ...withMeta
359
+ }] }));
360
+ }
361
+ }
362
+ function toolUiMeta(tool) {
363
+ if (!tool.ui) return void 0;
364
+ const resourceUri = tool.ui.app ? require_apps.appResourceUri(tool.ui.app.name) : void 0;
365
+ return {
366
+ ui: {
367
+ ...resourceUri ? { resourceUri } : {},
368
+ ...tool.ui.visibility ? { visibility: tool.ui.visibility } : {}
369
+ },
370
+ ...resourceUri ? { "ui/resourceUri": resourceUri } : {}
371
+ };
372
+ }
373
+ const PRIVATE_CACHE = {
332
374
  ttlMs: 0,
333
375
  cacheScope: "private"
334
376
  };
@@ -360,14 +402,14 @@ function skillEntry(skill) {
360
402
  function registerSkills(server, skills, era) {
361
403
  const resultMetadata = era === "modern" ? {
362
404
  resultType: "complete",
363
- ...SKILL_CACHE
405
+ ...PRIVATE_CACHE
364
406
  } : {};
365
407
  for (const file of skills.files.values()) {
366
408
  const owner = skills.skillsByUri.get(file.uri);
367
409
  server.registerResource(owner ? owner.frontmatter.name : file.uri, file.uri, {
368
410
  mimeType: file.mimeType,
369
411
  ...owner ? { description: owner.frontmatter.description } : {},
370
- cacheHint: SKILL_CACHE
412
+ cacheHint: PRIVATE_CACHE
371
413
  }, async () => ({ contents: [{
372
414
  uri: file.uri,
373
415
  mimeType: file.mimeType,
@@ -388,16 +430,27 @@ function registerSkills(server, skills, era) {
388
430
  });
389
431
  }
390
432
  async function buildServer(mcp, auth, recorder, era, signal, operations, skills) {
433
+ const hasApps = mcp.tools.some((tool) => tool.ui?.app !== void 0);
391
434
  const calledTools = operations ? mcp.tools.filter((tool) => operations.calledTools.has(tool.name)) : mcp.tools;
392
435
  const selectedTools = !operations || operations.listTools ? mcp.tools : calledTools;
393
- const hasConditionalTools = mcp.tools.some((tool) => tool.enabled !== void 0);
394
- const needsAppContext = skills !== void 0 && skills.prepared === void 0 || operations?.listTools === true && hasConditionalTools || calledTools.some((tool) => tool.enabled !== void 0 || require_errors.toolRequiresAppContext(tool));
436
+ const exposureTools = operations?.exposeApps ? mcp.tools.filter((tool) => tool.ui?.app !== void 0 || selectedTools.includes(tool)) : selectedTools;
437
+ const needsAppContext = skills !== void 0 && skills.prepared === void 0 || exposureTools.some((tool) => tool.enabled !== void 0) || calledTools.some(require_errors.toolRequiresAppContext);
395
438
  const { createAppContext } = mcp;
396
439
  const appContext = needsAppContext && createAppContext ? await withAppContextError(() => createAppContext({
397
440
  auth: new require_errors.AuthContext(auth),
398
441
  signal
399
442
  })) : void 0;
400
443
  const visibilityContext = Object.freeze({ appContext });
444
+ const enabledTools = /* @__PURE__ */ new Set();
445
+ for (const tool of exposureTools) if (await withAppContextError(() => {
446
+ const value = tool.enabled ? tool.enabled(visibilityContext) : true;
447
+ if (typeof value !== "boolean") {
448
+ Promise.resolve(value).catch(() => {});
449
+ throw new TypeError(`@lovable.dev/mcp-js: tool "${tool.name}" enabled must return a boolean synchronously`);
450
+ }
451
+ return value;
452
+ })) enabledTools.add(tool);
453
+ const apps = require_apps.collectApps([...enabledTools]);
401
454
  let preparedSkills = skills?.prepared;
402
455
  if (skills && !preparedSkills) {
403
456
  const enabledSkills = await withAppContextError(() => mcp.skills.flatMap((entry) => {
@@ -418,14 +471,19 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
418
471
  }, {
419
472
  maxToolInputElements: mcp.limits?.maxToolInputElements ?? 1e4,
420
473
  instructions: preparedSkills ? composeInstructions(mcp.instructions, preparedSkills, skills.declared) : mcp.instructions,
421
- capabilities: skills ? {
474
+ capabilities: {
422
475
  tools: { listChanged: false },
423
- resources: {
424
- listChanged: false,
425
- subscribe: false
426
- },
427
- extensions: { [SKILLS_EXTENSION_ID]: {} }
428
- } : { tools: { listChanged: false } },
476
+ ...hasApps || skills ? {
477
+ resources: {
478
+ listChanged: false,
479
+ subscribe: false
480
+ },
481
+ extensions: {
482
+ ...apps.length > 0 ? { [require_apps.UI_EXTENSION_ID]: { mimeTypes: [require_apps.APP_RESOURCE_MIME_TYPE] } } : {},
483
+ ...skills ? { [SKILLS_EXTENSION_ID]: {} } : {}
484
+ }
485
+ } : {}
486
+ },
429
487
  cacheHints: {
430
488
  "tools/list": {
431
489
  ttlMs: 0,
@@ -435,26 +493,22 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
435
493
  ttlMs: 0,
436
494
  cacheScope: "private"
437
495
  },
438
- ...skills ? {
439
- "resources/list": SKILL_CACHE,
440
- "resources/read": SKILL_CACHE
496
+ ...hasApps || skills ? {
497
+ "resources/list": PRIVATE_CACHE,
498
+ "resources/read": PRIVATE_CACHE
441
499
  } : {}
442
500
  }
443
501
  });
502
+ registerApps(server, apps);
444
503
  if (preparedSkills) registerSkills(server, preparedSkills, era);
445
504
  for (const tool of selectedTools) {
446
- if (tool.enabled) {
447
- const { enabled } = tool;
448
- if (!await withAppContextError(() => {
449
- const value = enabled(visibilityContext);
450
- if (typeof value !== "boolean") throw new TypeError(`@lovable.dev/mcp-js: tool "${tool.name}" enabled must return a boolean synchronously`);
451
- return value;
452
- })) continue;
453
- }
505
+ if (!enabledTools.has(tool)) continue;
506
+ const _meta = toolUiMeta(tool);
454
507
  const config = {
455
508
  title: tool.title,
456
509
  description: tool.description,
457
510
  annotations: tool.annotations,
511
+ ..._meta ? { _meta } : {},
458
512
  ...tool.outputSchema ? { outputSchema: standardSchemaFromDefinition(tool.outputSchema, false) } : {}
459
513
  };
460
514
  const callback = adaptToolCallback(tool, auth, recorder, era === "legacy" ? "legacy" : MODERN_PROTOCOL_VERSION, appContext);
@@ -494,21 +548,26 @@ function createMcpProtocolHandler(mcp, options = {}) {
494
548
  outcome: "500 internal error"
495
549
  });
496
550
  };
551
+ let classificationRequest;
497
552
  try {
498
- const classified = mcp.createAppContext || hasSkills ? await classifyRequest(request, maxRequestBodySize) : void 0;
499
- const operations = mcp.createAppContext ? classified?.operations : void 0;
500
- const skills = hasSkills ? {
501
- prepared: preparedSkills,
502
- declared: declaresSkillsSupport(classified?.parsedBody)
503
- } : void 0;
504
- const response = await (0, _modelcontextprotocol_server.createMcpHandler)(({ era, requestInfo }) => buildServer(mcp, authResult.auth, recorder, era, requestInfo?.signal ?? request.signal, operations, skills), {
553
+ classificationRequest = mcp.createAppContext || hasSkills ? request.clone() : void 0;
554
+ const response = await (0, _modelcontextprotocol_server.createMcpHandler)(async ({ era, requestInfo }) => {
555
+ const classified = classificationRequest ? await classifyRequest(classificationRequest, maxRequestBodySize) : void 0;
556
+ const operations = mcp.createAppContext ? classified?.operations : void 0;
557
+ const skills = hasSkills ? {
558
+ prepared: preparedSkills,
559
+ declared: declaresSkillsSupport(classified?.parsedBody)
560
+ } : void 0;
561
+ return buildServer(mcp, authResult.auth, recorder, era, requestInfo?.signal ?? request.signal, operations, skills);
562
+ }, {
505
563
  legacy: "stateless",
506
564
  maxRequestBodySize,
507
565
  maxSubscriptions: 0,
508
566
  onerror: (error) => {
509
567
  protocolError = error;
510
568
  }
511
- }).fetch(request, classified?.parsedBody === void 0 ? void 0 : { parsedBody: classified.parsedBody });
569
+ }).fetch(request);
570
+ response.headers.append("Cache-Control", "no-store");
512
571
  if (response.status >= 500) await reportTransportError(protocolError);
513
572
  return response;
514
573
  } catch (err) {
@@ -521,6 +580,8 @@ function createMcpProtocolHandler(mcp, options = {}) {
521
580
  message: "internal error"
522
581
  }
523
582
  }, { status: 500 });
583
+ } finally {
584
+ if (classificationRequest?.body && !classificationRequest.bodyUsed) classificationRequest.body.cancel().catch(() => {});
524
585
  }
525
586
  };
526
587
  return createGatedHandler({
@@ -0,0 +1,4 @@
1
+ declare module "*.html?mcp-app" {
2
+ const html: string;
3
+ export default html;
4
+ }
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "3.3.1";
2
+ var version = "3.5.0";
3
3
  //#endregion
4
4
  Object.defineProperty(exports, "version", {
5
5
  enumerable: true,
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "3.3.1";
2
+ var version = "3.5.0";
3
3
  //#endregion
4
4
  export { version as t };
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_mcp = require("../../mcp-DlWLIwX9.cjs");
2
+ const require_mcp = require("../../mcp-DpI0wwnW.cjs");
3
3
  exports.createMcpProtocolHandler = require_mcp.createMcpProtocolHandler;
@@ -1,6 +1,6 @@
1
- import { h as McpDefinition } from "../../types-z7T5bBIU.cjs";
2
- import { t as MetricsRecorder } from "../../base-CzWe8AD1.cjs";
3
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-CoaAw6wg.cjs";
1
+ import { y as McpDefinition } from "../../types-B_dVw-zM.cjs";
2
+ import { t as MetricsRecorder } from "../../base-qEX8YVcD.cjs";
3
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize--W1XtwdB.cjs";
4
4
  //#region src/protocols/mcp/protocol.d.ts
5
5
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { h as McpDefinition } from "../../types-z7T5bBIU.js";
2
- import { t as MetricsRecorder } from "../../base-Cx0spfMk.js";
3
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-BV62MDan.js";
1
+ import { y as McpDefinition } from "../../types-B_dVw-zM.js";
2
+ import { t as MetricsRecorder } from "../../base-Ce9JYirF.js";
3
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-DpNYioXM.js";
4
4
  //#region src/protocols/mcp/protocol.d.ts
5
5
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
6
6
  /**
@@ -1,2 +1,2 @@
1
- import { t as createMcpProtocolHandler } from "../../mcp-DC8AoD18.js";
1
+ import { t as createMcpProtocolHandler } from "../../mcp-BgIFUoo1.js";
2
2
  export { createMcpProtocolHandler };
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_logger = require("../logger-C-Hdu57K.cjs");
3
- const require_cors = require("../cors-3HjrsmEW.cjs");
3
+ const require_cors = require("../cors-B_Oui5La.cjs");
4
4
  //#region src/protocols/oauth-metadata.ts
5
5
  function notFound() {
6
6
  return new Response(JSON.stringify({ error: "not found" }), {
@@ -1,6 +1,6 @@
1
- import { h as McpDefinition } from "../types-z7T5bBIU.cjs";
2
- import { t as MetricsRecorder } from "../base-CzWe8AD1.cjs";
3
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-CoaAw6wg.cjs";
1
+ import { y as McpDefinition } from "../types-B_dVw-zM.cjs";
2
+ import { t as MetricsRecorder } from "../base-qEX8YVcD.cjs";
3
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize--W1XtwdB.cjs";
4
4
  //#region src/protocols/oauth-metadata.d.ts
5
5
  type OAuthProtectedResourceMetadataHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
6
6
  declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
@@ -1,6 +1,6 @@
1
- import { h as McpDefinition } from "../types-z7T5bBIU.js";
2
- import { t as MetricsRecorder } from "../base-Cx0spfMk.js";
3
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-BV62MDan.js";
1
+ import { y as McpDefinition } from "../types-B_dVw-zM.js";
2
+ import { t as MetricsRecorder } from "../base-Ce9JYirF.js";
3
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-DpNYioXM.js";
4
4
  //#region src/protocols/oauth-metadata.d.ts
5
5
  type OAuthProtectedResourceMetadataHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
6
6
  declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
@@ -1,5 +1,5 @@
1
1
  import { i as log, r as describeError } from "../logger-CpLgYbCG.js";
2
- import { a as oauthConfigurationErrorResponse, f as JSON_HEADERS, i as normalizeHttpMethod, l as emitBeforeResponse, m as methodNotAllowed, p as finalizeWireResponse, r as getOAuthRuntime, s as resolveProtectedResource, t as evaluateCors, u as createNoopRecorder } from "../cors-CNNmKKIg.js";
2
+ import { a as oauthConfigurationErrorResponse, f as JSON_HEADERS, i as normalizeHttpMethod, l as emitBeforeResponse, m as methodNotAllowed, p as finalizeWireResponse, r as getOAuthRuntime, s as resolveProtectedResource, t as evaluateCors, u as createNoopRecorder } from "../cors-D83r8WUF.js";
3
3
  //#region src/protocols/oauth-metadata.ts
4
4
  function notFound() {
5
5
  return new Response(JSON.stringify({ error: "not found" }), {
@@ -0,0 +1,311 @@
1
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/estree-walker/3.0.3/f149906e2d585666ae890c5dd2fceac84a9263c116ae67fb226fe4bb380de7c4/node_modules/estree-walker/src/walker.js
2
+ /**
3
+ * @typedef { import('estree').Node} Node
4
+ * @typedef {{
5
+ * skip: () => void;
6
+ * remove: () => void;
7
+ * replace: (node: Node) => void;
8
+ * }} WalkerContext
9
+ */
10
+ var WalkerBase = class {
11
+ constructor() {
12
+ /** @type {boolean} */
13
+ this.should_skip = false;
14
+ /** @type {boolean} */
15
+ this.should_remove = false;
16
+ /** @type {Node | null} */
17
+ this.replacement = null;
18
+ /** @type {WalkerContext} */
19
+ this.context = {
20
+ skip: () => this.should_skip = true,
21
+ remove: () => this.should_remove = true,
22
+ replace: (node) => this.replacement = node
23
+ };
24
+ }
25
+ /**
26
+ * @template {Node} Parent
27
+ * @param {Parent | null | undefined} parent
28
+ * @param {keyof Parent | null | undefined} prop
29
+ * @param {number | null | undefined} index
30
+ * @param {Node} node
31
+ */
32
+ replace(parent, prop, index, node) {
33
+ if (parent && prop) if (index != null)
34
+ /** @type {Array<Node>} */ parent[prop][index] = node;
35
+ else
36
+ /** @type {Node} */ parent[prop] = node;
37
+ }
38
+ /**
39
+ * @template {Node} Parent
40
+ * @param {Parent | null | undefined} parent
41
+ * @param {keyof Parent | null | undefined} prop
42
+ * @param {number | null | undefined} index
43
+ */
44
+ remove(parent, prop, index) {
45
+ if (parent && prop) if (index !== null && index !== void 0)
46
+ /** @type {Array<Node>} */ parent[prop].splice(index, 1);
47
+ else delete parent[prop];
48
+ }
49
+ };
50
+ //#endregion
51
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/estree-walker/3.0.3/f149906e2d585666ae890c5dd2fceac84a9263c116ae67fb226fe4bb380de7c4/node_modules/estree-walker/src/sync.js
52
+ /**
53
+ * @typedef { import('estree').Node} Node
54
+ * @typedef { import('./walker.js').WalkerContext} WalkerContext
55
+ * @typedef {(
56
+ * this: WalkerContext,
57
+ * node: Node,
58
+ * parent: Node | null,
59
+ * key: string | number | symbol | null | undefined,
60
+ * index: number | null | undefined
61
+ * ) => void} SyncHandler
62
+ */
63
+ var SyncWalker = class extends WalkerBase {
64
+ /**
65
+ *
66
+ * @param {SyncHandler} [enter]
67
+ * @param {SyncHandler} [leave]
68
+ */
69
+ constructor(enter, leave) {
70
+ super();
71
+ /** @type {boolean} */
72
+ this.should_skip = false;
73
+ /** @type {boolean} */
74
+ this.should_remove = false;
75
+ /** @type {Node | null} */
76
+ this.replacement = null;
77
+ /** @type {WalkerContext} */
78
+ this.context = {
79
+ skip: () => this.should_skip = true,
80
+ remove: () => this.should_remove = true,
81
+ replace: (node) => this.replacement = node
82
+ };
83
+ /** @type {SyncHandler | undefined} */
84
+ this.enter = enter;
85
+ /** @type {SyncHandler | undefined} */
86
+ this.leave = leave;
87
+ }
88
+ /**
89
+ * @template {Node} Parent
90
+ * @param {Node} node
91
+ * @param {Parent | null} parent
92
+ * @param {keyof Parent} [prop]
93
+ * @param {number | null} [index]
94
+ * @returns {Node | null}
95
+ */
96
+ visit(node, parent, prop, index) {
97
+ if (node) {
98
+ if (this.enter) {
99
+ const _should_skip = this.should_skip;
100
+ const _should_remove = this.should_remove;
101
+ const _replacement = this.replacement;
102
+ this.should_skip = false;
103
+ this.should_remove = false;
104
+ this.replacement = null;
105
+ this.enter.call(this.context, node, parent, prop, index);
106
+ if (this.replacement) {
107
+ node = this.replacement;
108
+ this.replace(parent, prop, index, node);
109
+ }
110
+ if (this.should_remove) this.remove(parent, prop, index);
111
+ const skipped = this.should_skip;
112
+ const removed = this.should_remove;
113
+ this.should_skip = _should_skip;
114
+ this.should_remove = _should_remove;
115
+ this.replacement = _replacement;
116
+ if (skipped) return node;
117
+ if (removed) return null;
118
+ }
119
+ /** @type {keyof Node} */
120
+ let key;
121
+ for (key in node) {
122
+ /** @type {unknown} */
123
+ const value = node[key];
124
+ if (value && typeof value === "object") {
125
+ if (Array.isArray(value)) {
126
+ const nodes = value;
127
+ for (let i = 0; i < nodes.length; i += 1) {
128
+ const item = nodes[i];
129
+ if (isNode$1(item)) {
130
+ if (!this.visit(item, node, key, i)) i--;
131
+ }
132
+ }
133
+ } else if (isNode$1(value)) this.visit(value, node, key, null);
134
+ }
135
+ }
136
+ if (this.leave) {
137
+ const _replacement = this.replacement;
138
+ const _should_remove = this.should_remove;
139
+ this.replacement = null;
140
+ this.should_remove = false;
141
+ this.leave.call(this.context, node, parent, prop, index);
142
+ if (this.replacement) {
143
+ node = this.replacement;
144
+ this.replace(parent, prop, index, node);
145
+ }
146
+ if (this.should_remove) this.remove(parent, prop, index);
147
+ const removed = this.should_remove;
148
+ this.replacement = _replacement;
149
+ this.should_remove = _should_remove;
150
+ if (removed) return null;
151
+ }
152
+ }
153
+ return node;
154
+ }
155
+ };
156
+ /**
157
+ * Ducktype a node.
158
+ *
159
+ * @param {unknown} value
160
+ * @returns {value is Node}
161
+ */
162
+ function isNode$1(value) {
163
+ return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string";
164
+ }
165
+ //#endregion
166
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/estree-walker/3.0.3/f149906e2d585666ae890c5dd2fceac84a9263c116ae67fb226fe4bb380de7c4/node_modules/estree-walker/src/async.js
167
+ /**
168
+ * @typedef { import('estree').Node} Node
169
+ * @typedef { import('./walker.js').WalkerContext} WalkerContext
170
+ * @typedef {(
171
+ * this: WalkerContext,
172
+ * node: Node,
173
+ * parent: Node | null,
174
+ * key: string | number | symbol | null | undefined,
175
+ * index: number | null | undefined
176
+ * ) => Promise<void>} AsyncHandler
177
+ */
178
+ var AsyncWalker = class extends WalkerBase {
179
+ /**
180
+ *
181
+ * @param {AsyncHandler} [enter]
182
+ * @param {AsyncHandler} [leave]
183
+ */
184
+ constructor(enter, leave) {
185
+ super();
186
+ /** @type {boolean} */
187
+ this.should_skip = false;
188
+ /** @type {boolean} */
189
+ this.should_remove = false;
190
+ /** @type {Node | null} */
191
+ this.replacement = null;
192
+ /** @type {WalkerContext} */
193
+ this.context = {
194
+ skip: () => this.should_skip = true,
195
+ remove: () => this.should_remove = true,
196
+ replace: (node) => this.replacement = node
197
+ };
198
+ /** @type {AsyncHandler | undefined} */
199
+ this.enter = enter;
200
+ /** @type {AsyncHandler | undefined} */
201
+ this.leave = leave;
202
+ }
203
+ /**
204
+ * @template {Node} Parent
205
+ * @param {Node} node
206
+ * @param {Parent | null} parent
207
+ * @param {keyof Parent} [prop]
208
+ * @param {number | null} [index]
209
+ * @returns {Promise<Node | null>}
210
+ */
211
+ async visit(node, parent, prop, index) {
212
+ if (node) {
213
+ if (this.enter) {
214
+ const _should_skip = this.should_skip;
215
+ const _should_remove = this.should_remove;
216
+ const _replacement = this.replacement;
217
+ this.should_skip = false;
218
+ this.should_remove = false;
219
+ this.replacement = null;
220
+ await this.enter.call(this.context, node, parent, prop, index);
221
+ if (this.replacement) {
222
+ node = this.replacement;
223
+ this.replace(parent, prop, index, node);
224
+ }
225
+ if (this.should_remove) this.remove(parent, prop, index);
226
+ const skipped = this.should_skip;
227
+ const removed = this.should_remove;
228
+ this.should_skip = _should_skip;
229
+ this.should_remove = _should_remove;
230
+ this.replacement = _replacement;
231
+ if (skipped) return node;
232
+ if (removed) return null;
233
+ }
234
+ /** @type {keyof Node} */
235
+ let key;
236
+ for (key in node) {
237
+ /** @type {unknown} */
238
+ const value = node[key];
239
+ if (value && typeof value === "object") {
240
+ if (Array.isArray(value)) {
241
+ const nodes = value;
242
+ for (let i = 0; i < nodes.length; i += 1) {
243
+ const item = nodes[i];
244
+ if (isNode(item)) {
245
+ if (!await this.visit(item, node, key, i)) i--;
246
+ }
247
+ }
248
+ } else if (isNode(value)) await this.visit(value, node, key, null);
249
+ }
250
+ }
251
+ if (this.leave) {
252
+ const _replacement = this.replacement;
253
+ const _should_remove = this.should_remove;
254
+ this.replacement = null;
255
+ this.should_remove = false;
256
+ await this.leave.call(this.context, node, parent, prop, index);
257
+ if (this.replacement) {
258
+ node = this.replacement;
259
+ this.replace(parent, prop, index, node);
260
+ }
261
+ if (this.should_remove) this.remove(parent, prop, index);
262
+ const removed = this.should_remove;
263
+ this.replacement = _replacement;
264
+ this.should_remove = _should_remove;
265
+ if (removed) return null;
266
+ }
267
+ }
268
+ return node;
269
+ }
270
+ };
271
+ /**
272
+ * Ducktype a node.
273
+ *
274
+ * @param {unknown} value
275
+ * @returns {value is Node}
276
+ */
277
+ function isNode(value) {
278
+ return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string";
279
+ }
280
+ //#endregion
281
+ //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/estree-walker/3.0.3/f149906e2d585666ae890c5dd2fceac84a9263c116ae67fb226fe4bb380de7c4/node_modules/estree-walker/src/index.js
282
+ /**
283
+ * @typedef {import('estree').Node} Node
284
+ * @typedef {import('./sync.js').SyncHandler} SyncHandler
285
+ * @typedef {import('./async.js').AsyncHandler} AsyncHandler
286
+ */
287
+ /**
288
+ * @param {Node} ast
289
+ * @param {{
290
+ * enter?: SyncHandler
291
+ * leave?: SyncHandler
292
+ * }} walker
293
+ * @returns {Node | null}
294
+ */
295
+ function walk(ast, { enter, leave }) {
296
+ return new SyncWalker(enter, leave).visit(ast, null);
297
+ }
298
+ /**
299
+ * @param {Node} ast
300
+ * @param {{
301
+ * enter?: AsyncHandler
302
+ * leave?: AsyncHandler
303
+ * }} walker
304
+ * @returns {Promise<Node | null>}
305
+ */
306
+ async function asyncWalk(ast, { enter, leave }) {
307
+ return await new AsyncWalker(enter, leave).visit(ast, null);
308
+ }
309
+ //#endregion
310
+ exports.asyncWalk = asyncWalk;
311
+ exports.walk = walk;