@kentico/management-api-mcp 31.4.4-preview → 31.5.1-preview
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 +385 -14
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -5,10 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
8
14
|
var __esm = (fn, res) => function __init() {
|
|
9
15
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
16
|
};
|
|
11
|
-
var __commonJS = (cb, mod) => function
|
|
17
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
12
18
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
19
|
};
|
|
14
20
|
var __export = (target, all) => {
|
|
@@ -1708,6 +1714,357 @@ var init_sqids = __esm({
|
|
|
1708
1714
|
}
|
|
1709
1715
|
});
|
|
1710
1716
|
|
|
1717
|
+
// node_modules/pluralize/pluralize.js
|
|
1718
|
+
var require_pluralize = __commonJS({
|
|
1719
|
+
"node_modules/pluralize/pluralize.js"(exports, module) {
|
|
1720
|
+
(function(root, pluralize2) {
|
|
1721
|
+
if (typeof __require === "function" && typeof exports === "object" && typeof module === "object") {
|
|
1722
|
+
module.exports = pluralize2();
|
|
1723
|
+
} else if (typeof define === "function" && define.amd) {
|
|
1724
|
+
define(function() {
|
|
1725
|
+
return pluralize2();
|
|
1726
|
+
});
|
|
1727
|
+
} else {
|
|
1728
|
+
root.pluralize = pluralize2();
|
|
1729
|
+
}
|
|
1730
|
+
})(exports, function() {
|
|
1731
|
+
var pluralRules = [];
|
|
1732
|
+
var singularRules = [];
|
|
1733
|
+
var uncountables = {};
|
|
1734
|
+
var irregularPlurals = {};
|
|
1735
|
+
var irregularSingles = {};
|
|
1736
|
+
function sanitizeRule(rule) {
|
|
1737
|
+
if (typeof rule === "string") {
|
|
1738
|
+
return new RegExp("^" + rule + "$", "i");
|
|
1739
|
+
}
|
|
1740
|
+
return rule;
|
|
1741
|
+
}
|
|
1742
|
+
function restoreCase(word, token) {
|
|
1743
|
+
if (word === token) return token;
|
|
1744
|
+
if (word === word.toLowerCase()) return token.toLowerCase();
|
|
1745
|
+
if (word === word.toUpperCase()) return token.toUpperCase();
|
|
1746
|
+
if (word[0] === word[0].toUpperCase()) {
|
|
1747
|
+
return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
|
|
1748
|
+
}
|
|
1749
|
+
return token.toLowerCase();
|
|
1750
|
+
}
|
|
1751
|
+
function interpolate(str, args) {
|
|
1752
|
+
return str.replace(/\$(\d{1,2})/g, function(match, index) {
|
|
1753
|
+
return args[index] || "";
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
function replace(word, rule) {
|
|
1757
|
+
return word.replace(rule[0], function(match, index) {
|
|
1758
|
+
var result = interpolate(rule[1], arguments);
|
|
1759
|
+
if (match === "") {
|
|
1760
|
+
return restoreCase(word[index - 1], result);
|
|
1761
|
+
}
|
|
1762
|
+
return restoreCase(match, result);
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
function sanitizeWord(token, word, rules) {
|
|
1766
|
+
if (!token.length || uncountables.hasOwnProperty(token)) {
|
|
1767
|
+
return word;
|
|
1768
|
+
}
|
|
1769
|
+
var len = rules.length;
|
|
1770
|
+
while (len--) {
|
|
1771
|
+
var rule = rules[len];
|
|
1772
|
+
if (rule[0].test(word)) return replace(word, rule);
|
|
1773
|
+
}
|
|
1774
|
+
return word;
|
|
1775
|
+
}
|
|
1776
|
+
function replaceWord(replaceMap, keepMap, rules) {
|
|
1777
|
+
return function(word) {
|
|
1778
|
+
var token = word.toLowerCase();
|
|
1779
|
+
if (keepMap.hasOwnProperty(token)) {
|
|
1780
|
+
return restoreCase(word, token);
|
|
1781
|
+
}
|
|
1782
|
+
if (replaceMap.hasOwnProperty(token)) {
|
|
1783
|
+
return restoreCase(word, replaceMap[token]);
|
|
1784
|
+
}
|
|
1785
|
+
return sanitizeWord(token, word, rules);
|
|
1786
|
+
};
|
|
1787
|
+
}
|
|
1788
|
+
function checkWord(replaceMap, keepMap, rules, bool) {
|
|
1789
|
+
return function(word) {
|
|
1790
|
+
var token = word.toLowerCase();
|
|
1791
|
+
if (keepMap.hasOwnProperty(token)) return true;
|
|
1792
|
+
if (replaceMap.hasOwnProperty(token)) return false;
|
|
1793
|
+
return sanitizeWord(token, token, rules) === token;
|
|
1794
|
+
};
|
|
1795
|
+
}
|
|
1796
|
+
function pluralize2(word, count, inclusive) {
|
|
1797
|
+
var pluralized = count === 1 ? pluralize2.singular(word) : pluralize2.plural(word);
|
|
1798
|
+
return (inclusive ? count + " " : "") + pluralized;
|
|
1799
|
+
}
|
|
1800
|
+
pluralize2.plural = replaceWord(
|
|
1801
|
+
irregularSingles,
|
|
1802
|
+
irregularPlurals,
|
|
1803
|
+
pluralRules
|
|
1804
|
+
);
|
|
1805
|
+
pluralize2.isPlural = checkWord(
|
|
1806
|
+
irregularSingles,
|
|
1807
|
+
irregularPlurals,
|
|
1808
|
+
pluralRules
|
|
1809
|
+
);
|
|
1810
|
+
pluralize2.singular = replaceWord(
|
|
1811
|
+
irregularPlurals,
|
|
1812
|
+
irregularSingles,
|
|
1813
|
+
singularRules
|
|
1814
|
+
);
|
|
1815
|
+
pluralize2.isSingular = checkWord(
|
|
1816
|
+
irregularPlurals,
|
|
1817
|
+
irregularSingles,
|
|
1818
|
+
singularRules
|
|
1819
|
+
);
|
|
1820
|
+
pluralize2.addPluralRule = function(rule, replacement) {
|
|
1821
|
+
pluralRules.push([sanitizeRule(rule), replacement]);
|
|
1822
|
+
};
|
|
1823
|
+
pluralize2.addSingularRule = function(rule, replacement) {
|
|
1824
|
+
singularRules.push([sanitizeRule(rule), replacement]);
|
|
1825
|
+
};
|
|
1826
|
+
pluralize2.addUncountableRule = function(word) {
|
|
1827
|
+
if (typeof word === "string") {
|
|
1828
|
+
uncountables[word.toLowerCase()] = true;
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1831
|
+
pluralize2.addPluralRule(word, "$0");
|
|
1832
|
+
pluralize2.addSingularRule(word, "$0");
|
|
1833
|
+
};
|
|
1834
|
+
pluralize2.addIrregularRule = function(single, plural) {
|
|
1835
|
+
plural = plural.toLowerCase();
|
|
1836
|
+
single = single.toLowerCase();
|
|
1837
|
+
irregularSingles[single] = plural;
|
|
1838
|
+
irregularPlurals[plural] = single;
|
|
1839
|
+
};
|
|
1840
|
+
[
|
|
1841
|
+
// Pronouns.
|
|
1842
|
+
["I", "we"],
|
|
1843
|
+
["me", "us"],
|
|
1844
|
+
["he", "they"],
|
|
1845
|
+
["she", "they"],
|
|
1846
|
+
["them", "them"],
|
|
1847
|
+
["myself", "ourselves"],
|
|
1848
|
+
["yourself", "yourselves"],
|
|
1849
|
+
["itself", "themselves"],
|
|
1850
|
+
["herself", "themselves"],
|
|
1851
|
+
["himself", "themselves"],
|
|
1852
|
+
["themself", "themselves"],
|
|
1853
|
+
["is", "are"],
|
|
1854
|
+
["was", "were"],
|
|
1855
|
+
["has", "have"],
|
|
1856
|
+
["this", "these"],
|
|
1857
|
+
["that", "those"],
|
|
1858
|
+
// Words ending in with a consonant and `o`.
|
|
1859
|
+
["echo", "echoes"],
|
|
1860
|
+
["dingo", "dingoes"],
|
|
1861
|
+
["volcano", "volcanoes"],
|
|
1862
|
+
["tornado", "tornadoes"],
|
|
1863
|
+
["torpedo", "torpedoes"],
|
|
1864
|
+
// Ends with `us`.
|
|
1865
|
+
["genus", "genera"],
|
|
1866
|
+
["viscus", "viscera"],
|
|
1867
|
+
// Ends with `ma`.
|
|
1868
|
+
["stigma", "stigmata"],
|
|
1869
|
+
["stoma", "stomata"],
|
|
1870
|
+
["dogma", "dogmata"],
|
|
1871
|
+
["lemma", "lemmata"],
|
|
1872
|
+
["schema", "schemata"],
|
|
1873
|
+
["anathema", "anathemata"],
|
|
1874
|
+
// Other irregular rules.
|
|
1875
|
+
["ox", "oxen"],
|
|
1876
|
+
["axe", "axes"],
|
|
1877
|
+
["die", "dice"],
|
|
1878
|
+
["yes", "yeses"],
|
|
1879
|
+
["foot", "feet"],
|
|
1880
|
+
["eave", "eaves"],
|
|
1881
|
+
["goose", "geese"],
|
|
1882
|
+
["tooth", "teeth"],
|
|
1883
|
+
["quiz", "quizzes"],
|
|
1884
|
+
["human", "humans"],
|
|
1885
|
+
["proof", "proofs"],
|
|
1886
|
+
["carve", "carves"],
|
|
1887
|
+
["valve", "valves"],
|
|
1888
|
+
["looey", "looies"],
|
|
1889
|
+
["thief", "thieves"],
|
|
1890
|
+
["groove", "grooves"],
|
|
1891
|
+
["pickaxe", "pickaxes"],
|
|
1892
|
+
["passerby", "passersby"]
|
|
1893
|
+
].forEach(function(rule) {
|
|
1894
|
+
return pluralize2.addIrregularRule(rule[0], rule[1]);
|
|
1895
|
+
});
|
|
1896
|
+
[
|
|
1897
|
+
[/s?$/i, "s"],
|
|
1898
|
+
[/[^\u0000-\u007F]$/i, "$0"],
|
|
1899
|
+
[/([^aeiou]ese)$/i, "$1"],
|
|
1900
|
+
[/(ax|test)is$/i, "$1es"],
|
|
1901
|
+
[/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
|
|
1902
|
+
[/(e[mn]u)s?$/i, "$1s"],
|
|
1903
|
+
[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
|
|
1904
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
|
|
1905
|
+
[/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
|
|
1906
|
+
[/(seraph|cherub)(?:im)?$/i, "$1im"],
|
|
1907
|
+
[/(her|at|gr)o$/i, "$1oes"],
|
|
1908
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
|
|
1909
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
|
|
1910
|
+
[/sis$/i, "ses"],
|
|
1911
|
+
[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
|
|
1912
|
+
[/([^aeiouy]|qu)y$/i, "$1ies"],
|
|
1913
|
+
[/([^ch][ieo][ln])ey$/i, "$1ies"],
|
|
1914
|
+
[/(x|ch|ss|sh|zz)$/i, "$1es"],
|
|
1915
|
+
[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
|
|
1916
|
+
[/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
|
|
1917
|
+
[/(pe)(?:rson|ople)$/i, "$1ople"],
|
|
1918
|
+
[/(child)(?:ren)?$/i, "$1ren"],
|
|
1919
|
+
[/eaux$/i, "$0"],
|
|
1920
|
+
[/m[ae]n$/i, "men"],
|
|
1921
|
+
["thou", "you"]
|
|
1922
|
+
].forEach(function(rule) {
|
|
1923
|
+
return pluralize2.addPluralRule(rule[0], rule[1]);
|
|
1924
|
+
});
|
|
1925
|
+
[
|
|
1926
|
+
[/s$/i, ""],
|
|
1927
|
+
[/(ss)$/i, "$1"],
|
|
1928
|
+
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
|
|
1929
|
+
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
|
|
1930
|
+
[/ies$/i, "y"],
|
|
1931
|
+
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
|
|
1932
|
+
[/\b(mon|smil)ies$/i, "$1ey"],
|
|
1933
|
+
[/\b((?:tit)?m|l)ice$/i, "$1ouse"],
|
|
1934
|
+
[/(seraph|cherub)im$/i, "$1"],
|
|
1935
|
+
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
|
|
1936
|
+
[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
|
|
1937
|
+
[/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
|
|
1938
|
+
[/(test)(?:is|es)$/i, "$1is"],
|
|
1939
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
|
|
1940
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
|
|
1941
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
|
|
1942
|
+
[/(alumn|alg|vertebr)ae$/i, "$1a"],
|
|
1943
|
+
[/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
|
|
1944
|
+
[/(matr|append)ices$/i, "$1ix"],
|
|
1945
|
+
[/(pe)(rson|ople)$/i, "$1rson"],
|
|
1946
|
+
[/(child)ren$/i, "$1"],
|
|
1947
|
+
[/(eau)x?$/i, "$1"],
|
|
1948
|
+
[/men$/i, "man"]
|
|
1949
|
+
].forEach(function(rule) {
|
|
1950
|
+
return pluralize2.addSingularRule(rule[0], rule[1]);
|
|
1951
|
+
});
|
|
1952
|
+
[
|
|
1953
|
+
// Singular words with no plurals.
|
|
1954
|
+
"adulthood",
|
|
1955
|
+
"advice",
|
|
1956
|
+
"agenda",
|
|
1957
|
+
"aid",
|
|
1958
|
+
"aircraft",
|
|
1959
|
+
"alcohol",
|
|
1960
|
+
"ammo",
|
|
1961
|
+
"analytics",
|
|
1962
|
+
"anime",
|
|
1963
|
+
"athletics",
|
|
1964
|
+
"audio",
|
|
1965
|
+
"bison",
|
|
1966
|
+
"blood",
|
|
1967
|
+
"bream",
|
|
1968
|
+
"buffalo",
|
|
1969
|
+
"butter",
|
|
1970
|
+
"carp",
|
|
1971
|
+
"cash",
|
|
1972
|
+
"chassis",
|
|
1973
|
+
"chess",
|
|
1974
|
+
"clothing",
|
|
1975
|
+
"cod",
|
|
1976
|
+
"commerce",
|
|
1977
|
+
"cooperation",
|
|
1978
|
+
"corps",
|
|
1979
|
+
"debris",
|
|
1980
|
+
"diabetes",
|
|
1981
|
+
"digestion",
|
|
1982
|
+
"elk",
|
|
1983
|
+
"energy",
|
|
1984
|
+
"equipment",
|
|
1985
|
+
"excretion",
|
|
1986
|
+
"expertise",
|
|
1987
|
+
"firmware",
|
|
1988
|
+
"flounder",
|
|
1989
|
+
"fun",
|
|
1990
|
+
"gallows",
|
|
1991
|
+
"garbage",
|
|
1992
|
+
"graffiti",
|
|
1993
|
+
"hardware",
|
|
1994
|
+
"headquarters",
|
|
1995
|
+
"health",
|
|
1996
|
+
"herpes",
|
|
1997
|
+
"highjinks",
|
|
1998
|
+
"homework",
|
|
1999
|
+
"housework",
|
|
2000
|
+
"information",
|
|
2001
|
+
"jeans",
|
|
2002
|
+
"justice",
|
|
2003
|
+
"kudos",
|
|
2004
|
+
"labour",
|
|
2005
|
+
"literature",
|
|
2006
|
+
"machinery",
|
|
2007
|
+
"mackerel",
|
|
2008
|
+
"mail",
|
|
2009
|
+
"media",
|
|
2010
|
+
"mews",
|
|
2011
|
+
"moose",
|
|
2012
|
+
"music",
|
|
2013
|
+
"mud",
|
|
2014
|
+
"manga",
|
|
2015
|
+
"news",
|
|
2016
|
+
"only",
|
|
2017
|
+
"personnel",
|
|
2018
|
+
"pike",
|
|
2019
|
+
"plankton",
|
|
2020
|
+
"pliers",
|
|
2021
|
+
"police",
|
|
2022
|
+
"pollution",
|
|
2023
|
+
"premises",
|
|
2024
|
+
"rain",
|
|
2025
|
+
"research",
|
|
2026
|
+
"rice",
|
|
2027
|
+
"salmon",
|
|
2028
|
+
"scissors",
|
|
2029
|
+
"series",
|
|
2030
|
+
"sewage",
|
|
2031
|
+
"shambles",
|
|
2032
|
+
"shrimp",
|
|
2033
|
+
"software",
|
|
2034
|
+
"species",
|
|
2035
|
+
"staff",
|
|
2036
|
+
"swine",
|
|
2037
|
+
"tennis",
|
|
2038
|
+
"traffic",
|
|
2039
|
+
"transportation",
|
|
2040
|
+
"trout",
|
|
2041
|
+
"tuna",
|
|
2042
|
+
"wealth",
|
|
2043
|
+
"welfare",
|
|
2044
|
+
"whiting",
|
|
2045
|
+
"wildebeest",
|
|
2046
|
+
"wildlife",
|
|
2047
|
+
"you",
|
|
2048
|
+
/pok[eé]mon$/i,
|
|
2049
|
+
// Regexes.
|
|
2050
|
+
/[^aeiou]ese$/i,
|
|
2051
|
+
// "chinese", "japanese"
|
|
2052
|
+
/deer$/i,
|
|
2053
|
+
// "deer", "reindeer"
|
|
2054
|
+
/fish$/i,
|
|
2055
|
+
// "fish", "blowfish", "angelfish"
|
|
2056
|
+
/measles$/i,
|
|
2057
|
+
/o[iu]s$/i,
|
|
2058
|
+
// "carnivorous"
|
|
2059
|
+
/pox$/i,
|
|
2060
|
+
// "chickpox", "smallpox"
|
|
2061
|
+
/sheep$/i
|
|
2062
|
+
].forEach(pluralize2.addUncountableRule);
|
|
2063
|
+
return pluralize2;
|
|
2064
|
+
});
|
|
2065
|
+
}
|
|
2066
|
+
});
|
|
2067
|
+
|
|
1711
2068
|
// node_modules/@tmcp/transport-stdio/src/index.js
|
|
1712
2069
|
import process2 from "node:process";
|
|
1713
2070
|
var StdioTransport = class {
|
|
@@ -20060,7 +20417,15 @@ function isZodObject(obj) {
|
|
|
20060
20417
|
return "shape" in obj && "extend" in obj;
|
|
20061
20418
|
}
|
|
20062
20419
|
|
|
20420
|
+
// src/openapi/mcp-tool-extensions.ts
|
|
20421
|
+
var MCP_TOOL_NAME = "x-tool-name";
|
|
20422
|
+
var MCP_TOOL_DESCRIPTION = "x-tool-description";
|
|
20423
|
+
|
|
20424
|
+
// src/mcp.ts
|
|
20425
|
+
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
20426
|
+
|
|
20063
20427
|
// src/utils.ts
|
|
20428
|
+
var buildManagementApiV1Url = (baseUrl) => `${baseUrl.replace(/\/+$/, "")}/v1`;
|
|
20064
20429
|
function info(...parts) {
|
|
20065
20430
|
console.error(parts.map(formatPart).join("\n"));
|
|
20066
20431
|
}
|
|
@@ -20116,8 +20481,7 @@ function createMcpServer(config2) {
|
|
|
20116
20481
|
function generateMcpTools(config2) {
|
|
20117
20482
|
const tools = [];
|
|
20118
20483
|
const paths = config2.openApiSpec.paths ?? {};
|
|
20119
|
-
const
|
|
20120
|
-
const defaultServerUrl = (servers.length > 0 ? servers[0].url : config2.managementApiUrl).replace(/\/+$/, "");
|
|
20484
|
+
const defaultServerUrl = buildManagementApiV1Url(config2.managementApiUrl);
|
|
20121
20485
|
info(`Server url: ${defaultServerUrl}`);
|
|
20122
20486
|
for (const [path2, pathItem] of Object.entries(paths)) {
|
|
20123
20487
|
if (!pathItem) {
|
|
@@ -20203,19 +20567,26 @@ function generateMcpTool(description, config2) {
|
|
|
20203
20567
|
return { content: [{ type: "text", text: String(error51) }], isError: true };
|
|
20204
20568
|
}
|
|
20205
20569
|
}
|
|
20570
|
+
const extensions = operation;
|
|
20571
|
+
const toolName = extensions[MCP_TOOL_NAME] ?? generateToolName(method, path2);
|
|
20572
|
+
const toolDescription = extensions[MCP_TOOL_DESCRIPTION] ?? operation.description ?? operation.summary ?? "";
|
|
20573
|
+
const inputSchema = buildInputSchemaFromOperation(parameters, operation.requestBody, components);
|
|
20574
|
+
return {
|
|
20575
|
+
name: toolName,
|
|
20576
|
+
description: toolDescription,
|
|
20577
|
+
inputSchema,
|
|
20578
|
+
invoke
|
|
20579
|
+
};
|
|
20580
|
+
}
|
|
20581
|
+
function buildInputSchemaFromOperation(parameters, requestBody, components) {
|
|
20206
20582
|
const inputSchema = {};
|
|
20207
20583
|
for (const parameter of parameters) {
|
|
20208
20584
|
inputSchema[parameter.name] = parameterToZod(parameter, components);
|
|
20209
20585
|
}
|
|
20210
|
-
if (
|
|
20211
|
-
inputSchema.data = requestBodyToZod(
|
|
20586
|
+
if (requestBody) {
|
|
20587
|
+
inputSchema.data = requestBodyToZod(requestBody, components);
|
|
20212
20588
|
}
|
|
20213
|
-
return
|
|
20214
|
-
name: generateToolName(method, path2),
|
|
20215
|
-
description: operation.description ?? operation.summary ?? "",
|
|
20216
|
-
inputSchema,
|
|
20217
|
-
invoke
|
|
20218
|
-
};
|
|
20589
|
+
return inputSchema;
|
|
20219
20590
|
}
|
|
20220
20591
|
function generateToolName(method, path2) {
|
|
20221
20592
|
const segments = path2.split("/").filter(Boolean);
|
|
@@ -20242,8 +20613,8 @@ function generateToolName(method, path2) {
|
|
|
20242
20613
|
DELETE: "delete"
|
|
20243
20614
|
};
|
|
20244
20615
|
const action = actions[method.toUpperCase()] ?? "call";
|
|
20245
|
-
if (hasPathParam
|
|
20246
|
-
resource =
|
|
20616
|
+
if (hasPathParam || action === "create") {
|
|
20617
|
+
resource = import_pluralize.default.singular(resource);
|
|
20247
20618
|
}
|
|
20248
20619
|
let toolName = `${action}_${resource}`;
|
|
20249
20620
|
if (pathParams.length > 0) {
|
|
@@ -20356,7 +20727,7 @@ if (!managementApiSecret) {
|
|
|
20356
20727
|
var workingDir = process.cwd();
|
|
20357
20728
|
info(`Working directory is ${workingDir}`);
|
|
20358
20729
|
info("Looking for OpenAPI specification");
|
|
20359
|
-
var openApiSpec = await lookupOpenApiSpec(`${managementApiUrl}/
|
|
20730
|
+
var openApiSpec = await lookupOpenApiSpec(`${buildManagementApiV1Url(managementApiUrl)}/openapi.json`, managementApiSecret);
|
|
20360
20731
|
if (!openApiSpec) {
|
|
20361
20732
|
err("No OpenAPI specification found");
|
|
20362
20733
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kentico/management-api-mcp",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.5.1-preview",
|
|
4
4
|
"description": "Model Context Protocol server for Xperience by Kentico Management API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
"author": "Kentico",
|
|
21
21
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"tmcp": "^1.19.3",
|
|
24
23
|
"@tmcp/adapter-zod": "^0.1.7",
|
|
25
24
|
"@tmcp/transport-stdio": "^0.4.2",
|
|
26
|
-
"
|
|
25
|
+
"pluralize": "^8.0.0",
|
|
26
|
+
"tmcp": "^1.19.3",
|
|
27
|
+
"zod": "^4.4.3"
|
|
27
28
|
},
|
|
28
29
|
"engines": {
|
|
29
30
|
"node": ">= 22.0.0"
|