@umbraco-cms/mcp-dev 17.3.7 → 17.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,8 +6,9 @@ import {
6
6
  allModeNames,
7
7
  allModes,
8
8
  allSliceNames,
9
- availableCollections
10
- } from "./chunk-EONL3SEB.js";
9
+ availableCollections,
10
+ setUmbracoVersion
11
+ } from "./chunk-6NEKTCPS.js";
11
12
 
12
13
  // node_modules/ajv/dist/compile/codegen/code.js
13
14
  var require_code = __commonJS({
@@ -3085,6 +3086,9 @@ var require_utils = __commonJS({
3085
3086
  "use strict";
3086
3087
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3087
3088
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
3089
+ var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3090
+ var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3091
+ var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
3088
3092
  function stringArrayToHexStripped(input) {
3089
3093
  let acc = "";
3090
3094
  let code = 0;
@@ -3277,27 +3281,77 @@ var require_utils = __commonJS({
3277
3281
  }
3278
3282
  return output.join("");
3279
3283
  }
3280
- function normalizeComponentEncoding(component, esc) {
3281
- const func = esc !== true ? escape : unescape;
3282
- if (component.scheme !== void 0) {
3283
- component.scheme = func(component.scheme);
3284
- }
3285
- if (component.userinfo !== void 0) {
3286
- component.userinfo = func(component.userinfo);
3287
- }
3288
- if (component.host !== void 0) {
3289
- component.host = func(component.host);
3284
+ var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3285
+ var HOST_DELIM_RE = /[@/?#:]/g;
3286
+ var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
3287
+ function reescapeHostDelimiters(host, isIP) {
3288
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
3289
+ re.lastIndex = 0;
3290
+ return host.replace(re, (ch) => HOST_DELIMS[ch]);
3291
+ }
3292
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
3293
+ if (input.indexOf("%") === -1) {
3294
+ return input;
3290
3295
  }
3291
- if (component.path !== void 0) {
3292
- component.path = func(component.path);
3296
+ let output = "";
3297
+ for (let i = 0; i < input.length; i++) {
3298
+ if (input[i] === "%" && i + 2 < input.length) {
3299
+ const hex = input.slice(i + 1, i + 3);
3300
+ if (isHexPair(hex)) {
3301
+ const normalizedHex = hex.toUpperCase();
3302
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3303
+ if (decodeUnreserved && isUnreserved(decoded)) {
3304
+ output += decoded;
3305
+ } else {
3306
+ output += "%" + normalizedHex;
3307
+ }
3308
+ i += 2;
3309
+ continue;
3310
+ }
3311
+ }
3312
+ output += input[i];
3293
3313
  }
3294
- if (component.query !== void 0) {
3295
- component.query = func(component.query);
3314
+ return output;
3315
+ }
3316
+ function normalizePathEncoding(input) {
3317
+ let output = "";
3318
+ for (let i = 0; i < input.length; i++) {
3319
+ if (input[i] === "%" && i + 2 < input.length) {
3320
+ const hex = input.slice(i + 1, i + 3);
3321
+ if (isHexPair(hex)) {
3322
+ const normalizedHex = hex.toUpperCase();
3323
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3324
+ if (decoded !== "." && isUnreserved(decoded)) {
3325
+ output += decoded;
3326
+ } else {
3327
+ output += "%" + normalizedHex;
3328
+ }
3329
+ i += 2;
3330
+ continue;
3331
+ }
3332
+ }
3333
+ if (isPathCharacter(input[i])) {
3334
+ output += input[i];
3335
+ } else {
3336
+ output += escape(input[i]);
3337
+ }
3296
3338
  }
3297
- if (component.fragment !== void 0) {
3298
- component.fragment = func(component.fragment);
3339
+ return output;
3340
+ }
3341
+ function escapePreservingEscapes(input) {
3342
+ let output = "";
3343
+ for (let i = 0; i < input.length; i++) {
3344
+ if (input[i] === "%" && i + 2 < input.length) {
3345
+ const hex = input.slice(i + 1, i + 3);
3346
+ if (isHexPair(hex)) {
3347
+ output += "%" + hex.toUpperCase();
3348
+ i += 2;
3349
+ continue;
3350
+ }
3351
+ }
3352
+ output += escape(input[i]);
3299
3353
  }
3300
- return component;
3354
+ return output;
3301
3355
  }
3302
3356
  function recomposeAuthority(component) {
3303
3357
  const uriTokens = [];
@@ -3312,7 +3366,7 @@ var require_utils = __commonJS({
3312
3366
  if (ipV6res.isIPV6 === true) {
3313
3367
  host = `[${ipV6res.escapedHost}]`;
3314
3368
  } else {
3315
- host = component.host;
3369
+ host = reescapeHostDelimiters(host, false);
3316
3370
  }
3317
3371
  }
3318
3372
  uriTokens.push(host);
@@ -3326,7 +3380,10 @@ var require_utils = __commonJS({
3326
3380
  module.exports = {
3327
3381
  nonSimpleDomain,
3328
3382
  recomposeAuthority,
3329
- normalizeComponentEncoding,
3383
+ reescapeHostDelimiters,
3384
+ normalizePercentEncoding,
3385
+ normalizePathEncoding,
3386
+ escapePreservingEscapes,
3330
3387
  removeDotSegments,
3331
3388
  isIPv4,
3332
3389
  isUUID,
@@ -3550,12 +3607,12 @@ var require_schemes = __commonJS({
3550
3607
  var require_fast_uri = __commonJS({
3551
3608
  "node_modules/fast-uri/index.js"(exports, module) {
3552
3609
  "use strict";
3553
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
3610
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3554
3611
  var { SCHEMES, getSchemeHandler } = require_schemes();
3555
3612
  function normalize(uri, options) {
3556
3613
  if (typeof uri === "string") {
3557
3614
  uri = /** @type {T} */
3558
- serialize(parse(uri, options), options);
3615
+ normalizeString(uri, options);
3559
3616
  } else if (typeof uri === "object") {
3560
3617
  uri = /** @type {T} */
3561
3618
  parse(serialize(uri, options), options);
@@ -3622,19 +3679,9 @@ var require_fast_uri = __commonJS({
3622
3679
  return target;
3623
3680
  }
3624
3681
  function equal(uriA, uriB, options) {
3625
- if (typeof uriA === "string") {
3626
- uriA = unescape(uriA);
3627
- uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
3628
- } else if (typeof uriA === "object") {
3629
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
3630
- }
3631
- if (typeof uriB === "string") {
3632
- uriB = unescape(uriB);
3633
- uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
3634
- } else if (typeof uriB === "object") {
3635
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
3636
- }
3637
- return uriA.toLowerCase() === uriB.toLowerCase();
3682
+ const normalizedA = normalizeComparableURI(uriA, options);
3683
+ const normalizedB = normalizeComparableURI(uriB, options);
3684
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
3638
3685
  }
3639
3686
  function serialize(cmpts, opts) {
3640
3687
  const component = {
@@ -3659,12 +3706,12 @@ var require_fast_uri = __commonJS({
3659
3706
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3660
3707
  if (component.path !== void 0) {
3661
3708
  if (!options.skipEscape) {
3662
- component.path = escape(component.path);
3709
+ component.path = escapePreservingEscapes(component.path);
3663
3710
  if (component.scheme !== void 0) {
3664
3711
  component.path = component.path.split("%3A").join(":");
3665
3712
  }
3666
3713
  } else {
3667
- component.path = unescape(component.path);
3714
+ component.path = normalizePercentEncoding(component.path);
3668
3715
  }
3669
3716
  }
3670
3717
  if (options.reference !== "suffix" && component.scheme) {
@@ -3699,7 +3746,16 @@ var require_fast_uri = __commonJS({
3699
3746
  return uriTokens.join("");
3700
3747
  }
3701
3748
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
3702
- function parse(uri, opts) {
3749
+ function getParseError(parsed, matches) {
3750
+ if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
3751
+ return 'URI path must start with "/" when authority is present.';
3752
+ }
3753
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
3754
+ return "URI port is malformed.";
3755
+ }
3756
+ return void 0;
3757
+ }
3758
+ function parseWithStatus(uri, opts) {
3703
3759
  const options = Object.assign({}, opts);
3704
3760
  const parsed = {
3705
3761
  scheme: void 0,
@@ -3710,6 +3766,7 @@ var require_fast_uri = __commonJS({
3710
3766
  query: void 0,
3711
3767
  fragment: void 0
3712
3768
  };
3769
+ let malformedAuthorityOrPort = false;
3713
3770
  let isIP = false;
3714
3771
  if (options.reference === "suffix") {
3715
3772
  if (options.scheme) {
@@ -3730,6 +3787,11 @@ var require_fast_uri = __commonJS({
3730
3787
  if (isNaN(parsed.port)) {
3731
3788
  parsed.port = matches[5];
3732
3789
  }
3790
+ const parseError = getParseError(parsed, matches);
3791
+ if (parseError !== void 0) {
3792
+ parsed.error = parsed.error || parseError;
3793
+ malformedAuthorityOrPort = true;
3794
+ }
3733
3795
  if (parsed.host) {
3734
3796
  const ipv4result = isIPv4(parsed.host);
3735
3797
  if (ipv4result === false) {
@@ -3768,14 +3830,18 @@ var require_fast_uri = __commonJS({
3768
3830
  parsed.scheme = unescape(parsed.scheme);
3769
3831
  }
3770
3832
  if (parsed.host !== void 0) {
3771
- parsed.host = unescape(parsed.host);
3833
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
3772
3834
  }
3773
3835
  }
3774
3836
  if (parsed.path) {
3775
- parsed.path = escape(unescape(parsed.path));
3837
+ parsed.path = normalizePathEncoding(parsed.path);
3776
3838
  }
3777
3839
  if (parsed.fragment) {
3778
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3840
+ try {
3841
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3842
+ } catch {
3843
+ parsed.error = parsed.error || "URI malformed";
3844
+ }
3779
3845
  }
3780
3846
  }
3781
3847
  if (schemeHandler && schemeHandler.parse) {
@@ -3784,7 +3850,29 @@ var require_fast_uri = __commonJS({
3784
3850
  } else {
3785
3851
  parsed.error = parsed.error || "URI can not be parsed.";
3786
3852
  }
3787
- return parsed;
3853
+ return { parsed, malformedAuthorityOrPort };
3854
+ }
3855
+ function parse(uri, opts) {
3856
+ return parseWithStatus(uri, opts).parsed;
3857
+ }
3858
+ function normalizeString(uri, opts) {
3859
+ return normalizeStringWithStatus(uri, opts).normalized;
3860
+ }
3861
+ function normalizeStringWithStatus(uri, opts) {
3862
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
3863
+ return {
3864
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
3865
+ malformedAuthorityOrPort
3866
+ };
3867
+ }
3868
+ function normalizeComparableURI(uri, opts) {
3869
+ if (typeof uri === "string") {
3870
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
3871
+ return malformedAuthorityOrPort ? void 0 : normalized;
3872
+ }
3873
+ if (typeof uri === "object") {
3874
+ return serialize(uri, opts);
3875
+ }
3788
3876
  }
3789
3877
  var fastUri = {
3790
3878
  SCHEMES,
@@ -12422,7 +12510,7 @@ var StdioServerTransport = class {
12422
12510
  // package.json
12423
12511
  var package_default = {
12424
12512
  name: "@umbraco-cms/mcp-dev",
12425
- version: "17.3.7",
12513
+ version: "17.4.0",
12426
12514
  type: "module",
12427
12515
  description: "A model context protocol (MCP) server for Umbraco CMS",
12428
12516
  main: "dist/index.js",
@@ -12490,8 +12578,8 @@ var package_default = {
12490
12578
  "@modelcontextprotocol/sdk": "^1.28.0",
12491
12579
  "@types/uuid": "^10.0.0",
12492
12580
  "@types/yargs": "^17.0.33",
12493
- "@umbraco-cms/mcp-hosted": "^17.0.0-beta.21",
12494
- "@umbraco-cms/mcp-server-sdk": "^17.0.0-beta.21",
12581
+ "@umbraco-cms/mcp-hosted": "^17.0.0-beta.24",
12582
+ "@umbraco-cms/mcp-server-sdk": "^17.0.0-beta.24",
12495
12583
  axios: "^1.8.4",
12496
12584
  dotenv: "^16.5.0",
12497
12585
  "form-data": "^4.0.4",
@@ -12719,9 +12807,11 @@ var main = async () => {
12719
12807
  filterConfig,
12720
12808
  serverConfig: config
12721
12809
  });
12810
+ const serverInfo = await client.getServerInformation();
12811
+ setUmbracoVersion(serverInfo.version);
12722
12812
  await checkUmbracoVersion({
12723
12813
  mcpVersion: package_default.version,
12724
- client: { getServerInformation: () => client.getServerInformation() }
12814
+ client: { getServerInformation: async () => serverInfo }
12725
12815
  });
12726
12816
  UmbracoToolFactory(server, user, config);
12727
12817
  const transport = new StdioServerTransport();