@tinycloud/mcp 0.10.0-beta.5 → 0.10.0-beta.51

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/dist/index.cjs CHANGED
@@ -48,6 +48,7 @@ var import_node_path = require("path");
48
48
  var import_server = require("@modelcontextprotocol/server");
49
49
  var import_ajv = require("@modelcontextprotocol/server/validators/ajv");
50
50
  var import_operations = require("@tinycloud/operations");
51
+ var import_tc_apps = require("@tinycloud/operations/tc-apps");
51
52
 
52
53
  // src/results.ts
53
54
  function toMcpToolResult(result, bindings = [], options = {}) {
@@ -206,8 +207,7 @@ var TOOL_NAMES = [
206
207
  "tinycloud_apps_context",
207
208
  "tinycloud_apps_read",
208
209
  "tinycloud_apps_write",
209
- "tinycloud_apps_query",
210
- "tinycloud_apps_move"
210
+ "tinycloud_apps_query"
211
211
  ];
212
212
  function invocationTargetForMcp(selection) {
213
213
  return {
@@ -431,7 +431,7 @@ var TOOL_BINDINGS = [
431
431
  operationVersion: 1,
432
432
  readOnlyHint: false,
433
433
  idempotentHint: true,
434
- destructiveHint: true,
434
+ destructiveHint: false,
435
435
  openWorldHint: false,
436
436
  surfaces: ["hosted", "public"]
437
437
  },
@@ -461,19 +461,9 @@ var TOOL_BINDINGS = [
461
461
  operationVersion: 1,
462
462
  readOnlyHint: false,
463
463
  idempotentHint: true,
464
- destructiveHint: true,
465
- openWorldHint: false,
466
- surfaces: ["hosted", "public"]
467
- },
468
- {
469
- name: "tinycloud_apps_move",
470
- operationId: "tinycloud.apps.move",
471
- operationVersion: 1,
472
- readOnlyHint: false,
473
- idempotentHint: true,
474
464
  destructiveHint: false,
475
465
  openWorldHint: false,
476
- surfaces: ["hosted"]
466
+ surfaces: ["hosted", "public"]
477
467
  }
478
468
  ];
479
469
  var definitions = new Map(generatedCatalog.operations.map((operation) => [
@@ -484,18 +474,50 @@ var definitions = new Map(generatedCatalog.operations.map((operation) => [
484
474
  result: toMcpJsonSchema(operation.result)
485
475
  }
486
476
  ]));
477
+ var CATALOG_APP_TOOLS = [
478
+ "tinycloud_knowledge_list",
479
+ "tinycloud_knowledge_read",
480
+ "tinycloud_sql_query",
481
+ "tinycloud_sql_execute"
482
+ ];
483
+ var APP_WITHOUT_CATALOG_APPS = "Pass one existing personal app id to request its task access together.";
484
+ function withPropertyDescription(schema, property, description) {
485
+ const properties = schema.properties;
486
+ const current = properties?.[property];
487
+ if (current === void 0) throw new Error(`Generated operations catalog has no ${property} input to describe.`);
488
+ return { ...schema, properties: { ...properties, [property]: { ...current, description } } };
489
+ }
490
+ function catalogAppRefusal(binding, profile, input) {
491
+ const app = typeof input === "object" && input !== null ? input.app : void 0;
492
+ if (typeof app !== "string" || !Object.hasOwn(import_tc_apps.TC_APPS_CATALOG_APPS, app)) return void 0;
493
+ const { title, link } = import_tc_apps.TC_APPS_CATALOG_APPS[app];
494
+ return {
495
+ status: "error",
496
+ operation: { operationId: binding.operationId, operationVersion: binding.operationVersion },
497
+ context: { profile, host: "unresolved", posture: "unauthenticated" },
498
+ error: {
499
+ code: "INPUT_INVALID",
500
+ message: `${title} is not available through this connector. Its page is ${link}. If the user asked for ${title}, tell them so and give them that link. For any other personal records, call tinycloud_apps_context without app.`,
501
+ retryable: false,
502
+ details: { reason: "catalog_app_unavailable", app, link }
503
+ }
504
+ };
505
+ }
487
506
  function createJsonSchemaValidator() {
488
507
  return new import_ajv.AjvJsonSchemaValidator();
489
508
  }
490
509
  function registerTinyCloudTools(server, selection, validator) {
491
510
  const bindings = TOOL_BINDINGS.filter((binding) => bindingSurfaces(binding).includes(selection.surface) && (selection.allowedTools === void 0 || selection.allowedTools.includes(binding.name)));
511
+ const servesCatalogApps = CATALOG_APP_TOOLS.every((name) => bindings.some((binding) => binding.name === name));
492
512
  for (const binding of bindings) {
493
513
  const operation = definitions.get(`${binding.operationId}@${binding.operationVersion}`);
494
514
  if (operation === void 0) {
495
515
  throw new Error(`Generated operations catalog is missing ${binding.operationId}@${binding.operationVersion}.`);
496
516
  }
517
+ const offersCatalogApps = servesCatalogApps || binding.operationId !== "tinycloud.apps.context";
518
+ const inputJsonSchema = offersCatalogApps ? operation.input : withPropertyDescription(operation.input, "app", APP_WITHOUT_CATALOG_APPS);
497
519
  const inputSchema = (0, import_server.fromJsonSchema)(
498
- operation.input,
520
+ inputJsonSchema,
499
521
  validator
500
522
  );
501
523
  const outputSchema = (0, import_server.fromJsonSchema)(
@@ -503,6 +525,7 @@ function registerTinyCloudTools(server, selection, validator) {
503
525
  validator
504
526
  );
505
527
  const annotations = {
528
+ ...selection.annotationTitles === true ? { title: operation.title } : {},
506
529
  readOnlyHint: binding.readOnlyHint,
507
530
  idempotentHint: binding.idempotentHint,
508
531
  destructiveHint: binding.destructiveHint,
@@ -522,19 +545,22 @@ function registerTinyCloudTools(server, selection, validator) {
522
545
  const metrics = { replayedGrants: 0 };
523
546
  let code = "INTERNAL_ERROR";
524
547
  try {
525
- await selection.beforeOperation?.();
526
- const result = await (0, import_operations.invokeOperation)(
527
- binding.operationId,
528
- binding.operationVersion,
529
- invocationTargetForMcp(selection),
530
- input,
531
- metrics
532
- );
533
- const projected = selection.transformOperationResult === void 0 ? result : await selection.transformOperationResult(result, {
534
- operationId: binding.operationId,
535
- operationVersion: binding.operationVersion,
536
- input
537
- });
548
+ let projected = offersCatalogApps ? void 0 : catalogAppRefusal(binding, selection.profile, input);
549
+ if (projected === void 0) {
550
+ await selection.beforeOperation?.();
551
+ const result = await (0, import_operations.invokeOperation)(
552
+ binding.operationId,
553
+ binding.operationVersion,
554
+ invocationTargetForMcp(selection),
555
+ input,
556
+ metrics
557
+ );
558
+ projected = selection.transformOperationResult === void 0 ? result : await selection.transformOperationResult(result, {
559
+ operationId: binding.operationId,
560
+ operationVersion: binding.operationVersion,
561
+ input
562
+ });
563
+ }
538
564
  const response = toMcpToolResult(projected, bindings, {
539
565
  surface: selection.surface === "local" ? "local" : "hosted",
540
566
  readOnly: binding.readOnlyHint,
@@ -566,7 +592,7 @@ function outcomeCode(result) {
566
592
  // package.json
567
593
  var package_default = {
568
594
  name: "@tinycloud/mcp",
569
- version: "0.10.0-beta.5",
595
+ version: "0.10.0-beta.51",
570
596
  description: "TinyCloud delegated operations MCP server",
571
597
  keywords: [
572
598
  "tinycloud",
@@ -637,9 +663,10 @@ var package_default = {
637
663
  dependencies: {
638
664
  "@modelcontextprotocol/node": "2.0.0-beta.5",
639
665
  "@modelcontextprotocol/server": "2.0.0-beta.5",
640
- "@tinycloud/node-sdk": "3.12.0-beta.2",
641
- "@tinycloud/node-sdk-wasm": "1.7.8",
642
- "@tinycloud/operations": "0.9.0-beta.4",
666
+ "@tinycloud/node-sdk": "3.12.0-beta.38",
667
+ "@tinycloud/sdk-core": "3.12.0-beta.37",
668
+ "@tinycloud/node-sdk-wasm": "1.7.9-beta.0",
669
+ "@tinycloud/operations": "0.9.0-beta.45",
643
670
  jose: "6.2.4"
644
671
  },
645
672
  devDependencies: {
@@ -1017,6 +1044,7 @@ function claims(token) {
1017
1044
  }
1018
1045
 
1019
1046
  // src/remote-store.ts
1047
+ var import_sdk_core = require("@tinycloud/sdk-core");
1020
1048
  var import_node_crypto3 = require("crypto");
1021
1049
  var import_promises = require("fs/promises");
1022
1050
  var import_node_path3 = require("path");
@@ -1026,7 +1054,7 @@ var import_artifacts = require("@tinycloud/operations/artifacts");
1026
1054
  var import_state = require("@tinycloud/operations/state");
1027
1055
  var import_operations2 = require("@tinycloud/operations");
1028
1056
  var import_mcp_authority = require("@tinycloud/operations/mcp-authority");
1029
- var import_tc_apps = require("@tinycloud/operations/tc-apps");
1057
+ var import_tc_apps2 = require("@tinycloud/operations/tc-apps");
1030
1058
 
1031
1059
  // src/native-auth.ts
1032
1060
  var import_node_crypto2 = require("crypto");
@@ -1096,7 +1124,7 @@ var NATIVE_GRANT_IMPORT_REJECTION_CODES = /* @__PURE__ */ new Set([
1096
1124
  "DELEGATION_HOST_MISMATCH",
1097
1125
  "DELEGATION_REJECTED"
1098
1126
  ]);
1099
- var LEGACY_DEFAULT_NODE_HOST = "https://node.tinycloud.xyz";
1127
+ var PRODUCTION_NODE_HOSTS = /* @__PURE__ */ new Set(["https://node.tinycloud.xyz", "https://tee.node.tinycloud.xyz"]);
1100
1128
  var BOOTSTRAP_PERMISSIONS = [
1101
1129
  {
1102
1130
  service: "tinycloud.kv",
@@ -1422,7 +1450,7 @@ var RemoteTenantStore = class {
1422
1450
  kind: "openkey",
1423
1451
  requestId,
1424
1452
  url: this.#connectUrl(pending),
1425
- fallback: (0, import_tc_apps.tcAppsApprovalMessage)(requested) ?? "Open the approval URL, then retry the same MCP tool."
1453
+ fallback: (0, import_tc_apps2.tcAppsApprovalMessage)(requested) ?? "Open the approval URL, then retry the same MCP tool."
1426
1454
  }
1427
1455
  };
1428
1456
  }
@@ -1457,7 +1485,7 @@ var RemoteTenantStore = class {
1457
1485
  kind: "openkey",
1458
1486
  requestId,
1459
1487
  url: this.#connectUrl(pending),
1460
- fallback: (0, import_tc_apps.tcAppsApprovalMessage)(requested) ?? "Open the approval URL, then retry the same MCP tool."
1488
+ fallback: (0, import_tc_apps2.tcAppsApprovalMessage)(requested) ?? "Open the approval URL, then retry the same MCP tool."
1461
1489
  },
1462
1490
  retry: (0, import_mcp_authority.operationRetryDescriptor)(invocation, invocation.input)
1463
1491
  };
@@ -1519,14 +1547,16 @@ var RemoteTenantStore = class {
1519
1547
  did: tenant.sessionDid,
1520
1548
  callback: callback.toString(),
1521
1549
  host: this.#config.nodeHost,
1522
- jwk: Buffer.from(JSON.stringify(publicJwk(tenant.jwk))).toString("base64url"),
1550
+ requesterOrigin: this.#config.publicUrl.origin,
1551
+ jwk: Buffer.from(JSON.stringify((0, import_node_sdk2.publicJwk)(tenant.jwk))).toString("base64url"),
1523
1552
  permissions: Buffer.from(JSON.stringify({
1524
1553
  permissions: pending.permissions,
1525
1554
  reason: [
1526
- pending.kind === "bootstrap" ? "Connect this TinyCloud account to the hosted MCP delegate." : (0, import_tc_apps.tcAppsApprovalReason)(pending.permissions) ?? "Approve the exact capabilities requested by the TinyCloud MCP operation.",
1555
+ pending.kind === "bootstrap" ? "Connect this TinyCloud account to the hosted MCP delegate." : (0, import_tc_apps2.tcAppsApprovalReason)(pending.permissions) ?? "Approve the exact capabilities requested by the TinyCloud MCP operation.",
1527
1556
  // Owner DIDs come from the verified OpenKey access token of the MCP
1528
- // client that created this link, never from the link itself.
1529
- ...pending.ownerDids.length === 0 ? [] : [`Requested by TinyCloud account ${pending.ownerDids.join(", ")}; approve only if that is you.`]
1557
+ // client that created this link, never from the link itself. The
1558
+ // callback refuses a signer outside them, so the approver isn't asked to check.
1559
+ ...pending.ownerDids.length === 0 ? [] : [`Requested by TinyCloud account ${pending.ownerDids.join(", ")}.`]
1530
1560
  ].join(" ")
1531
1561
  })).toString("base64url"),
1532
1562
  expiry: this.#config.delegationExpiry
@@ -1825,10 +1855,10 @@ var RemoteTenantStore = class {
1825
1855
  authMethod: "openkey",
1826
1856
  openkeyHost: this.#config.openkeyHost
1827
1857
  });
1828
- } else if (typeof profile.host === "string" && profile.host.replace(/\/+$/, "") === LEGACY_DEFAULT_NODE_HOST && this.#config.nodeHost.replace(/\/+$/, "") !== LEGACY_DEFAULT_NODE_HOST) {
1858
+ } else if (typeof profile.host === "string" && PRODUCTION_NODE_HOSTS.has(profile.host.replace(/\/+$/, "")) && PRODUCTION_NODE_HOSTS.has(this.#config.nodeHost.replace(/\/+$/, "")) && profile.host.replace(/\/+$/, "") !== this.#config.nodeHost.replace(/\/+$/, "")) {
1829
1859
  await secureWrite(profilePath, { ...profile, host: this.#config.nodeHost });
1830
1860
  process.stderr.write(
1831
- `[tinycloud-mcp-http] tenant node host migrated: from=${LEGACY_DEFAULT_NODE_HOST} to=${new URL(this.#config.nodeHost).origin}
1861
+ `[tinycloud-mcp-http] tenant node host migrated: from=${profile.host.replace(/\/+$/, "")} to=${new URL(this.#config.nodeHost).origin}
1832
1862
  `
1833
1863
  );
1834
1864
  }
@@ -2134,11 +2164,6 @@ function sessionFromCallback(data, privateJwk) {
2134
2164
  signature: data.signature
2135
2165
  };
2136
2166
  }
2137
- function publicJwk(jwk) {
2138
- const copy = { ...jwk };
2139
- for (const field of ["d", "p", "q", "dp", "dq", "qi", "oth", "k"]) delete copy[field];
2140
- return copy;
2141
- }
2142
2167
  function samePrincipal(left, right) {
2143
2168
  if (typeof left !== "string") return false;
2144
2169
  try {
@@ -2151,6 +2176,7 @@ function normalizeDid(value) {
2151
2176
  return value.split("#", 1)[0];
2152
2177
  }
2153
2178
  function sameNodeHost(left, right) {
2179
+ if (PRODUCTION_NODE_HOSTS.has(left) && (0, import_sdk_core.sameTinyCloudNode)(left, right)) return true;
2154
2180
  try {
2155
2181
  const normalize = (value) => {
2156
2182
  const url = new URL(value);
@@ -2245,36 +2271,47 @@ function samePendingRequest(pending, expected) {
2245
2271
  // src/http.ts
2246
2272
  var REQUIRED_SCOPE = "tinycloud:mcp";
2247
2273
  var MCP_CORS_ALLOWED_HEADERS = "Authorization, Content-Type, Accept, Mcp-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Mcp-Method, Mcp-Name";
2274
+ var MCP_CORS_EXPOSED_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
2248
2275
  var LOCAL_CLI_PACKAGE = ["@tinycloud", "cli"].join("/");
2249
2276
  var LOCAL_MCP_PACKAGE = ["@tinycloud", "mcp"].join("/");
2277
+ var RESTRICTED_ADDRESS_PREFIXES = ["chatgpt", "claude", "grok", "muse"];
2278
+ var ANNOTATION_TITLE_PREFIXES = /* @__PURE__ */ new Set(["claude"]);
2250
2279
  function createHostedMcpApp(config) {
2251
2280
  if (config.nativeServiceCredential !== void 0 && Buffer.byteLength(config.nativeServiceCredential, "utf8") < 32) {
2252
2281
  throw new Error("TC_MCP_NATIVE_SERVICE_CREDENTIAL must contain at least 32 bytes.");
2253
2282
  }
2254
2283
  const resourceUrl = canonicalResourceUrl(config.publicUrl);
2255
- const pluginUrl = new URL("./chatgpt/mcp", resourceUrl);
2256
2284
  const statusFor = (resource) => config.introspection === void 0 ? void 0 : createTokenStatusChecker({ ...config.introspection, resourceUrl: resource.toString() });
2257
2285
  const hosted = createHostedSurface(config, resourceUrl, "hosted", statusFor(resourceUrl));
2258
- const plugin = createHostedSurface({
2259
- ...config,
2260
- nativeServiceCredential: void 0,
2261
- stateDir: (0, import_node_path4.join)(config.stateDir, "chatgpt"),
2262
- approvalPath: new URL("./connect", pluginUrl).pathname
2263
- }, pluginUrl, "public", statusFor(pluginUrl));
2264
- const pluginPaths = {
2265
- [pluginUrl.pathname]: true,
2266
- [new URL("./connect", pluginUrl).pathname]: true,
2267
- [new URL("./connect/callback", pluginUrl).pathname]: true,
2268
- [new URL((0, import_server5.getOAuthProtectedResourceMetadataUrl)(pluginUrl)).pathname]: true
2269
- };
2286
+ const surfaces = [hosted];
2287
+ const restrictedByPath = /* @__PURE__ */ new Map();
2288
+ for (const prefix of RESTRICTED_ADDRESS_PREFIXES) {
2289
+ const restrictedUrl = new URL(`./${prefix}/mcp`, resourceUrl);
2290
+ const connectUrl = new URL("./connect", restrictedUrl);
2291
+ const restricted = createHostedSurface({
2292
+ ...config,
2293
+ nativeServiceCredential: void 0,
2294
+ stateDir: (0, import_node_path4.join)(config.stateDir, prefix),
2295
+ approvalPath: connectUrl.pathname
2296
+ }, restrictedUrl, "public", statusFor(restrictedUrl), ANNOTATION_TITLE_PREFIXES.has(prefix));
2297
+ surfaces.push(restricted);
2298
+ for (const owned of [
2299
+ restrictedUrl,
2300
+ connectUrl,
2301
+ new URL("./connect/callback", restrictedUrl),
2302
+ new URL((0, import_server5.getOAuthProtectedResourceMetadataUrl)(restrictedUrl))
2303
+ ]) {
2304
+ restrictedByPath.set(owned.pathname, restricted);
2305
+ }
2306
+ }
2270
2307
  return {
2271
- fetch: (request) => (pluginPaths[new URL(request.url).pathname] === true ? plugin : hosted).fetch(request),
2308
+ fetch: (request) => (restrictedByPath.get(new URL(request.url).pathname) ?? hosted).fetch(request),
2272
2309
  close: async () => {
2273
- await Promise.all([hosted.close(), plugin.close()]);
2310
+ await Promise.all(surfaces.map((surface) => surface.close()));
2274
2311
  }
2275
2312
  };
2276
2313
  }
2277
- function createHostedSurface(config, resourceUrl, surface, tokenStatus) {
2314
+ function createHostedSurface(config, resourceUrl, surface, tokenStatus, annotationTitles = false) {
2278
2315
  const connectPath = config.approvalPath ?? "/connect";
2279
2316
  const callbackPath = `${connectPath}/callback`;
2280
2317
  const issuer = String(config.oauthMetadata.issuer);
@@ -2314,6 +2351,7 @@ function createHostedSurface(config, resourceUrl, surface, tokenStatus) {
2314
2351
  explicitProfile: true,
2315
2352
  allowOwnerProfile: false,
2316
2353
  stateRoot,
2354
+ annotationTitles,
2317
2355
  ...nativeOwner === void 0 ? {} : {
2318
2356
  allowedTools: ["tinycloud_sql_query", "tinycloud_kv_get", "tinycloud_read"]
2319
2357
  },
@@ -2322,7 +2360,7 @@ function createHostedSurface(config, resourceUrl, surface, tokenStatus) {
2322
2360
  transformOperationResult: (result, invocation) => store.decorateAuthorityResult(subject, ownerDids, result, invocation)
2323
2361
  } : {}
2324
2362
  }, validator);
2325
- if (nativeOwner === void 0) registerConnectTool(server, validator, store, identity, surface);
2363
+ if (nativeOwner === void 0) registerConnectTool(server, validator, store, identity, surface, annotationTitles);
2326
2364
  return server;
2327
2365
  }, {
2328
2366
  legacy: "stateless",
@@ -2542,10 +2580,12 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
2542
2580
  try {
2543
2581
  const destination = await store.approvalRedirect(requiredState(url));
2544
2582
  return Response.redirect(destination, 302);
2545
- } catch {
2583
+ } catch (error) {
2584
+ const reason = error instanceof ApprovalRequestError ? error.detail : "unknown";
2585
+ writeDiagnostic(`connect rejected: reason=${reason} path=${connectPath}`);
2546
2586
  if (request.headers.get("accept")?.includes("text/html")) {
2547
2587
  return new Response(
2548
- '<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>TinyCloud approval unavailable</title><main><h1>This approval link is unavailable</h1><p>It may have expired or already been used. No new approval was accepted through this link.</p><p>Return to the conversation that requested access. In ChatGPT, select @TinyCloud and ask it to continue your original request. If access is still needed, it can provide a fresh approval link.</p><p>If you declined access, no further approval is required. Never paste passwords, codes or approval links into support messages.</p></main></html>',
2588
+ '<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>TinyCloud approval unavailable</title><main><h1>This approval link is unavailable</h1><p>It may have expired or already been used. Go back to the assistant that sent it and ask it to connect TinyCloud again.</p><p>If you declined access, no further approval is required. Never paste passwords, codes or approval links into support messages.</p></main></html>',
2549
2589
  {
2550
2590
  status: 400,
2551
2591
  headers: {
@@ -2667,7 +2707,8 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
2667
2707
  close: () => handler.close()
2668
2708
  };
2669
2709
  }
2670
- function registerConnectTool(server, validator, store, identity, surface) {
2710
+ function registerConnectTool(server, validator, store, identity, surface, annotationTitles) {
2711
+ const title = "Connect TinyCloud";
2671
2712
  const inputSchema = (0, import_server5.fromJsonSchema)({ type: "object", properties: {}, additionalProperties: false }, validator);
2672
2713
  const outputSchema = (0, import_server5.fromJsonSchema)({
2673
2714
  type: "object",
@@ -2683,11 +2724,12 @@ function registerConnectTool(server, validator, store, identity, surface) {
2683
2724
  server.registerTool(
2684
2725
  "tinycloud_connect",
2685
2726
  {
2686
- title: "Connect TinyCloud",
2727
+ title,
2687
2728
  description: "Check the hosted delegate connection and return a one-time OpenKey approval URL when setup is required.",
2688
2729
  inputSchema,
2689
2730
  outputSchema,
2690
2731
  annotations: {
2732
+ ...annotationTitles ? { title } : {},
2691
2733
  readOnlyHint: false,
2692
2734
  idempotentHint: true,
2693
2735
  destructiveHint: false,
@@ -2756,7 +2798,7 @@ function mcpCors(response, request) {
2756
2798
  if (request.headers.has("origin")) {
2757
2799
  headers.set("access-control-allow-origin", "*");
2758
2800
  headers.set("access-control-allow-methods", "GET, POST, DELETE, OPTIONS");
2759
- headers.set("access-control-expose-headers", "WWW-Authenticate");
2801
+ headers.set("access-control-expose-headers", MCP_CORS_EXPOSED_HEADERS);
2760
2802
  if (request.method === "OPTIONS") headers.set("access-control-allow-headers", MCP_CORS_ALLOWED_HEADERS);
2761
2803
  }
2762
2804
  return new Response(response.body, { status: response.status, statusText: response.statusText, headers });