@opentiny/next-sdk 0.1.13 → 0.1.14
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/WebMcpClient.d.ts +24 -360
- package/dist/index.es.dev.js +2484 -2893
- package/dist/index.es.js +10824 -11188
- package/dist/index.umd.dev.js +2483 -2892
- package/dist/index.umd.js +46 -42
- package/dist/{mcpsdk@1.20.1.dev.js → mcpsdk@1.17.0.dev.js} +451 -587
- package/dist/{mcpsdk@1.20.1.es.dev.js → mcpsdk@1.17.0.es.dev.js} +451 -587
- package/dist/{mcpsdk@1.20.1.es.js → mcpsdk@1.17.0.es.js} +4045 -4140
- package/dist/mcpsdk@1.17.0.js +16 -0
- package/dist/webagent.dev.js +2514 -2836
- package/dist/webagent.es.dev.js +2521 -2843
- package/dist/webagent.es.js +8784 -9088
- package/dist/webagent.js +31 -27
- package/dist/webmcp-full.dev.js +451 -584
- package/dist/webmcp-full.es.dev.js +451 -584
- package/dist/webmcp-full.es.js +5985 -6078
- package/dist/webmcp-full.js +13 -13
- package/package.json +1 -1
- package/dist/mcpsdk@1.20.1.js +0 -16
|
@@ -2966,58 +2966,81 @@ const require$$9 = {
|
|
|
2966
2966
|
};
|
|
2967
2967
|
var uri$2 = {};
|
|
2968
2968
|
var fastUri$1 = { exports: {} };
|
|
2969
|
-
const
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2969
|
+
const HEX$1 = {
|
|
2970
|
+
0: 0,
|
|
2971
|
+
1: 1,
|
|
2972
|
+
2: 2,
|
|
2973
|
+
3: 3,
|
|
2974
|
+
4: 4,
|
|
2975
|
+
5: 5,
|
|
2976
|
+
6: 6,
|
|
2977
|
+
7: 7,
|
|
2978
|
+
8: 8,
|
|
2979
|
+
9: 9,
|
|
2980
|
+
a: 10,
|
|
2981
|
+
A: 10,
|
|
2982
|
+
b: 11,
|
|
2983
|
+
B: 11,
|
|
2984
|
+
c: 12,
|
|
2985
|
+
C: 12,
|
|
2986
|
+
d: 13,
|
|
2987
|
+
D: 13,
|
|
2988
|
+
e: 14,
|
|
2989
|
+
E: 14,
|
|
2990
|
+
f: 15,
|
|
2991
|
+
F: 15
|
|
2992
|
+
};
|
|
2993
|
+
var scopedChars = {
|
|
2994
|
+
HEX: HEX$1
|
|
2995
|
+
};
|
|
2996
|
+
const { HEX } = scopedChars;
|
|
2997
|
+
const IPV4_REG = /^(?:(?: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;
|
|
2998
|
+
function normalizeIPv4$1(host) {
|
|
2999
|
+
if (findToken(host, ".") < 3) {
|
|
3000
|
+
return { host, isIPV4: false };
|
|
3001
|
+
}
|
|
3002
|
+
const matches = host.match(IPV4_REG) || [];
|
|
3003
|
+
const [address] = matches;
|
|
3004
|
+
if (address) {
|
|
3005
|
+
return { host: stripLeadingZeros(address, "."), isIPV4: true };
|
|
3006
|
+
} else {
|
|
3007
|
+
return { host, isIPV4: false };
|
|
2992
3008
|
}
|
|
2993
|
-
return acc;
|
|
2994
3009
|
}
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
const hex = stringArrayToHexStripped(buffer);
|
|
3003
|
-
if (hex !== "") {
|
|
3004
|
-
address.push(hex);
|
|
3005
|
-
} else {
|
|
3006
|
-
output.error = true;
|
|
3007
|
-
return false;
|
|
3008
|
-
}
|
|
3009
|
-
buffer.length = 0;
|
|
3010
|
+
function stringArrayToHexStripped(input, keepZero = false) {
|
|
3011
|
+
let acc = "";
|
|
3012
|
+
let strip = true;
|
|
3013
|
+
for (const c of input) {
|
|
3014
|
+
if (HEX[c] === void 0) return void 0;
|
|
3015
|
+
if (c !== "0" && strip === true) strip = false;
|
|
3016
|
+
if (!strip) acc += c;
|
|
3010
3017
|
}
|
|
3011
|
-
|
|
3018
|
+
if (keepZero && acc.length === 0) acc = "0";
|
|
3019
|
+
return acc;
|
|
3012
3020
|
}
|
|
3013
3021
|
function getIPV6(input) {
|
|
3014
3022
|
let tokenCount = 0;
|
|
3015
3023
|
const output = { error: false, address: "", zone: "" };
|
|
3016
3024
|
const address = [];
|
|
3017
3025
|
const buffer = [];
|
|
3026
|
+
let isZone = false;
|
|
3018
3027
|
let endipv6Encountered = false;
|
|
3019
3028
|
let endIpv6 = false;
|
|
3020
|
-
|
|
3029
|
+
function consume() {
|
|
3030
|
+
if (buffer.length) {
|
|
3031
|
+
if (isZone === false) {
|
|
3032
|
+
const hex = stringArrayToHexStripped(buffer);
|
|
3033
|
+
if (hex !== void 0) {
|
|
3034
|
+
address.push(hex);
|
|
3035
|
+
} else {
|
|
3036
|
+
output.error = true;
|
|
3037
|
+
return false;
|
|
3038
|
+
}
|
|
3039
|
+
}
|
|
3040
|
+
buffer.length = 0;
|
|
3041
|
+
}
|
|
3042
|
+
return true;
|
|
3043
|
+
}
|
|
3021
3044
|
for (let i = 0; i < input.length; i++) {
|
|
3022
3045
|
const cursor = input[i];
|
|
3023
3046
|
if (cursor === "[" || cursor === "]") {
|
|
@@ -3027,30 +3050,31 @@ function getIPV6(input) {
|
|
|
3027
3050
|
if (endipv6Encountered === true) {
|
|
3028
3051
|
endIpv6 = true;
|
|
3029
3052
|
}
|
|
3030
|
-
if (!consume(
|
|
3053
|
+
if (!consume()) {
|
|
3031
3054
|
break;
|
|
3032
3055
|
}
|
|
3033
|
-
|
|
3056
|
+
tokenCount++;
|
|
3057
|
+
address.push(":");
|
|
3058
|
+
if (tokenCount > 7) {
|
|
3034
3059
|
output.error = true;
|
|
3035
3060
|
break;
|
|
3036
3061
|
}
|
|
3037
|
-
if (i
|
|
3062
|
+
if (i - 1 >= 0 && input[i - 1] === ":") {
|
|
3038
3063
|
endipv6Encountered = true;
|
|
3039
3064
|
}
|
|
3040
|
-
address.push(":");
|
|
3041
3065
|
continue;
|
|
3042
3066
|
} else if (cursor === "%") {
|
|
3043
|
-
if (!consume(
|
|
3067
|
+
if (!consume()) {
|
|
3044
3068
|
break;
|
|
3045
3069
|
}
|
|
3046
|
-
|
|
3070
|
+
isZone = true;
|
|
3047
3071
|
} else {
|
|
3048
3072
|
buffer.push(cursor);
|
|
3049
3073
|
continue;
|
|
3050
3074
|
}
|
|
3051
3075
|
}
|
|
3052
3076
|
if (buffer.length) {
|
|
3053
|
-
if (
|
|
3077
|
+
if (isZone) {
|
|
3054
3078
|
output.zone = buffer.join("");
|
|
3055
3079
|
} else if (endIpv6) {
|
|
3056
3080
|
address.push(buffer.join(""));
|
|
@@ -3073,11 +3097,33 @@ function normalizeIPv6$1(host) {
|
|
|
3073
3097
|
newHost += "%" + ipv6.zone;
|
|
3074
3098
|
escapedHost += "%25" + ipv6.zone;
|
|
3075
3099
|
}
|
|
3076
|
-
return { host: newHost, isIPV6: true
|
|
3100
|
+
return { host: newHost, escapedHost, isIPV6: true };
|
|
3077
3101
|
} else {
|
|
3078
3102
|
return { host, isIPV6: false };
|
|
3079
3103
|
}
|
|
3080
3104
|
}
|
|
3105
|
+
function stripLeadingZeros(str, token) {
|
|
3106
|
+
let out = "";
|
|
3107
|
+
let skip = true;
|
|
3108
|
+
const l = str.length;
|
|
3109
|
+
for (let i = 0; i < l; i++) {
|
|
3110
|
+
const c = str[i];
|
|
3111
|
+
if (c === "0" && skip) {
|
|
3112
|
+
if (i + 1 <= l && str[i + 1] === token || i + 1 === l) {
|
|
3113
|
+
out += c;
|
|
3114
|
+
skip = false;
|
|
3115
|
+
}
|
|
3116
|
+
} else {
|
|
3117
|
+
if (c === token) {
|
|
3118
|
+
skip = true;
|
|
3119
|
+
} else {
|
|
3120
|
+
skip = false;
|
|
3121
|
+
}
|
|
3122
|
+
out += c;
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
return out;
|
|
3126
|
+
}
|
|
3081
3127
|
function findToken(str, token) {
|
|
3082
3128
|
let ind = 0;
|
|
3083
3129
|
for (let i = 0; i < str.length; i++) {
|
|
@@ -3085,339 +3131,246 @@ function findToken(str, token) {
|
|
|
3085
3131
|
}
|
|
3086
3132
|
return ind;
|
|
3087
3133
|
}
|
|
3088
|
-
|
|
3089
|
-
|
|
3134
|
+
const RDS1 = /^\.\.?\//u;
|
|
3135
|
+
const RDS2 = /^\/\.(?:\/|$)/u;
|
|
3136
|
+
const RDS3 = /^\/\.\.(?:\/|$)/u;
|
|
3137
|
+
const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u;
|
|
3138
|
+
function removeDotSegments$1(input) {
|
|
3090
3139
|
const output = [];
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
if (
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3140
|
+
while (input.length) {
|
|
3141
|
+
if (input.match(RDS1)) {
|
|
3142
|
+
input = input.replace(RDS1, "");
|
|
3143
|
+
} else if (input.match(RDS2)) {
|
|
3144
|
+
input = input.replace(RDS2, "/");
|
|
3145
|
+
} else if (input.match(RDS3)) {
|
|
3146
|
+
input = input.replace(RDS3, "/");
|
|
3147
|
+
output.pop();
|
|
3148
|
+
} else if (input === "." || input === "..") {
|
|
3149
|
+
input = "";
|
|
3150
|
+
} else {
|
|
3151
|
+
const im = input.match(RDS5);
|
|
3152
|
+
if (im) {
|
|
3153
|
+
const s = im[0];
|
|
3154
|
+
input = input.slice(s.length);
|
|
3155
|
+
output.push(s);
|
|
3100
3156
|
} else {
|
|
3101
|
-
|
|
3102
|
-
break;
|
|
3103
|
-
}
|
|
3104
|
-
} else if (len === 2) {
|
|
3105
|
-
if (input[0] === ".") {
|
|
3106
|
-
if (input[1] === ".") {
|
|
3107
|
-
break;
|
|
3108
|
-
} else if (input[1] === "/") {
|
|
3109
|
-
input = input.slice(2);
|
|
3110
|
-
continue;
|
|
3111
|
-
}
|
|
3112
|
-
} else if (input[0] === "/") {
|
|
3113
|
-
if (input[1] === "." || input[1] === "/") {
|
|
3114
|
-
output.push("/");
|
|
3115
|
-
break;
|
|
3116
|
-
}
|
|
3117
|
-
}
|
|
3118
|
-
} else if (len === 3) {
|
|
3119
|
-
if (input === "/..") {
|
|
3120
|
-
if (output.length !== 0) {
|
|
3121
|
-
output.pop();
|
|
3122
|
-
}
|
|
3123
|
-
output.push("/");
|
|
3124
|
-
break;
|
|
3125
|
-
}
|
|
3126
|
-
}
|
|
3127
|
-
if (input[0] === ".") {
|
|
3128
|
-
if (input[1] === ".") {
|
|
3129
|
-
if (input[2] === "/") {
|
|
3130
|
-
input = input.slice(3);
|
|
3131
|
-
continue;
|
|
3132
|
-
}
|
|
3133
|
-
} else if (input[1] === "/") {
|
|
3134
|
-
input = input.slice(2);
|
|
3135
|
-
continue;
|
|
3157
|
+
throw new Error("Unexpected dot segment condition");
|
|
3136
3158
|
}
|
|
3137
|
-
} else if (input[0] === "/") {
|
|
3138
|
-
if (input[1] === ".") {
|
|
3139
|
-
if (input[2] === "/") {
|
|
3140
|
-
input = input.slice(2);
|
|
3141
|
-
continue;
|
|
3142
|
-
} else if (input[2] === ".") {
|
|
3143
|
-
if (input[3] === "/") {
|
|
3144
|
-
input = input.slice(3);
|
|
3145
|
-
if (output.length !== 0) {
|
|
3146
|
-
output.pop();
|
|
3147
|
-
}
|
|
3148
|
-
continue;
|
|
3149
|
-
}
|
|
3150
|
-
}
|
|
3151
|
-
}
|
|
3152
|
-
}
|
|
3153
|
-
if ((nextSlash = input.indexOf("/", 1)) === -1) {
|
|
3154
|
-
output.push(input);
|
|
3155
|
-
break;
|
|
3156
|
-
} else {
|
|
3157
|
-
output.push(input.slice(0, nextSlash));
|
|
3158
|
-
input = input.slice(nextSlash);
|
|
3159
3159
|
}
|
|
3160
3160
|
}
|
|
3161
3161
|
return output.join("");
|
|
3162
3162
|
}
|
|
3163
|
-
function normalizeComponentEncoding$1(
|
|
3163
|
+
function normalizeComponentEncoding$1(components, esc) {
|
|
3164
3164
|
const func = esc !== true ? escape : unescape;
|
|
3165
|
-
if (
|
|
3166
|
-
|
|
3165
|
+
if (components.scheme !== void 0) {
|
|
3166
|
+
components.scheme = func(components.scheme);
|
|
3167
3167
|
}
|
|
3168
|
-
if (
|
|
3169
|
-
|
|
3168
|
+
if (components.userinfo !== void 0) {
|
|
3169
|
+
components.userinfo = func(components.userinfo);
|
|
3170
3170
|
}
|
|
3171
|
-
if (
|
|
3172
|
-
|
|
3171
|
+
if (components.host !== void 0) {
|
|
3172
|
+
components.host = func(components.host);
|
|
3173
3173
|
}
|
|
3174
|
-
if (
|
|
3175
|
-
|
|
3174
|
+
if (components.path !== void 0) {
|
|
3175
|
+
components.path = func(components.path);
|
|
3176
3176
|
}
|
|
3177
|
-
if (
|
|
3178
|
-
|
|
3177
|
+
if (components.query !== void 0) {
|
|
3178
|
+
components.query = func(components.query);
|
|
3179
3179
|
}
|
|
3180
|
-
if (
|
|
3181
|
-
|
|
3180
|
+
if (components.fragment !== void 0) {
|
|
3181
|
+
components.fragment = func(components.fragment);
|
|
3182
3182
|
}
|
|
3183
|
-
return
|
|
3183
|
+
return components;
|
|
3184
3184
|
}
|
|
3185
|
-
function recomposeAuthority$1(
|
|
3185
|
+
function recomposeAuthority$1(components) {
|
|
3186
3186
|
const uriTokens = [];
|
|
3187
|
-
if (
|
|
3188
|
-
uriTokens.push(
|
|
3187
|
+
if (components.userinfo !== void 0) {
|
|
3188
|
+
uriTokens.push(components.userinfo);
|
|
3189
3189
|
uriTokens.push("@");
|
|
3190
3190
|
}
|
|
3191
|
-
if (
|
|
3192
|
-
let host = unescape(
|
|
3193
|
-
|
|
3194
|
-
|
|
3191
|
+
if (components.host !== void 0) {
|
|
3192
|
+
let host = unescape(components.host);
|
|
3193
|
+
const ipV4res = normalizeIPv4$1(host);
|
|
3194
|
+
if (ipV4res.isIPV4) {
|
|
3195
|
+
host = ipV4res.host;
|
|
3196
|
+
} else {
|
|
3197
|
+
const ipV6res = normalizeIPv6$1(ipV4res.host);
|
|
3195
3198
|
if (ipV6res.isIPV6 === true) {
|
|
3196
3199
|
host = `[${ipV6res.escapedHost}]`;
|
|
3197
3200
|
} else {
|
|
3198
|
-
host =
|
|
3201
|
+
host = components.host;
|
|
3199
3202
|
}
|
|
3200
3203
|
}
|
|
3201
3204
|
uriTokens.push(host);
|
|
3202
3205
|
}
|
|
3203
|
-
if (typeof
|
|
3206
|
+
if (typeof components.port === "number" || typeof components.port === "string") {
|
|
3204
3207
|
uriTokens.push(":");
|
|
3205
|
-
uriTokens.push(String(
|
|
3208
|
+
uriTokens.push(String(components.port));
|
|
3206
3209
|
}
|
|
3207
3210
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
3208
3211
|
}
|
|
3209
3212
|
var utils = {
|
|
3210
|
-
nonSimpleDomain: nonSimpleDomain$1,
|
|
3211
3213
|
recomposeAuthority: recomposeAuthority$1,
|
|
3212
3214
|
normalizeComponentEncoding: normalizeComponentEncoding$1,
|
|
3213
3215
|
removeDotSegments: removeDotSegments$1,
|
|
3214
|
-
|
|
3215
|
-
isUUID: isUUID$1,
|
|
3216
|
+
normalizeIPv4: normalizeIPv4$1,
|
|
3216
3217
|
normalizeIPv6: normalizeIPv6$1
|
|
3217
3218
|
};
|
|
3218
|
-
const
|
|
3219
|
+
const UUID_REG = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;
|
|
3219
3220
|
const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
|
|
3220
|
-
function
|
|
3221
|
-
|
|
3222
|
-
return true;
|
|
3223
|
-
} else if (wsComponent.secure === false) {
|
|
3224
|
-
return false;
|
|
3225
|
-
} else if (wsComponent.scheme) {
|
|
3226
|
-
return wsComponent.scheme.length === 3 && (wsComponent.scheme[0] === "w" || wsComponent.scheme[0] === "W") && (wsComponent.scheme[1] === "s" || wsComponent.scheme[1] === "S") && (wsComponent.scheme[2] === "s" || wsComponent.scheme[2] === "S");
|
|
3227
|
-
} else {
|
|
3228
|
-
return false;
|
|
3229
|
-
}
|
|
3221
|
+
function isSecure(wsComponents) {
|
|
3222
|
+
return typeof wsComponents.secure === "boolean" ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
|
|
3230
3223
|
}
|
|
3231
|
-
function httpParse(
|
|
3232
|
-
if (!
|
|
3233
|
-
|
|
3224
|
+
function httpParse(components) {
|
|
3225
|
+
if (!components.host) {
|
|
3226
|
+
components.error = components.error || "HTTP URIs must have a host.";
|
|
3234
3227
|
}
|
|
3235
|
-
return
|
|
3228
|
+
return components;
|
|
3236
3229
|
}
|
|
3237
|
-
function httpSerialize(
|
|
3238
|
-
const secure = String(
|
|
3239
|
-
if (
|
|
3240
|
-
|
|
3230
|
+
function httpSerialize(components) {
|
|
3231
|
+
const secure = String(components.scheme).toLowerCase() === "https";
|
|
3232
|
+
if (components.port === (secure ? 443 : 80) || components.port === "") {
|
|
3233
|
+
components.port = void 0;
|
|
3241
3234
|
}
|
|
3242
|
-
if (!
|
|
3243
|
-
|
|
3235
|
+
if (!components.path) {
|
|
3236
|
+
components.path = "/";
|
|
3244
3237
|
}
|
|
3245
|
-
return
|
|
3238
|
+
return components;
|
|
3246
3239
|
}
|
|
3247
|
-
function wsParse(
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
return
|
|
3240
|
+
function wsParse(wsComponents) {
|
|
3241
|
+
wsComponents.secure = isSecure(wsComponents);
|
|
3242
|
+
wsComponents.resourceName = (wsComponents.path || "/") + (wsComponents.query ? "?" + wsComponents.query : "");
|
|
3243
|
+
wsComponents.path = void 0;
|
|
3244
|
+
wsComponents.query = void 0;
|
|
3245
|
+
return wsComponents;
|
|
3253
3246
|
}
|
|
3254
|
-
function wsSerialize(
|
|
3255
|
-
if (
|
|
3256
|
-
|
|
3247
|
+
function wsSerialize(wsComponents) {
|
|
3248
|
+
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
|
|
3249
|
+
wsComponents.port = void 0;
|
|
3257
3250
|
}
|
|
3258
|
-
if (typeof
|
|
3259
|
-
|
|
3260
|
-
|
|
3251
|
+
if (typeof wsComponents.secure === "boolean") {
|
|
3252
|
+
wsComponents.scheme = wsComponents.secure ? "wss" : "ws";
|
|
3253
|
+
wsComponents.secure = void 0;
|
|
3261
3254
|
}
|
|
3262
|
-
if (
|
|
3263
|
-
const [path, query] =
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3255
|
+
if (wsComponents.resourceName) {
|
|
3256
|
+
const [path, query] = wsComponents.resourceName.split("?");
|
|
3257
|
+
wsComponents.path = path && path !== "/" ? path : void 0;
|
|
3258
|
+
wsComponents.query = query;
|
|
3259
|
+
wsComponents.resourceName = void 0;
|
|
3267
3260
|
}
|
|
3268
|
-
|
|
3269
|
-
return
|
|
3261
|
+
wsComponents.fragment = void 0;
|
|
3262
|
+
return wsComponents;
|
|
3270
3263
|
}
|
|
3271
|
-
function urnParse(
|
|
3272
|
-
if (!
|
|
3273
|
-
|
|
3274
|
-
return
|
|
3264
|
+
function urnParse(urnComponents, options) {
|
|
3265
|
+
if (!urnComponents.path) {
|
|
3266
|
+
urnComponents.error = "URN can not be parsed";
|
|
3267
|
+
return urnComponents;
|
|
3275
3268
|
}
|
|
3276
|
-
const matches =
|
|
3269
|
+
const matches = urnComponents.path.match(URN_REG);
|
|
3277
3270
|
if (matches) {
|
|
3278
|
-
const scheme = options.scheme ||
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
const urnScheme = `${scheme}:${options.nid ||
|
|
3282
|
-
const schemeHandler =
|
|
3283
|
-
|
|
3271
|
+
const scheme = options.scheme || urnComponents.scheme || "urn";
|
|
3272
|
+
urnComponents.nid = matches[1].toLowerCase();
|
|
3273
|
+
urnComponents.nss = matches[2];
|
|
3274
|
+
const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`;
|
|
3275
|
+
const schemeHandler = SCHEMES$1[urnScheme];
|
|
3276
|
+
urnComponents.path = void 0;
|
|
3284
3277
|
if (schemeHandler) {
|
|
3285
|
-
|
|
3278
|
+
urnComponents = schemeHandler.parse(urnComponents, options);
|
|
3286
3279
|
}
|
|
3287
3280
|
} else {
|
|
3288
|
-
|
|
3281
|
+
urnComponents.error = urnComponents.error || "URN can not be parsed.";
|
|
3289
3282
|
}
|
|
3290
|
-
return
|
|
3283
|
+
return urnComponents;
|
|
3291
3284
|
}
|
|
3292
|
-
function urnSerialize(
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
}
|
|
3296
|
-
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
3297
|
-
const nid = urnComponent.nid.toLowerCase();
|
|
3285
|
+
function urnSerialize(urnComponents, options) {
|
|
3286
|
+
const scheme = options.scheme || urnComponents.scheme || "urn";
|
|
3287
|
+
const nid = urnComponents.nid.toLowerCase();
|
|
3298
3288
|
const urnScheme = `${scheme}:${options.nid || nid}`;
|
|
3299
|
-
const schemeHandler =
|
|
3289
|
+
const schemeHandler = SCHEMES$1[urnScheme];
|
|
3300
3290
|
if (schemeHandler) {
|
|
3301
|
-
|
|
3291
|
+
urnComponents = schemeHandler.serialize(urnComponents, options);
|
|
3302
3292
|
}
|
|
3303
|
-
const
|
|
3304
|
-
const nss =
|
|
3305
|
-
|
|
3293
|
+
const uriComponents = urnComponents;
|
|
3294
|
+
const nss = urnComponents.nss;
|
|
3295
|
+
uriComponents.path = `${nid || options.nid}:${nss}`;
|
|
3306
3296
|
options.skipEscape = true;
|
|
3307
|
-
return
|
|
3308
|
-
}
|
|
3309
|
-
function urnuuidParse(
|
|
3310
|
-
const
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
if (!options.tolerant && (!
|
|
3314
|
-
|
|
3315
|
-
}
|
|
3316
|
-
return
|
|
3317
|
-
}
|
|
3318
|
-
function urnuuidSerialize(
|
|
3319
|
-
const
|
|
3320
|
-
|
|
3321
|
-
return
|
|
3322
|
-
}
|
|
3323
|
-
const http =
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
const
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
parse: wsParse,
|
|
3347
|
-
serialize: wsSerialize
|
|
3348
|
-
}
|
|
3349
|
-
);
|
|
3350
|
-
const wss = (
|
|
3351
|
-
/** @type {SchemeHandler} */
|
|
3352
|
-
{
|
|
3353
|
-
scheme: "wss",
|
|
3354
|
-
domainHost: ws.domainHost,
|
|
3355
|
-
parse: ws.parse,
|
|
3356
|
-
serialize: ws.serialize
|
|
3357
|
-
}
|
|
3358
|
-
);
|
|
3359
|
-
const urn = (
|
|
3360
|
-
/** @type {SchemeHandler} */
|
|
3361
|
-
{
|
|
3362
|
-
scheme: "urn",
|
|
3363
|
-
parse: urnParse,
|
|
3364
|
-
serialize: urnSerialize,
|
|
3365
|
-
skipNormalize: true
|
|
3366
|
-
}
|
|
3367
|
-
);
|
|
3368
|
-
const urnuuid = (
|
|
3369
|
-
/** @type {SchemeHandler} */
|
|
3370
|
-
{
|
|
3371
|
-
scheme: "urn:uuid",
|
|
3372
|
-
parse: urnuuidParse,
|
|
3373
|
-
serialize: urnuuidSerialize,
|
|
3374
|
-
skipNormalize: true
|
|
3375
|
-
}
|
|
3376
|
-
);
|
|
3377
|
-
const SCHEMES$1 = (
|
|
3378
|
-
/** @type {Record<SchemeName, SchemeHandler>} */
|
|
3379
|
-
{
|
|
3380
|
-
http,
|
|
3381
|
-
https,
|
|
3382
|
-
ws,
|
|
3383
|
-
wss,
|
|
3384
|
-
urn,
|
|
3385
|
-
"urn:uuid": urnuuid
|
|
3386
|
-
}
|
|
3387
|
-
);
|
|
3388
|
-
Object.setPrototypeOf(SCHEMES$1, null);
|
|
3389
|
-
function getSchemeHandler$1(scheme) {
|
|
3390
|
-
return scheme && (SCHEMES$1[
|
|
3391
|
-
/** @type {SchemeName} */
|
|
3392
|
-
scheme
|
|
3393
|
-
] || SCHEMES$1[
|
|
3394
|
-
/** @type {SchemeName} */
|
|
3395
|
-
scheme.toLowerCase()
|
|
3396
|
-
]) || void 0;
|
|
3397
|
-
}
|
|
3398
|
-
var schemes = {
|
|
3399
|
-
SCHEMES: SCHEMES$1,
|
|
3400
|
-
getSchemeHandler: getSchemeHandler$1
|
|
3297
|
+
return uriComponents;
|
|
3298
|
+
}
|
|
3299
|
+
function urnuuidParse(urnComponents, options) {
|
|
3300
|
+
const uuidComponents = urnComponents;
|
|
3301
|
+
uuidComponents.uuid = uuidComponents.nss;
|
|
3302
|
+
uuidComponents.nss = void 0;
|
|
3303
|
+
if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
|
|
3304
|
+
uuidComponents.error = uuidComponents.error || "UUID is not valid.";
|
|
3305
|
+
}
|
|
3306
|
+
return uuidComponents;
|
|
3307
|
+
}
|
|
3308
|
+
function urnuuidSerialize(uuidComponents) {
|
|
3309
|
+
const urnComponents = uuidComponents;
|
|
3310
|
+
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
|
|
3311
|
+
return urnComponents;
|
|
3312
|
+
}
|
|
3313
|
+
const http = {
|
|
3314
|
+
scheme: "http",
|
|
3315
|
+
domainHost: true,
|
|
3316
|
+
parse: httpParse,
|
|
3317
|
+
serialize: httpSerialize
|
|
3318
|
+
};
|
|
3319
|
+
const https = {
|
|
3320
|
+
scheme: "https",
|
|
3321
|
+
domainHost: http.domainHost,
|
|
3322
|
+
parse: httpParse,
|
|
3323
|
+
serialize: httpSerialize
|
|
3324
|
+
};
|
|
3325
|
+
const ws = {
|
|
3326
|
+
scheme: "ws",
|
|
3327
|
+
domainHost: true,
|
|
3328
|
+
parse: wsParse,
|
|
3329
|
+
serialize: wsSerialize
|
|
3330
|
+
};
|
|
3331
|
+
const wss = {
|
|
3332
|
+
scheme: "wss",
|
|
3333
|
+
domainHost: ws.domainHost,
|
|
3334
|
+
parse: ws.parse,
|
|
3335
|
+
serialize: ws.serialize
|
|
3401
3336
|
};
|
|
3402
|
-
const
|
|
3403
|
-
|
|
3337
|
+
const urn = {
|
|
3338
|
+
scheme: "urn",
|
|
3339
|
+
parse: urnParse,
|
|
3340
|
+
serialize: urnSerialize,
|
|
3341
|
+
skipNormalize: true
|
|
3342
|
+
};
|
|
3343
|
+
const urnuuid = {
|
|
3344
|
+
scheme: "urn:uuid",
|
|
3345
|
+
parse: urnuuidParse,
|
|
3346
|
+
serialize: urnuuidSerialize,
|
|
3347
|
+
skipNormalize: true
|
|
3348
|
+
};
|
|
3349
|
+
const SCHEMES$1 = {
|
|
3350
|
+
http,
|
|
3351
|
+
https,
|
|
3352
|
+
ws,
|
|
3353
|
+
wss,
|
|
3354
|
+
urn,
|
|
3355
|
+
"urn:uuid": urnuuid
|
|
3356
|
+
};
|
|
3357
|
+
var schemes = SCHEMES$1;
|
|
3358
|
+
const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = utils;
|
|
3359
|
+
const SCHEMES = schemes;
|
|
3404
3360
|
function normalize(uri2, options) {
|
|
3405
3361
|
if (typeof uri2 === "string") {
|
|
3406
|
-
uri2 =
|
|
3407
|
-
serialize(parse(uri2, options), options);
|
|
3362
|
+
uri2 = serialize(parse(uri2, options), options);
|
|
3408
3363
|
} else if (typeof uri2 === "object") {
|
|
3409
|
-
uri2 =
|
|
3410
|
-
parse(serialize(uri2, options), options);
|
|
3364
|
+
uri2 = parse(serialize(uri2, options), options);
|
|
3411
3365
|
}
|
|
3412
3366
|
return uri2;
|
|
3413
3367
|
}
|
|
3414
3368
|
function resolve$4(baseURI, relativeURI, options) {
|
|
3415
|
-
const schemelessOptions =
|
|
3416
|
-
const resolved =
|
|
3417
|
-
schemelessOptions
|
|
3418
|
-
return serialize(resolved, schemelessOptions);
|
|
3369
|
+
const schemelessOptions = Object.assign({ scheme: "null" }, options);
|
|
3370
|
+
const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
3371
|
+
return serialize(resolved, { ...schemelessOptions, skipEscape: true });
|
|
3419
3372
|
}
|
|
3420
|
-
function
|
|
3373
|
+
function resolveComponents(base, relative, options, skipNormalization) {
|
|
3421
3374
|
const target = {};
|
|
3422
3375
|
if (!skipNormalization) {
|
|
3423
3376
|
base = parse(serialize(base, options), options);
|
|
@@ -3447,7 +3400,7 @@ function resolveComponent(base, relative, options, skipNormalization) {
|
|
|
3447
3400
|
target.query = base.query;
|
|
3448
3401
|
}
|
|
3449
3402
|
} else {
|
|
3450
|
-
if (relative.path
|
|
3403
|
+
if (relative.path.charAt(0) === "/") {
|
|
3451
3404
|
target.path = removeDotSegments(relative.path);
|
|
3452
3405
|
} else {
|
|
3453
3406
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
@@ -3486,7 +3439,7 @@ function equal$4(uriA, uriB, options) {
|
|
|
3486
3439
|
return uriA.toLowerCase() === uriB.toLowerCase();
|
|
3487
3440
|
}
|
|
3488
3441
|
function serialize(cmpts, opts) {
|
|
3489
|
-
const
|
|
3442
|
+
const components = {
|
|
3490
3443
|
host: cmpts.host,
|
|
3491
3444
|
scheme: cmpts.scheme,
|
|
3492
3445
|
userinfo: cmpts.userinfo,
|
|
@@ -3504,49 +3457,60 @@ function serialize(cmpts, opts) {
|
|
|
3504
3457
|
};
|
|
3505
3458
|
const options = Object.assign({}, opts);
|
|
3506
3459
|
const uriTokens = [];
|
|
3507
|
-
const schemeHandler =
|
|
3508
|
-
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(
|
|
3509
|
-
if (
|
|
3460
|
+
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
|
|
3461
|
+
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
|
|
3462
|
+
if (components.path !== void 0) {
|
|
3510
3463
|
if (!options.skipEscape) {
|
|
3511
|
-
|
|
3512
|
-
if (
|
|
3513
|
-
|
|
3464
|
+
components.path = escape(components.path);
|
|
3465
|
+
if (components.scheme !== void 0) {
|
|
3466
|
+
components.path = components.path.split("%3A").join(":");
|
|
3514
3467
|
}
|
|
3515
3468
|
} else {
|
|
3516
|
-
|
|
3469
|
+
components.path = unescape(components.path);
|
|
3517
3470
|
}
|
|
3518
3471
|
}
|
|
3519
|
-
if (options.reference !== "suffix" &&
|
|
3520
|
-
uriTokens.push(
|
|
3472
|
+
if (options.reference !== "suffix" && components.scheme) {
|
|
3473
|
+
uriTokens.push(components.scheme, ":");
|
|
3521
3474
|
}
|
|
3522
|
-
const authority = recomposeAuthority(
|
|
3475
|
+
const authority = recomposeAuthority(components);
|
|
3523
3476
|
if (authority !== void 0) {
|
|
3524
3477
|
if (options.reference !== "suffix") {
|
|
3525
3478
|
uriTokens.push("//");
|
|
3526
3479
|
}
|
|
3527
3480
|
uriTokens.push(authority);
|
|
3528
|
-
if (
|
|
3481
|
+
if (components.path && components.path.charAt(0) !== "/") {
|
|
3529
3482
|
uriTokens.push("/");
|
|
3530
3483
|
}
|
|
3531
3484
|
}
|
|
3532
|
-
if (
|
|
3533
|
-
let s =
|
|
3485
|
+
if (components.path !== void 0) {
|
|
3486
|
+
let s = components.path;
|
|
3534
3487
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
3535
3488
|
s = removeDotSegments(s);
|
|
3536
3489
|
}
|
|
3537
|
-
if (authority === void 0
|
|
3538
|
-
s = "/%2F"
|
|
3490
|
+
if (authority === void 0) {
|
|
3491
|
+
s = s.replace(/^\/\//u, "/%2F");
|
|
3539
3492
|
}
|
|
3540
3493
|
uriTokens.push(s);
|
|
3541
3494
|
}
|
|
3542
|
-
if (
|
|
3543
|
-
uriTokens.push("?",
|
|
3495
|
+
if (components.query !== void 0) {
|
|
3496
|
+
uriTokens.push("?", components.query);
|
|
3544
3497
|
}
|
|
3545
|
-
if (
|
|
3546
|
-
uriTokens.push("#",
|
|
3498
|
+
if (components.fragment !== void 0) {
|
|
3499
|
+
uriTokens.push("#", components.fragment);
|
|
3547
3500
|
}
|
|
3548
3501
|
return uriTokens.join("");
|
|
3549
3502
|
}
|
|
3503
|
+
const hexLookUp = Array.from({ length: 127 }, (_v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)));
|
|
3504
|
+
function nonSimpleDomain(value) {
|
|
3505
|
+
let code2 = 0;
|
|
3506
|
+
for (let i = 0, len = value.length; i < len; ++i) {
|
|
3507
|
+
code2 = value.charCodeAt(i);
|
|
3508
|
+
if (code2 > 126 || hexLookUp[code2]) {
|
|
3509
|
+
return true;
|
|
3510
|
+
}
|
|
3511
|
+
}
|
|
3512
|
+
return false;
|
|
3513
|
+
}
|
|
3550
3514
|
const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
3551
3515
|
function parse(uri2, opts) {
|
|
3552
3516
|
const options = Object.assign({}, opts);
|
|
@@ -3559,14 +3523,9 @@ function parse(uri2, opts) {
|
|
|
3559
3523
|
query: void 0,
|
|
3560
3524
|
fragment: void 0
|
|
3561
3525
|
};
|
|
3526
|
+
const gotEncoding = uri2.indexOf("%") !== -1;
|
|
3562
3527
|
let isIP = false;
|
|
3563
|
-
if (options.reference === "suffix")
|
|
3564
|
-
if (options.scheme) {
|
|
3565
|
-
uri2 = options.scheme + ":" + uri2;
|
|
3566
|
-
} else {
|
|
3567
|
-
uri2 = "//" + uri2;
|
|
3568
|
-
}
|
|
3569
|
-
}
|
|
3528
|
+
if (options.reference === "suffix") uri2 = (options.scheme ? options.scheme + ":" : "") + "//" + uri2;
|
|
3570
3529
|
const matches = uri2.match(URI_PARSE);
|
|
3571
3530
|
if (matches) {
|
|
3572
3531
|
parsed.scheme = matches[1];
|
|
@@ -3580,12 +3539,13 @@ function parse(uri2, opts) {
|
|
|
3580
3539
|
parsed.port = matches[5];
|
|
3581
3540
|
}
|
|
3582
3541
|
if (parsed.host) {
|
|
3583
|
-
const ipv4result =
|
|
3584
|
-
if (ipv4result === false) {
|
|
3585
|
-
const ipv6result = normalizeIPv6(
|
|
3542
|
+
const ipv4result = normalizeIPv4(parsed.host);
|
|
3543
|
+
if (ipv4result.isIPV4 === false) {
|
|
3544
|
+
const ipv6result = normalizeIPv6(ipv4result.host);
|
|
3586
3545
|
parsed.host = ipv6result.host.toLowerCase();
|
|
3587
3546
|
isIP = ipv6result.isIPV6;
|
|
3588
3547
|
} else {
|
|
3548
|
+
parsed.host = ipv4result.host;
|
|
3589
3549
|
isIP = true;
|
|
3590
3550
|
}
|
|
3591
3551
|
}
|
|
@@ -3601,7 +3561,7 @@ function parse(uri2, opts) {
|
|
|
3601
3561
|
if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) {
|
|
3602
3562
|
parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
3603
3563
|
}
|
|
3604
|
-
const schemeHandler =
|
|
3564
|
+
const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || "").toLowerCase()];
|
|
3605
3565
|
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
3606
3566
|
if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
3607
3567
|
try {
|
|
@@ -3612,13 +3572,11 @@ function parse(uri2, opts) {
|
|
|
3612
3572
|
}
|
|
3613
3573
|
}
|
|
3614
3574
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
3615
|
-
if (
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
parsed.host = unescape(parsed.host);
|
|
3621
|
-
}
|
|
3575
|
+
if (gotEncoding && parsed.scheme !== void 0) {
|
|
3576
|
+
parsed.scheme = unescape(parsed.scheme);
|
|
3577
|
+
}
|
|
3578
|
+
if (gotEncoding && parsed.host !== void 0) {
|
|
3579
|
+
parsed.host = unescape(parsed.host);
|
|
3622
3580
|
}
|
|
3623
3581
|
if (parsed.path) {
|
|
3624
3582
|
parsed.path = escape(unescape(parsed.path));
|
|
@@ -3639,7 +3597,7 @@ const fastUri = {
|
|
|
3639
3597
|
SCHEMES,
|
|
3640
3598
|
normalize,
|
|
3641
3599
|
resolve: resolve$4,
|
|
3642
|
-
|
|
3600
|
+
resolveComponents,
|
|
3643
3601
|
equal: equal$4,
|
|
3644
3602
|
serialize,
|
|
3645
3603
|
parse
|
|
@@ -10175,7 +10133,12 @@ const z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10175
10133
|
void: voidType
|
|
10176
10134
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10177
10135
|
const LATEST_PROTOCOL_VERSION = "2025-06-18";
|
|
10178
|
-
const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
10136
|
+
const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
10137
|
+
LATEST_PROTOCOL_VERSION,
|
|
10138
|
+
"2025-03-26",
|
|
10139
|
+
"2024-11-05",
|
|
10140
|
+
"2024-10-07"
|
|
10141
|
+
];
|
|
10179
10142
|
const JSONRPC_VERSION = "2.0";
|
|
10180
10143
|
const ProgressTokenSchema = unionType([stringType(), numberType().int()]);
|
|
10181
10144
|
const CursorSchema = stringType();
|
|
@@ -10255,7 +10218,12 @@ const JSONRPCErrorSchema = objectType({
|
|
|
10255
10218
|
})
|
|
10256
10219
|
}).strict();
|
|
10257
10220
|
const isJSONRPCError = (value) => JSONRPCErrorSchema.safeParse(value).success;
|
|
10258
|
-
const JSONRPCMessageSchema = unionType([
|
|
10221
|
+
const JSONRPCMessageSchema = unionType([
|
|
10222
|
+
JSONRPCRequestSchema,
|
|
10223
|
+
JSONRPCNotificationSchema,
|
|
10224
|
+
JSONRPCResponseSchema,
|
|
10225
|
+
JSONRPCErrorSchema
|
|
10226
|
+
]);
|
|
10259
10227
|
const EmptyResultSchema = ResultSchema.strict();
|
|
10260
10228
|
const CancelledNotificationSchema = NotificationSchema.extend({
|
|
10261
10229
|
method: literalType("notifications/cancelled"),
|
|
@@ -10272,57 +10240,22 @@ const CancelledNotificationSchema = NotificationSchema.extend({
|
|
|
10272
10240
|
reason: stringType().optional()
|
|
10273
10241
|
})
|
|
10274
10242
|
});
|
|
10275
|
-
const IconSchema = objectType({
|
|
10276
|
-
/**
|
|
10277
|
-
* URL or data URI for the icon.
|
|
10278
|
-
*/
|
|
10279
|
-
src: stringType(),
|
|
10280
|
-
/**
|
|
10281
|
-
* Optional MIME type for the icon.
|
|
10282
|
-
*/
|
|
10283
|
-
mimeType: optionalType(stringType()),
|
|
10284
|
-
/**
|
|
10285
|
-
* Optional array of strings that specify sizes at which the icon can be used.
|
|
10286
|
-
* Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
|
|
10287
|
-
*
|
|
10288
|
-
* If not provided, the client should assume that the icon can be used at any size.
|
|
10289
|
-
*/
|
|
10290
|
-
sizes: optionalType(arrayType(stringType()))
|
|
10291
|
-
}).passthrough();
|
|
10292
|
-
const IconsSchema = objectType({
|
|
10293
|
-
/**
|
|
10294
|
-
* Optional set of sized icons that the client can display in a user interface.
|
|
10295
|
-
*
|
|
10296
|
-
* Clients that support rendering icons MUST support at least the following MIME types:
|
|
10297
|
-
* - `image/png` - PNG images (safe, universal compatibility)
|
|
10298
|
-
* - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
|
|
10299
|
-
*
|
|
10300
|
-
* Clients that support rendering icons SHOULD also support:
|
|
10301
|
-
* - `image/svg+xml` - SVG images (scalable but requires security precautions)
|
|
10302
|
-
* - `image/webp` - WebP images (modern, efficient format)
|
|
10303
|
-
*/
|
|
10304
|
-
icons: arrayType(IconSchema).optional()
|
|
10305
|
-
}).passthrough();
|
|
10306
10243
|
const BaseMetadataSchema = objectType({
|
|
10307
10244
|
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
10308
10245
|
name: stringType(),
|
|
10309
10246
|
/**
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10247
|
+
* Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
|
|
10248
|
+
* even by those unfamiliar with domain-specific terminology.
|
|
10249
|
+
*
|
|
10250
|
+
* If not provided, the name should be used for display (except for Tool,
|
|
10251
|
+
* where `annotations.title` should be given precedence over using `name`,
|
|
10252
|
+
* if present).
|
|
10253
|
+
*/
|
|
10317
10254
|
title: optionalType(stringType())
|
|
10318
10255
|
}).passthrough();
|
|
10319
10256
|
const ImplementationSchema = BaseMetadataSchema.extend({
|
|
10320
|
-
version: stringType()
|
|
10321
|
-
|
|
10322
|
-
* An optional URL of the website for this implementation.
|
|
10323
|
-
*/
|
|
10324
|
-
websiteUrl: optionalType(stringType())
|
|
10325
|
-
}).merge(IconsSchema);
|
|
10257
|
+
version: stringType()
|
|
10258
|
+
});
|
|
10326
10259
|
const ClientCapabilitiesSchema = objectType({
|
|
10327
10260
|
/**
|
|
10328
10261
|
* Experimental, non-standard capabilities that the client supports.
|
|
@@ -10517,7 +10450,7 @@ const ResourceSchema = BaseMetadataSchema.extend({
|
|
|
10517
10450
|
* for notes on _meta usage.
|
|
10518
10451
|
*/
|
|
10519
10452
|
_meta: optionalType(objectType({}).passthrough())
|
|
10520
|
-
})
|
|
10453
|
+
});
|
|
10521
10454
|
const ResourceTemplateSchema = BaseMetadataSchema.extend({
|
|
10522
10455
|
/**
|
|
10523
10456
|
* A URI template (according to RFC 6570) that can be used to construct resource URIs.
|
|
@@ -10538,7 +10471,7 @@ const ResourceTemplateSchema = BaseMetadataSchema.extend({
|
|
|
10538
10471
|
* for notes on _meta usage.
|
|
10539
10472
|
*/
|
|
10540
10473
|
_meta: optionalType(objectType({}).passthrough())
|
|
10541
|
-
})
|
|
10474
|
+
});
|
|
10542
10475
|
const ListResourcesRequestSchema = PaginatedRequestSchema.extend({
|
|
10543
10476
|
method: literalType("resources/list")
|
|
10544
10477
|
});
|
|
@@ -10621,7 +10554,7 @@ const PromptSchema = BaseMetadataSchema.extend({
|
|
|
10621
10554
|
* for notes on _meta usage.
|
|
10622
10555
|
*/
|
|
10623
10556
|
_meta: optionalType(objectType({}).passthrough())
|
|
10624
|
-
})
|
|
10557
|
+
});
|
|
10625
10558
|
const ListPromptsRequestSchema = PaginatedRequestSchema.extend({
|
|
10626
10559
|
method: literalType("prompts/list")
|
|
10627
10560
|
});
|
|
@@ -10788,7 +10721,7 @@ const ToolSchema = BaseMetadataSchema.extend({
|
|
|
10788
10721
|
* for notes on _meta usage.
|
|
10789
10722
|
*/
|
|
10790
10723
|
_meta: optionalType(objectType({}).passthrough())
|
|
10791
|
-
})
|
|
10724
|
+
});
|
|
10792
10725
|
const ListToolsRequestSchema = PaginatedRequestSchema.extend({
|
|
10793
10726
|
method: literalType("tools/list")
|
|
10794
10727
|
});
|
|
@@ -10838,7 +10771,16 @@ const CallToolRequestSchema = RequestSchema.extend({
|
|
|
10838
10771
|
const ToolListChangedNotificationSchema = NotificationSchema.extend({
|
|
10839
10772
|
method: literalType("notifications/tools/list_changed")
|
|
10840
10773
|
});
|
|
10841
|
-
const LoggingLevelSchema = enumType([
|
|
10774
|
+
const LoggingLevelSchema = enumType([
|
|
10775
|
+
"debug",
|
|
10776
|
+
"info",
|
|
10777
|
+
"notice",
|
|
10778
|
+
"warning",
|
|
10779
|
+
"error",
|
|
10780
|
+
"critical",
|
|
10781
|
+
"alert",
|
|
10782
|
+
"emergency"
|
|
10783
|
+
]);
|
|
10842
10784
|
const SetLevelRequestSchema = RequestSchema.extend({
|
|
10843
10785
|
method: literalType("logging/setLevel"),
|
|
10844
10786
|
params: BaseRequestParamsSchema.extend({
|
|
@@ -10931,7 +10873,11 @@ const CreateMessageResultSchema = ResultSchema.extend({
|
|
|
10931
10873
|
*/
|
|
10932
10874
|
stopReason: optionalType(enumType(["endTurn", "stopSequence", "maxTokens"]).or(stringType())),
|
|
10933
10875
|
role: enumType(["user", "assistant"]),
|
|
10934
|
-
content: discriminatedUnionType("type", [
|
|
10876
|
+
content: discriminatedUnionType("type", [
|
|
10877
|
+
TextContentSchema,
|
|
10878
|
+
ImageContentSchema,
|
|
10879
|
+
AudioContentSchema
|
|
10880
|
+
])
|
|
10935
10881
|
});
|
|
10936
10882
|
const BooleanSchemaSchema = objectType({
|
|
10937
10883
|
type: literalType("boolean"),
|
|
@@ -10961,7 +10907,12 @@ const EnumSchemaSchema = objectType({
|
|
|
10961
10907
|
enum: arrayType(stringType()),
|
|
10962
10908
|
enumNames: optionalType(arrayType(stringType()))
|
|
10963
10909
|
}).passthrough();
|
|
10964
|
-
const PrimitiveSchemaDefinitionSchema = unionType([
|
|
10910
|
+
const PrimitiveSchemaDefinitionSchema = unionType([
|
|
10911
|
+
BooleanSchemaSchema,
|
|
10912
|
+
StringSchemaSchema,
|
|
10913
|
+
NumberSchemaSchema,
|
|
10914
|
+
EnumSchemaSchema
|
|
10915
|
+
]);
|
|
10965
10916
|
const ElicitRequestSchema = RequestSchema.extend({
|
|
10966
10917
|
method: literalType("elicitation/create"),
|
|
10967
10918
|
params: BaseRequestParamsSchema.extend({
|
|
@@ -11089,8 +11040,18 @@ unionType([
|
|
|
11089
11040
|
InitializedNotificationSchema,
|
|
11090
11041
|
RootsListChangedNotificationSchema
|
|
11091
11042
|
]);
|
|
11092
|
-
unionType([
|
|
11093
|
-
|
|
11043
|
+
unionType([
|
|
11044
|
+
EmptyResultSchema,
|
|
11045
|
+
CreateMessageResultSchema,
|
|
11046
|
+
ElicitResultSchema,
|
|
11047
|
+
ListRootsResultSchema
|
|
11048
|
+
]);
|
|
11049
|
+
unionType([
|
|
11050
|
+
PingRequestSchema,
|
|
11051
|
+
CreateMessageRequestSchema,
|
|
11052
|
+
ElicitRequestSchema,
|
|
11053
|
+
ListRootsRequestSchema
|
|
11054
|
+
]);
|
|
11094
11055
|
unionType([
|
|
11095
11056
|
CancelledNotificationSchema,
|
|
11096
11057
|
ProgressNotificationSchema,
|
|
@@ -11162,10 +11123,7 @@ class Protocol {
|
|
|
11162
11123
|
const totalElapsed = Date.now() - info.startTime;
|
|
11163
11124
|
if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {
|
|
11164
11125
|
this._timeoutInfo.delete(messageId);
|
|
11165
|
-
throw new McpError(ErrorCode.RequestTimeout, "Maximum total timeout exceeded", {
|
|
11166
|
-
maxTotalTimeout: info.maxTotalTimeout,
|
|
11167
|
-
totalElapsed
|
|
11168
|
-
});
|
|
11126
|
+
throw new McpError(ErrorCode.RequestTimeout, "Maximum total timeout exceeded", { maxTotalTimeout: info.maxTotalTimeout, totalElapsed });
|
|
11169
11127
|
}
|
|
11170
11128
|
clearTimeout(info.timeoutId);
|
|
11171
11129
|
info.timeoutId = setTimeout(info.onTimeout, info.timeout);
|
|
@@ -11237,11 +11195,10 @@ class Protocol {
|
|
|
11237
11195
|
Promise.resolve().then(() => handler(notification)).catch((error2) => this._onerror(new Error(`Uncaught error in notification handler: ${error2}`)));
|
|
11238
11196
|
}
|
|
11239
11197
|
_onrequest(request, extra) {
|
|
11240
|
-
var _a, _b;
|
|
11198
|
+
var _a, _b, _c, _d;
|
|
11241
11199
|
const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== void 0 ? _a : this.fallbackRequestHandler;
|
|
11242
|
-
const capturedTransport = this._transport;
|
|
11243
11200
|
if (handler === void 0) {
|
|
11244
|
-
|
|
11201
|
+
(_b = this._transport) === null || _b === void 0 ? void 0 : _b.send({
|
|
11245
11202
|
jsonrpc: "2.0",
|
|
11246
11203
|
id: request.id,
|
|
11247
11204
|
error: {
|
|
@@ -11255,8 +11212,8 @@ class Protocol {
|
|
|
11255
11212
|
this._requestHandlerAbortControllers.set(request.id, abortController);
|
|
11256
11213
|
const fullExtra = {
|
|
11257
11214
|
signal: abortController.signal,
|
|
11258
|
-
sessionId:
|
|
11259
|
-
_meta: (
|
|
11215
|
+
sessionId: (_c = this._transport) === null || _c === void 0 ? void 0 : _c.sessionId,
|
|
11216
|
+
_meta: (_d = request.params) === null || _d === void 0 ? void 0 : _d._meta,
|
|
11260
11217
|
sendNotification: (notification) => this.notification(notification, { relatedRequestId: request.id }),
|
|
11261
11218
|
sendRequest: (r, resultSchema, options) => this.request(r, resultSchema, { ...options, relatedRequestId: request.id }),
|
|
11262
11219
|
authInfo: extra === null || extra === void 0 ? void 0 : extra.authInfo,
|
|
@@ -11264,25 +11221,26 @@ class Protocol {
|
|
|
11264
11221
|
requestInfo: extra === null || extra === void 0 ? void 0 : extra.requestInfo
|
|
11265
11222
|
};
|
|
11266
11223
|
Promise.resolve().then(() => handler(request, fullExtra)).then((result) => {
|
|
11224
|
+
var _a2;
|
|
11267
11225
|
if (abortController.signal.aborted) {
|
|
11268
11226
|
return;
|
|
11269
11227
|
}
|
|
11270
|
-
return
|
|
11228
|
+
return (_a2 = this._transport) === null || _a2 === void 0 ? void 0 : _a2.send({
|
|
11271
11229
|
result,
|
|
11272
11230
|
jsonrpc: "2.0",
|
|
11273
11231
|
id: request.id
|
|
11274
11232
|
});
|
|
11275
11233
|
}, (error2) => {
|
|
11276
|
-
var _a2;
|
|
11234
|
+
var _a2, _b2;
|
|
11277
11235
|
if (abortController.signal.aborted) {
|
|
11278
11236
|
return;
|
|
11279
11237
|
}
|
|
11280
|
-
return
|
|
11238
|
+
return (_a2 = this._transport) === null || _a2 === void 0 ? void 0 : _a2.send({
|
|
11281
11239
|
jsonrpc: "2.0",
|
|
11282
11240
|
id: request.id,
|
|
11283
11241
|
error: {
|
|
11284
11242
|
code: Number.isSafeInteger(error2["code"]) ? error2["code"] : ErrorCode.InternalError,
|
|
11285
|
-
message: (
|
|
11243
|
+
message: (_b2 = error2.message) !== null && _b2 !== void 0 ? _b2 : "Internal error"
|
|
11286
11244
|
}
|
|
11287
11245
|
});
|
|
11288
11246
|
}).catch((error2) => this._onerror(new Error(`Failed to send response: ${error2}`))).finally(() => {
|
|
@@ -12113,24 +12071,24 @@ var uri_all = { exports: {} };
|
|
|
12113
12071
|
}
|
|
12114
12072
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
12115
12073
|
}
|
|
12116
|
-
var
|
|
12117
|
-
var
|
|
12118
|
-
var
|
|
12119
|
-
var
|
|
12074
|
+
var RDS12 = /^\.\.?\//;
|
|
12075
|
+
var RDS22 = /^\/\.(\/|$)/;
|
|
12076
|
+
var RDS32 = /^\/\.\.(\/|$)/;
|
|
12077
|
+
var RDS52 = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
12120
12078
|
function removeDotSegments2(input) {
|
|
12121
12079
|
var output = [];
|
|
12122
12080
|
while (input.length) {
|
|
12123
|
-
if (input.match(
|
|
12124
|
-
input = input.replace(
|
|
12125
|
-
} else if (input.match(
|
|
12126
|
-
input = input.replace(
|
|
12127
|
-
} else if (input.match(
|
|
12128
|
-
input = input.replace(
|
|
12081
|
+
if (input.match(RDS12)) {
|
|
12082
|
+
input = input.replace(RDS12, "");
|
|
12083
|
+
} else if (input.match(RDS22)) {
|
|
12084
|
+
input = input.replace(RDS22, "/");
|
|
12085
|
+
} else if (input.match(RDS32)) {
|
|
12086
|
+
input = input.replace(RDS32, "/");
|
|
12129
12087
|
output.pop();
|
|
12130
12088
|
} else if (input === "." || input === "..") {
|
|
12131
12089
|
input = "";
|
|
12132
12090
|
} else {
|
|
12133
|
-
var im = input.match(
|
|
12091
|
+
var im = input.match(RDS52);
|
|
12134
12092
|
if (im) {
|
|
12135
12093
|
var s = im[0];
|
|
12136
12094
|
input = input.slice(s.length);
|
|
@@ -12193,7 +12151,7 @@ var uri_all = { exports: {} };
|
|
|
12193
12151
|
}
|
|
12194
12152
|
return uriTokens.join("");
|
|
12195
12153
|
}
|
|
12196
|
-
function
|
|
12154
|
+
function resolveComponents2(base2, relative) {
|
|
12197
12155
|
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
12198
12156
|
var skipNormalization = arguments[3];
|
|
12199
12157
|
var target = {};
|
|
@@ -12250,7 +12208,7 @@ var uri_all = { exports: {} };
|
|
|
12250
12208
|
}
|
|
12251
12209
|
function resolve2(baseURI, relativeURI, options) {
|
|
12252
12210
|
var schemelessOptions = assign({ scheme: "null" }, options);
|
|
12253
|
-
return serialize2(
|
|
12211
|
+
return serialize2(resolveComponents2(parse2(baseURI, schemelessOptions), parse2(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
|
|
12254
12212
|
}
|
|
12255
12213
|
function normalize2(uri2, options) {
|
|
12256
12214
|
if (typeof uri2 === "string") {
|
|
@@ -12305,7 +12263,7 @@ var uri_all = { exports: {} };
|
|
|
12305
12263
|
parse: handler.parse,
|
|
12306
12264
|
serialize: handler.serialize
|
|
12307
12265
|
};
|
|
12308
|
-
function
|
|
12266
|
+
function isSecure2(wsComponents) {
|
|
12309
12267
|
return typeof wsComponents.secure === "boolean" ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
|
|
12310
12268
|
}
|
|
12311
12269
|
var handler$2 = {
|
|
@@ -12313,14 +12271,14 @@ var uri_all = { exports: {} };
|
|
|
12313
12271
|
domainHost: true,
|
|
12314
12272
|
parse: function parse3(components, options) {
|
|
12315
12273
|
var wsComponents = components;
|
|
12316
|
-
wsComponents.secure =
|
|
12274
|
+
wsComponents.secure = isSecure2(wsComponents);
|
|
12317
12275
|
wsComponents.resourceName = (wsComponents.path || "/") + (wsComponents.query ? "?" + wsComponents.query : "");
|
|
12318
12276
|
wsComponents.path = void 0;
|
|
12319
12277
|
wsComponents.query = void 0;
|
|
12320
12278
|
return wsComponents;
|
|
12321
12279
|
},
|
|
12322
12280
|
serialize: function serialize3(wsComponents, options) {
|
|
12323
|
-
if (wsComponents.port === (
|
|
12281
|
+
if (wsComponents.port === (isSecure2(wsComponents) ? 443 : 80) || wsComponents.port === "") {
|
|
12324
12282
|
wsComponents.port = void 0;
|
|
12325
12283
|
}
|
|
12326
12284
|
if (typeof wsComponents.secure === "boolean") {
|
|
@@ -12511,7 +12469,7 @@ var uri_all = { exports: {} };
|
|
|
12511
12469
|
exports2.parse = parse2;
|
|
12512
12470
|
exports2.removeDotSegments = removeDotSegments2;
|
|
12513
12471
|
exports2.serialize = serialize2;
|
|
12514
|
-
exports2.resolveComponents =
|
|
12472
|
+
exports2.resolveComponents = resolveComponents2;
|
|
12515
12473
|
exports2.resolve = resolve2;
|
|
12516
12474
|
exports2.normalize = normalize2;
|
|
12517
12475
|
exports2.equal = equal3;
|
|
@@ -17767,7 +17725,7 @@ function splitLines(chunk) {
|
|
|
17767
17725
|
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
17768
17726
|
`, searchIndex);
|
|
17769
17727
|
let lineEnd = -1;
|
|
17770
|
-
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ?
|
|
17728
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
|
|
17771
17729
|
incompleteLine = chunk.slice(searchIndex);
|
|
17772
17730
|
break;
|
|
17773
17731
|
} else {
|
|
@@ -18080,22 +18038,9 @@ async function pkceChallenge(length) {
|
|
|
18080
18038
|
code_challenge: challenge
|
|
18081
18039
|
};
|
|
18082
18040
|
}
|
|
18083
|
-
const SafeUrlSchema = stringType().url().superRefine((val, ctx) => {
|
|
18084
|
-
if (!URL.canParse(val)) {
|
|
18085
|
-
ctx.addIssue({
|
|
18086
|
-
code: ZodIssueCode.custom,
|
|
18087
|
-
message: "URL must be parseable",
|
|
18088
|
-
fatal: true
|
|
18089
|
-
});
|
|
18090
|
-
return NEVER;
|
|
18091
|
-
}
|
|
18092
|
-
}).refine((url) => {
|
|
18093
|
-
const u = new URL(url);
|
|
18094
|
-
return u.protocol !== "javascript:" && u.protocol !== "data:" && u.protocol !== "vbscript:";
|
|
18095
|
-
}, { message: "URL cannot use javascript:, data:, or vbscript: scheme" });
|
|
18096
18041
|
const OAuthProtectedResourceMetadataSchema = objectType({
|
|
18097
18042
|
resource: stringType().url(),
|
|
18098
|
-
authorization_servers: arrayType(
|
|
18043
|
+
authorization_servers: arrayType(stringType().url()).optional(),
|
|
18099
18044
|
jwks_uri: stringType().url().optional(),
|
|
18100
18045
|
scopes_supported: arrayType(stringType()).optional(),
|
|
18101
18046
|
bearer_methods_supported: arrayType(stringType()).optional(),
|
|
@@ -18111,17 +18056,17 @@ const OAuthProtectedResourceMetadataSchema = objectType({
|
|
|
18111
18056
|
}).passthrough();
|
|
18112
18057
|
const OAuthMetadataSchema = objectType({
|
|
18113
18058
|
issuer: stringType(),
|
|
18114
|
-
authorization_endpoint:
|
|
18115
|
-
token_endpoint:
|
|
18116
|
-
registration_endpoint:
|
|
18059
|
+
authorization_endpoint: stringType(),
|
|
18060
|
+
token_endpoint: stringType(),
|
|
18061
|
+
registration_endpoint: stringType().optional(),
|
|
18117
18062
|
scopes_supported: arrayType(stringType()).optional(),
|
|
18118
18063
|
response_types_supported: arrayType(stringType()),
|
|
18119
18064
|
response_modes_supported: arrayType(stringType()).optional(),
|
|
18120
18065
|
grant_types_supported: arrayType(stringType()).optional(),
|
|
18121
18066
|
token_endpoint_auth_methods_supported: arrayType(stringType()).optional(),
|
|
18122
18067
|
token_endpoint_auth_signing_alg_values_supported: arrayType(stringType()).optional(),
|
|
18123
|
-
service_documentation:
|
|
18124
|
-
revocation_endpoint:
|
|
18068
|
+
service_documentation: stringType().optional(),
|
|
18069
|
+
revocation_endpoint: stringType().optional(),
|
|
18125
18070
|
revocation_endpoint_auth_methods_supported: arrayType(stringType()).optional(),
|
|
18126
18071
|
revocation_endpoint_auth_signing_alg_values_supported: arrayType(stringType()).optional(),
|
|
18127
18072
|
introspection_endpoint: stringType().optional(),
|
|
@@ -18131,11 +18076,11 @@ const OAuthMetadataSchema = objectType({
|
|
|
18131
18076
|
}).passthrough();
|
|
18132
18077
|
const OpenIdProviderMetadataSchema = objectType({
|
|
18133
18078
|
issuer: stringType(),
|
|
18134
|
-
authorization_endpoint:
|
|
18135
|
-
token_endpoint:
|
|
18136
|
-
userinfo_endpoint:
|
|
18137
|
-
jwks_uri:
|
|
18138
|
-
registration_endpoint:
|
|
18079
|
+
authorization_endpoint: stringType(),
|
|
18080
|
+
token_endpoint: stringType(),
|
|
18081
|
+
userinfo_endpoint: stringType().optional(),
|
|
18082
|
+
jwks_uri: stringType(),
|
|
18083
|
+
registration_endpoint: stringType().optional(),
|
|
18139
18084
|
scopes_supported: arrayType(stringType()).optional(),
|
|
18140
18085
|
response_types_supported: arrayType(stringType()),
|
|
18141
18086
|
response_modes_supported: arrayType(stringType()).optional(),
|
|
@@ -18163,8 +18108,8 @@ const OpenIdProviderMetadataSchema = objectType({
|
|
|
18163
18108
|
request_parameter_supported: booleanType().optional(),
|
|
18164
18109
|
request_uri_parameter_supported: booleanType().optional(),
|
|
18165
18110
|
require_request_uri_registration: booleanType().optional(),
|
|
18166
|
-
op_policy_uri:
|
|
18167
|
-
op_tos_uri:
|
|
18111
|
+
op_policy_uri: stringType().optional(),
|
|
18112
|
+
op_tos_uri: stringType().optional()
|
|
18168
18113
|
}).passthrough();
|
|
18169
18114
|
const OpenIdProviderDiscoveryMetadataSchema = OpenIdProviderMetadataSchema.merge(OAuthMetadataSchema.pick({
|
|
18170
18115
|
code_challenge_methods_supported: true
|
|
@@ -18183,20 +18128,19 @@ const OAuthErrorResponseSchema = objectType({
|
|
|
18183
18128
|
error_description: stringType().optional(),
|
|
18184
18129
|
error_uri: stringType().optional()
|
|
18185
18130
|
});
|
|
18186
|
-
const OptionalSafeUrlSchema = SafeUrlSchema.optional().or(literalType("").transform(() => void 0));
|
|
18187
18131
|
const OAuthClientMetadataSchema = objectType({
|
|
18188
|
-
redirect_uris: arrayType(
|
|
18132
|
+
redirect_uris: arrayType(stringType()).refine((uris) => uris.every((uri2) => URL.canParse(uri2)), { message: "redirect_uris must contain valid URLs" }),
|
|
18189
18133
|
token_endpoint_auth_method: stringType().optional(),
|
|
18190
18134
|
grant_types: arrayType(stringType()).optional(),
|
|
18191
18135
|
response_types: arrayType(stringType()).optional(),
|
|
18192
18136
|
client_name: stringType().optional(),
|
|
18193
|
-
client_uri:
|
|
18194
|
-
logo_uri:
|
|
18137
|
+
client_uri: stringType().optional(),
|
|
18138
|
+
logo_uri: stringType().optional(),
|
|
18195
18139
|
scope: stringType().optional(),
|
|
18196
18140
|
contacts: arrayType(stringType()).optional(),
|
|
18197
|
-
tos_uri:
|
|
18141
|
+
tos_uri: stringType().optional(),
|
|
18198
18142
|
policy_uri: stringType().optional(),
|
|
18199
|
-
jwks_uri:
|
|
18143
|
+
jwks_uri: stringType().optional(),
|
|
18200
18144
|
jwks: anyType().optional(),
|
|
18201
18145
|
software_id: stringType().optional(),
|
|
18202
18146
|
software_version: stringType().optional(),
|
|
@@ -18329,8 +18273,6 @@ class UnauthorizedError extends Error {
|
|
|
18329
18273
|
super(message !== null && message !== void 0 ? message : "Unauthorized");
|
|
18330
18274
|
}
|
|
18331
18275
|
}
|
|
18332
|
-
const AUTHORIZATION_CODE_RESPONSE_TYPE = "code";
|
|
18333
|
-
const AUTHORIZATION_CODE_CHALLENGE_METHOD = "S256";
|
|
18334
18276
|
function selectClientAuthMethod(clientInformation, supportedMethods) {
|
|
18335
18277
|
const hasClientSecret = clientInformation.client_secret !== void 0;
|
|
18336
18278
|
if (supportedMethods.length === 0) {
|
|
@@ -18434,8 +18376,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope: sco
|
|
|
18434
18376
|
}
|
|
18435
18377
|
const fullInformation = await registerClient(authorizationServerUrl, {
|
|
18436
18378
|
metadata: metadata2,
|
|
18437
|
-
clientMetadata: provider.clientMetadata
|
|
18438
|
-
fetchFn
|
|
18379
|
+
clientMetadata: provider.clientMetadata
|
|
18439
18380
|
});
|
|
18440
18381
|
await provider.saveClientInformation(fullInformation);
|
|
18441
18382
|
clientInformation = fullInformation;
|
|
@@ -18463,8 +18404,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope: sco
|
|
|
18463
18404
|
clientInformation,
|
|
18464
18405
|
refreshToken: tokens.refresh_token,
|
|
18465
18406
|
resource,
|
|
18466
|
-
addClientAuthentication: provider.addClientAuthentication
|
|
18467
|
-
fetchFn
|
|
18407
|
+
addClientAuthentication: provider.addClientAuthentication
|
|
18468
18408
|
});
|
|
18469
18409
|
await provider.saveTokens(newTokens);
|
|
18470
18410
|
return "AUTHORIZED";
|
|
@@ -18561,7 +18501,7 @@ async function tryMetadataDiscovery(url, protocolVersion, fetchFn = fetch) {
|
|
|
18561
18501
|
return await fetchWithCorsRetry(url, headers, fetchFn);
|
|
18562
18502
|
}
|
|
18563
18503
|
function shouldAttemptFallback(response, pathname) {
|
|
18564
|
-
return !response || response.status
|
|
18504
|
+
return !response || response.status === 404 && pathname !== "/";
|
|
18565
18505
|
}
|
|
18566
18506
|
async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, opts) {
|
|
18567
18507
|
var _a, _b;
|
|
@@ -18620,15 +18560,13 @@ function buildDiscoveryUrls(authorizationServerUrl) {
|
|
|
18620
18560
|
return urlsToTry;
|
|
18621
18561
|
}
|
|
18622
18562
|
async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fetchFn = fetch, protocolVersion = LATEST_PROTOCOL_VERSION } = {}) {
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
Accept: "application/json"
|
|
18626
|
-
};
|
|
18563
|
+
var _a;
|
|
18564
|
+
const headers = { "MCP-Protocol-Version": protocolVersion };
|
|
18627
18565
|
const urlsToTry = buildDiscoveryUrls(authorizationServerUrl);
|
|
18628
18566
|
for (const { url: endpointUrl, type: type2 } of urlsToTry) {
|
|
18629
18567
|
const response = await fetchWithCorsRetry(endpointUrl, headers, fetchFn);
|
|
18630
18568
|
if (!response) {
|
|
18631
|
-
|
|
18569
|
+
throw new Error(`CORS error trying to load ${type2 === "oauth" ? "OAuth" : "OpenID provider"} metadata from ${endpointUrl}`);
|
|
18632
18570
|
}
|
|
18633
18571
|
if (!response.ok) {
|
|
18634
18572
|
if (response.status >= 400 && response.status < 500) {
|
|
@@ -18639,20 +18577,26 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
18639
18577
|
if (type2 === "oauth") {
|
|
18640
18578
|
return OAuthMetadataSchema.parse(await response.json());
|
|
18641
18579
|
} else {
|
|
18642
|
-
|
|
18580
|
+
const metadata2 = OpenIdProviderDiscoveryMetadataSchema.parse(await response.json());
|
|
18581
|
+
if (!((_a = metadata2.code_challenge_methods_supported) === null || _a === void 0 ? void 0 : _a.includes("S256"))) {
|
|
18582
|
+
throw new Error(`Incompatible OIDC provider at ${endpointUrl}: does not support S256 code challenge method required by MCP specification`);
|
|
18583
|
+
}
|
|
18584
|
+
return metadata2;
|
|
18643
18585
|
}
|
|
18644
18586
|
}
|
|
18645
18587
|
return void 0;
|
|
18646
18588
|
}
|
|
18647
18589
|
async function startAuthorization(authorizationServerUrl, { metadata: metadata2, clientInformation, redirectUrl, scope: scope2, state, resource }) {
|
|
18590
|
+
const responseType = "code";
|
|
18591
|
+
const codeChallengeMethod = "S256";
|
|
18648
18592
|
let authorizationUrl;
|
|
18649
18593
|
if (metadata2) {
|
|
18650
18594
|
authorizationUrl = new URL(metadata2.authorization_endpoint);
|
|
18651
|
-
if (!metadata2.response_types_supported.includes(
|
|
18652
|
-
throw new Error(`Incompatible auth server: does not support response type ${
|
|
18595
|
+
if (!metadata2.response_types_supported.includes(responseType)) {
|
|
18596
|
+
throw new Error(`Incompatible auth server: does not support response type ${responseType}`);
|
|
18653
18597
|
}
|
|
18654
|
-
if (metadata2.code_challenge_methods_supported
|
|
18655
|
-
throw new Error(`Incompatible auth server: does not support code challenge method ${
|
|
18598
|
+
if (!metadata2.code_challenge_methods_supported || !metadata2.code_challenge_methods_supported.includes(codeChallengeMethod)) {
|
|
18599
|
+
throw new Error(`Incompatible auth server: does not support code challenge method ${codeChallengeMethod}`);
|
|
18656
18600
|
}
|
|
18657
18601
|
} else {
|
|
18658
18602
|
authorizationUrl = new URL("/authorize", authorizationServerUrl);
|
|
@@ -18660,10 +18604,10 @@ async function startAuthorization(authorizationServerUrl, { metadata: metadata2,
|
|
|
18660
18604
|
const challenge = await pkceChallenge();
|
|
18661
18605
|
const codeVerifier = challenge.code_verifier;
|
|
18662
18606
|
const codeChallenge = challenge.code_challenge;
|
|
18663
|
-
authorizationUrl.searchParams.set("response_type",
|
|
18607
|
+
authorizationUrl.searchParams.set("response_type", responseType);
|
|
18664
18608
|
authorizationUrl.searchParams.set("client_id", clientInformation.client_id);
|
|
18665
18609
|
authorizationUrl.searchParams.set("code_challenge", codeChallenge);
|
|
18666
|
-
authorizationUrl.searchParams.set("code_challenge_method",
|
|
18610
|
+
authorizationUrl.searchParams.set("code_challenge_method", codeChallengeMethod);
|
|
18667
18611
|
authorizationUrl.searchParams.set("redirect_uri", String(redirectUrl));
|
|
18668
18612
|
if (state) {
|
|
18669
18613
|
authorizationUrl.searchParams.set("state", state);
|
|
@@ -18688,7 +18632,7 @@ async function exchangeAuthorization(authorizationServerUrl, { metadata: metadat
|
|
|
18688
18632
|
}
|
|
18689
18633
|
const headers = new Headers({
|
|
18690
18634
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
18691
|
-
Accept: "application/json"
|
|
18635
|
+
"Accept": "application/json"
|
|
18692
18636
|
});
|
|
18693
18637
|
const params = new URLSearchParams({
|
|
18694
18638
|
grant_type: grantType,
|
|
@@ -18800,11 +18744,7 @@ class SSEClientTransport {
|
|
|
18800
18744
|
}
|
|
18801
18745
|
let result;
|
|
18802
18746
|
try {
|
|
18803
|
-
result = await auth(this._authProvider, {
|
|
18804
|
-
serverUrl: this._url,
|
|
18805
|
-
resourceMetadataUrl: this._resourceMetadataUrl,
|
|
18806
|
-
fetchFn: this._fetch
|
|
18807
|
-
});
|
|
18747
|
+
result = await auth(this._authProvider, { serverUrl: this._url, resourceMetadataUrl: this._resourceMetadataUrl, fetchFn: this._fetch });
|
|
18808
18748
|
} catch (error2) {
|
|
18809
18749
|
(_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error2);
|
|
18810
18750
|
throw error2;
|
|
@@ -18903,12 +18843,7 @@ class SSEClientTransport {
|
|
|
18903
18843
|
if (!this._authProvider) {
|
|
18904
18844
|
throw new UnauthorizedError("No auth provider");
|
|
18905
18845
|
}
|
|
18906
|
-
const result = await auth(this._authProvider, {
|
|
18907
|
-
serverUrl: this._url,
|
|
18908
|
-
authorizationCode,
|
|
18909
|
-
resourceMetadataUrl: this._resourceMetadataUrl,
|
|
18910
|
-
fetchFn: this._fetch
|
|
18911
|
-
});
|
|
18846
|
+
const result = await auth(this._authProvider, { serverUrl: this._url, authorizationCode, resourceMetadataUrl: this._resourceMetadataUrl, fetchFn: this._fetch });
|
|
18912
18847
|
if (result !== "AUTHORIZED") {
|
|
18913
18848
|
throw new UnauthorizedError("Failed to authorize");
|
|
18914
18849
|
}
|
|
@@ -18938,11 +18873,7 @@ class SSEClientTransport {
|
|
|
18938
18873
|
if (!response.ok) {
|
|
18939
18874
|
if (response.status === 401 && this._authProvider) {
|
|
18940
18875
|
this._resourceMetadataUrl = extractResourceMetadataUrl(response);
|
|
18941
|
-
const result = await auth(this._authProvider, {
|
|
18942
|
-
serverUrl: this._url,
|
|
18943
|
-
resourceMetadataUrl: this._resourceMetadataUrl,
|
|
18944
|
-
fetchFn: this._fetch
|
|
18945
|
-
});
|
|
18876
|
+
const result = await auth(this._authProvider, { serverUrl: this._url, resourceMetadataUrl: this._resourceMetadataUrl, fetchFn: this._fetch });
|
|
18946
18877
|
if (result !== "AUTHORIZED") {
|
|
18947
18878
|
throw new UnauthorizedError();
|
|
18948
18879
|
}
|
|
@@ -18997,7 +18928,6 @@ class StreamableHTTPError extends Error {
|
|
|
18997
18928
|
class StreamableHTTPClientTransport {
|
|
18998
18929
|
constructor(url, opts) {
|
|
18999
18930
|
var _a;
|
|
19000
|
-
this._hasCompletedAuthFlow = false;
|
|
19001
18931
|
this._url = url;
|
|
19002
18932
|
this._resourceMetadataUrl = void 0;
|
|
19003
18933
|
this._requestInit = opts === null || opts === void 0 ? void 0 : opts.requestInit;
|
|
@@ -19013,11 +18943,7 @@ class StreamableHTTPClientTransport {
|
|
|
19013
18943
|
}
|
|
19014
18944
|
let result;
|
|
19015
18945
|
try {
|
|
19016
|
-
result = await auth(this._authProvider, {
|
|
19017
|
-
serverUrl: this._url,
|
|
19018
|
-
resourceMetadataUrl: this._resourceMetadataUrl,
|
|
19019
|
-
fetchFn: this._fetch
|
|
19020
|
-
});
|
|
18946
|
+
result = await auth(this._authProvider, { serverUrl: this._url, resourceMetadataUrl: this._resourceMetadataUrl, fetchFn: this._fetch });
|
|
19021
18947
|
} catch (error2) {
|
|
19022
18948
|
(_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error2);
|
|
19023
18949
|
throw error2;
|
|
@@ -19183,12 +19109,7 @@ class StreamableHTTPClientTransport {
|
|
|
19183
19109
|
if (!this._authProvider) {
|
|
19184
19110
|
throw new UnauthorizedError("No auth provider");
|
|
19185
19111
|
}
|
|
19186
|
-
const result = await auth(this._authProvider, {
|
|
19187
|
-
serverUrl: this._url,
|
|
19188
|
-
authorizationCode,
|
|
19189
|
-
resourceMetadataUrl: this._resourceMetadataUrl,
|
|
19190
|
-
fetchFn: this._fetch
|
|
19191
|
-
});
|
|
19112
|
+
const result = await auth(this._authProvider, { serverUrl: this._url, authorizationCode, resourceMetadataUrl: this._resourceMetadataUrl, fetchFn: this._fetch });
|
|
19192
19113
|
if (result !== "AUTHORIZED") {
|
|
19193
19114
|
throw new UnauthorizedError("Failed to authorize");
|
|
19194
19115
|
}
|
|
@@ -19226,25 +19147,16 @@ class StreamableHTTPClientTransport {
|
|
|
19226
19147
|
}
|
|
19227
19148
|
if (!response.ok) {
|
|
19228
19149
|
if (response.status === 401 && this._authProvider) {
|
|
19229
|
-
if (this._hasCompletedAuthFlow) {
|
|
19230
|
-
throw new StreamableHTTPError(401, "Server returned 401 after successful authentication");
|
|
19231
|
-
}
|
|
19232
19150
|
this._resourceMetadataUrl = extractResourceMetadataUrl(response);
|
|
19233
|
-
const result = await auth(this._authProvider, {
|
|
19234
|
-
serverUrl: this._url,
|
|
19235
|
-
resourceMetadataUrl: this._resourceMetadataUrl,
|
|
19236
|
-
fetchFn: this._fetch
|
|
19237
|
-
});
|
|
19151
|
+
const result = await auth(this._authProvider, { serverUrl: this._url, resourceMetadataUrl: this._resourceMetadataUrl, fetchFn: this._fetch });
|
|
19238
19152
|
if (result !== "AUTHORIZED") {
|
|
19239
19153
|
throw new UnauthorizedError();
|
|
19240
19154
|
}
|
|
19241
|
-
this._hasCompletedAuthFlow = true;
|
|
19242
19155
|
return this.send(message);
|
|
19243
19156
|
}
|
|
19244
19157
|
const text = await response.text().catch(() => null);
|
|
19245
19158
|
throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${text}`);
|
|
19246
19159
|
}
|
|
19247
|
-
this._hasCompletedAuthFlow = false;
|
|
19248
19160
|
if (response.status === 202) {
|
|
19249
19161
|
if (isInitializedNotification(message)) {
|
|
19250
19162
|
this._startOrAuthSse({ resumptionToken: void 0 }).catch((err) => {
|
|
@@ -20174,12 +20086,6 @@ class Server extends Protocol {
|
|
|
20174
20086
|
var _a;
|
|
20175
20087
|
super(options);
|
|
20176
20088
|
this._serverInfo = _serverInfo;
|
|
20177
|
-
this._loggingLevels = /* @__PURE__ */ new Map();
|
|
20178
|
-
this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index]));
|
|
20179
|
-
this.isMessageIgnored = (level, sessionId) => {
|
|
20180
|
-
const currentLevel = this._loggingLevels.get(sessionId);
|
|
20181
|
-
return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;
|
|
20182
|
-
};
|
|
20183
20089
|
this._capabilities = (_a = options === null || options === void 0 ? void 0 : options.capabilities) !== null && _a !== void 0 ? _a : {};
|
|
20184
20090
|
this._instructions = options === null || options === void 0 ? void 0 : options.instructions;
|
|
20185
20091
|
this.setRequestHandler(InitializeRequestSchema, (request) => this._oninitialize(request));
|
|
@@ -20187,18 +20093,6 @@ class Server extends Protocol {
|
|
|
20187
20093
|
var _a2;
|
|
20188
20094
|
return (_a2 = this.oninitialized) === null || _a2 === void 0 ? void 0 : _a2.call(this);
|
|
20189
20095
|
});
|
|
20190
|
-
if (this._capabilities.logging) {
|
|
20191
|
-
this.setRequestHandler(SetLevelRequestSchema, async (request, extra) => {
|
|
20192
|
-
var _a2;
|
|
20193
|
-
const transportSessionId = extra.sessionId || ((_a2 = extra.requestInfo) === null || _a2 === void 0 ? void 0 : _a2.headers["mcp-session-id"]) || void 0;
|
|
20194
|
-
const { level } = request.params;
|
|
20195
|
-
const parseResult = LoggingLevelSchema.safeParse(level);
|
|
20196
|
-
if (parseResult.success) {
|
|
20197
|
-
this._loggingLevels.set(transportSessionId, parseResult.data);
|
|
20198
|
-
}
|
|
20199
|
-
return {};
|
|
20200
|
-
});
|
|
20201
|
-
}
|
|
20202
20096
|
}
|
|
20203
20097
|
/**
|
|
20204
20098
|
* Registers new capabilities. This can only be called before connecting to a transport.
|
|
@@ -20344,19 +20238,8 @@ class Server extends Protocol {
|
|
|
20344
20238
|
async listRoots(params, options) {
|
|
20345
20239
|
return this.request({ method: "roots/list", params }, ListRootsResultSchema, options);
|
|
20346
20240
|
}
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
* Note: You only need to send the parameters object, not the entire JSON RPC message
|
|
20350
|
-
* @see LoggingMessageNotification
|
|
20351
|
-
* @param params
|
|
20352
|
-
* @param sessionId optional for stateless and backward compatibility
|
|
20353
|
-
*/
|
|
20354
|
-
async sendLoggingMessage(params, sessionId) {
|
|
20355
|
-
if (this._capabilities.logging) {
|
|
20356
|
-
if (!this.isMessageIgnored(params.level, sessionId)) {
|
|
20357
|
-
return this.notification({ method: "notifications/message", params });
|
|
20358
|
-
}
|
|
20359
|
-
}
|
|
20241
|
+
async sendLoggingMessage(params) {
|
|
20242
|
+
return this.notification({ method: "notifications/message", params });
|
|
20360
20243
|
}
|
|
20361
20244
|
async sendResourceUpdated(params) {
|
|
20362
20245
|
return this.notification({
|
|
@@ -21905,13 +21788,10 @@ class McpServer {
|
|
|
21905
21788
|
inputSchema: tool.inputSchema ? zodToJsonSchema(tool.inputSchema, {
|
|
21906
21789
|
strictUnions: true
|
|
21907
21790
|
}) : EMPTY_OBJECT_JSON_SCHEMA,
|
|
21908
|
-
annotations: tool.annotations
|
|
21909
|
-
_meta: tool._meta
|
|
21791
|
+
annotations: tool.annotations
|
|
21910
21792
|
};
|
|
21911
21793
|
if (tool.outputSchema) {
|
|
21912
|
-
toolDefinition.outputSchema = zodToJsonSchema(tool.outputSchema, {
|
|
21913
|
-
strictUnions: true
|
|
21914
|
-
});
|
|
21794
|
+
toolDefinition.outputSchema = zodToJsonSchema(tool.outputSchema, { strictUnions: true });
|
|
21915
21795
|
}
|
|
21916
21796
|
return toolDefinition;
|
|
21917
21797
|
})
|
|
@@ -22274,14 +22154,13 @@ class McpServer {
|
|
|
22274
22154
|
this._registeredPrompts[name] = registeredPrompt;
|
|
22275
22155
|
return registeredPrompt;
|
|
22276
22156
|
}
|
|
22277
|
-
_createRegisteredTool(name, title2, description2, inputSchema, outputSchema, annotations,
|
|
22157
|
+
_createRegisteredTool(name, title2, description2, inputSchema, outputSchema, annotations, callback) {
|
|
22278
22158
|
const registeredTool = {
|
|
22279
22159
|
title: title2,
|
|
22280
22160
|
description: description2,
|
|
22281
22161
|
inputSchema: inputSchema === void 0 ? void 0 : objectType(inputSchema),
|
|
22282
22162
|
outputSchema: outputSchema === void 0 ? void 0 : objectType(outputSchema),
|
|
22283
22163
|
annotations,
|
|
22284
|
-
_meta,
|
|
22285
22164
|
callback,
|
|
22286
22165
|
enabled: true,
|
|
22287
22166
|
disable: () => registeredTool.update({ enabled: false }),
|
|
@@ -22303,8 +22182,6 @@ class McpServer {
|
|
|
22303
22182
|
registeredTool.callback = updates.callback;
|
|
22304
22183
|
if (typeof updates.annotations !== "undefined")
|
|
22305
22184
|
registeredTool.annotations = updates.annotations;
|
|
22306
|
-
if (typeof updates._meta !== "undefined")
|
|
22307
|
-
registeredTool._meta = updates._meta;
|
|
22308
22185
|
if (typeof updates.enabled !== "undefined")
|
|
22309
22186
|
registeredTool.enabled = updates.enabled;
|
|
22310
22187
|
this.sendToolListChanged();
|
|
@@ -22341,7 +22218,7 @@ class McpServer {
|
|
|
22341
22218
|
}
|
|
22342
22219
|
}
|
|
22343
22220
|
const callback = rest[0];
|
|
22344
|
-
return this._createRegisteredTool(name, void 0, description2, inputSchema, outputSchema, annotations,
|
|
22221
|
+
return this._createRegisteredTool(name, void 0, description2, inputSchema, outputSchema, annotations, callback);
|
|
22345
22222
|
}
|
|
22346
22223
|
/**
|
|
22347
22224
|
* Registers a tool with a config object and callback.
|
|
@@ -22350,8 +22227,8 @@ class McpServer {
|
|
|
22350
22227
|
if (this._registeredTools[name]) {
|
|
22351
22228
|
throw new Error(`Tool ${name} is already registered`);
|
|
22352
22229
|
}
|
|
22353
|
-
const { title: title2, description: description2, inputSchema, outputSchema, annotations
|
|
22354
|
-
return this._createRegisteredTool(name, title2, description2, inputSchema, outputSchema, annotations,
|
|
22230
|
+
const { title: title2, description: description2, inputSchema, outputSchema, annotations } = config;
|
|
22231
|
+
return this._createRegisteredTool(name, title2, description2, inputSchema, outputSchema, annotations, cb);
|
|
22355
22232
|
}
|
|
22356
22233
|
prompt(name, ...rest) {
|
|
22357
22234
|
if (this._registeredPrompts[name]) {
|
|
@@ -22391,16 +22268,6 @@ class McpServer {
|
|
|
22391
22268
|
isConnected() {
|
|
22392
22269
|
return this.server.transport !== void 0;
|
|
22393
22270
|
}
|
|
22394
|
-
/**
|
|
22395
|
-
* Sends a logging message to the client, if connected.
|
|
22396
|
-
* Note: You only need to send the parameters object, not the entire JSON RPC message
|
|
22397
|
-
* @see LoggingMessageNotification
|
|
22398
|
-
* @param params
|
|
22399
|
-
* @param sessionId optional for stateless and backward compatibility
|
|
22400
|
-
*/
|
|
22401
|
-
async sendLoggingMessage(params, sessionId) {
|
|
22402
|
-
return this.server.sendLoggingMessage(params, sessionId);
|
|
22403
|
-
}
|
|
22404
22271
|
/**
|
|
22405
22272
|
* Sends a resource list changed event to the client, if connected.
|
|
22406
22273
|
*/
|