@prefecthq/fastmcp-ts 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.cjs +64 -29
- package/dist/cli/index.cjs.map +1 -1
- package/dist/client.d.ts +127 -115
- package/dist/client.js +47 -26
- package/dist/client.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -1172,7 +1172,7 @@ var init_version = __esm({
|
|
|
1172
1172
|
async run({ args }) {
|
|
1173
1173
|
if (args.json) setJsonMode(true);
|
|
1174
1174
|
const data = {
|
|
1175
|
-
fastmcp: "1.1
|
|
1175
|
+
fastmcp: "1.2.1",
|
|
1176
1176
|
"mcp-sdk": "2.0.0",
|
|
1177
1177
|
node: process.version,
|
|
1178
1178
|
platform: `${process.platform} ${process.arch}`
|
|
@@ -28348,6 +28348,33 @@ var init_auth = __esm({
|
|
|
28348
28348
|
}
|
|
28349
28349
|
});
|
|
28350
28350
|
|
|
28351
|
+
// src/client/capabilities.ts
|
|
28352
|
+
function buildClientCapabilities(supplied, inferred) {
|
|
28353
|
+
const capabilities = { ...supplied };
|
|
28354
|
+
if (inferred.sampling) {
|
|
28355
|
+
capabilities.sampling = {
|
|
28356
|
+
...supplied?.sampling,
|
|
28357
|
+
tools: supplied?.sampling?.tools ?? {}
|
|
28358
|
+
};
|
|
28359
|
+
}
|
|
28360
|
+
if (inferred.elicitation) {
|
|
28361
|
+
const elicitation = supplied?.elicitation;
|
|
28362
|
+
capabilities.elicitation = elicitation ? { ...elicitation, form: elicitation.form ?? {} } : {};
|
|
28363
|
+
}
|
|
28364
|
+
if (inferred.rootsListChanged !== void 0) {
|
|
28365
|
+
capabilities.roots = {
|
|
28366
|
+
...supplied?.roots,
|
|
28367
|
+
listChanged: inferred.rootsListChanged
|
|
28368
|
+
};
|
|
28369
|
+
}
|
|
28370
|
+
return capabilities;
|
|
28371
|
+
}
|
|
28372
|
+
var init_capabilities = __esm({
|
|
28373
|
+
"src/client/capabilities.ts"() {
|
|
28374
|
+
"use strict";
|
|
28375
|
+
}
|
|
28376
|
+
});
|
|
28377
|
+
|
|
28351
28378
|
// src/client/handlers.ts
|
|
28352
28379
|
function defaultLogHandler(message) {
|
|
28353
28380
|
const prefix = message.logger ? `[${message.logger}]` : "[server]";
|
|
@@ -28377,6 +28404,20 @@ var init_handlers = __esm({
|
|
|
28377
28404
|
}
|
|
28378
28405
|
});
|
|
28379
28406
|
|
|
28407
|
+
// src/client/results.ts
|
|
28408
|
+
function normalizeCallToolResult(result) {
|
|
28409
|
+
return {
|
|
28410
|
+
...result,
|
|
28411
|
+
structuredContent: result.structuredContent ?? null,
|
|
28412
|
+
isError: result.isError === true
|
|
28413
|
+
};
|
|
28414
|
+
}
|
|
28415
|
+
var init_results = __esm({
|
|
28416
|
+
"src/client/results.ts"() {
|
|
28417
|
+
"use strict";
|
|
28418
|
+
}
|
|
28419
|
+
});
|
|
28420
|
+
|
|
28380
28421
|
// node_modules/isexe/windows.js
|
|
28381
28422
|
var require_windows = __commonJS({
|
|
28382
28423
|
"node_modules/isexe/windows.js"(exports2, module2) {
|
|
@@ -29288,7 +29329,9 @@ var init_multi_server = __esm({
|
|
|
29288
29329
|
"src/client/multi-server.ts"() {
|
|
29289
29330
|
"use strict";
|
|
29290
29331
|
init_dist4();
|
|
29332
|
+
init_capabilities();
|
|
29291
29333
|
init_handlers();
|
|
29334
|
+
init_results();
|
|
29292
29335
|
init_transports();
|
|
29293
29336
|
init_client();
|
|
29294
29337
|
MultiServerClient = class _MultiServerClient {
|
|
@@ -29300,6 +29343,7 @@ var init_multi_server = __esm({
|
|
|
29300
29343
|
_config;
|
|
29301
29344
|
_handlers;
|
|
29302
29345
|
_roots;
|
|
29346
|
+
_capabilities;
|
|
29303
29347
|
_defaultOptions;
|
|
29304
29348
|
_versionNegotiation;
|
|
29305
29349
|
_resourceSubscriptions = /* @__PURE__ */ new Map();
|
|
@@ -29323,6 +29367,11 @@ var init_multi_server = __esm({
|
|
|
29323
29367
|
};
|
|
29324
29368
|
this._versionNegotiation = options?.versionNegotiation ?? { mode: "auto" };
|
|
29325
29369
|
this._roots = options?.roots;
|
|
29370
|
+
this._capabilities = buildClientCapabilities(options?.capabilities, {
|
|
29371
|
+
sampling: this._handlers.sampling !== void 0,
|
|
29372
|
+
elicitation: this._handlers.elicitation !== void 0,
|
|
29373
|
+
rootsListChanged: this._roots === void 0 ? void 0 : false
|
|
29374
|
+
});
|
|
29326
29375
|
this._defaultOptions = options?.defaultOptions ?? {};
|
|
29327
29376
|
}
|
|
29328
29377
|
// -------------------------------------------------------------------------
|
|
@@ -29451,11 +29500,7 @@ var init_multi_server = __esm({
|
|
|
29451
29500
|
{ name: localName, arguments: args ?? {}, ...this._metaParamsFor(serverName) },
|
|
29452
29501
|
sdkOptions
|
|
29453
29502
|
);
|
|
29454
|
-
return
|
|
29455
|
-
content: result.content,
|
|
29456
|
-
structuredContent: result.structuredContent ?? null,
|
|
29457
|
-
isError: result.isError === true
|
|
29458
|
-
};
|
|
29503
|
+
return normalizeCallToolResult(result);
|
|
29459
29504
|
}
|
|
29460
29505
|
// -------------------------------------------------------------------------
|
|
29461
29506
|
// Resources
|
|
@@ -29734,18 +29779,11 @@ ${errors.map(String).join("\n")}`);
|
|
|
29734
29779
|
return new Client(
|
|
29735
29780
|
{ name: "fastmcp-ts", version: "1.0.0" },
|
|
29736
29781
|
{
|
|
29737
|
-
capabilities: this.
|
|
29782
|
+
capabilities: this._capabilities,
|
|
29738
29783
|
versionNegotiation: this._versionNegotiation
|
|
29739
29784
|
}
|
|
29740
29785
|
);
|
|
29741
29786
|
}
|
|
29742
|
-
_buildCapabilities() {
|
|
29743
|
-
return {
|
|
29744
|
-
...this._handlers.sampling ? { sampling: { tools: {} } } : {},
|
|
29745
|
-
...this._handlers.elicitation ? { elicitation: {} } : {},
|
|
29746
|
-
...this._roots ? { roots: { listChanged: false } } : {}
|
|
29747
|
-
};
|
|
29748
|
-
}
|
|
29749
29787
|
_registerHandlers(sdk) {
|
|
29750
29788
|
sdk.setNotificationHandler("notifications/message", (notification) => {
|
|
29751
29789
|
void this._handlers.log({
|
|
@@ -29831,7 +29869,9 @@ var init_client = __esm({
|
|
|
29831
29869
|
"use strict";
|
|
29832
29870
|
init_dist4();
|
|
29833
29871
|
init_auth();
|
|
29872
|
+
init_capabilities();
|
|
29834
29873
|
init_handlers();
|
|
29874
|
+
init_results();
|
|
29835
29875
|
init_transports();
|
|
29836
29876
|
init_multi_server();
|
|
29837
29877
|
ToolCallError = class extends Error {
|
|
@@ -29869,6 +29909,7 @@ var init_client = __esm({
|
|
|
29869
29909
|
_auth;
|
|
29870
29910
|
_handlers;
|
|
29871
29911
|
_roots;
|
|
29912
|
+
_capabilities;
|
|
29872
29913
|
_autoInitialize;
|
|
29873
29914
|
_versionNegotiation;
|
|
29874
29915
|
_prior;
|
|
@@ -29896,6 +29937,11 @@ var init_client = __esm({
|
|
|
29896
29937
|
onPromptsListChanged: options?.handlers?.onPromptsListChanged
|
|
29897
29938
|
};
|
|
29898
29939
|
this._roots = options?.roots ? normalizeRootsOption(options.roots) : void 0;
|
|
29940
|
+
this._capabilities = buildClientCapabilities(options?.capabilities, {
|
|
29941
|
+
sampling: this._handlers.sampling !== void 0,
|
|
29942
|
+
elicitation: this._handlers.elicitation !== void 0,
|
|
29943
|
+
rootsListChanged: this._roots === void 0 ? void 0 : true
|
|
29944
|
+
});
|
|
29899
29945
|
this._autoInitialize = options?.autoInitialize ?? true;
|
|
29900
29946
|
this._versionNegotiation = options?.versionNegotiation ?? { mode: "auto" };
|
|
29901
29947
|
this._prior = options?.prior;
|
|
@@ -29930,7 +29976,7 @@ var init_client = __esm({
|
|
|
29930
29976
|
const sdkClient = new Client(
|
|
29931
29977
|
{ name: "fastmcp-ts", version: "1.0.0" },
|
|
29932
29978
|
{
|
|
29933
|
-
capabilities: this.
|
|
29979
|
+
capabilities: this._capabilities,
|
|
29934
29980
|
listChanged: this._buildListChangedConfig(),
|
|
29935
29981
|
versionNegotiation: this._versionNegotiation,
|
|
29936
29982
|
...this._inputRequired ? { inputRequired: this._inputRequired } : {},
|
|
@@ -30099,11 +30145,7 @@ var init_client = __esm({
|
|
|
30099
30145
|
const result = await this._reauthRetry(
|
|
30100
30146
|
() => this._sdk().callTool({ name, arguments: args ?? {}, ...this._metaParams() }, sdkOptions)
|
|
30101
30147
|
);
|
|
30102
|
-
return
|
|
30103
|
-
content: result.content,
|
|
30104
|
-
structuredContent: result.structuredContent ?? null,
|
|
30105
|
-
isError: result.isError === true
|
|
30106
|
-
};
|
|
30148
|
+
return normalizeCallToolResult(result);
|
|
30107
30149
|
}
|
|
30108
30150
|
// -------------------------------------------------------------------------
|
|
30109
30151
|
// Resources (IResourcesClient)
|
|
@@ -30402,13 +30444,6 @@ var init_client = __esm({
|
|
|
30402
30444
|
}
|
|
30403
30445
|
return sdkOptions;
|
|
30404
30446
|
}
|
|
30405
|
-
_buildCapabilities() {
|
|
30406
|
-
return {
|
|
30407
|
-
...this._handlers.sampling ? { sampling: { tools: {} } } : {},
|
|
30408
|
-
...this._handlers.elicitation ? { elicitation: {} } : {},
|
|
30409
|
-
...this._roots ? { roots: { listChanged: true } } : {}
|
|
30410
|
-
};
|
|
30411
|
-
}
|
|
30412
30447
|
_buildListChangedConfig() {
|
|
30413
30448
|
const { onToolsListChanged, onResourcesListChanged, onPromptsListChanged } = this._handlers;
|
|
30414
30449
|
if (!onToolsListChanged && !onResourcesListChanged && !onPromptsListChanged) return void 0;
|
|
@@ -33369,7 +33404,7 @@ var init_inspect = __esm({
|
|
|
33369
33404
|
// only case Python's inspect supports); over --url/--command the
|
|
33370
33405
|
// generation is unknowable from the wire.
|
|
33371
33406
|
generation: mode.kind === "inprocess" ? 2 : null,
|
|
33372
|
-
fastmcpVersion: "1.1
|
|
33407
|
+
fastmcpVersion: "1.2.1",
|
|
33373
33408
|
mcpVersion: "2.0.0",
|
|
33374
33409
|
tools: tools2,
|
|
33375
33410
|
prompts: prompts2,
|
|
@@ -46873,7 +46908,7 @@ init_format();
|
|
|
46873
46908
|
var main = defineCommand({
|
|
46874
46909
|
meta: {
|
|
46875
46910
|
name: "fastmcp",
|
|
46876
|
-
version: "1.1
|
|
46911
|
+
version: "1.2.1",
|
|
46877
46912
|
description: "FastMCP CLI \u2014 build, run, and manage MCP servers"
|
|
46878
46913
|
},
|
|
46879
46914
|
args: {
|