@dereekb/firebase-server 13.24.0 → 13.25.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.
package/mcp/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import { Injectable, Inject, Optional, Logger, Post, Req, Res, Controller, Get }
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
3
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
5
- import { getOidcScopesFromRequest } from '@dereekb/firebase-server/oidc';
5
+ import { getOidcScopesFromRequest, OidcProviderConfigService } from '@dereekb/firebase-server/oidc';
6
6
  import { makeValuesGroupMap, IMPERSONATION_URL_QUERY_PARAM, performAsyncTasks, authRolesSetHasRoles } from '@dereekb/util';
7
7
  import { ModelApiCallModelDispatchService, ModelApiGetService, FirebaseServerStorageService, FirebaseServerEnvService, FirebaseServerAnalyticsService } from '@dereekb/firebase-server';
8
8
  import { inspect } from 'node:util';
@@ -95,6 +95,24 @@ function _define_property$9(obj, key, value) {
95
95
  *
96
96
  * @example 'https://api.example.com/mcp'
97
97
  */ _define_property$9(this, "mcpUrl", void 0);
98
+ /**
99
+ * Optional filter applied to the OIDC provider's scope list when building the
100
+ * protected-resource discovery document's `scopes_supported` (RFC 9728 §2).
101
+ *
102
+ * The base list is pulled automatically from the OIDC provider config via the
103
+ * injected {@link OidcProviderConfigService.scopesSupported} (i.e.
104
+ * `Object.keys(providerConfig.claims)`), so the MCP resource advertises exactly
105
+ * the scopes the issuer supports without the app restating them. Provide this
106
+ * only to narrow that set — it receives every scope the provider issues and
107
+ * returns the subset to advertise. When unset, all of them are advertised.
108
+ *
109
+ * Advertising these matters because dynamic-registration MCP clients (the Claude
110
+ * Code CLI) read `scopes_supported` to decide which scopes to request on the
111
+ * authorization call; with none advertised they authorize with no `scope`, leaving
112
+ * the OIDC provider nothing to grant and ending the interaction in `access_denied`.
113
+ *
114
+ * @example (allScopes) => allScopes.filter((scope) => scope === 'openid' || scope.startsWith('model.'))
115
+ */ _define_property$9(this, "scopesSupported", void 0);
98
116
  /**
99
117
  * Optional name advertised on the MCP `initialize` handshake. Defaults to
100
118
  * {@link DEFAULT_MCP_SERVER_NAME}.
@@ -172,13 +190,13 @@ typeof SuppressedError === "function" ? SuppressedError : function(error, suppre
172
190
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
173
191
  };
174
192
 
175
- function _array_like_to_array$a(arr, len) {
193
+ function _array_like_to_array$b(arr, len) {
176
194
  if (len == null || len > arr.length) len = arr.length;
177
195
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
178
196
  return arr2;
179
197
  }
180
- function _array_without_holes$7(arr) {
181
- if (Array.isArray(arr)) return _array_like_to_array$a(arr);
198
+ function _array_without_holes$8(arr) {
199
+ if (Array.isArray(arr)) return _array_like_to_array$b(arr);
182
200
  }
183
201
  function _define_property$8(obj, key, value) {
184
202
  if (key in obj) {
@@ -193,13 +211,13 @@ function _define_property$8(obj, key, value) {
193
211
  }
194
212
  return obj;
195
213
  }
196
- function _iterable_to_array$7(iter) {
214
+ function _iterable_to_array$8(iter) {
197
215
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
198
216
  }
199
- function _non_iterable_spread$7() {
217
+ function _non_iterable_spread$8() {
200
218
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
201
219
  }
202
- function _object_spread$5(target) {
220
+ function _object_spread$6(target) {
203
221
  for(var i = 1; i < arguments.length; i++){
204
222
  var source = arguments[i] != null ? arguments[i] : {};
205
223
  var ownKeys = Object.keys(source);
@@ -233,20 +251,20 @@ function _object_spread_props$3(target, source) {
233
251
  }
234
252
  return target;
235
253
  }
236
- function _to_consumable_array$7(arr) {
237
- return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$7();
254
+ function _to_consumable_array$8(arr) {
255
+ return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$8();
238
256
  }
239
257
  function _type_of$4(obj) {
240
258
  "@swc/helpers - typeof";
241
259
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
242
260
  }
243
- function _unsupported_iterable_to_array$a(o, minLen) {
261
+ function _unsupported_iterable_to_array$b(o, minLen) {
244
262
  if (!o) return;
245
- if (typeof o === "string") return _array_like_to_array$a(o, minLen);
263
+ if (typeof o === "string") return _array_like_to_array$b(o, minLen);
246
264
  var n = Object.prototype.toString.call(o).slice(8, -1);
247
265
  if (n === "Object" && o.constructor) n = o.constructor.name;
248
266
  if (n === "Map" || n === "Set") return Array.from(n);
249
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
267
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
250
268
  }
251
269
  /**
252
270
  * Normalizes the app-supplied {@link McpModuleConfig.reasonParameter} value (object / boolean /
@@ -319,9 +337,9 @@ function _unsupported_iterable_to_array$a(o, minLen) {
319
337
  var _base_type;
320
338
  var base = (typeof inputSchema === "undefined" ? "undefined" : _type_of$4(inputSchema)) === 'object' && inputSchema != null ? inputSchema : {};
321
339
  var existingProperties = _type_of$4(base.properties) === 'object' && base.properties != null ? base.properties : {};
322
- var next = _object_spread_props$3(_object_spread$5({}, base), {
340
+ var next = _object_spread_props$3(_object_spread$6({}, base), {
323
341
  type: (_base_type = base.type) !== null && _base_type !== void 0 ? _base_type : 'object',
324
- properties: _object_spread_props$3(_object_spread$5({}, existingProperties), _define_property$8({}, resolved.parameterName, {
342
+ properties: _object_spread_props$3(_object_spread$6({}, existingProperties), _define_property$8({}, resolved.parameterName, {
325
343
  type: 'string',
326
344
  maxLength: resolved.maxLength,
327
345
  description: resolved.description
@@ -329,7 +347,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
329
347
  });
330
348
  if (resolved.required) {
331
349
  var existingRequired = Array.isArray(base.required) ? base.required : [];
332
- next.required = existingRequired.includes(resolved.parameterName) ? _to_consumable_array$7(existingRequired) : _to_consumable_array$7(existingRequired).concat([
350
+ next.required = existingRequired.includes(resolved.parameterName) ? _to_consumable_array$8(existingRequired) : _to_consumable_array$8(existingRequired).concat([
333
351
  resolved.parameterName
334
352
  ]);
335
353
  }
@@ -355,7 +373,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
355
373
  var result;
356
374
  if (resolved.enabled && !toolDeclaresOwnReason && Object.prototype.hasOwnProperty.call(args, resolved.parameterName)) {
357
375
  var rawValue = args[resolved.parameterName];
358
- var nextArgs = _object_spread$5({}, args);
376
+ var nextArgs = _object_spread$6({}, args);
359
377
  delete nextArgs[resolved.parameterName];
360
378
  var stringValue = rawValue == null ? '' : String(rawValue);
361
379
  var clamped = stringValue.length > resolved.maxLength ? stringValue.slice(0, resolved.maxLength) : stringValue;
@@ -427,7 +445,7 @@ function _class_call_check$4(instance, Constructor) {
427
445
  return isDefault ? "".concat(modelType, ".").concat(call, "._") : "".concat(modelType, ".").concat(call, ".").concat(specifier);
428
446
  }
429
447
 
430
- function _array_like_to_array$9(arr, len) {
448
+ function _array_like_to_array$a(arr, len) {
431
449
  if (len == null || len > arr.length) len = arr.length;
432
450
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
433
451
  return arr2;
@@ -463,15 +481,15 @@ function _non_iterable_rest$5() {
463
481
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
464
482
  }
465
483
  function _sliced_to_array$5(arr, i) {
466
- return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$9(arr, i) || _non_iterable_rest$5();
484
+ return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$5();
467
485
  }
468
- function _unsupported_iterable_to_array$9(o, minLen) {
486
+ function _unsupported_iterable_to_array$a(o, minLen) {
469
487
  if (!o) return;
470
- if (typeof o === "string") return _array_like_to_array$9(o, minLen);
488
+ if (typeof o === "string") return _array_like_to_array$a(o, minLen);
471
489
  var n = Object.prototype.toString.call(o).slice(8, -1);
472
490
  if (n === "Object" && o.constructor) n = o.constructor.name;
473
491
  if (n === "Map" || n === "Set") return Array.from(n);
474
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
492
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
475
493
  }
476
494
  /**
477
495
  * Runtime mirror of the build-time route manifest schema + a ported URL matcher.
@@ -1063,7 +1081,7 @@ function stringifyResult(result) {
1063
1081
  return callModelOidcScopeForCallType(callType);
1064
1082
  }
1065
1083
 
1066
- function _array_like_to_array$8(arr, len) {
1084
+ function _array_like_to_array$9(arr, len) {
1067
1085
  if (len == null || len > arr.length) len = arr.length;
1068
1086
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1069
1087
  return arr2;
@@ -1099,19 +1117,19 @@ function _non_iterable_rest$4() {
1099
1117
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1100
1118
  }
1101
1119
  function _sliced_to_array$4(arr, i) {
1102
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$4();
1120
+ return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$9(arr, i) || _non_iterable_rest$4();
1103
1121
  }
1104
1122
  function _type_of$3(obj) {
1105
1123
  "@swc/helpers - typeof";
1106
1124
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1107
1125
  }
1108
- function _unsupported_iterable_to_array$8(o, minLen) {
1126
+ function _unsupported_iterable_to_array$9(o, minLen) {
1109
1127
  if (!o) return;
1110
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
1128
+ if (typeof o === "string") return _array_like_to_array$9(o, minLen);
1111
1129
  var n = Object.prototype.toString.call(o).slice(8, -1);
1112
1130
  if (n === "Object" && o.constructor) n = o.constructor.name;
1113
1131
  if (n === "Map" || n === "Set") return Array.from(n);
1114
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
1132
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
1115
1133
  }
1116
1134
  /**
1117
1135
  * Default `toJsonSchema()` options.
@@ -1714,13 +1732,13 @@ function resolveInputSchema(context) {
1714
1732
  return result;
1715
1733
  }
1716
1734
 
1717
- function _array_like_to_array$7(arr, len) {
1735
+ function _array_like_to_array$8(arr, len) {
1718
1736
  if (len == null || len > arr.length) len = arr.length;
1719
1737
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1720
1738
  return arr2;
1721
1739
  }
1722
- function _array_without_holes$6(arr) {
1723
- if (Array.isArray(arr)) return _array_like_to_array$7(arr);
1740
+ function _array_without_holes$7(arr) {
1741
+ if (Array.isArray(arr)) return _array_like_to_array$8(arr);
1724
1742
  }
1725
1743
  function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
1726
1744
  try {
@@ -1751,22 +1769,22 @@ function _async_to_generator$5(fn) {
1751
1769
  });
1752
1770
  };
1753
1771
  }
1754
- function _iterable_to_array$6(iter) {
1772
+ function _iterable_to_array$7(iter) {
1755
1773
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1756
1774
  }
1757
- function _non_iterable_spread$6() {
1775
+ function _non_iterable_spread$7() {
1758
1776
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1759
1777
  }
1760
- function _to_consumable_array$6(arr) {
1761
- return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$6();
1778
+ function _to_consumable_array$7(arr) {
1779
+ return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$7();
1762
1780
  }
1763
- function _unsupported_iterable_to_array$7(o, minLen) {
1781
+ function _unsupported_iterable_to_array$8(o, minLen) {
1764
1782
  if (!o) return;
1765
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
1783
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
1766
1784
  var n = Object.prototype.toString.call(o).slice(8, -1);
1767
1785
  if (n === "Object" && o.constructor) n = o.constructor.name;
1768
1786
  if (n === "Map" || n === "Set") return Array.from(n);
1769
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
1787
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
1770
1788
  }
1771
1789
  function _ts_generator$5(thisArg, body) {
1772
1790
  var f, y, t, _ = {
@@ -2062,8 +2080,8 @@ function readInChunks$1(input) {
2062
2080
  ];
2063
2081
  case 2:
2064
2082
  partial = _state.sent();
2065
- (_merged_results = merged.results).push.apply(_merged_results, _to_consumable_array$6(partial.results));
2066
- (_merged_errors = merged.errors).push.apply(_merged_errors, _to_consumable_array$6(partial.errors));
2083
+ (_merged_results = merged.results).push.apply(_merged_results, _to_consumable_array$7(partial.results));
2084
+ (_merged_errors = merged.errors).push.apply(_merged_errors, _to_consumable_array$7(partial.errors));
2067
2085
  _state.label = 3;
2068
2086
  case 3:
2069
2087
  offset += MCP_MODEL_GET_BATCH_SIZE;
@@ -2154,13 +2172,13 @@ var MODEL_GET_OUTPUT_SCHEMA = {
2154
2172
  }
2155
2173
  };
2156
2174
 
2157
- function _array_like_to_array$6(arr, len) {
2175
+ function _array_like_to_array$7(arr, len) {
2158
2176
  if (len == null || len > arr.length) len = arr.length;
2159
2177
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2160
2178
  return arr2;
2161
2179
  }
2162
- function _array_without_holes$5(arr) {
2163
- if (Array.isArray(arr)) return _array_like_to_array$6(arr);
2180
+ function _array_without_holes$6(arr) {
2181
+ if (Array.isArray(arr)) return _array_like_to_array$7(arr);
2164
2182
  }
2165
2183
  function _define_property$7(obj, key, value) {
2166
2184
  if (key in obj) {
@@ -2175,13 +2193,13 @@ function _define_property$7(obj, key, value) {
2175
2193
  }
2176
2194
  return obj;
2177
2195
  }
2178
- function _iterable_to_array$5(iter) {
2196
+ function _iterable_to_array$6(iter) {
2179
2197
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2180
2198
  }
2181
- function _non_iterable_spread$5() {
2199
+ function _non_iterable_spread$6() {
2182
2200
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2183
2201
  }
2184
- function _object_spread$4(target) {
2202
+ function _object_spread$5(target) {
2185
2203
  for(var i = 1; i < arguments.length; i++){
2186
2204
  var source = arguments[i] != null ? arguments[i] : {};
2187
2205
  var ownKeys = Object.keys(source);
@@ -2215,16 +2233,16 @@ function _object_spread_props$2(target, source) {
2215
2233
  }
2216
2234
  return target;
2217
2235
  }
2218
- function _to_consumable_array$5(arr) {
2219
- return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$5();
2236
+ function _to_consumable_array$6(arr) {
2237
+ return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$6();
2220
2238
  }
2221
- function _unsupported_iterable_to_array$6(o, minLen) {
2239
+ function _unsupported_iterable_to_array$7(o, minLen) {
2222
2240
  if (!o) return;
2223
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
2241
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
2224
2242
  var n = Object.prototype.toString.call(o).slice(8, -1);
2225
2243
  if (n === "Object" && o.constructor) n = o.constructor.name;
2226
2244
  if (n === "Map" || n === "Set") return Array.from(n);
2227
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
2245
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
2228
2246
  }
2229
2247
  // MARK: Constants
2230
2248
  /**
@@ -2391,7 +2409,7 @@ function resolveModelInfoOutput(input, manifest) {
2391
2409
  }
2392
2410
  }
2393
2411
  if (tables.length > 0) {
2394
- result = _object_spread_props$2(_object_spread$4({}, output), {
2412
+ result = _object_spread_props$2(_object_spread$5({}, output), {
2395
2413
  enums: tables
2396
2414
  });
2397
2415
  }
@@ -2410,7 +2428,7 @@ function resolveModelInfoOutput(input, manifest) {
2410
2428
  rows.push(output.model);
2411
2429
  } else if (output.mode === 'list' || output.mode === 'multiple') {
2412
2430
  var _rows;
2413
- (_rows = rows).push.apply(_rows, _to_consumable_array$5(output.models));
2431
+ (_rows = rows).push.apply(_rows, _to_consumable_array$6(output.models));
2414
2432
  }
2415
2433
  return rows.filter(function(row) {
2416
2434
  return Array.isArray(row.fields);
@@ -2445,7 +2463,7 @@ function parseModelInfoInput(args) {
2445
2463
  var modelGroup = parseModelGroupArg(args['modelGroup']);
2446
2464
  var all = parseBooleanArg(args['all'], 'all');
2447
2465
  var fields = parseBooleanArg(args['fields'], 'fields');
2448
- return _object_spread$4(_object_spread_props$2(_object_spread$4(_object_spread_props$2(_object_spread$4({}, modelQueries == null ? {} : {
2466
+ return _object_spread$5(_object_spread_props$2(_object_spread$5(_object_spread_props$2(_object_spread$5({}, modelQueries == null ? {} : {
2449
2467
  modelQueries: modelQueries
2450
2468
  }), {
2451
2469
  modelIsArray: Array.isArray(args['model'])
@@ -2608,7 +2626,7 @@ function toModelRow(entry, detailed) {
2608
2626
  return detailed ? entry : toSummaryRow(entry);
2609
2627
  }
2610
2628
  function toSummaryRow(entry) {
2611
- return _object_spread$4({
2629
+ return _object_spread$5({
2612
2630
  modelType: entry.modelType,
2613
2631
  modelName: entry.modelName,
2614
2632
  identityConst: entry.identityConst,
@@ -2636,7 +2654,7 @@ function toSummaryRow(entry) {
2636
2654
  *
2637
2655
  * @__NO_SIDE_EFFECTS__
2638
2656
  */ function computeGroupCounts(manifest) {
2639
- var grouped = makeValuesGroupMap(_to_consumable_array$5(manifest), function(entry) {
2657
+ var grouped = makeValuesGroupMap(_to_consumable_array$6(manifest), function(entry) {
2640
2658
  var _entry_modelGroup;
2641
2659
  return (_entry_modelGroup = entry.modelGroup) !== null && _entry_modelGroup !== void 0 ? _entry_modelGroup : MODEL_INFO_UNGROUPED_LABEL;
2642
2660
  });
@@ -2943,7 +2961,7 @@ var MODEL_INFO_OUTPUT_SCHEMA = {
2943
2961
  type: 'string',
2944
2962
  description: 'Present when `mode` is `"list"` from a `modelGroup` filter. The canonical group name.'
2945
2963
  },
2946
- model: _object_spread_props$2(_object_spread$4({}, MODEL_ROW_SCHEMA), {
2964
+ model: _object_spread_props$2(_object_spread$5({}, MODEL_ROW_SCHEMA), {
2947
2965
  description: 'Present when `mode` is `"single"`. The matched model entry (full detail unless `fields:false`).'
2948
2966
  }),
2949
2967
  notFound: {
@@ -3029,7 +3047,7 @@ function _define_property$6(obj, key, value) {
3029
3047
  }
3030
3048
  return obj;
3031
3049
  }
3032
- function _object_spread$3(target) {
3050
+ function _object_spread$4(target) {
3033
3051
  for(var i = 1; i < arguments.length; i++){
3034
3052
  var source = arguments[i] != null ? arguments[i] : {};
3035
3053
  var ownKeys = Object.keys(source);
@@ -3168,7 +3186,7 @@ function parseModelDecodeInput(args) {
3168
3186
  };
3169
3187
  }
3170
3188
  function toSegment(prefix, id, entry) {
3171
- var segment = entry ? _object_spread$3({
3189
+ var segment = entry ? _object_spread$4({
3172
3190
  prefix: prefix,
3173
3191
  id: id,
3174
3192
  modelType: entry.modelType,
@@ -3458,7 +3476,7 @@ var ENUM_INFO_OUTPUT_SCHEMA = {
3458
3476
  }
3459
3477
  };
3460
3478
 
3461
- function _array_like_to_array$5(arr, len) {
3479
+ function _array_like_to_array$6(arr, len) {
3462
3480
  if (len == null || len > arr.length) len = arr.length;
3463
3481
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3464
3482
  return arr2;
@@ -3466,8 +3484,8 @@ function _array_like_to_array$5(arr, len) {
3466
3484
  function _array_with_holes$3(arr) {
3467
3485
  if (Array.isArray(arr)) return arr;
3468
3486
  }
3469
- function _array_without_holes$4(arr) {
3470
- if (Array.isArray(arr)) return _array_like_to_array$5(arr);
3487
+ function _array_without_holes$5(arr) {
3488
+ if (Array.isArray(arr)) return _array_like_to_array$6(arr);
3471
3489
  }
3472
3490
  function _define_property$5(obj, key, value) {
3473
3491
  if (key in obj) {
@@ -3482,7 +3500,7 @@ function _define_property$5(obj, key, value) {
3482
3500
  }
3483
3501
  return obj;
3484
3502
  }
3485
- function _iterable_to_array$4(iter) {
3503
+ function _iterable_to_array$5(iter) {
3486
3504
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3487
3505
  }
3488
3506
  function _iterable_to_array_limit$3(arr, i) {
@@ -3512,10 +3530,10 @@ function _iterable_to_array_limit$3(arr, i) {
3512
3530
  function _non_iterable_rest$3() {
3513
3531
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3514
3532
  }
3515
- function _non_iterable_spread$4() {
3533
+ function _non_iterable_spread$5() {
3516
3534
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3517
3535
  }
3518
- function _object_spread$2(target) {
3536
+ function _object_spread$3(target) {
3519
3537
  for(var i = 1; i < arguments.length; i++){
3520
3538
  var source = arguments[i] != null ? arguments[i] : {};
3521
3539
  var ownKeys = Object.keys(source);
@@ -3531,18 +3549,18 @@ function _object_spread$2(target) {
3531
3549
  return target;
3532
3550
  }
3533
3551
  function _sliced_to_array$3(arr, i) {
3534
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$3();
3552
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$3();
3535
3553
  }
3536
- function _to_consumable_array$4(arr) {
3537
- return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$4();
3554
+ function _to_consumable_array$5(arr) {
3555
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$5();
3538
3556
  }
3539
- function _unsupported_iterable_to_array$5(o, minLen) {
3557
+ function _unsupported_iterable_to_array$6(o, minLen) {
3540
3558
  if (!o) return;
3541
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
3559
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
3542
3560
  var n = Object.prototype.toString.call(o).slice(8, -1);
3543
3561
  if (n === "Object" && o.constructor) n = o.constructor.name;
3544
3562
  if (n === "Map" || n === "Set") return Array.from(n);
3545
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
3563
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
3546
3564
  }
3547
3565
  // MARK: Constants
3548
3566
  /**
@@ -3610,7 +3628,7 @@ function whoamiToolHandler(args, ctx, deps) {
3610
3628
  return key;
3611
3629
  });
3612
3630
  var roleSet = deps.roleReader == null ? new Set() : deps.roleReader(token);
3613
- var roles = _to_consumable_array$4(roleSet).sort(function(a, b) {
3631
+ var roles = _to_consumable_array$5(roleSet).sort(function(a, b) {
3614
3632
  return a.localeCompare(b);
3615
3633
  });
3616
3634
  var claimsByKey = new Map();
@@ -3644,7 +3662,7 @@ function whoamiToolHandler(args, ctx, deps) {
3644
3662
  if (claim1 == null) {
3645
3663
  unknownClaimKeys.push(key);
3646
3664
  } else {
3647
- claimDetails.push(_object_spread$2({
3665
+ claimDetails.push(_object_spread$3({
3648
3666
  key: claim1.key,
3649
3667
  description: claim1.description,
3650
3668
  grantedRoles: claim1.mapping.roles,
@@ -3669,7 +3687,7 @@ function whoamiToolHandler(args, ctx, deps) {
3669
3687
  }
3670
3688
  }
3671
3689
  }
3672
- var output = _object_spread$2({
3690
+ var output = _object_spread$3({
3673
3691
  authenticated: true,
3674
3692
  uid: auth.uid,
3675
3693
  roles: roles,
@@ -3681,7 +3699,7 @@ function whoamiToolHandler(args, ctx, deps) {
3681
3699
  }, token.email_verified == null ? {} : {
3682
3700
  emailVerified: token.email_verified
3683
3701
  }, detail === 'summary' ? {} : {
3684
- claims: _object_spread$2({}, token)
3702
+ claims: _object_spread$3({}, token)
3685
3703
  }, detail === 'full' ? {
3686
3704
  claimDetails: claimDetails,
3687
3705
  unknownClaimKeys: unknownClaimKeys
@@ -3922,7 +3940,7 @@ var WHOAMI_OUTPUT_SCHEMA = {
3922
3940
  }
3923
3941
  };
3924
3942
 
3925
- function _array_like_to_array$4(arr, len) {
3943
+ function _array_like_to_array$5(arr, len) {
3926
3944
  if (len == null || len > arr.length) len = arr.length;
3927
3945
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3928
3946
  return arr2;
@@ -3930,8 +3948,8 @@ function _array_like_to_array$4(arr, len) {
3930
3948
  function _array_with_holes$2(arr) {
3931
3949
  if (Array.isArray(arr)) return arr;
3932
3950
  }
3933
- function _array_without_holes$3(arr) {
3934
- if (Array.isArray(arr)) return _array_like_to_array$4(arr);
3951
+ function _array_without_holes$4(arr) {
3952
+ if (Array.isArray(arr)) return _array_like_to_array$5(arr);
3935
3953
  }
3936
3954
  function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
3937
3955
  try {
@@ -3975,7 +3993,7 @@ function _define_property$4(obj, key, value) {
3975
3993
  }
3976
3994
  return obj;
3977
3995
  }
3978
- function _iterable_to_array$3(iter) {
3996
+ function _iterable_to_array$4(iter) {
3979
3997
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3980
3998
  }
3981
3999
  function _iterable_to_array_limit$2(arr, i) {
@@ -4005,10 +4023,10 @@ function _iterable_to_array_limit$2(arr, i) {
4005
4023
  function _non_iterable_rest$2() {
4006
4024
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4007
4025
  }
4008
- function _non_iterable_spread$3() {
4026
+ function _non_iterable_spread$4() {
4009
4027
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4010
4028
  }
4011
- function _object_spread$1(target) {
4029
+ function _object_spread$2(target) {
4012
4030
  for(var i = 1; i < arguments.length; i++){
4013
4031
  var source = arguments[i] != null ? arguments[i] : {};
4014
4032
  var ownKeys = Object.keys(source);
@@ -4043,18 +4061,18 @@ function _object_spread_props$1(target, source) {
4043
4061
  return target;
4044
4062
  }
4045
4063
  function _sliced_to_array$2(arr, i) {
4046
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$2();
4064
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$2();
4047
4065
  }
4048
- function _to_consumable_array$3(arr) {
4049
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$3();
4066
+ function _to_consumable_array$4(arr) {
4067
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$4();
4050
4068
  }
4051
- function _unsupported_iterable_to_array$4(o, minLen) {
4069
+ function _unsupported_iterable_to_array$5(o, minLen) {
4052
4070
  if (!o) return;
4053
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
4071
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
4054
4072
  var n = Object.prototype.toString.call(o).slice(8, -1);
4055
4073
  if (n === "Object" && o.constructor) n = o.constructor.name;
4056
4074
  if (n === "Map" || n === "Set") return Array.from(n);
4057
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
4075
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
4058
4076
  }
4059
4077
  function _ts_generator$4(thisArg, body) {
4060
4078
  var f, y, t, _ = {
@@ -4311,7 +4329,7 @@ function parseUrlModelsInput(args) {
4311
4329
  }
4312
4330
  currentUserUid = args.currentUserUid;
4313
4331
  }
4314
- return _object_spread$1(_object_spread_props$1(_object_spread$1({
4332
+ return _object_spread$2(_object_spread_props$1(_object_spread$2({
4315
4333
  url: url
4316
4334
  }, models === undefined ? {} : {
4317
4335
  models: models
@@ -4440,7 +4458,7 @@ function buildMatchedPayload(args) {
4440
4458
  loaded = _tmp;
4441
4459
  return [
4442
4460
  2,
4443
- _object_spread$1({
4461
+ _object_spread$2({
4444
4462
  state: {
4445
4463
  name: match.state.name,
4446
4464
  fullUrl: match.state.fullUrl,
@@ -4463,7 +4481,7 @@ function resolveModelEntry(input) {
4463
4481
  var base = keysOnly ? {
4464
4482
  modelType: entry.modelType,
4465
4483
  kind: entry.kind
4466
- } : _object_spread$1({
4484
+ } : _object_spread$2({
4467
4485
  modelType: entry.modelType,
4468
4486
  kind: entry.kind
4469
4487
  }, entry.keyTemplate === undefined ? {} : {
@@ -4477,11 +4495,11 @@ function resolveModelEntry(input) {
4477
4495
  if (entry.kind === 'list') {
4478
4496
  result = base;
4479
4497
  } else if (entry.kind === 'id') {
4480
- result = _object_spread$1({}, base, resolveIdKey(input));
4498
+ result = _object_spread$2({}, base, resolveIdKey(input));
4481
4499
  } else if (entry.kind === 'flatKey') {
4482
- result = _object_spread$1({}, base, resolveFlatKey(input));
4500
+ result = _object_spread$2({}, base, resolveFlatKey(input));
4483
4501
  } else {
4484
- result = _object_spread$1({}, base, resolveFullKey(input));
4502
+ result = _object_spread$2({}, base, resolveFullKey(input));
4485
4503
  }
4486
4504
  return result;
4487
4505
  }
@@ -4782,8 +4800,8 @@ function readInChunks(input) {
4782
4800
  ];
4783
4801
  case 2:
4784
4802
  partial = _state.sent();
4785
- (_merged_results = merged.results).push.apply(_merged_results, _to_consumable_array$3(partial.results));
4786
- (_merged_errors = merged.errors).push.apply(_merged_errors, _to_consumable_array$3(partial.errors));
4803
+ (_merged_results = merged.results).push.apply(_merged_results, _to_consumable_array$4(partial.results));
4804
+ (_merged_errors = merged.errors).push.apply(_merged_errors, _to_consumable_array$4(partial.errors));
4787
4805
  _state.label = 3;
4788
4806
  case 3:
4789
4807
  offset += MCP_MODEL_GET_BATCH_SIZE;
@@ -4896,7 +4914,7 @@ var URL_MODELS_OUTPUT_SCHEMA = {
4896
4914
  }
4897
4915
  };
4898
4916
 
4899
- function _array_like_to_array$3(arr, len) {
4917
+ function _array_like_to_array$4(arr, len) {
4900
4918
  if (len == null || len > arr.length) len = arr.length;
4901
4919
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4902
4920
  return arr2;
@@ -4969,19 +4987,19 @@ function _non_iterable_rest$1() {
4969
4987
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4970
4988
  }
4971
4989
  function _sliced_to_array$1(arr, i) {
4972
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$1();
4990
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$1();
4973
4991
  }
4974
4992
  function _type_of$2(obj) {
4975
4993
  "@swc/helpers - typeof";
4976
4994
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4977
4995
  }
4978
- function _unsupported_iterable_to_array$3(o, minLen) {
4996
+ function _unsupported_iterable_to_array$4(o, minLen) {
4979
4997
  if (!o) return;
4980
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
4998
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
4981
4999
  var n = Object.prototype.toString.call(o).slice(8, -1);
4982
5000
  if (n === "Object" && o.constructor) n = o.constructor.name;
4983
5001
  if (n === "Map" || n === "Set") return Array.from(n);
4984
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
5002
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
4985
5003
  }
4986
5004
  function _ts_generator$3(thisArg, body) {
4987
5005
  var f, y, t, _ = {
@@ -5744,7 +5762,7 @@ var BATCH_EXECUTE_OUTPUT_SCHEMA = {
5744
5762
  }
5745
5763
  };
5746
5764
 
5747
- function _array_like_to_array$2(arr, len) {
5765
+ function _array_like_to_array$3(arr, len) {
5748
5766
  if (len == null || len > arr.length) len = arr.length;
5749
5767
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5750
5768
  return arr2;
@@ -5752,8 +5770,8 @@ function _array_like_to_array$2(arr, len) {
5752
5770
  function _array_with_holes(arr) {
5753
5771
  if (Array.isArray(arr)) return arr;
5754
5772
  }
5755
- function _array_without_holes$2(arr) {
5756
- if (Array.isArray(arr)) return _array_like_to_array$2(arr);
5773
+ function _array_without_holes$3(arr) {
5774
+ if (Array.isArray(arr)) return _array_like_to_array$3(arr);
5757
5775
  }
5758
5776
  function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
5759
5777
  try {
@@ -5815,7 +5833,7 @@ function _define_property$3(obj, key, value) {
5815
5833
  }
5816
5834
  return obj;
5817
5835
  }
5818
- function _iterable_to_array$2(iter) {
5836
+ function _iterable_to_array$3(iter) {
5819
5837
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
5820
5838
  }
5821
5839
  function _iterable_to_array_limit(arr, i) {
@@ -5845,10 +5863,10 @@ function _iterable_to_array_limit(arr, i) {
5845
5863
  function _non_iterable_rest() {
5846
5864
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5847
5865
  }
5848
- function _non_iterable_spread$2() {
5866
+ function _non_iterable_spread$3() {
5849
5867
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5850
5868
  }
5851
- function _object_spread(target) {
5869
+ function _object_spread$1(target) {
5852
5870
  for(var i = 1; i < arguments.length; i++){
5853
5871
  var source = arguments[i] != null ? arguments[i] : {};
5854
5872
  var ownKeys = Object.keys(source);
@@ -5883,22 +5901,22 @@ function _object_spread_props(target, source) {
5883
5901
  return target;
5884
5902
  }
5885
5903
  function _sliced_to_array(arr, i) {
5886
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest();
5904
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest();
5887
5905
  }
5888
- function _to_consumable_array$2(arr) {
5889
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$2();
5906
+ function _to_consumable_array$3(arr) {
5907
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$3();
5890
5908
  }
5891
5909
  function _type_of$1(obj) {
5892
5910
  "@swc/helpers - typeof";
5893
5911
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5894
5912
  }
5895
- function _unsupported_iterable_to_array$2(o, minLen) {
5913
+ function _unsupported_iterable_to_array$3(o, minLen) {
5896
5914
  if (!o) return;
5897
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
5915
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
5898
5916
  var n = Object.prototype.toString.call(o).slice(8, -1);
5899
5917
  if (n === "Object" && o.constructor) n = o.constructor.name;
5900
5918
  if (n === "Map" || n === "Set") return Array.from(n);
5901
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
5919
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
5902
5920
  }
5903
5921
  function _ts_generator$2(thisArg, body) {
5904
5922
  var f, y, t, _ = {
@@ -6062,7 +6080,7 @@ var McpServerFactoryService_1;
6062
6080
  var staticTools = this._resolveStaticTools();
6063
6081
  var scopes = this._resolveScopes(ctx);
6064
6082
  var authRoles = this._resolveAuthRoles(ctx);
6065
- var combinedTools = _to_consumable_array$2(toolGeneration.tools).concat(_to_consumable_array$2(staticTools));
6083
+ var combinedTools = _to_consumable_array$3(toolGeneration.tools).concat(_to_consumable_array$3(staticTools));
6066
6084
  var visibleTools = this._filterToolsForRequest(combinedTools, {
6067
6085
  ctx: ctx,
6068
6086
  scopes: scopes,
@@ -6080,7 +6098,7 @@ var McpServerFactoryService_1;
6080
6098
  var listedTools = visibleTools;
6081
6099
  if (batchTool != null) {
6082
6100
  definitionsByName.set(batchTool.name, batchTool);
6083
- listedTools = _to_consumable_array$2(visibleTools).concat([
6101
+ listedTools = _to_consumable_array$3(visibleTools).concat([
6084
6102
  batchTool
6085
6103
  ]);
6086
6104
  }
@@ -6317,7 +6335,7 @@ var McpServerFactoryService_1;
6317
6335
  var modelManifest = this._cachedManifestModels;
6318
6336
  var enumManifest = this._cachedManifestEnums;
6319
6337
  if (modelManifest != null && modelManifest.length > 0) {
6320
- staticTools.push(createModelInfoTool(_object_spread({
6338
+ staticTools.push(createModelInfoTool(_object_spread$1({
6321
6339
  manifest: modelManifest
6322
6340
  }, enumManifest == null ? {} : {
6323
6341
  enums: enumManifest
@@ -6776,7 +6794,7 @@ var McpServerFactoryService_1;
6776
6794
  // applyMcpReasonParameterToSchema self-skips (returns the same reference) on collision, so the
6777
6795
  // frozen-verbatim hot path still holds for tools that already declare the parameter name.
6778
6796
  if (reasoned !== tool.staticWireEntry.inputSchema) {
6779
- result = _object_spread_props(_object_spread({}, tool.staticWireEntry), {
6797
+ result = _object_spread_props(_object_spread$1({}, tool.staticWireEntry), {
6780
6798
  inputSchema: reasoned
6781
6799
  });
6782
6800
  }
@@ -7474,6 +7492,14 @@ McpController = McpController_1 = __decorate([
7474
7492
  __param(0, Inject(McpServerFactoryService))
7475
7493
  ], McpController);
7476
7494
 
7495
+ function _array_like_to_array$2(arr, len) {
7496
+ if (len == null || len > arr.length) len = arr.length;
7497
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7498
+ return arr2;
7499
+ }
7500
+ function _array_without_holes$2(arr) {
7501
+ if (Array.isArray(arr)) return _array_like_to_array$2(arr);
7502
+ }
7477
7503
  function _class_call_check$1(instance, Constructor) {
7478
7504
  if (!(instance instanceof Constructor)) {
7479
7505
  throw new TypeError("Cannot call a class as a function");
@@ -7505,6 +7531,38 @@ function _define_property$1(obj, key, value) {
7505
7531
  }
7506
7532
  return obj;
7507
7533
  }
7534
+ function _iterable_to_array$2(iter) {
7535
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
7536
+ }
7537
+ function _non_iterable_spread$2() {
7538
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7539
+ }
7540
+ function _object_spread(target) {
7541
+ for(var i = 1; i < arguments.length; i++){
7542
+ var source = arguments[i] != null ? arguments[i] : {};
7543
+ var ownKeys = Object.keys(source);
7544
+ if (typeof Object.getOwnPropertySymbols === "function") {
7545
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
7546
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
7547
+ }));
7548
+ }
7549
+ ownKeys.forEach(function(key) {
7550
+ _define_property$1(target, key, source[key]);
7551
+ });
7552
+ }
7553
+ return target;
7554
+ }
7555
+ function _to_consumable_array$2(arr) {
7556
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$2();
7557
+ }
7558
+ function _unsupported_iterable_to_array$2(o, minLen) {
7559
+ if (!o) return;
7560
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
7561
+ var n = Object.prototype.toString.call(o).slice(8, -1);
7562
+ if (n === "Object" && o.constructor) n = o.constructor.name;
7563
+ if (n === "Map" || n === "Set") return Array.from(n);
7564
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
7565
+ }
7508
7566
  /**
7509
7567
  * Serves the `GET /.well-known/oauth-protected-resource` metadata document so
7510
7568
  * Claude (and other MCP clients) can discover which OIDC issuer guards this
@@ -7515,21 +7573,30 @@ function _define_property$1(obj, key, value) {
7515
7573
  * from any global API route prefix (see `FIREBASE_SERVER_OIDC_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE`
7516
7574
  * in `firebase-server/oidc` for the corresponding OIDC excludes).
7517
7575
  */ var McpWellKnownController = /*#__PURE__*/ function() {
7518
- function McpWellKnownController(mcpConfig) {
7576
+ function McpWellKnownController(mcpConfig, oidcProviderConfigService) {
7519
7577
  _class_call_check$1(this, McpWellKnownController);
7520
7578
  _define_property$1(this, "mcpConfig", void 0);
7579
+ _define_property$1(this, "oidcProviderConfigService", void 0);
7521
7580
  this.mcpConfig = mcpConfig;
7581
+ this.oidcProviderConfigService = oidcProviderConfigService;
7522
7582
  }
7523
7583
  _create_class$1(McpWellKnownController, [
7524
7584
  {
7525
7585
  key: "getProtectedResourceMetadata",
7526
7586
  value: function getProtectedResourceMetadata() {
7527
- return {
7528
- resource: this.mcpConfig.mcpUrl,
7587
+ var _this_mcpConfig = this.mcpConfig, mcpUrl = _this_mcpConfig.mcpUrl, oidcIssuer = _this_mcpConfig.oidcIssuer, scopesFilter = _this_mcpConfig.scopesSupported;
7588
+ // Base scope list is the OIDC provider's own `scopes_supported`, so the resource
7589
+ // advertises exactly what the issuer grants; the optional filter narrows it.
7590
+ var providerScopes = this.oidcProviderConfigService.scopesSupported;
7591
+ var scopes = scopesFilter ? scopesFilter(providerScopes) : providerScopes;
7592
+ return _object_spread({
7593
+ resource: mcpUrl,
7529
7594
  authorization_servers: [
7530
- this.mcpConfig.oidcIssuer
7595
+ oidcIssuer
7531
7596
  ]
7532
- };
7597
+ }, scopes.length ? {
7598
+ scopes_supported: _to_consumable_array$2(scopes)
7599
+ } : undefined);
7533
7600
  }
7534
7601
  }
7535
7602
  ]);
@@ -7540,7 +7607,8 @@ __decorate([
7540
7607
  ], McpWellKnownController.prototype, "getProtectedResourceMetadata", null);
7541
7608
  McpWellKnownController = __decorate([
7542
7609
  Controller('.well-known'),
7543
- __param(0, Inject(McpModuleConfig))
7610
+ __param(0, Inject(McpModuleConfig)),
7611
+ __param(1, Inject(OidcProviderConfigService))
7544
7612
  ], McpWellKnownController);
7545
7613
 
7546
7614
  function _array_like_to_array$1(arr, len) {