fastmcp 4.25.0 → 4.26.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 +2 -0
- package/dist/FastMCP.cjs +3 -3
- package/dist/FastMCP.d.cts +3 -2
- package/dist/FastMCP.d.ts +3 -2
- package/dist/FastMCP.js +2 -2
- package/dist/{OAuthProvider-BGtNEdC3.d.cts → OAuthProvider-CPC9zG96.d.cts} +2 -0
- package/dist/{OAuthProvider-BGtNEdC3.d.ts → OAuthProvider-CPC9zG96.d.ts} +2 -0
- 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-JFHOYU3S.js → chunk-3VYVXSBB.js} +11 -7
- package/dist/chunk-3VYVXSBB.js.map +1 -0
- package/dist/{chunk-B7IXBMHV.cjs → chunk-AKHG27NY.cjs} +11 -7
- package/dist/chunk-AKHG27NY.cjs.map +1 -0
- package/dist/{chunk-PU3JOW7T.js → chunk-LUGELV2V.js} +43 -15
- package/dist/chunk-LUGELV2V.js.map +1 -0
- package/dist/{chunk-AJE7ERFM.cjs → chunk-ZHTH5HQD.cjs} +50 -22
- package/dist/chunk-ZHTH5HQD.cjs.map +1 -0
- package/dist/examples/custom-routes.cjs +3 -3
- package/dist/examples/custom-routes.js +2 -2
- package/dist/openapi/index.cjs +25 -9
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +6 -5
- package/dist/openapi/index.d.ts +6 -5
- package/dist/openapi/index.js +19 -3
- package/dist/openapi/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-AJE7ERFM.cjs.map +0 -1
- package/dist/chunk-B7IXBMHV.cjs.map +0 -1
- package/dist/chunk-JFHOYU3S.js.map +0 -1
- package/dist/chunk-PU3JOW7T.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkAKHG27NYcjs = require('./chunk-AKHG27NY.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -141,7 +141,7 @@ var DiscoveryDocumentCache = class {
|
|
|
141
141
|
throw error;
|
|
142
142
|
}
|
|
143
143
|
if (!res.ok) {
|
|
144
|
-
await
|
|
144
|
+
await _chunkAKHG27NYcjs.cancelResponseBody.call(void 0, res);
|
|
145
145
|
throw new Error(
|
|
146
146
|
`Failed to fetch discovery document from ${url}: ${res.status} ${res.statusText}`
|
|
147
147
|
);
|
|
@@ -258,7 +258,7 @@ var imageContent = async (input) => {
|
|
|
258
258
|
signal: AbortSignal.timeout(timeoutMs)
|
|
259
259
|
});
|
|
260
260
|
if (!response.ok) {
|
|
261
|
-
await
|
|
261
|
+
await _chunkAKHG27NYcjs.cancelResponseBody.call(void 0, response);
|
|
262
262
|
throw new Error(
|
|
263
263
|
`Server responded with status: ${response.status} - ${response.statusText}`
|
|
264
264
|
);
|
|
@@ -340,7 +340,7 @@ var audioContent = async (input) => {
|
|
|
340
340
|
signal: AbortSignal.timeout(timeoutMs)
|
|
341
341
|
});
|
|
342
342
|
if (!response.ok) {
|
|
343
|
-
await
|
|
343
|
+
await _chunkAKHG27NYcjs.cancelResponseBody.call(void 0, response);
|
|
344
344
|
throw new Error(
|
|
345
345
|
`Server responded with status: ${response.status} - ${response.statusText}`
|
|
346
346
|
);
|
|
@@ -1642,22 +1642,41 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1642
1642
|
}
|
|
1643
1643
|
cachedToolsList = await Promise.all(
|
|
1644
1644
|
tools.map(async (tool) => {
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
inputSchema: tool.parameters ? _chunk6TDYSPLCcjs.strictInputSchema.call(void 0,
|
|
1645
|
+
let inputSchema;
|
|
1646
|
+
try {
|
|
1647
|
+
inputSchema = tool.parameters ? _chunk6TDYSPLCcjs.strictInputSchema.call(void 0,
|
|
1649
1648
|
tool.parameters["~standard"].vendor === "zod" && "_zod" in tool.parameters ? _chunk6TDYSPLCcjs.zodInputSchema.call(void 0, tool.parameters, "draft-7") : await _xsschema.toJsonSchema.call(void 0, tool.parameters)
|
|
1650
1649
|
) : {
|
|
1651
1650
|
additionalProperties: false,
|
|
1652
1651
|
properties: {},
|
|
1653
1652
|
type: "object"
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1653
|
+
};
|
|
1654
|
+
} catch (error) {
|
|
1655
|
+
this.#logger.warn(
|
|
1656
|
+
`[FastMCP warning] Tool '${tool.name}' parameters cannot be converted to JSON Schema; advertising a generic object schema.`,
|
|
1657
|
+
error
|
|
1658
|
+
);
|
|
1659
|
+
inputSchema = { type: "object" };
|
|
1660
|
+
}
|
|
1661
|
+
let outputSchema;
|
|
1662
|
+
if (tool.outputSchema) {
|
|
1663
|
+
try {
|
|
1664
|
+
outputSchema = _chunk6TDYSPLCcjs.objectRootSchema.call(void 0,
|
|
1658
1665
|
await _xsschema.toJsonSchema.call(void 0, tool.outputSchema)
|
|
1659
|
-
)
|
|
1660
|
-
}
|
|
1666
|
+
);
|
|
1667
|
+
} catch (error) {
|
|
1668
|
+
this.#logger.warn(
|
|
1669
|
+
`[FastMCP warning] Tool '${tool.name}' outputSchema cannot be converted to JSON Schema; advertising the tool without it.`,
|
|
1670
|
+
error
|
|
1671
|
+
);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
return {
|
|
1675
|
+
annotations: tool.annotations,
|
|
1676
|
+
description: tool.description,
|
|
1677
|
+
inputSchema,
|
|
1678
|
+
name: tool.name,
|
|
1679
|
+
...outputSchema && { outputSchema },
|
|
1661
1680
|
// Pass through _meta for MCP ext-apps UI support (issue #229)
|
|
1662
1681
|
...tool._meta && { _meta: tool._meta }
|
|
1663
1682
|
};
|
|
@@ -2117,9 +2136,14 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2117
2136
|
* Adds prompts to the server.
|
|
2118
2137
|
*/
|
|
2119
2138
|
addPrompts(prompts) {
|
|
2120
|
-
const
|
|
2121
|
-
|
|
2122
|
-
|
|
2139
|
+
const promptsByName = new Map(
|
|
2140
|
+
this.#prompts.map((prompt) => [prompt.name, prompt])
|
|
2141
|
+
);
|
|
2142
|
+
for (const prompt of prompts) {
|
|
2143
|
+
promptsByName.delete(prompt.name);
|
|
2144
|
+
promptsByName.set(prompt.name, prompt);
|
|
2145
|
+
}
|
|
2146
|
+
this.#prompts = Array.from(promptsByName.values());
|
|
2123
2147
|
if (this.#serverState === "running" /* Running */) {
|
|
2124
2148
|
this.#promptsListChanged(this.#prompts);
|
|
2125
2149
|
}
|
|
@@ -2561,6 +2585,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2561
2585
|
);
|
|
2562
2586
|
},
|
|
2563
2587
|
port: httpConfig.port,
|
|
2588
|
+
sseEndpoint: httpConfig.sseEndpoint,
|
|
2564
2589
|
sslCa: httpConfig.sslCa,
|
|
2565
2590
|
sslCert: httpConfig.sslCert,
|
|
2566
2591
|
sslKey: httpConfig.sslKey,
|
|
@@ -2615,6 +2640,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2615
2640
|
);
|
|
2616
2641
|
},
|
|
2617
2642
|
port: httpConfig.port,
|
|
2643
|
+
sseEndpoint: httpConfig.sseEndpoint,
|
|
2618
2644
|
sslCa: httpConfig.sslCa,
|
|
2619
2645
|
sslCert: httpConfig.sslCert,
|
|
2620
2646
|
sslKey: httpConfig.sslKey,
|
|
@@ -3397,9 +3423,10 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3397
3423
|
(statelessArg === "" ? true : parseBooleanSetting(statelessArg, "--stateless")))), () => ( parseBooleanSetting(envStateless, "FASTMCP_STATELESS"))), () => ( false));
|
|
3398
3424
|
const cors = _optionalChain([overrides, 'optionalAccess', _114 => _114.httpStream, 'optionalAccess', _115 => _115.cors]);
|
|
3399
3425
|
const eventStore = _optionalChain([overrides, 'optionalAccess', _116 => _116.httpStream, 'optionalAccess', _117 => _117.eventStore]);
|
|
3400
|
-
const
|
|
3401
|
-
const
|
|
3402
|
-
const
|
|
3426
|
+
const sseEndpoint = _optionalChain([overrides, 'optionalAccess', _118 => _118.httpStream, 'optionalAccess', _119 => _119.sseEndpoint]);
|
|
3427
|
+
const sslCa = _optionalChain([overrides, 'optionalAccess', _120 => _120.httpStream, 'optionalAccess', _121 => _121.sslCa]);
|
|
3428
|
+
const sslCert = _optionalChain([overrides, 'optionalAccess', _122 => _122.httpStream, 'optionalAccess', _123 => _123.sslCert]);
|
|
3429
|
+
const sslKey = _optionalChain([overrides, 'optionalAccess', _124 => _124.httpStream, 'optionalAccess', _125 => _125.sslKey]);
|
|
3403
3430
|
return {
|
|
3404
3431
|
httpStream: {
|
|
3405
3432
|
basePath,
|
|
@@ -3409,6 +3436,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3409
3436
|
eventStore,
|
|
3410
3437
|
host,
|
|
3411
3438
|
port,
|
|
3439
|
+
sseEndpoint,
|
|
3412
3440
|
sslCa,
|
|
3413
3441
|
sslCert,
|
|
3414
3442
|
sslKey,
|
|
@@ -3490,7 +3518,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3490
3518
|
*/
|
|
3491
3519
|
#useEndpointAsResource(endpoint) {
|
|
3492
3520
|
const oauth = this.#options.oauth;
|
|
3493
|
-
if (this.#providerResourceBase === void 0 || !_optionalChain([oauth, 'optionalAccess',
|
|
3521
|
+
if (this.#providerResourceBase === void 0 || !_optionalChain([oauth, 'optionalAccess', _126 => _126.protectedResource]))
|
|
3494
3522
|
return;
|
|
3495
3523
|
this.#options = {
|
|
3496
3524
|
...this.#options,
|
|
@@ -3519,4 +3547,4 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3519
3547
|
|
|
3520
3548
|
|
|
3521
3549
|
exports.DiscoveryDocumentCache = DiscoveryDocumentCache; exports.jsonSchemaAdapter = jsonSchemaAdapter; exports.MEDIA_FETCH_TIMEOUT_MS = MEDIA_FETCH_TIMEOUT_MS; exports.imageContent = imageContent; exports.audioContent = audioContent; exports.FastMCPError = FastMCPError; exports.SessionError = SessionError; exports.UnexpectedStateError = UnexpectedStateError; exports.UserError = UserError; exports.ServerState = ServerState; exports.FastMCPSession = FastMCPSession; exports.FastMCP = FastMCP;
|
|
3522
|
-
//# sourceMappingURL=chunk-
|
|
3550
|
+
//# sourceMappingURL=chunk-ZHTH5HQD.cjs.map
|