@vitemcp/server 1.8.7 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -8
- package/dist/{OAuthProvider-COBBSCMI.d.cts → OAuthProvider-DvW1SyKx.d.cts} +11 -0
- package/dist/{OAuthProvider-COBBSCMI.d.ts → OAuthProvider-DvW1SyKx.d.ts} +11 -0
- package/dist/ViteMCP.cjs +3 -3
- package/dist/ViteMCP.d.cts +5 -4
- package/dist/ViteMCP.d.ts +5 -4
- package/dist/ViteMCP.js +2 -2
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.d.cts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-5KNSU2F3.js → chunk-HWSTK2ZH.js} +9 -1
- package/dist/{chunk-5KNSU2F3.js.map → chunk-HWSTK2ZH.js.map} +1 -1
- package/dist/{chunk-Y3GRHB77.cjs → chunk-KFOTRFZS.cjs} +9 -1
- package/dist/chunk-KFOTRFZS.cjs.map +1 -0
- package/dist/{chunk-WPEA62CU.js → chunk-UFLW3ODH.js} +147 -22
- package/dist/chunk-UFLW3ODH.js.map +1 -0
- package/dist/{chunk-4G36TFXD.cjs → chunk-UPZH53RX.cjs} +161 -36
- package/dist/chunk-UPZH53RX.cjs.map +1 -0
- package/dist/openapi/index.cjs +10 -10
- package/dist/openapi/index.d.cts +1 -1
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.js +2 -2
- package/package.json +5 -1
- package/dist/chunk-4G36TFXD.cjs.map +0 -1
- package/dist/chunk-WPEA62CU.js.map +0 -1
- package/dist/chunk-Y3GRHB77.cjs.map +0 -1
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
|
|
17
|
+
|
|
16
18
|
var _server = require('@modelcontextprotocol/server');
|
|
17
19
|
|
|
18
20
|
|
|
@@ -461,6 +463,23 @@ var ServerState = /* @__PURE__ */ ((ServerState2) => {
|
|
|
461
463
|
})(ServerState || {});
|
|
462
464
|
var LATCH_NAME = "vitemcp.internal.capability-latch";
|
|
463
465
|
var LATCH_URI = "vitemcp-internal:capability-latch";
|
|
466
|
+
var LOG_LEVELS = [
|
|
467
|
+
"debug",
|
|
468
|
+
"info",
|
|
469
|
+
"notice",
|
|
470
|
+
"warning",
|
|
471
|
+
"error",
|
|
472
|
+
"critical",
|
|
473
|
+
"alert",
|
|
474
|
+
"emergency"
|
|
475
|
+
];
|
|
476
|
+
var stderrLogger = {
|
|
477
|
+
debug: (...args) => console.error(...args),
|
|
478
|
+
error: (...args) => console.error(...args),
|
|
479
|
+
info: (...args) => console.error(...args),
|
|
480
|
+
log: (...args) => console.error(...args),
|
|
481
|
+
warn: (...args) => console.warn(...args)
|
|
482
|
+
};
|
|
464
483
|
var ViteMCP = class {
|
|
465
484
|
/**
|
|
466
485
|
* The `auth` provider this server was constructed with, or `undefined` when
|
|
@@ -632,7 +651,8 @@ var ViteMCP = class {
|
|
|
632
651
|
}
|
|
633
652
|
/**
|
|
634
653
|
* Publishes `notifications/resources/updated` for a URI to any subscription
|
|
635
|
-
* that opted in to it.
|
|
654
|
+
* that opted in to it and whose caller may read it. HTTP only: a stdio
|
|
655
|
+
* client is never reached.
|
|
636
656
|
*/
|
|
637
657
|
notifyResourceUpdated(uri) {
|
|
638
658
|
_optionalChain([this, 'access', _13 => _13.#handler, 'optionalAccess', _14 => _14.notify, 'access', _15 => _15.resourceUpdated, 'call', _16 => _16(uri)]);
|
|
@@ -677,7 +697,10 @@ var ViteMCP = class {
|
|
|
677
697
|
this.#serverState = "starting" /* Starting */;
|
|
678
698
|
try {
|
|
679
699
|
if (options.transportType === "stdio") {
|
|
680
|
-
this.#
|
|
700
|
+
this.#logger = _nullishCoalesce(this.#options.logger, () => ( stderrLogger));
|
|
701
|
+
this.#stdioHandle = _stdio.serveStdio.call(void 0,
|
|
702
|
+
({ era }) => this.#buildServer(void 0, { era })
|
|
703
|
+
);
|
|
681
704
|
this.#logger.info(`[ViteMCP info] server is running on stdio`);
|
|
682
705
|
} else {
|
|
683
706
|
await this.#startHttp(options.httpStream);
|
|
@@ -740,7 +763,16 @@ var ViteMCP = class {
|
|
|
740
763
|
}
|
|
741
764
|
return { auth };
|
|
742
765
|
}
|
|
743
|
-
|
|
766
|
+
/**
|
|
767
|
+
* `era` is the protocol era the server will speak, where it is known: one
|
|
768
|
+
* built for `connect()` speaks whichever the client picks.
|
|
769
|
+
* `resourceSubscriptions` declares `resources.subscribe`. Set it only where
|
|
770
|
+
* `notifyResourceUpdated` delivers: to 2026-07-28 HTTP clients.
|
|
771
|
+
*/
|
|
772
|
+
async #buildServer(auth, {
|
|
773
|
+
era,
|
|
774
|
+
resourceSubscriptions = false
|
|
775
|
+
} = {}) {
|
|
744
776
|
const server = new (0, _server.McpServer)(
|
|
745
777
|
{
|
|
746
778
|
description: this.#options.description,
|
|
@@ -750,7 +782,15 @@ var ViteMCP = class {
|
|
|
750
782
|
version: this.#options.version,
|
|
751
783
|
websiteUrl: this.#options.websiteUrl
|
|
752
784
|
},
|
|
753
|
-
{
|
|
785
|
+
{
|
|
786
|
+
// Without it the SDK refuses to send `notifications/message`, and
|
|
787
|
+
// `log.*` swallows the refusal, so every log line vanished silently.
|
|
788
|
+
// Left out for a 2025-era client: `log.*` answers only the 2026-07-28
|
|
789
|
+
// per-request opt-in, so the `logging/setLevel` it would promise that
|
|
790
|
+
// client could never take effect.
|
|
791
|
+
capabilities: era === "legacy" ? {} : { logging: {} },
|
|
792
|
+
instructions: this.#options.instructions
|
|
793
|
+
}
|
|
754
794
|
);
|
|
755
795
|
const visible = (all) => all.filter((entry) => !entry.canAccess || entry.canAccess(auth));
|
|
756
796
|
const tools = (await Promise.all(
|
|
@@ -900,8 +940,48 @@ var ViteMCP = class {
|
|
|
900
940
|
if (this.#prompts.length > 0 && prompts.length === 0) {
|
|
901
941
|
server.registerPrompt(LATCH_NAME, {}, (() => ({ messages: [] }))).remove();
|
|
902
942
|
}
|
|
943
|
+
if (resourceSubscriptions && server.server.getCapabilities().resources) {
|
|
944
|
+
server.server.registerCapabilities({ resources: { subscribe: true } });
|
|
945
|
+
}
|
|
903
946
|
return server;
|
|
904
947
|
}
|
|
948
|
+
/**
|
|
949
|
+
* Whether `resources/read` would serve `uri` to this caller: a resource of
|
|
950
|
+
* that URI, or a template matching it, that `canAccess` leaves visible.
|
|
951
|
+
*/
|
|
952
|
+
#canRead(uri, auth) {
|
|
953
|
+
const visible = (entry) => !entry.canAccess || entry.canAccess(auth);
|
|
954
|
+
return this.#resources.some(
|
|
955
|
+
(resource) => resource.uri === uri && visible(resource)
|
|
956
|
+
) || this.#resourceTemplates.some(
|
|
957
|
+
(template) => visible(template) && new (0, _server.UriTemplate)(template.uriTemplate).match(uri) !== null
|
|
958
|
+
);
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* The bus `notifyResourceUpdated` publishes to and `subscriptions/listen`
|
|
962
|
+
* streams read from, narrowed per stream to updates its caller could read.
|
|
963
|
+
*
|
|
964
|
+
* `canAccess` keeps a resource out of `resources/read`, so its updates must
|
|
965
|
+
* not reach that caller either, or subscribing to the URI would reveal what
|
|
966
|
+
* reading it cannot. The SDK subscribes a stream while serving its listen
|
|
967
|
+
* request, so that caller's auth is still in scope here.
|
|
968
|
+
*/
|
|
969
|
+
#eventBus() {
|
|
970
|
+
const events = new (0, _server.InMemoryServerEventBus)(
|
|
971
|
+
(error) => this.#logger.error("[ViteMCP error]", error)
|
|
972
|
+
);
|
|
973
|
+
return {
|
|
974
|
+
publish: (event) => events.publish(event),
|
|
975
|
+
subscribe: (listener) => {
|
|
976
|
+
const auth = _optionalChain([this, 'access', _25 => _25.#authStore, 'access', _26 => _26.getStore, 'call', _27 => _27(), 'optionalAccess', _28 => _28.auth]);
|
|
977
|
+
return events.subscribe((event) => {
|
|
978
|
+
if (event.kind !== "resource_updated" || this.#canRead(event.uri, auth)) {
|
|
979
|
+
listener(event);
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
}
|
|
905
985
|
/** Builds the Hono app with the CORS shim installed ahead of user routes. */
|
|
906
986
|
#freshApp() {
|
|
907
987
|
const app = new (0, _hono.Hono)();
|
|
@@ -920,19 +1000,19 @@ var ViteMCP = class {
|
|
|
920
1000
|
*/
|
|
921
1001
|
#makeContext(auth, rawCtx, timeoutSignal) {
|
|
922
1002
|
const ctx = rawCtx;
|
|
923
|
-
const mcpReq = _optionalChain([ctx, 'optionalAccess',
|
|
924
|
-
const requestedLevel = _optionalChain([mcpReq, 'optionalAccess',
|
|
1003
|
+
const mcpReq = _optionalChain([ctx, 'optionalAccess', _29 => _29.mcpReq]);
|
|
1004
|
+
const requestedLevel = _optionalChain([mcpReq, 'optionalAccess', _30 => _30.envelope, 'optionalAccess', _31 => _31[_server.LOG_LEVEL_META_KEY]]);
|
|
925
1005
|
const emit = (level, message, data) => {
|
|
926
|
-
if (!requestedLevel) {
|
|
1006
|
+
if (!requestedLevel || LOG_LEVELS.indexOf(level) < LOG_LEVELS.indexOf(requestedLevel)) {
|
|
927
1007
|
return;
|
|
928
1008
|
}
|
|
929
|
-
void _optionalChain([mcpReq, 'optionalAccess',
|
|
1009
|
+
void _optionalChain([mcpReq, 'optionalAccess', _32 => _32.notify, 'optionalCall', _33 => _33({
|
|
930
1010
|
method: "notifications/message",
|
|
931
1011
|
params: { data: { context: data, message }, level }
|
|
932
|
-
}), 'optionalAccess',
|
|
1012
|
+
}), 'optionalAccess', _34 => _34.catch, 'call', _35 => _35(() => {
|
|
933
1013
|
})]);
|
|
934
1014
|
};
|
|
935
|
-
const scope = requestScope(_optionalChain([mcpReq, 'optionalAccess',
|
|
1015
|
+
const scope = requestScope(_optionalChain([mcpReq, 'optionalAccess', _36 => _36.signal]), timeoutSignal);
|
|
936
1016
|
return {
|
|
937
1017
|
context: {
|
|
938
1018
|
auth,
|
|
@@ -941,12 +1021,12 @@ var ViteMCP = class {
|
|
|
941
1021
|
requestedSchema: params.requestedSchema
|
|
942
1022
|
}),
|
|
943
1023
|
input: (key, schema) => _server.acceptedContent.call(void 0,
|
|
944
|
-
_optionalChain([mcpReq, 'optionalAccess',
|
|
1024
|
+
_optionalChain([mcpReq, 'optionalAccess', _37 => _37.inputResponses]),
|
|
945
1025
|
key,
|
|
946
1026
|
schema
|
|
947
1027
|
),
|
|
948
1028
|
inputRequired: (inputRequests, requestState) => _server.inputRequired.call(void 0, { inputRequests, requestState }),
|
|
949
|
-
inputResponses: _optionalChain([mcpReq, 'optionalAccess',
|
|
1029
|
+
inputResponses: _optionalChain([mcpReq, 'optionalAccess', _38 => _38.inputResponses]),
|
|
950
1030
|
log: {
|
|
951
1031
|
debug: (m, d) => emit("debug", m, d),
|
|
952
1032
|
error: (m, d) => emit("error", m, d),
|
|
@@ -954,11 +1034,11 @@ var ViteMCP = class {
|
|
|
954
1034
|
warn: (m, d) => emit("warning", m, d)
|
|
955
1035
|
},
|
|
956
1036
|
reportProgress: async (progress) => {
|
|
957
|
-
const progressToken = _optionalChain([mcpReq, 'optionalAccess',
|
|
1037
|
+
const progressToken = _optionalChain([mcpReq, 'optionalAccess', _39 => _39._meta, 'optionalAccess', _40 => _40.progressToken]);
|
|
958
1038
|
if (progressToken === void 0) {
|
|
959
1039
|
return;
|
|
960
1040
|
}
|
|
961
|
-
await _optionalChain([mcpReq, 'optionalAccess',
|
|
1041
|
+
await _optionalChain([mcpReq, 'optionalAccess', _41 => _41.notify, 'optionalCall', _42 => _42({
|
|
962
1042
|
method: "notifications/progress",
|
|
963
1043
|
params: {
|
|
964
1044
|
message: progress.message,
|
|
@@ -968,10 +1048,10 @@ var ViteMCP = class {
|
|
|
968
1048
|
}
|
|
969
1049
|
})]);
|
|
970
1050
|
},
|
|
971
|
-
requestId: _optionalChain([mcpReq, 'optionalAccess',
|
|
1051
|
+
requestId: _optionalChain([mcpReq, 'optionalAccess', _43 => _43.id]),
|
|
972
1052
|
// The SDK exposes this as an accessor; call it so callers get the
|
|
973
1053
|
// value.
|
|
974
|
-
requestState: _optionalChain([mcpReq, 'optionalAccess',
|
|
1054
|
+
requestState: _optionalChain([mcpReq, 'optionalAccess', _44 => _44.requestState, 'optionalCall', _45 => _45()]),
|
|
975
1055
|
signal: scope.signal
|
|
976
1056
|
},
|
|
977
1057
|
release: scope.release
|
|
@@ -983,7 +1063,7 @@ var ViteMCP = class {
|
|
|
983
1063
|
* no addressee on a stateless transport.
|
|
984
1064
|
*/
|
|
985
1065
|
#notifyListChanged(kind) {
|
|
986
|
-
const notifier = _optionalChain([this, 'access',
|
|
1066
|
+
const notifier = _optionalChain([this, 'access', _46 => _46.#handler, 'optionalAccess', _47 => _47.notify]);
|
|
987
1067
|
if (!notifier) {
|
|
988
1068
|
return;
|
|
989
1069
|
}
|
|
@@ -1031,8 +1111,14 @@ var ViteMCP = class {
|
|
|
1031
1111
|
// Authentication has already run in the route below, which is the only
|
|
1032
1112
|
// place that can turn a refusal into an HTTP status. What reaches here
|
|
1033
1113
|
// is either an authenticated session or a deliberately anonymous one.
|
|
1034
|
-
async () => this.#buildServer(_optionalChain([this, 'access',
|
|
1114
|
+
async ({ era }) => this.#buildServer(_optionalChain([this, 'access', _48 => _48.#authStore, 'access', _49 => _49.getStore, 'call', _50 => _50(), 'optionalAccess', _51 => _51.auth]), {
|
|
1115
|
+
era,
|
|
1116
|
+
// A 2025-era client reads `resources.subscribe` as a promise of
|
|
1117
|
+
// `resources/subscribe`, which is not served.
|
|
1118
|
+
resourceSubscriptions: era === "modern"
|
|
1119
|
+
}),
|
|
1035
1120
|
{
|
|
1121
|
+
bus: this.#eventBus(),
|
|
1036
1122
|
// Tradeoff: `server/discover` advertises only 2026-07-28, so legacy
|
|
1037
1123
|
// requests are answered unadvertised and skip Mcp-* validation.
|
|
1038
1124
|
legacy: _nullishCoalesce(config.legacy, () => ( "stateless")),
|
|
@@ -1041,7 +1127,11 @@ var ViteMCP = class {
|
|
|
1041
1127
|
}
|
|
1042
1128
|
);
|
|
1043
1129
|
this.#corsMiddleware = config.cors === false ? null : _cors.cors.call(void 0, config.cors);
|
|
1044
|
-
const
|
|
1130
|
+
const provider = this.#options.auth;
|
|
1131
|
+
const oauth = _nullishCoalesce(this.#options.oauth, () => ( (provider && withEndpointAsResource(
|
|
1132
|
+
provider.getOAuthConfig(),
|
|
1133
|
+
_nullishCoalesce(config.endpoint, () => ( "/mcp"))
|
|
1134
|
+
))));
|
|
1045
1135
|
if (_optionalChain([oauth, 'optionalAccess', _52 => _52.enabled]) !== false && (_nullishCoalesce(_nullishCoalesce(_optionalChain([oauth, 'optionalAccess', _53 => _53.proxy]), () => ( _optionalChain([oauth, 'optionalAccess', _54 => _54.authorizationServer]))), () => ( _optionalChain([oauth, 'optionalAccess', _55 => _55.protectedResource]))))) {
|
|
1046
1136
|
this.#honoApp.route(
|
|
1047
1137
|
"/",
|
|
@@ -1170,32 +1260,43 @@ var ViteMCP = class {
|
|
|
1170
1260
|
);
|
|
1171
1261
|
}
|
|
1172
1262
|
/**
|
|
1173
|
-
*
|
|
1174
|
-
* JSON Schema natively and pass through; anything else
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1178
|
-
*
|
|
1263
|
+
* Gives the SDK a JSON Schema for a schema that has none of its own. Zod v4
|
|
1264
|
+
* and ArkType emit JSON Schema natively and pass through; anything else
|
|
1265
|
+
* (Valibot, say) is converted, and the conversion is only what `tools/list`
|
|
1266
|
+
* advertises. Validation stays with the library the schema was written in:
|
|
1267
|
+
* the conversion drops what JSON Schema cannot say — a transform, a
|
|
1268
|
+
* `check()` — so validating against it instead would pass `execute`
|
|
1269
|
+
* arguments the schema never produced.
|
|
1270
|
+
*
|
|
1271
|
+
* Advertised inputs are closed with `strictInputSchema`. Outputs are left as
|
|
1272
|
+
* converted, since closing them would misdescribe results the schema allows.
|
|
1179
1273
|
*/
|
|
1180
1274
|
async #toSdkSchema(schema, label, io) {
|
|
1181
1275
|
if (!schema) {
|
|
1182
1276
|
return void 0;
|
|
1183
1277
|
}
|
|
1184
1278
|
const standard = schema["~standard"];
|
|
1185
|
-
if (
|
|
1279
|
+
if (standard.jsonSchema) {
|
|
1186
1280
|
return schema;
|
|
1187
1281
|
}
|
|
1282
|
+
let json;
|
|
1188
1283
|
try {
|
|
1189
|
-
|
|
1190
|
-
return _server.fromJsonSchema.call(void 0,
|
|
1191
|
-
io === "input" ? strictInputSchema(json) : json
|
|
1192
|
-
);
|
|
1284
|
+
json = await convertToJsonSchema(schema, io);
|
|
1193
1285
|
} catch (error) {
|
|
1194
1286
|
throw new UnexpectedStateError(
|
|
1195
1287
|
`${label} is not a supported Standard Schema: ${error instanceof Error ? error.message : String(error)}`,
|
|
1196
1288
|
{ label }
|
|
1197
1289
|
);
|
|
1198
1290
|
}
|
|
1291
|
+
const advertised = io === "input" ? strictInputSchema(json) : json;
|
|
1292
|
+
return {
|
|
1293
|
+
"~standard": {
|
|
1294
|
+
jsonSchema: { input: () => advertised, output: () => advertised },
|
|
1295
|
+
validate: (value) => standard.validate(value),
|
|
1296
|
+
vendor: standard.vendor,
|
|
1297
|
+
version: standard.version
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1199
1300
|
}
|
|
1200
1301
|
/**
|
|
1201
1302
|
* The RFC 6750 §3 challenge sent when `authenticate` refuses a request.
|
|
@@ -1218,6 +1319,13 @@ var ViteMCP = class {
|
|
|
1218
1319
|
);
|
|
1219
1320
|
}
|
|
1220
1321
|
};
|
|
1322
|
+
var withEndpointAsResource = (config, endpoint) => ({
|
|
1323
|
+
...config,
|
|
1324
|
+
protectedResource: {
|
|
1325
|
+
...config.protectedResource,
|
|
1326
|
+
resource: `${config.protectedResource.resource}${endpoint}`
|
|
1327
|
+
}
|
|
1328
|
+
});
|
|
1221
1329
|
var nodeToWebRequest = (req, body, secure, signal) => {
|
|
1222
1330
|
const host = _nullishCoalesce(req.headers.host, () => ( "localhost"));
|
|
1223
1331
|
const url = `${secure ? "https" : "http"}://${host}${_nullishCoalesce(req.url, () => ( "/"))}`;
|
|
@@ -1313,6 +1421,23 @@ var readCappedNodeBody = async (req, maxBytes) => {
|
|
|
1313
1421
|
}
|
|
1314
1422
|
return Buffer.concat(chunks);
|
|
1315
1423
|
};
|
|
1424
|
+
var convertToJsonSchema = async (schema, io) => {
|
|
1425
|
+
if (schema["~standard"].vendor !== "valibot") {
|
|
1426
|
+
return _xsschema.toJsonSchema.call(void 0, schema);
|
|
1427
|
+
}
|
|
1428
|
+
let converter;
|
|
1429
|
+
try {
|
|
1430
|
+
converter = await Promise.resolve().then(() => _interopRequireWildcard(require("@valibot/to-json-schema")));
|
|
1431
|
+
} catch (e7) {
|
|
1432
|
+
throw new Error(
|
|
1433
|
+
'The "@valibot/to-json-schema" package is required to describe Valibot schemas. Install it with: npm install @valibot/to-json-schema'
|
|
1434
|
+
);
|
|
1435
|
+
}
|
|
1436
|
+
return converter.toJsonSchema(schema, {
|
|
1437
|
+
errorMode: "ignore",
|
|
1438
|
+
typeMode: io
|
|
1439
|
+
});
|
|
1440
|
+
};
|
|
1316
1441
|
var strictInputSchema = (schema) => ({
|
|
1317
1442
|
...schema,
|
|
1318
1443
|
additionalProperties: typeof schema.additionalProperties === "object" ? schema.additionalProperties : false,
|
|
@@ -1329,8 +1454,8 @@ var assertStandardSchema = (schema, toolName, field) => {
|
|
|
1329
1454
|
if (schema === void 0) {
|
|
1330
1455
|
return;
|
|
1331
1456
|
}
|
|
1332
|
-
const standard = _optionalChain([schema, 'optionalAccess',
|
|
1333
|
-
if (typeof _optionalChain([standard, 'optionalAccess',
|
|
1457
|
+
const standard = _optionalChain([schema, 'optionalAccess', _63 => _63["~standard"]]);
|
|
1458
|
+
if (typeof _optionalChain([standard, 'optionalAccess', _64 => _64.validate]) !== "function") {
|
|
1334
1459
|
throw new UnexpectedStateError(
|
|
1335
1460
|
`Tool '${toolName}' ${field} must implement Standard Schema. If you are using Zod, upgrade to version 3.24 or later.`,
|
|
1336
1461
|
{ toolName }
|
|
@@ -1339,21 +1464,21 @@ var assertStandardSchema = (schema, toolName, field) => {
|
|
|
1339
1464
|
};
|
|
1340
1465
|
var promptArgsSchema = (prompt) => {
|
|
1341
1466
|
const args = prompt.arguments;
|
|
1342
|
-
if (!_optionalChain([args, 'optionalAccess',
|
|
1467
|
+
if (!_optionalChain([args, 'optionalAccess', _65 => _65.length])) {
|
|
1343
1468
|
return void 0;
|
|
1344
1469
|
}
|
|
1345
1470
|
const shape = {};
|
|
1346
1471
|
for (const arg of args) {
|
|
1347
1472
|
const explicitCompleter = _nullishCoalesce(arg.complete, () => ( (prompt.complete ? (value) => prompt.complete(arg.name, value) : void 0)));
|
|
1348
1473
|
const enumValues = arg.enum;
|
|
1349
|
-
const completer = _nullishCoalesce(explicitCompleter, () => ( (_optionalChain([enumValues, 'optionalAccess',
|
|
1474
|
+
const completer = _nullishCoalesce(explicitCompleter, () => ( (_optionalChain([enumValues, 'optionalAccess', _66 => _66.length]) ? async (value) => ({
|
|
1350
1475
|
// An empty value is how an editor asks for the whole set before the
|
|
1351
1476
|
// user has typed anything; filtering it would answer with nothing.
|
|
1352
1477
|
values: value ? enumValues.filter(
|
|
1353
1478
|
(option) => option.toLowerCase().includes(value.toLowerCase())
|
|
1354
1479
|
) : [...enumValues]
|
|
1355
1480
|
}) : void 0)));
|
|
1356
|
-
const valueSchema = _optionalChain([enumValues, 'optionalAccess',
|
|
1481
|
+
const valueSchema = _optionalChain([enumValues, 'optionalAccess', _67 => _67.length]) ? _zod.z.enum(enumValues) : _zod.z.string();
|
|
1357
1482
|
const described = arg.description ? valueSchema.describe(arg.description) : valueSchema;
|
|
1358
1483
|
const base = completer ? _server.completable.call(void 0,
|
|
1359
1484
|
described,
|
|
@@ -1430,4 +1555,4 @@ var normalizeToolResult = (result, hasOutputSchema) => {
|
|
|
1430
1555
|
|
|
1431
1556
|
|
|
1432
1557
|
exports.cancelResponseBody = cancelResponseBody; exports.DiscoveryDocumentCache = DiscoveryDocumentCache; exports.jsonSchemaAdapter = jsonSchemaAdapter; exports.delay = _promises5.setTimeout; exports.MEDIA_FETCH_TIMEOUT_MS = MEDIA_FETCH_TIMEOUT_MS; exports.ViteMCPError = ViteMCPError; exports.UnexpectedStateError = UnexpectedStateError; exports.UserError = UserError; exports.imageContent = imageContent; exports.audioContent = audioContent; exports.ServerState = ServerState; exports.ViteMCP = ViteMCP;
|
|
1433
|
-
//# sourceMappingURL=chunk-
|
|
1558
|
+
//# sourceMappingURL=chunk-UPZH53RX.cjs.map
|