fastmcp 4.9.2 → 4.11.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 +103 -14
- package/dist/FastMCP.cjs +4 -2
- package/dist/FastMCP.cjs.map +1 -1
- package/dist/FastMCP.d.cts +94 -3
- package/dist/FastMCP.d.ts +94 -3
- package/dist/FastMCP.js +4 -2
- package/dist/{chunk-ENLYR3QM.cjs → chunk-ISO2WPB5.cjs} +113 -45
- package/dist/chunk-ISO2WPB5.cjs.map +1 -0
- package/dist/{chunk-JIPRWP6F.js → chunk-JOZJUFKE.js} +69 -1
- package/dist/chunk-JOZJUFKE.js.map +1 -0
- package/dist/examples/custom-routes.cjs +2 -2
- package/dist/examples/custom-routes.js +1 -1
- package/package.json +11 -1
- package/dist/chunk-ENLYR3QM.cjs.map +0 -1
- package/dist/chunk-JIPRWP6F.js.map +0 -1
|
@@ -114,6 +114,73 @@ var DiscoveryDocumentCache = class {
|
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
+
// src/jsonSchemaAdapter.ts
|
|
118
|
+
function jsonSchemaAdapter(schema) {
|
|
119
|
+
let compiled;
|
|
120
|
+
const getValidator = () => {
|
|
121
|
+
compiled ??= compileSchema(schema).catch((error) => {
|
|
122
|
+
compiled = void 0;
|
|
123
|
+
throw error;
|
|
124
|
+
});
|
|
125
|
+
return compiled;
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
"~standard": {
|
|
129
|
+
jsonSchema: {
|
|
130
|
+
input: () => schema,
|
|
131
|
+
output: () => schema
|
|
132
|
+
},
|
|
133
|
+
validate: async (data) => {
|
|
134
|
+
const validate = await getValidator();
|
|
135
|
+
if (validate(data)) {
|
|
136
|
+
return { value: data };
|
|
137
|
+
}
|
|
138
|
+
return { issues: (_nullishCoalesce(validate.errors, () => ( []))).map(toIssue) };
|
|
139
|
+
},
|
|
140
|
+
vendor: "json-schema",
|
|
141
|
+
version: 1
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
async function compileSchema(schema) {
|
|
146
|
+
let ajvModule;
|
|
147
|
+
try {
|
|
148
|
+
ajvModule = await Promise.resolve().then(() => _interopRequireWildcard(require("ajv")));
|
|
149
|
+
} catch (e2) {
|
|
150
|
+
throw new Error(
|
|
151
|
+
'The "ajv" package is required to validate JSON Schema tool parameters. Install it with: npm install ajv'
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
const Ajv = unwrapDefault(unwrapDefault(ajvModule));
|
|
155
|
+
const ajv = new Ajv({ allErrors: true, strict: false });
|
|
156
|
+
try {
|
|
157
|
+
const formatsModule = await Promise.resolve().then(() => _interopRequireWildcard(require("ajv-formats")));
|
|
158
|
+
const addFormats = unwrapDefault(
|
|
159
|
+
unwrapDefault(formatsModule)
|
|
160
|
+
);
|
|
161
|
+
addFormats(ajv);
|
|
162
|
+
} catch (e3) {
|
|
163
|
+
}
|
|
164
|
+
return ajv.compile(schema);
|
|
165
|
+
}
|
|
166
|
+
function toIssue(error) {
|
|
167
|
+
const path = error.instancePath.split("/").filter(Boolean).map((segment) => segment.replaceAll("~1", "/").replaceAll("~0", "~")).map((segment) => {
|
|
168
|
+
const index = Number(segment);
|
|
169
|
+
return Number.isInteger(index) && segment !== "" ? index : segment;
|
|
170
|
+
});
|
|
171
|
+
const missingProperty = _optionalChain([error, 'access', _2 => _2.params, 'optionalAccess', _3 => _3.missingProperty]);
|
|
172
|
+
if (error.keyword === "required" && typeof missingProperty === "string") {
|
|
173
|
+
path.push(missingProperty);
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
message: error.message || "Validation error",
|
|
177
|
+
path
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function unwrapDefault(value) {
|
|
181
|
+
return typeof value === "object" && value !== null && "default" in value ? value.default : value;
|
|
182
|
+
}
|
|
183
|
+
|
|
117
184
|
// src/FastMCP.ts
|
|
118
185
|
var imageContent = async (input) => {
|
|
119
186
|
let rawData;
|
|
@@ -151,13 +218,13 @@ var imageContent = async (input) => {
|
|
|
151
218
|
const mimeType = await fileTypeFromBuffer(rawData);
|
|
152
219
|
if (!mimeType || !mimeType.mime.startsWith("image/")) {
|
|
153
220
|
console.warn(
|
|
154
|
-
`Warning: Content may not be a valid image. Detected MIME: ${_optionalChain([mimeType, 'optionalAccess',
|
|
221
|
+
`Warning: Content may not be a valid image. Detected MIME: ${_optionalChain([mimeType, 'optionalAccess', _4 => _4.mime]) || "unknown"}`
|
|
155
222
|
);
|
|
156
223
|
}
|
|
157
224
|
const base64Data = rawData.toString("base64");
|
|
158
225
|
return {
|
|
159
226
|
data: base64Data,
|
|
160
|
-
mimeType: _nullishCoalesce(_optionalChain([mimeType, 'optionalAccess',
|
|
227
|
+
mimeType: _nullishCoalesce(_optionalChain([mimeType, 'optionalAccess', _5 => _5.mime]), () => ( "image/png")),
|
|
161
228
|
type: "image"
|
|
162
229
|
};
|
|
163
230
|
} catch (error) {
|
|
@@ -204,13 +271,13 @@ var audioContent = async (input) => {
|
|
|
204
271
|
const mimeType = await fileTypeFromBuffer(rawData);
|
|
205
272
|
if (!mimeType || !mimeType.mime.startsWith("audio/")) {
|
|
206
273
|
console.warn(
|
|
207
|
-
`Warning: Content may not be a valid audio file. Detected MIME: ${_optionalChain([mimeType, 'optionalAccess',
|
|
274
|
+
`Warning: Content may not be a valid audio file. Detected MIME: ${_optionalChain([mimeType, 'optionalAccess', _6 => _6.mime]) || "unknown"}`
|
|
208
275
|
);
|
|
209
276
|
}
|
|
210
277
|
const base64Data = rawData.toString("base64");
|
|
211
278
|
return {
|
|
212
279
|
data: base64Data,
|
|
213
|
-
mimeType: _nullishCoalesce(_optionalChain([mimeType, 'optionalAccess',
|
|
280
|
+
mimeType: _nullishCoalesce(_optionalChain([mimeType, 'optionalAccess', _7 => _7.mime]), () => ( "audio/mpeg")),
|
|
214
281
|
type: "audio"
|
|
215
282
|
};
|
|
216
283
|
} catch (error) {
|
|
@@ -484,10 +551,10 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
|
|
|
484
551
|
);
|
|
485
552
|
}
|
|
486
553
|
}
|
|
487
|
-
if (_optionalChain([this, 'access',
|
|
554
|
+
if (_optionalChain([this, 'access', _8 => _8.#rootsConfig, 'optionalAccess', _9 => _9.enabled]) !== false && _optionalChain([this, 'access', _10 => _10.#clientCapabilities, 'optionalAccess', _11 => _11.roots, 'optionalAccess', _12 => _12.listChanged]) && typeof this.#server.listRoots === "function") {
|
|
488
555
|
try {
|
|
489
556
|
const roots = await this.#server.listRoots();
|
|
490
|
-
this.#roots = _optionalChain([roots, 'optionalAccess',
|
|
557
|
+
this.#roots = _optionalChain([roots, 'optionalAccess', _13 => _13.roots]) || [];
|
|
491
558
|
} catch (e) {
|
|
492
559
|
if (e instanceof _typesjs.McpError && e.code === _typesjs.ErrorCode.MethodNotFound) {
|
|
493
560
|
this.#logger.debug(
|
|
@@ -508,7 +575,7 @@ ${e instanceof Error ? e.stack : JSON.stringify(e)}`
|
|
|
508
575
|
this.#pingInterval = setInterval(async () => {
|
|
509
576
|
try {
|
|
510
577
|
await this.#server.ping();
|
|
511
|
-
} catch (
|
|
578
|
+
} catch (e4) {
|
|
512
579
|
const logLevel = pingConfig.logLevel;
|
|
513
580
|
if (logLevel === "debug") {
|
|
514
581
|
this.#logger.debug("[FastMCP debug] server ping failed");
|
|
@@ -660,7 +727,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
660
727
|
},
|
|
661
728
|
elicit: (params, options) => this.#server.elicitInput(params, options),
|
|
662
729
|
log: this.#createLog(),
|
|
663
|
-
requestId: typeof _optionalChain([meta, 'optionalAccess',
|
|
730
|
+
requestId: typeof _optionalChain([meta, 'optionalAccess', _14 => _14.requestId]) === "string" ? meta.requestId : void 0,
|
|
664
731
|
session: this.#auth,
|
|
665
732
|
sessionId: this.#sessionId
|
|
666
733
|
};
|
|
@@ -706,8 +773,8 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
706
773
|
};
|
|
707
774
|
}
|
|
708
775
|
#formatSchemaIssues(issues) {
|
|
709
|
-
return _optionalChain([this, 'access',
|
|
710
|
-
const path = _optionalChain([issue, 'access',
|
|
776
|
+
return _optionalChain([this, 'access', _15 => _15.#utils, 'optionalAccess', _16 => _16.formatInvalidParamsErrorMessage]) ? this.#utils.formatInvalidParamsErrorMessage(issues) : issues.map((issue) => {
|
|
777
|
+
const path = _optionalChain([issue, 'access', _17 => _17.path, 'optionalAccess', _18 => _18.join, 'call', _19 => _19(".")]) || "root";
|
|
711
778
|
return `${path}: ${issue.message}`;
|
|
712
779
|
}).join(", ");
|
|
713
780
|
}
|
|
@@ -919,7 +986,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
919
986
|
result = await prompt.load(
|
|
920
987
|
args,
|
|
921
988
|
this.#auth,
|
|
922
|
-
this.#createLoadContext(_optionalChain([request, 'access',
|
|
989
|
+
this.#createLoadContext(_optionalChain([request, 'access', _20 => _20.params, 'optionalAccess', _21 => _21._meta]))
|
|
923
990
|
);
|
|
924
991
|
} catch (error) {
|
|
925
992
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -984,7 +1051,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
984
1051
|
const result = await resourceTemplate.load(
|
|
985
1052
|
match,
|
|
986
1053
|
this.#auth,
|
|
987
|
-
this.#createLoadContext(_optionalChain([request, 'access',
|
|
1054
|
+
this.#createLoadContext(_optionalChain([request, 'access', _22 => _22.params, 'optionalAccess', _23 => _23._meta]))
|
|
988
1055
|
);
|
|
989
1056
|
const resources = Array.isArray(result) ? result : [result];
|
|
990
1057
|
return {
|
|
@@ -1009,7 +1076,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1009
1076
|
try {
|
|
1010
1077
|
maybeArrayResult = await resource.load(
|
|
1011
1078
|
this.#auth,
|
|
1012
|
-
this.#createLoadContext(_optionalChain([request, 'access',
|
|
1079
|
+
this.#createLoadContext(_optionalChain([request, 'access', _24 => _24.params, 'optionalAccess', _25 => _25._meta]))
|
|
1013
1080
|
);
|
|
1014
1081
|
} catch (error) {
|
|
1015
1082
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -1072,7 +1139,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1072
1139
|
);
|
|
1073
1140
|
}
|
|
1074
1141
|
setupRootsHandlers() {
|
|
1075
|
-
if (_optionalChain([this, 'access',
|
|
1142
|
+
if (_optionalChain([this, 'access', _26 => _26.#rootsConfig, 'optionalAccess', _27 => _27.enabled]) === false) {
|
|
1076
1143
|
this.#logger.debug(
|
|
1077
1144
|
"[FastMCP debug] roots capability explicitly disabled via config"
|
|
1078
1145
|
);
|
|
@@ -1164,7 +1231,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1164
1231
|
}
|
|
1165
1232
|
args = parsed.value;
|
|
1166
1233
|
}
|
|
1167
|
-
const progressToken = _optionalChain([request, 'access',
|
|
1234
|
+
const progressToken = _optionalChain([request, 'access', _28 => _28.params, 'optionalAccess', _29 => _29._meta, 'optionalAccess', _30 => _30.progressToken]);
|
|
1168
1235
|
let result;
|
|
1169
1236
|
try {
|
|
1170
1237
|
const reportProgress = async (progress) => {
|
|
@@ -1223,7 +1290,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1223
1290
|
elicit: (params, options) => this.#server.elicitInput(params, options),
|
|
1224
1291
|
log,
|
|
1225
1292
|
reportProgress,
|
|
1226
|
-
requestId: typeof _optionalChain([request, 'access',
|
|
1293
|
+
requestId: typeof _optionalChain([request, 'access', _31 => _31.params, 'optionalAccess', _32 => _32._meta, 'optionalAccess', _33 => _33.requestId]) === "string" ? request.params._meta.requestId : void 0,
|
|
1227
1294
|
session: this.#auth,
|
|
1228
1295
|
sessionId: this.#sessionId,
|
|
1229
1296
|
streamContent
|
|
@@ -1333,14 +1400,14 @@ function normalizePath(path) {
|
|
|
1333
1400
|
return path.startsWith("/") ? path : `/${path}`;
|
|
1334
1401
|
}
|
|
1335
1402
|
function parseBasicAuthHeader(authHeader) {
|
|
1336
|
-
const basicMatch = _optionalChain([authHeader, 'optionalAccess',
|
|
1403
|
+
const basicMatch = _optionalChain([authHeader, 'optionalAccess', _34 => _34.match, 'call', _35 => _35(/^Basic\s+(.+)$/)]);
|
|
1337
1404
|
if (!basicMatch) return null;
|
|
1338
1405
|
try {
|
|
1339
1406
|
const credentials = Buffer.from(basicMatch[1], "base64").toString("utf-8");
|
|
1340
1407
|
const credMatch = credentials.match(/^([^:]+):(.*)$/);
|
|
1341
1408
|
if (!credMatch) return null;
|
|
1342
1409
|
return { clientId: credMatch[1], clientSecret: credMatch[2] };
|
|
1343
|
-
} catch (
|
|
1410
|
+
} catch (e5) {
|
|
1344
1411
|
return null;
|
|
1345
1412
|
}
|
|
1346
1413
|
}
|
|
@@ -1767,7 +1834,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
1767
1834
|
enableJsonResponse: httpConfig.enableJsonResponse,
|
|
1768
1835
|
eventStore: httpConfig.eventStore,
|
|
1769
1836
|
host: httpConfig.host,
|
|
1770
|
-
..._optionalChain([this, 'access',
|
|
1837
|
+
..._optionalChain([this, 'access', _36 => _36.#options, 'access', _37 => _37.oauth, 'optionalAccess', _38 => _38.enabled]) && _optionalChain([this, 'access', _39 => _39.#options, 'access', _40 => _40.oauth, 'access', _41 => _41.protectedResource, 'optionalAccess', _42 => _42.resource]) ? {
|
|
1771
1838
|
oauth: {
|
|
1772
1839
|
protectedResource: {
|
|
1773
1840
|
resource: this.#options.oauth.protectedResource.resource
|
|
@@ -1814,7 +1881,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
1814
1881
|
enableJsonResponse: httpConfig.enableJsonResponse,
|
|
1815
1882
|
eventStore: httpConfig.eventStore,
|
|
1816
1883
|
host: httpConfig.host,
|
|
1817
|
-
..._optionalChain([this, 'access',
|
|
1884
|
+
..._optionalChain([this, 'access', _43 => _43.#options, 'access', _44 => _44.oauth, 'optionalAccess', _45 => _45.enabled]) && _optionalChain([this, 'access', _46 => _46.#options, 'access', _47 => _47.oauth, 'access', _48 => _48.protectedResource, 'optionalAccess', _49 => _49.resource]) ? {
|
|
1818
1885
|
oauth: {
|
|
1819
1886
|
protectedResource: {
|
|
1820
1887
|
resource: this.#options.oauth.protectedResource.resource
|
|
@@ -1916,7 +1983,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
1916
1983
|
*/
|
|
1917
1984
|
#createUnauthorizedResponse(message) {
|
|
1918
1985
|
const oauth = this.#options.oauth;
|
|
1919
|
-
const resource = _optionalChain([oauth, 'optionalAccess',
|
|
1986
|
+
const resource = _optionalChain([oauth, 'optionalAccess', _50 => _50.enabled]) ? _optionalChain([oauth, 'access', _51 => _51.protectedResource, 'optionalAccess', _52 => _52.resource]) : void 0;
|
|
1920
1987
|
const wwwAuthenticateParts = [
|
|
1921
1988
|
'error="invalid_token"',
|
|
1922
1989
|
`error_description="${message.replace(/"/g, '\\"')}"`
|
|
@@ -2028,7 +2095,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2028
2095
|
}
|
|
2029
2096
|
}
|
|
2030
2097
|
const oauthConfig = this.#options.oauth;
|
|
2031
|
-
if (_optionalChain([oauthConfig, 'optionalAccess',
|
|
2098
|
+
if (_optionalChain([oauthConfig, 'optionalAccess', _53 => _53.enabled]) && req.method === "GET") {
|
|
2032
2099
|
const url2 = new URL(req.url || "", `http://${host}`);
|
|
2033
2100
|
const authorizationServerMetadataPath = joinPaths(
|
|
2034
2101
|
"",
|
|
@@ -2062,8 +2129,8 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2062
2129
|
}
|
|
2063
2130
|
}
|
|
2064
2131
|
}
|
|
2065
|
-
const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess',
|
|
2066
|
-
if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess',
|
|
2132
|
+
const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess', _54 => _54.proxy]);
|
|
2133
|
+
if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess', _55 => _55.enabled])) {
|
|
2067
2134
|
const url2 = new URL(req.url || "", `http://${host}`);
|
|
2068
2135
|
const oauthPath = basePathRelativePath;
|
|
2069
2136
|
try {
|
|
@@ -2080,7 +2147,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2080
2147
|
const statusCode = error.statusCode || 400;
|
|
2081
2148
|
res.writeHead(statusCode, { "Content-Type": "application/json" }).end(
|
|
2082
2149
|
JSON.stringify(
|
|
2083
|
-
_optionalChain([error, 'access',
|
|
2150
|
+
_optionalChain([error, 'access', _56 => _56.toJSON, 'optionalCall', _57 => _57()]) || {
|
|
2084
2151
|
error: "invalid_request"
|
|
2085
2152
|
}
|
|
2086
2153
|
)
|
|
@@ -2107,7 +2174,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2107
2174
|
} catch (error) {
|
|
2108
2175
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
2109
2176
|
JSON.stringify(
|
|
2110
|
-
_optionalChain([error, 'access',
|
|
2177
|
+
_optionalChain([error, 'access', _58 => _58.toJSON, 'optionalCall', _59 => _59()]) || {
|
|
2111
2178
|
error: "invalid_request"
|
|
2112
2179
|
}
|
|
2113
2180
|
)
|
|
@@ -2129,7 +2196,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2129
2196
|
} catch (error) {
|
|
2130
2197
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
2131
2198
|
JSON.stringify(
|
|
2132
|
-
_optionalChain([error, 'access',
|
|
2199
|
+
_optionalChain([error, 'access', _60 => _60.toJSON, 'optionalCall', _61 => _61()]) || {
|
|
2133
2200
|
error: "server_error"
|
|
2134
2201
|
}
|
|
2135
2202
|
)
|
|
@@ -2164,7 +2231,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2164
2231
|
} catch (error) {
|
|
2165
2232
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
2166
2233
|
JSON.stringify(
|
|
2167
|
-
_optionalChain([error, 'access',
|
|
2234
|
+
_optionalChain([error, 'access', _62 => _62.toJSON, 'optionalCall', _63 => _63()]) || {
|
|
2168
2235
|
error: "server_error"
|
|
2169
2236
|
}
|
|
2170
2237
|
)
|
|
@@ -2186,8 +2253,8 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2186
2253
|
const basicAuth = parseBasicAuthHeader(
|
|
2187
2254
|
req.headers.authorization
|
|
2188
2255
|
);
|
|
2189
|
-
const clientId = _optionalChain([basicAuth, 'optionalAccess',
|
|
2190
|
-
const clientSecret = _nullishCoalesce(_nullishCoalesce(_optionalChain([basicAuth, 'optionalAccess',
|
|
2256
|
+
const clientId = _optionalChain([basicAuth, 'optionalAccess', _64 => _64.clientId]) || params.get("client_id") || "";
|
|
2257
|
+
const clientSecret = _nullishCoalesce(_nullishCoalesce(_optionalChain([basicAuth, 'optionalAccess', _65 => _65.clientSecret]), () => ( params.get("client_secret"))), () => ( void 0));
|
|
2191
2258
|
let response;
|
|
2192
2259
|
if (grantType === "authorization_code") {
|
|
2193
2260
|
response = await oauthProxy.exchangeAuthorizationCode({
|
|
@@ -2217,7 +2284,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2217
2284
|
const statusCode = error.statusCode || 400;
|
|
2218
2285
|
res.writeHead(statusCode, { "Content-Type": "application/json" }).end(
|
|
2219
2286
|
JSON.stringify(
|
|
2220
|
-
_optionalChain([error, 'access',
|
|
2287
|
+
_optionalChain([error, 'access', _66 => _66.toJSON, 'optionalCall', _67 => _67()]) || {
|
|
2221
2288
|
error: "invalid_request"
|
|
2222
2289
|
}
|
|
2223
2290
|
)
|
|
@@ -2288,23 +2355,23 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2288
2355
|
const envBasePath = process.env.FASTMCP_BASE_PATH;
|
|
2289
2356
|
const envStateless = process.env.FASTMCP_STATELESS;
|
|
2290
2357
|
const envHost = process.env.FASTMCP_HOST;
|
|
2291
|
-
const transportType = _optionalChain([overrides, 'optionalAccess',
|
|
2358
|
+
const transportType = _optionalChain([overrides, 'optionalAccess', _68 => _68.transportType]) || (transportArg === "http-stream" ? "httpStream" : transportArg) || envTransport || "stdio";
|
|
2292
2359
|
if (transportType === "httpStream") {
|
|
2293
2360
|
const port = parseInt(
|
|
2294
|
-
_optionalChain([overrides, 'optionalAccess',
|
|
2361
|
+
_optionalChain([overrides, 'optionalAccess', _69 => _69.httpStream, 'optionalAccess', _70 => _70.port, 'optionalAccess', _71 => _71.toString, 'call', _72 => _72()]) || portArg || envPort || "8080"
|
|
2295
2362
|
);
|
|
2296
|
-
const host = _optionalChain([overrides, 'optionalAccess',
|
|
2297
|
-
const endpoint = _optionalChain([overrides, 'optionalAccess',
|
|
2363
|
+
const host = _optionalChain([overrides, 'optionalAccess', _73 => _73.httpStream, 'optionalAccess', _74 => _74.host]) || hostArg || envHost || "localhost";
|
|
2364
|
+
const endpoint = _optionalChain([overrides, 'optionalAccess', _75 => _75.httpStream, 'optionalAccess', _76 => _76.endpoint]) || endpointArg || envEndpoint || "/mcp";
|
|
2298
2365
|
const basePath = normalizeBasePath(
|
|
2299
|
-
_optionalChain([overrides, 'optionalAccess',
|
|
2366
|
+
_optionalChain([overrides, 'optionalAccess', _77 => _77.httpStream, 'optionalAccess', _78 => _78.basePath]) || basePathArg || envBasePath
|
|
2300
2367
|
);
|
|
2301
|
-
const enableJsonResponse = _optionalChain([overrides, 'optionalAccess',
|
|
2302
|
-
const stateless = _optionalChain([overrides, 'optionalAccess',
|
|
2303
|
-
const cors = _optionalChain([overrides, 'optionalAccess',
|
|
2304
|
-
const eventStore = _optionalChain([overrides, 'optionalAccess',
|
|
2305
|
-
const sslCa = _optionalChain([overrides, 'optionalAccess',
|
|
2306
|
-
const sslCert = _optionalChain([overrides, 'optionalAccess',
|
|
2307
|
-
const sslKey = _optionalChain([overrides, 'optionalAccess',
|
|
2368
|
+
const enableJsonResponse = _optionalChain([overrides, 'optionalAccess', _79 => _79.httpStream, 'optionalAccess', _80 => _80.enableJsonResponse]) || false;
|
|
2369
|
+
const stateless = _optionalChain([overrides, 'optionalAccess', _81 => _81.httpStream, 'optionalAccess', _82 => _82.stateless]) || statelessArg === "true" || envStateless === "true" || false;
|
|
2370
|
+
const cors = _optionalChain([overrides, 'optionalAccess', _83 => _83.httpStream, 'optionalAccess', _84 => _84.cors]);
|
|
2371
|
+
const eventStore = _optionalChain([overrides, 'optionalAccess', _85 => _85.httpStream, 'optionalAccess', _86 => _86.eventStore]);
|
|
2372
|
+
const sslCa = _optionalChain([overrides, 'optionalAccess', _87 => _87.httpStream, 'optionalAccess', _88 => _88.sslCa]);
|
|
2373
|
+
const sslCert = _optionalChain([overrides, 'optionalAccess', _89 => _89.httpStream, 'optionalAccess', _90 => _90.sslCert]);
|
|
2374
|
+
const sslKey = _optionalChain([overrides, 'optionalAccess', _91 => _91.httpStream, 'optionalAccess', _92 => _92.sslKey]);
|
|
2308
2375
|
return {
|
|
2309
2376
|
httpStream: {
|
|
2310
2377
|
basePath,
|
|
@@ -2376,5 +2443,6 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2376
2443
|
|
|
2377
2444
|
|
|
2378
2445
|
|
|
2379
|
-
|
|
2380
|
-
|
|
2446
|
+
|
|
2447
|
+
exports.DiscoveryDocumentCache = DiscoveryDocumentCache; exports.jsonSchemaAdapter = jsonSchemaAdapter; exports.imageContent = imageContent; exports.audioContent = audioContent; exports.UnexpectedStateError = UnexpectedStateError; exports.UserError = UserError; exports.ServerState = ServerState; exports.FastMCPSession = FastMCPSession; exports.FastMCP = FastMCP;
|
|
2448
|
+
//# sourceMappingURL=chunk-ISO2WPB5.cjs.map
|