@prefecthq/fastmcp-ts 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.cjs +193 -5
- package/dist/cli/index.cjs.map +1 -1
- package/dist/client.d.ts +20 -1
- package/dist/client.js +176 -2
- package/dist/client.js.map +1 -1
- package/dist/server.d.ts +24 -24
- package/dist/server.js +36 -28
- package/dist/server.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.
|
|
1175
|
+
fastmcp: "1.6.0",
|
|
1176
1176
|
"mcp-sdk": "2.0.0",
|
|
1177
1177
|
node: process.version,
|
|
1178
1178
|
platform: `${process.platform} ${process.arch}`
|
|
@@ -28404,6 +28404,175 @@ var init_handlers = __esm({
|
|
|
28404
28404
|
}
|
|
28405
28405
|
});
|
|
28406
28406
|
|
|
28407
|
+
// package.json
|
|
28408
|
+
var package_default;
|
|
28409
|
+
var init_package = __esm({
|
|
28410
|
+
"package.json"() {
|
|
28411
|
+
package_default = {
|
|
28412
|
+
name: "@prefecthq/fastmcp-ts",
|
|
28413
|
+
version: "1.6.0",
|
|
28414
|
+
description: "\u{1F3CE}\uFE0F The official FastMCP TypeScript library - build MCP servers and clients, fast \u{1F3CE}\uFE0F",
|
|
28415
|
+
type: "module",
|
|
28416
|
+
exports: {
|
|
28417
|
+
"./server": {
|
|
28418
|
+
types: "./dist/server.d.ts",
|
|
28419
|
+
import: "./dist/server.js"
|
|
28420
|
+
},
|
|
28421
|
+
"./client": {
|
|
28422
|
+
types: "./dist/client.d.ts",
|
|
28423
|
+
import: "./dist/client.js"
|
|
28424
|
+
}
|
|
28425
|
+
},
|
|
28426
|
+
browser: {
|
|
28427
|
+
child_process: false,
|
|
28428
|
+
"node:child_process": false,
|
|
28429
|
+
fs: false,
|
|
28430
|
+
"fs/promises": false,
|
|
28431
|
+
"node:fs": false,
|
|
28432
|
+
"node:fs/promises": false,
|
|
28433
|
+
http: false,
|
|
28434
|
+
"node:http": false,
|
|
28435
|
+
https: false,
|
|
28436
|
+
"node:https": false,
|
|
28437
|
+
os: false,
|
|
28438
|
+
"node:os": false,
|
|
28439
|
+
path: false,
|
|
28440
|
+
"node:path": false,
|
|
28441
|
+
"node:url": false,
|
|
28442
|
+
"node:process": false,
|
|
28443
|
+
"node:stream": false,
|
|
28444
|
+
net: false,
|
|
28445
|
+
"node:net": false,
|
|
28446
|
+
tls: false,
|
|
28447
|
+
"node:tls": false,
|
|
28448
|
+
"@modelcontextprotocol/client/stdio": false
|
|
28449
|
+
},
|
|
28450
|
+
sideEffects: false,
|
|
28451
|
+
bin: {
|
|
28452
|
+
fastmcp: "dist/cli/index.cjs"
|
|
28453
|
+
},
|
|
28454
|
+
files: [
|
|
28455
|
+
"dist",
|
|
28456
|
+
"README.md"
|
|
28457
|
+
],
|
|
28458
|
+
engines: {
|
|
28459
|
+
node: ">=22"
|
|
28460
|
+
},
|
|
28461
|
+
scripts: {
|
|
28462
|
+
build: "tsup",
|
|
28463
|
+
prepublishOnly: "npm run build && node scripts/test-dist.mjs && npm run test:browser-bundle",
|
|
28464
|
+
test: "vitest run",
|
|
28465
|
+
"test:browser-bundle": "node scripts/test-browser-bundle.mjs",
|
|
28466
|
+
"test:e2e": "playwright test",
|
|
28467
|
+
"test:watch": "vitest",
|
|
28468
|
+
"test:coverage": "vitest run --coverage",
|
|
28469
|
+
typecheck: "tsc --noEmit",
|
|
28470
|
+
"conformance:server": "node tests/conformance/run-server.mjs",
|
|
28471
|
+
"conformance:client": "node tests/conformance/run-client.mjs",
|
|
28472
|
+
"docs:dev": "cd docs && npx --yes mint@latest dev",
|
|
28473
|
+
"docs:api": "typedoc && node scripts/generate-api-nav.mjs",
|
|
28474
|
+
"docs:links": "cd docs && npx --yes mint@latest broken-links",
|
|
28475
|
+
changeset: "changeset",
|
|
28476
|
+
"version-packages": "changeset version",
|
|
28477
|
+
release: "changeset publish"
|
|
28478
|
+
},
|
|
28479
|
+
devDependencies: {
|
|
28480
|
+
"@anthropic-ai/sdk": "^0.91.1",
|
|
28481
|
+
"@changesets/cli": "^3.0.0",
|
|
28482
|
+
"@google/genai": "^1.50.1",
|
|
28483
|
+
"@playwright/test": "^1.61.1",
|
|
28484
|
+
"@types/node": "^22.0.0",
|
|
28485
|
+
"@types/url-template": "^2.0.31",
|
|
28486
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
28487
|
+
arktype: "^2.2.0",
|
|
28488
|
+
esbuild: "^0.28.1",
|
|
28489
|
+
execa: "^9.6.1",
|
|
28490
|
+
"fake-indexeddb": "^6.2.5",
|
|
28491
|
+
"get-bin-path": "^11.0.1",
|
|
28492
|
+
jsdom: "^29.1.1",
|
|
28493
|
+
openai: "^6.34.0",
|
|
28494
|
+
tsup: "^8.5.1",
|
|
28495
|
+
tsx: "^4.21.0",
|
|
28496
|
+
typedoc: "^0.28.0",
|
|
28497
|
+
"typedoc-plugin-markdown": "^4.12.0",
|
|
28498
|
+
typescript: "^5.0.0",
|
|
28499
|
+
valibot: "^1.3.1",
|
|
28500
|
+
vitest: "^4.1.8",
|
|
28501
|
+
zod: "^4.3.6"
|
|
28502
|
+
},
|
|
28503
|
+
repository: {
|
|
28504
|
+
type: "git",
|
|
28505
|
+
url: "git+https://github.com/PrefectHQ/fastmcp-ts.git"
|
|
28506
|
+
},
|
|
28507
|
+
keywords: [
|
|
28508
|
+
"mcp",
|
|
28509
|
+
"mcp-tools",
|
|
28510
|
+
"fastmcp",
|
|
28511
|
+
"mcp-clients",
|
|
28512
|
+
"llms",
|
|
28513
|
+
"model-context-protocol",
|
|
28514
|
+
"mcp-servers",
|
|
28515
|
+
"typescript"
|
|
28516
|
+
],
|
|
28517
|
+
author: "prefecthq",
|
|
28518
|
+
license: "Apache-2.0",
|
|
28519
|
+
bugs: {
|
|
28520
|
+
url: "https://github.com/PrefectHQ/fastmcp-ts/issues"
|
|
28521
|
+
},
|
|
28522
|
+
homepage: "https://github.com/PrefectHQ/fastmcp-ts#readme",
|
|
28523
|
+
peerDependencies: {
|
|
28524
|
+
"@anthropic-ai/sdk": ">=0.39",
|
|
28525
|
+
"@google/genai": ">=0.7",
|
|
28526
|
+
openai: ">=4"
|
|
28527
|
+
},
|
|
28528
|
+
peerDependenciesMeta: {
|
|
28529
|
+
"@anthropic-ai/sdk": {
|
|
28530
|
+
optional: true
|
|
28531
|
+
},
|
|
28532
|
+
openai: {
|
|
28533
|
+
optional: true
|
|
28534
|
+
},
|
|
28535
|
+
"@google/genai": {
|
|
28536
|
+
optional: true
|
|
28537
|
+
}
|
|
28538
|
+
},
|
|
28539
|
+
dependencies: {
|
|
28540
|
+
"@clack/prompts": "^1.2.0",
|
|
28541
|
+
"@modelcontextprotocol/client": "^2.0.0",
|
|
28542
|
+
"@modelcontextprotocol/core": "^2.0.0",
|
|
28543
|
+
"@modelcontextprotocol/node": "^2.0.0",
|
|
28544
|
+
"@modelcontextprotocol/server": "^2.0.0",
|
|
28545
|
+
"@modelcontextprotocol/server-legacy": "^2.0.0",
|
|
28546
|
+
"@standard-schema/spec": "^1.1.0",
|
|
28547
|
+
"@types/express": "^5.0.6",
|
|
28548
|
+
chalk: "^5.6.2",
|
|
28549
|
+
chokidar: "^5.0.0",
|
|
28550
|
+
citty: "^0.2.2",
|
|
28551
|
+
"cli-table3": "^0.6.5",
|
|
28552
|
+
express: "^5.2.1",
|
|
28553
|
+
"fastest-levenshtein": "^1.0.16",
|
|
28554
|
+
jose: "6.2.2",
|
|
28555
|
+
listr2: "^10.2.1",
|
|
28556
|
+
"url-template": "^3.1.1",
|
|
28557
|
+
yaml: "^2.8.3"
|
|
28558
|
+
}
|
|
28559
|
+
};
|
|
28560
|
+
}
|
|
28561
|
+
});
|
|
28562
|
+
|
|
28563
|
+
// src/client/options.ts
|
|
28564
|
+
var DEFAULT_CLIENT_INFO;
|
|
28565
|
+
var init_options = __esm({
|
|
28566
|
+
"src/client/options.ts"() {
|
|
28567
|
+
"use strict";
|
|
28568
|
+
init_package();
|
|
28569
|
+
DEFAULT_CLIENT_INFO = {
|
|
28570
|
+
name: "fastmcp-ts",
|
|
28571
|
+
version: package_default.version
|
|
28572
|
+
};
|
|
28573
|
+
}
|
|
28574
|
+
});
|
|
28575
|
+
|
|
28407
28576
|
// src/client/results.ts
|
|
28408
28577
|
function normalizeCallToolResult(result) {
|
|
28409
28578
|
return {
|
|
@@ -29333,6 +29502,7 @@ var init_multi_server = __esm({
|
|
|
29333
29502
|
init_handlers();
|
|
29334
29503
|
init_results();
|
|
29335
29504
|
init_transports();
|
|
29505
|
+
init_options();
|
|
29336
29506
|
init_client();
|
|
29337
29507
|
MultiServerClient = class _MultiServerClient {
|
|
29338
29508
|
_clients = /* @__PURE__ */ new Map();
|
|
@@ -29341,6 +29511,7 @@ var init_multi_server = __esm({
|
|
|
29341
29511
|
/** URI (or namespaced template URI) → server name, populated by list calls */
|
|
29342
29512
|
_uriMap = /* @__PURE__ */ new Map();
|
|
29343
29513
|
_config;
|
|
29514
|
+
_clientInfo;
|
|
29344
29515
|
_handlers;
|
|
29345
29516
|
_roots;
|
|
29346
29517
|
_capabilities;
|
|
@@ -29359,6 +29530,7 @@ var init_multi_server = __esm({
|
|
|
29359
29530
|
_logLevels = /* @__PURE__ */ new Map();
|
|
29360
29531
|
constructor(config2, options) {
|
|
29361
29532
|
this._config = config2;
|
|
29533
|
+
this._clientInfo = options?.clientInfo ?? DEFAULT_CLIENT_INFO;
|
|
29362
29534
|
this._handlers = {
|
|
29363
29535
|
log: options?.handlers?.log ?? defaultLogHandler,
|
|
29364
29536
|
progress: options?.handlers?.progress ?? defaultProgressHandler,
|
|
@@ -29777,7 +29949,7 @@ ${errors.map(String).join("\n")}`);
|
|
|
29777
29949
|
}
|
|
29778
29950
|
_buildSdkClient() {
|
|
29779
29951
|
return new Client(
|
|
29780
|
-
|
|
29952
|
+
this._clientInfo,
|
|
29781
29953
|
{
|
|
29782
29954
|
capabilities: this._capabilities,
|
|
29783
29955
|
versionNegotiation: this._versionNegotiation
|
|
@@ -29871,6 +30043,7 @@ var init_client = __esm({
|
|
|
29871
30043
|
init_auth();
|
|
29872
30044
|
init_capabilities();
|
|
29873
30045
|
init_handlers();
|
|
30046
|
+
init_options();
|
|
29874
30047
|
init_results();
|
|
29875
30048
|
init_transports();
|
|
29876
30049
|
init_multi_server();
|
|
@@ -29907,6 +30080,7 @@ var init_client = __esm({
|
|
|
29907
30080
|
static _MAX_REAUTH_ROUNDS = 2;
|
|
29908
30081
|
_input;
|
|
29909
30082
|
_auth;
|
|
30083
|
+
_clientInfo;
|
|
29910
30084
|
_handlers;
|
|
29911
30085
|
_roots;
|
|
29912
30086
|
_capabilities;
|
|
@@ -29927,6 +30101,7 @@ var init_client = __esm({
|
|
|
29927
30101
|
constructor(input, options) {
|
|
29928
30102
|
this._input = input;
|
|
29929
30103
|
this._auth = resolveAuth(options?.auth);
|
|
30104
|
+
this._clientInfo = options?.clientInfo ?? DEFAULT_CLIENT_INFO;
|
|
29930
30105
|
this._handlers = {
|
|
29931
30106
|
log: options?.handlers?.log ?? defaultLogHandler,
|
|
29932
30107
|
progress: options?.handlers?.progress ?? defaultProgressHandler,
|
|
@@ -29974,7 +30149,7 @@ var init_client = __esm({
|
|
|
29974
30149
|
}
|
|
29975
30150
|
async _doConnect() {
|
|
29976
30151
|
const sdkClient = new Client(
|
|
29977
|
-
|
|
30152
|
+
this._clientInfo,
|
|
29978
30153
|
{
|
|
29979
30154
|
capabilities: this._capabilities,
|
|
29980
30155
|
listChanged: this._buildListChangedConfig(),
|
|
@@ -30194,11 +30369,24 @@ var init_client = __esm({
|
|
|
30194
30369
|
* via a `subscriptions/listen` stream opted into `resourceSubscriptions` — both
|
|
30195
30370
|
* dispatch to the same `notifications/resources/updated` handler registered in
|
|
30196
30371
|
* `_registerHandlers`, so this method is the only era-aware part.
|
|
30372
|
+
*
|
|
30373
|
+
* On a modern connection this rejects when the server's acknowledged filter does
|
|
30374
|
+
* not include the URI — that is how a server without the `resources.subscribe`
|
|
30375
|
+
* capability declines per-resource subscriptions, and registering a handler that
|
|
30376
|
+
* can never fire would fail silently instead.
|
|
30197
30377
|
*/
|
|
30198
30378
|
async subscribeResource(uri, handler, options) {
|
|
30199
30379
|
this._resourceSubscriptions.set(uri, handler);
|
|
30200
30380
|
if (this._sdk().getProtocolEra() === "modern") {
|
|
30201
30381
|
await this._refreshResourceListenSubscription();
|
|
30382
|
+
const honored = this._resourceListenSubscription?.honoredFilter.resourceSubscriptions ?? [];
|
|
30383
|
+
if (!honored.includes(uri)) {
|
|
30384
|
+
this._resourceSubscriptions.delete(uri);
|
|
30385
|
+
await this._refreshResourceListenSubscription();
|
|
30386
|
+
throw new Error(
|
|
30387
|
+
`subscribeResource(${JSON.stringify(uri)}): the server did not honor the subscription \u2014 its subscriptions/acknowledged filter omits the URI, which means it does not advertise the resources.subscribe capability.`
|
|
30388
|
+
);
|
|
30389
|
+
}
|
|
30202
30390
|
} else {
|
|
30203
30391
|
await this._reauthRetry(
|
|
30204
30392
|
() => this._sdk().subscribeResource(
|
|
@@ -33536,7 +33724,7 @@ var init_inspect = __esm({
|
|
|
33536
33724
|
// only case Python's inspect supports); over --url/--command the
|
|
33537
33725
|
// generation is unknowable from the wire.
|
|
33538
33726
|
generation: mode.kind === "inprocess" ? 2 : null,
|
|
33539
|
-
fastmcpVersion: "1.
|
|
33727
|
+
fastmcpVersion: "1.6.0",
|
|
33540
33728
|
mcpVersion: "2.0.0",
|
|
33541
33729
|
tools: tools2,
|
|
33542
33730
|
prompts: prompts2,
|
|
@@ -47065,7 +47253,7 @@ init_format();
|
|
|
47065
47253
|
var main = defineCommand({
|
|
47066
47254
|
meta: {
|
|
47067
47255
|
name: "fastmcp",
|
|
47068
|
-
version: "1.
|
|
47256
|
+
version: "1.6.0",
|
|
47069
47257
|
description: "FastMCP CLI \u2014 build, run, and manage MCP servers"
|
|
47070
47258
|
},
|
|
47071
47259
|
args: {
|