@prefecthq/fastmcp-ts 1.8.0 → 1.8.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 +167 -41
- package/dist/cli/index.cjs.map +1 -1
- package/dist/client.js +4 -4
- package/dist/client.js.map +1 -1
- package/package.json +4 -4
package/dist/cli/index.cjs
CHANGED
|
@@ -1180,8 +1180,8 @@ var init_version = __esm({
|
|
|
1180
1180
|
async run({ args }) {
|
|
1181
1181
|
if (args.json) setJsonMode(true);
|
|
1182
1182
|
const data = {
|
|
1183
|
-
fastmcp: "1.8.
|
|
1184
|
-
"mcp-sdk": "2.
|
|
1183
|
+
fastmcp: "1.8.1",
|
|
1184
|
+
"mcp-sdk": "2.3.1",
|
|
1185
1185
|
node: process.version,
|
|
1186
1186
|
platform: `${process.platform} ${process.arch}`
|
|
1187
1187
|
};
|
|
@@ -8965,10 +8965,10 @@ var init_v4 = __esm({
|
|
|
8965
8965
|
}
|
|
8966
8966
|
});
|
|
8967
8967
|
|
|
8968
|
-
// node_modules/@modelcontextprotocol/
|
|
8968
|
+
// node_modules/@modelcontextprotocol/core/dist/auth-BNDyLTqp.mjs
|
|
8969
8969
|
var LATEST_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, RELATED_TASK_META_KEY, PROTOCOL_VERSION_META_KEY, CLIENT_INFO_META_KEY, SERVER_INFO_META_KEY, CLIENT_CAPABILITIES_META_KEY, SUBSCRIPTION_ID_META_KEY, LOG_LEVEL_META_KEY, JSONRPC_VERSION, JSONValueSchema, JSONObjectSchema, JSONArraySchema, ProgressTokenSchema, CursorSchema, TaskMetadataSchema, RelatedTaskMetadataSchema, RequestMetaSchema, BaseRequestParamsSchema, TaskAugmentedRequestParamsSchema, RequestSchema, NotificationsParamsSchema, NotificationSchema, ResultMetaObjectSchema, ResultSchema, RequestIdSchema, JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema, JSONRPCMessageSchema, JSONRPCResponseSchema, EmptyResultSchema, CancelledNotificationParamsSchema, CancelledNotificationSchema, IconSchema, IconsSchema, BaseMetadataSchema, ImplementationSchema, FormElicitationCapabilitySchema, ElicitationCapabilitySchema, ClientTasksCapabilitySchema, ServerTasksCapabilitySchema, ClientCapabilitiesSchema, InitializeRequestParamsSchema, InitializeRequestSchema, ServerCapabilitiesSchema, InitializeResultSchema, InitializedNotificationSchema, DiscoverRequestSchema, DiscoverResultSchema, PingRequestSchema, ProgressSchema, ProgressNotificationParamsSchema, ProgressNotificationSchema, PaginatedRequestParamsSchema, PaginatedRequestSchema, PaginatedResultSchema, ResourceContentsSchema, TextResourceContentsSchema, Base64Schema, BlobResourceContentsSchema, RoleSchema, AnnotationsSchema, ResourceSchema, ResourceTemplateSchema, ListResourcesRequestSchema, ListResourcesResultSchema, ListResourceTemplatesRequestSchema, ListResourceTemplatesResultSchema, ResourceRequestParamsSchema, ReadResourceRequestParamsSchema, ReadResourceRequestSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema, SubscribeRequestParamsSchema, SubscribeRequestSchema, UnsubscribeRequestParamsSchema, UnsubscribeRequestSchema, SubscriptionFilterSchema, SubscriptionsListenRequestParamsSchema, SubscriptionsListenRequestSchema, SubscriptionsAcknowledgedNotificationParamsSchema, SubscriptionsAcknowledgedNotificationSchema, SubscriptionsListenResultMetaSchema, SubscriptionsListenResultSchema, ResourceUpdatedNotificationParamsSchema, ResourceUpdatedNotificationSchema, PromptArgumentSchema, PromptSchema, ListPromptsRequestSchema, ListPromptsResultSchema, GetPromptRequestParamsSchema, GetPromptRequestSchema, TextContentSchema, ImageContentSchema, AudioContentSchema, ToolUseContentSchema, EmbeddedResourceSchema, ResourceLinkSchema, ContentBlockSchema, PromptMessageSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ToolAnnotationsSchema, ToolExecutionSchema, ToolSchema, ListToolsRequestSchema, ListToolsResultSchema, CallToolResultSchema, CompatibilityCallToolResultSchema, CallToolRequestParamsSchema, CallToolRequestSchema, ToolListChangedNotificationSchema, ListChangedOptionsBaseSchema, LoggingLevelSchema, SetLevelRequestParamsSchema, SetLevelRequestSchema, LoggingMessageNotificationParamsSchema, LoggingMessageNotificationSchema, ModelHintSchema, ModelPreferencesSchema, ToolChoiceSchema, ToolResultContentSchema, SamplingContentSchema, SamplingMessageContentBlockSchema, SamplingMessageSchema, CreateMessageRequestParamsSchema, CreateMessageRequestSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema, UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema, LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema, EnumSchemaSchema, PrimitiveSchemaDefinitionSchema, ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema, ElicitRequestParamsSchema, ElicitRequestSchema, ElicitationCompleteNotificationParamsSchema, ElicitationCompleteNotificationSchema, ElicitResultSchema, ResourceTemplateReferenceSchema, PromptReferenceSchema, CompleteRequestParamsSchema, CompleteRequestSchema, CompleteResultSchema, RootSchema, ListRootsRequestSchema, ListRootsResultSchema, RootsListChangedNotificationSchema, TaskCreationParamsSchema, TaskStatusSchema, TaskSchema, CreateTaskResultSchema, TaskStatusNotificationParamsSchema, TaskStatusNotificationSchema, GetTaskRequestSchema, GetTaskResultSchema, GetTaskPayloadRequestSchema, GetTaskPayloadResultSchema, ListTasksRequestSchema, ListTasksResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, ClientRequestSchema, ClientNotificationSchema, ClientResultSchema, ServerRequestSchema, ServerNotificationSchema, ServerResultSchema, SafeUrlSchema, OAuthProtectedResourceMetadataSchema, OAuthMetadataSchema, OpenIdProviderMetadataSchema, OpenIdProviderDiscoveryMetadataSchema, OAuthTokensSchema, IdJagTokenExchangeResponseSchema, OAuthErrorResponseSchema, OptionalSafeUrlSchema, OAuthClientMetadataSchema, OAuthClientInformationSchema, OAuthClientInformationFullSchema, OAuthClientRegistrationErrorSchema, OAuthTokenRevocationRequestSchema;
|
|
8970
8970
|
var init_auth_BNDyLTqp = __esm({
|
|
8971
|
-
"node_modules/@modelcontextprotocol/
|
|
8971
|
+
"node_modules/@modelcontextprotocol/core/dist/auth-BNDyLTqp.mjs"() {
|
|
8972
8972
|
"use strict";
|
|
8973
8973
|
init_v4();
|
|
8974
8974
|
LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
@@ -9913,15 +9913,15 @@ var init_auth_BNDyLTqp = __esm({
|
|
|
9913
9913
|
}
|
|
9914
9914
|
});
|
|
9915
9915
|
|
|
9916
|
-
// node_modules/@modelcontextprotocol/
|
|
9916
|
+
// node_modules/@modelcontextprotocol/core/dist/internal.mjs
|
|
9917
9917
|
var init_internal = __esm({
|
|
9918
|
-
"node_modules/@modelcontextprotocol/
|
|
9918
|
+
"node_modules/@modelcontextprotocol/core/dist/internal.mjs"() {
|
|
9919
9919
|
"use strict";
|
|
9920
9920
|
init_auth_BNDyLTqp();
|
|
9921
9921
|
}
|
|
9922
9922
|
});
|
|
9923
9923
|
|
|
9924
|
-
// node_modules/@modelcontextprotocol/client/dist/src-
|
|
9924
|
+
// node_modules/@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs
|
|
9925
9925
|
function stampErrorBrands(instance, ctor) {
|
|
9926
9926
|
const brands = /* @__PURE__ */ new Set();
|
|
9927
9927
|
let current = ctor;
|
|
@@ -11882,7 +11882,8 @@ function build() {
|
|
|
11882
11882
|
ListResourceTemplatesResultResponseSchema: wireResultResponse(ListResourceTemplatesResultSchema$1),
|
|
11883
11883
|
ReadResourceResultResponseSchema: wireResultResponse(union([ReadResourceResultSchema$1, InputRequiredResultSchema])),
|
|
11884
11884
|
CompleteResultResponseSchema: wireResultResponse(CompleteResultSchema$1),
|
|
11885
|
-
DiscoverResultResponseSchema: wireResultResponse(DiscoverResultSchema$1)
|
|
11885
|
+
DiscoverResultResponseSchema: wireResultResponse(DiscoverResultSchema$1),
|
|
11886
|
+
SubscriptionsListenResultResponseSchema: wireResultResponse(SubscriptionsListenResultSchema$1)
|
|
11886
11887
|
};
|
|
11887
11888
|
}
|
|
11888
11889
|
function buildSchemas2026() {
|
|
@@ -12080,6 +12081,9 @@ function isSpecRequestMethod(method) {
|
|
|
12080
12081
|
function isSpecNotificationMethod(method) {
|
|
12081
12082
|
return ALL_CODECS.some((codec2) => codec2.hasNotificationMethod(method));
|
|
12082
12083
|
}
|
|
12084
|
+
function isExtensionReusedRequestMethod(method) {
|
|
12085
|
+
return method === "tasks/get" || method === "tasks/cancel";
|
|
12086
|
+
}
|
|
12083
12087
|
function scanXMcpHeaderDeclarations(inputSchema) {
|
|
12084
12088
|
const declarations = [];
|
|
12085
12089
|
const seenLower = /* @__PURE__ */ new Map();
|
|
@@ -12709,9 +12713,61 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
12709
12713
|
});
|
|
12710
12714
|
};
|
|
12711
12715
|
}
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
"
|
|
12716
|
+
function isWithinOrigin(from, to) {
|
|
12717
|
+
if (from.protocol === to.protocol && from.host === to.host) return true;
|
|
12718
|
+
return from.protocol === "http:" && to.protocol === "https:" && from.hostname === to.hostname && !from.port && !to.port;
|
|
12719
|
+
}
|
|
12720
|
+
function redirectTarget(url2, response) {
|
|
12721
|
+
const location = REDIRECT_STATUSES.has(response.status) ? response.headers?.get("location") : void 0;
|
|
12722
|
+
if (!location) return void 0;
|
|
12723
|
+
try {
|
|
12724
|
+
return new URL(location, url2);
|
|
12725
|
+
} catch {
|
|
12726
|
+
return;
|
|
12727
|
+
}
|
|
12728
|
+
}
|
|
12729
|
+
function fetchLeavingRedirects(baseFetch) {
|
|
12730
|
+
const copy = (url2, init) => baseFetch(url2, init);
|
|
12731
|
+
leftToFetch.add(copy);
|
|
12732
|
+
return copy;
|
|
12733
|
+
}
|
|
12734
|
+
function fetchWithinOrigin(baseFetch) {
|
|
12735
|
+
if (leftToFetch.has(baseFetch)) return baseFetch;
|
|
12736
|
+
return async (url2, init) => {
|
|
12737
|
+
if (init?.redirect === "error" || init?.redirect === "manual") return baseFetch(url2, init);
|
|
12738
|
+
const method = (init?.method ?? "GET").toUpperCase();
|
|
12739
|
+
let current = url2;
|
|
12740
|
+
for (let followed = 0; ; followed++) {
|
|
12741
|
+
const response = await baseFetch(current, {
|
|
12742
|
+
...init,
|
|
12743
|
+
redirect: "manual"
|
|
12744
|
+
});
|
|
12745
|
+
const target = redirectTarget(current, response);
|
|
12746
|
+
if (!target || followed === MAX_REDIRECTS) return response;
|
|
12747
|
+
const from = new URL(current);
|
|
12748
|
+
const keepsMethod = method === "GET" || response.status === 307 || response.status === 308;
|
|
12749
|
+
const keepsUserinfo = !(target.username || target.password) || target.username === from.username && target.password === from.password;
|
|
12750
|
+
if (!keepsMethod || !keepsUserinfo || !isWithinOrigin(from, target)) return response;
|
|
12751
|
+
await response.text?.().catch(() => {
|
|
12752
|
+
});
|
|
12753
|
+
current = target;
|
|
12754
|
+
}
|
|
12755
|
+
};
|
|
12756
|
+
}
|
|
12757
|
+
function unfollowedRedirect(url2, response) {
|
|
12758
|
+
if (response.type === "opaqueredirect") return "Redirect not followed: this runtime does not expose where it points";
|
|
12759
|
+
const target = redirectTarget(response.url || url2, response);
|
|
12760
|
+
if (!target) return void 0;
|
|
12761
|
+
target.username = target.password = target.search = target.hash = "";
|
|
12762
|
+
if (target.protocol === "http:" && new URL(response.url || url2).protocol === "https:") {
|
|
12763
|
+
target.protocol = "https:";
|
|
12764
|
+
return `Redirect from https to plain http not followed; try ${target.href} as the endpoint`;
|
|
12765
|
+
}
|
|
12766
|
+
return `Redirect to ${target.href} not followed; use that URL as the endpoint if it is the intended server`;
|
|
12767
|
+
}
|
|
12768
|
+
var BRANDS, OAuthErrorCode, OAuthError, SdkErrorCode, SdkError, SdkHttpError, FIRST_MODERN_PROTOCOL_VERSION, SUPPORTED_MODERN_PROTOCOL_VERSIONS, TOOL_RESULT_FOREIGN_FAMILY_KEYS, memo$1, REF_REWRITE_DATA_POSITION_KEYS, REF_REWRITE_NAME_MAP_KEYS, requestMethodKeys$1, notificationMethodKeys$1, resultMethodKeys, maps$1, rev2025RequestMethods, rev2025NotificationMethods, NOT_IN_ERA$1, rev2025Codec, memo, CACHEABLE_RESULT_METHODS, RESULT_CACHE_HINT_FALLBACK, ProtocolErrorCode, ProtocolError, ResourceNotFoundError, UrlElicitationRequiredError, UnsupportedProtocolVersionError, MissingRequiredClientCapabilityError, DEFAULT_CACHE_TTL_MS, DEFAULT_CACHE_SCOPE, EXTENDED_RESULT_TYPE_METHODS, INPUT_REQUEST_METHODS_2026, maps, requestMethodKeys, notificationMethodKeys, rev2026RequestMethods, rev2026NotificationMethods, NOT_IN_ERA, REQUIRED_ENVELOPE_KEYS, rev2026Codec, wireResultSchemasMemo, MODERN_WIRE_REVISION, ALL_CODECS, schemas_exports3, isJSONRPCRequest, isJSONRPCNotification, isJSONRPCResultResponse, isJSONRPCErrorResponse, isInputRequiredResult, isInitializeRequest, isInitializedNotification, MCP_PARAM_HEADER_PREFIX, X_MCP_HEADER_KEY, RFC9110_TOKEN, PERMITTED_X_MCP_HEADER_TYPES, NON_REACHABLE_SUBSCHEMA_KEYWORDS, OBJECT_VALUED_SUBSCHEMA_KEYWORDS, BASE64_SENTINEL_PREFIX, BASE64_SENTINEL_SUFFIX, HEADER_MISMATCH_ERROR_CODE, INBOUND_VALIDATION_LADDER, LADDER_ERROR_HTTP_STATUS, MCP_NAME_HEADER_SOURCE, warnedZodFallback, JSON_SCHEMA_CONVERSION_TARGET, DATETIME_FRACTION_DIGITS, ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS, ROOT_KEYS, PROPERTY_KEYS_BY_TYPE, SUPPORTED_STRING_FORMATS, inputRequired, DEFAULT_INPUT_REQUIRED_AUTO_FULFILL, DEFAULT_INPUT_REQUIRED_MAX_ROUNDS, REQUEST_STATE_ONLY_LEG_PACING_MS, SPEC_SCHEMA_KEYS, authSchemas, _specTypeSchemas, _isSpecType, specTypeSchemas, isSpecType, DEFAULT_REQUEST_TIMEOUT_MSEC, RESERVED_ENVELOPE_META_KEYS, RETRY_PARAMS_KEYS, NO_REQUEST_STATE, writeNegotiatedProtocolVersion, Protocol, require_content_type, import_content_type, STDIO_DEFAULT_MAX_BUFFER_SIZE, ReadBuffer, REDIRECT_STATUSES, MAX_REDIRECTS, leftToFetch, InMemoryTransport;
|
|
12769
|
+
var init_src_WCy6ifGf = __esm({
|
|
12770
|
+
"node_modules/@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs"() {
|
|
12715
12771
|
"use strict";
|
|
12716
12772
|
init_chunk_Br0eD_fh();
|
|
12717
12773
|
init_dialects_BOhdv1Fc();
|
|
@@ -13850,6 +13906,8 @@ var init_src_xKF0PJN = __esm({
|
|
|
13850
13906
|
_transport;
|
|
13851
13907
|
_requestMessageId = 0;
|
|
13852
13908
|
_requestHandlers = /* @__PURE__ */ new Map();
|
|
13909
|
+
/** Methods registered with an explicit schema; the era gate in `_onrequest` reads it for the Tasks extension names. */
|
|
13910
|
+
_customSchemaRequestMethods = /* @__PURE__ */ new Set();
|
|
13853
13911
|
_requestHandlerAbortControllers = /* @__PURE__ */ new Map();
|
|
13854
13912
|
_notificationHandlers = /* @__PURE__ */ new Map();
|
|
13855
13913
|
_responseHandlers = /* @__PURE__ */ new Map();
|
|
@@ -14133,7 +14191,7 @@ var init_src_xKF0PJN = __esm({
|
|
|
14133
14191
|
return;
|
|
14134
14192
|
}
|
|
14135
14193
|
}
|
|
14136
|
-
if (isSpecRequestMethod(request.method) && !codec2.hasRequestMethod(request.method)) {
|
|
14194
|
+
if (isSpecRequestMethod(request.method) && !codec2.hasRequestMethod(request.method) && !(isExtensionReusedRequestMethod(request.method) && this._customSchemaRequestMethods.has(request.method))) {
|
|
14137
14195
|
sendErrorResponse(ProtocolErrorCode.MethodNotFound, "Method not found");
|
|
14138
14196
|
return;
|
|
14139
14197
|
}
|
|
@@ -14266,8 +14324,11 @@ var init_src_xKF0PJN = __esm({
|
|
|
14266
14324
|
}
|
|
14267
14325
|
request(request, schemaOrOptions, maybeOptions) {
|
|
14268
14326
|
const codec2 = this._resolveOutboundCodec(request.method);
|
|
14327
|
+
if (isStandardSchema(schemaOrOptions)) {
|
|
14328
|
+
if (!isExtensionReusedRequestMethod(request.method)) this._assertOutboundRequestInEra(codec2, request.method);
|
|
14329
|
+
return this._requestWithSchemaViaCodec(codec2, request, schemaOrOptions, maybeOptions);
|
|
14330
|
+
}
|
|
14269
14331
|
this._assertOutboundRequestInEra(codec2, request.method);
|
|
14270
|
-
if (isStandardSchema(schemaOrOptions)) return this._requestWithSchemaViaCodec(codec2, request, schemaOrOptions, maybeOptions);
|
|
14271
14332
|
const validate2 = codecResultValidator(codec2, request.method);
|
|
14272
14333
|
if (validate2 === void 0) throw new TypeError(`'${request.method}' is not a spec method; pass a result schema as the second argument to request().`);
|
|
14273
14334
|
return this._requestWithSchemaViaCodec(codec2, request, validate2, schemaOrOptions);
|
|
@@ -14511,6 +14572,8 @@ var init_src_xKF0PJN = __esm({
|
|
|
14511
14572
|
return maybeHandler(parsed.data, ctx);
|
|
14512
14573
|
};
|
|
14513
14574
|
else throw new TypeError("setRequestHandler: handler is required");
|
|
14575
|
+
if (typeof schemasOrHandler === "function") this._customSchemaRequestMethods.delete(method);
|
|
14576
|
+
else this._customSchemaRequestMethods.add(method);
|
|
14514
14577
|
this._requestHandlers.set(method, this._wrapHandler(method, stored));
|
|
14515
14578
|
}
|
|
14516
14579
|
/**
|
|
@@ -14540,6 +14603,7 @@ var init_src_xKF0PJN = __esm({
|
|
|
14540
14603
|
*/
|
|
14541
14604
|
removeRequestHandler(method) {
|
|
14542
14605
|
this._requestHandlers.delete(method);
|
|
14606
|
+
this._customSchemaRequestMethods.delete(method);
|
|
14543
14607
|
}
|
|
14544
14608
|
/**
|
|
14545
14609
|
* Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
|
|
@@ -14653,6 +14717,15 @@ var init_src_xKF0PJN = __esm({
|
|
|
14653
14717
|
this._buffer = void 0;
|
|
14654
14718
|
}
|
|
14655
14719
|
};
|
|
14720
|
+
REDIRECT_STATUSES = /* @__PURE__ */ new Set([
|
|
14721
|
+
301,
|
|
14722
|
+
302,
|
|
14723
|
+
303,
|
|
14724
|
+
307,
|
|
14725
|
+
308
|
|
14726
|
+
]);
|
|
14727
|
+
MAX_REDIRECTS = 5;
|
|
14728
|
+
leftToFetch = /* @__PURE__ */ new WeakSet();
|
|
14656
14729
|
InMemoryTransport = class InMemoryTransport2 {
|
|
14657
14730
|
_otherTransport;
|
|
14658
14731
|
_messageQueue = [];
|
|
@@ -22703,12 +22776,13 @@ async function discoverOAuthProtectedResourceMetadata(serverUrl, opts, fetchFn =
|
|
|
22703
22776
|
return OAuthProtectedResourceMetadataSchema.parse(await response.json());
|
|
22704
22777
|
}
|
|
22705
22778
|
async function fetchWithCorsRetry(url2, headers, fetchFn = fetch) {
|
|
22779
|
+
const withinOrigin = fetchWithinOrigin(fetchFn);
|
|
22706
22780
|
try {
|
|
22707
|
-
return await
|
|
22781
|
+
return await withinOrigin(url2, { headers });
|
|
22708
22782
|
} catch (error2) {
|
|
22709
22783
|
if (!(error2 instanceof TypeError) || !CORS_IS_POSSIBLE) throw error2;
|
|
22710
22784
|
if (headers) try {
|
|
22711
|
-
return await
|
|
22785
|
+
return await withinOrigin(url2, {});
|
|
22712
22786
|
} catch (retryError) {
|
|
22713
22787
|
if (!(retryError instanceof TypeError)) throw retryError;
|
|
22714
22788
|
return;
|
|
@@ -22726,7 +22800,7 @@ async function tryMetadataDiscovery(url2, protocolVersion, fetchFn = fetch) {
|
|
|
22726
22800
|
function shouldAttemptFallback(response, pathname) {
|
|
22727
22801
|
if (!response) return true;
|
|
22728
22802
|
if (pathname === "/") return false;
|
|
22729
|
-
return response.
|
|
22803
|
+
return !response.ok && response.status < 500 || response.status === 502;
|
|
22730
22804
|
}
|
|
22731
22805
|
async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, opts) {
|
|
22732
22806
|
const issuer = new URL(serverUrl);
|
|
@@ -22783,7 +22857,7 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
22783
22857
|
if (!response.ok) {
|
|
22784
22858
|
await response.text?.().catch(() => {
|
|
22785
22859
|
});
|
|
22786
|
-
if (response.status
|
|
22860
|
+
if (response.status < 500 || response.status === 502) continue;
|
|
22787
22861
|
throw new Error(`HTTP ${response.status} trying to load ${type === "oauth" ? "OAuth" : "OpenID provider"} metadata from ${endpointUrl}`);
|
|
22788
22862
|
}
|
|
22789
22863
|
const parsed = type === "oauth" ? OAuthMetadataSchema.parse(await response.json()) : OpenIdProviderDiscoveryMetadataSchema.parse(await response.json());
|
|
@@ -22864,7 +22938,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequ
|
|
|
22864
22938
|
htm: "POST",
|
|
22865
22939
|
htu: tokenUrl
|
|
22866
22940
|
}));
|
|
22867
|
-
return (fetchFn ?? fetch)(tokenUrl, {
|
|
22941
|
+
return fetchWithinOrigin(fetchFn ?? fetch)(tokenUrl, {
|
|
22868
22942
|
method: "POST",
|
|
22869
22943
|
headers: requestHeaders,
|
|
22870
22944
|
body: tokenRequestParams
|
|
@@ -22948,7 +23022,7 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
|
|
|
22948
23022
|
...clientMetadata,
|
|
22949
23023
|
...scope === void 0 ? {} : { scope }
|
|
22950
23024
|
};
|
|
22951
|
-
const response = await (fetchFn ?? fetch)(registrationUrl, {
|
|
23025
|
+
const response = await fetchWithinOrigin(fetchFn ?? fetch)(registrationUrl, {
|
|
22952
23026
|
method: "POST",
|
|
22953
23027
|
headers: { "Content-Type": "application/json" },
|
|
22954
23028
|
body: JSON.stringify(submittedMetadata)
|
|
@@ -22999,6 +23073,11 @@ function classifyProbeOutcome(outcome, context) {
|
|
|
22999
23073
|
return classifyHttpError(outcome, context);
|
|
23000
23074
|
case "network-error":
|
|
23001
23075
|
return classifyNetworkError(outcome.error, context);
|
|
23076
|
+
case "unusable-reply":
|
|
23077
|
+
return {
|
|
23078
|
+
kind: "error",
|
|
23079
|
+
error: new SdkError(SdkErrorCode.EraNegotiationFailed, `Version negotiation probe failed: the server answered with an unusable reply (${describeError(outcome.error)})`, { cause: outcome.error }, { cause: outcome.error })
|
|
23080
|
+
};
|
|
23002
23081
|
case "auth-required":
|
|
23003
23082
|
return {
|
|
23004
23083
|
kind: "error",
|
|
@@ -23173,6 +23252,10 @@ function buildProbeRequest(id, protocolVersion, clientInfo, capabilities) {
|
|
|
23173
23252
|
}) }
|
|
23174
23253
|
};
|
|
23175
23254
|
}
|
|
23255
|
+
function isUnusableReplyError(error2) {
|
|
23256
|
+
if (error2 instanceof SdkError && error2.code === SdkErrorCode.ClientHttpUnexpectedContent) return true;
|
|
23257
|
+
return error2 instanceof Error && error2.name === "SyntaxError";
|
|
23258
|
+
}
|
|
23176
23259
|
function normalizeReply(reply, timeoutMs) {
|
|
23177
23260
|
switch (reply.kind) {
|
|
23178
23261
|
case "response":
|
|
@@ -23198,6 +23281,10 @@ function normalizeReply(reply, timeoutMs) {
|
|
|
23198
23281
|
statusText: error2.data.statusText
|
|
23199
23282
|
};
|
|
23200
23283
|
}
|
|
23284
|
+
if (isUnusableReplyError(error2)) return {
|
|
23285
|
+
kind: "unusable-reply",
|
|
23286
|
+
error: error2
|
|
23287
|
+
};
|
|
23201
23288
|
return {
|
|
23202
23289
|
kind: "network-error",
|
|
23203
23290
|
error: error2
|
|
@@ -23395,7 +23482,7 @@ var OAuthClientFlowError, IssuerMismatchError, RegistrationRejectedError, Insecu
|
|
|
23395
23482
|
var init_dist4 = __esm({
|
|
23396
23483
|
"node_modules/@modelcontextprotocol/client/dist/index.mjs"() {
|
|
23397
23484
|
"use strict";
|
|
23398
|
-
|
|
23485
|
+
init_src_WCy6ifGf();
|
|
23399
23486
|
init_shimsNode();
|
|
23400
23487
|
init_index_node();
|
|
23401
23488
|
init_dist3();
|
|
@@ -25546,6 +25633,7 @@ var init_dist4 = __esm({
|
|
|
25546
25633
|
_skipIssuerMetadataValidation;
|
|
25547
25634
|
_fetch;
|
|
25548
25635
|
_fetchWithInit;
|
|
25636
|
+
_redirectPolicy;
|
|
25549
25637
|
_dpop;
|
|
25550
25638
|
_protocolVersion;
|
|
25551
25639
|
onclose;
|
|
@@ -25567,9 +25655,21 @@ var init_dist4 = __esm({
|
|
|
25567
25655
|
this._fetch = this._dpop(opts.fetch ?? fetch);
|
|
25568
25656
|
}
|
|
25569
25657
|
} else this._authProvider = opts?.authProvider;
|
|
25658
|
+
this._redirectPolicy = opts?.redirectPolicy;
|
|
25570
25659
|
this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
|
|
25660
|
+
if (this._redirectPolicy === "follow") this._fetchWithInit = fetchLeavingRedirects(this._fetchWithInit);
|
|
25571
25661
|
}
|
|
25572
25662
|
_last401Response;
|
|
25663
|
+
_connectAuthRetried = false;
|
|
25664
|
+
/** `baseFetch` with redirects handled as `redirectPolicy` says. */
|
|
25665
|
+
_redirects(baseFetch) {
|
|
25666
|
+
return this._redirectPolicy === "follow" ? baseFetch : fetchWithinOrigin(baseFetch);
|
|
25667
|
+
}
|
|
25668
|
+
/** Error text for a redirect `response` that was not followed, or `undefined` for any other response. */
|
|
25669
|
+
_unfollowedRedirect(url2, response) {
|
|
25670
|
+
const text = this._redirectPolicy === "follow" ? void 0 : unfollowedRedirect(url2, response);
|
|
25671
|
+
return text && `${text} (redirectPolicy: 'same-origin')`;
|
|
25672
|
+
}
|
|
25573
25673
|
async _commonHeaders() {
|
|
25574
25674
|
const headers = new Headers(this._requestInit?.headers || void 0);
|
|
25575
25675
|
let token;
|
|
@@ -25584,7 +25684,8 @@ var init_dist4 = __esm({
|
|
|
25584
25684
|
}
|
|
25585
25685
|
_startOrAuth() {
|
|
25586
25686
|
const eventSourceFetch = this._eventSourceInit?.fetch;
|
|
25587
|
-
const fetchImpl = eventSourceFetch ? this._dpop?.(eventSourceFetch) ?? eventSourceFetch : this._fetch ?? fetch;
|
|
25687
|
+
const fetchImpl = this._redirects(eventSourceFetch ? this._dpop?.(eventSourceFetch) ?? eventSourceFetch : this._fetch ?? fetch);
|
|
25688
|
+
let redirect;
|
|
25588
25689
|
return new Promise((resolve5, reject) => {
|
|
25589
25690
|
this._eventSource = new EventSource(this._url.href, {
|
|
25590
25691
|
...this._eventSourceInit,
|
|
@@ -25595,6 +25696,7 @@ var init_dist4 = __esm({
|
|
|
25595
25696
|
...init,
|
|
25596
25697
|
headers
|
|
25597
25698
|
});
|
|
25699
|
+
redirect = this._unfollowedRedirect(url2, response);
|
|
25598
25700
|
if (response.status === 401) {
|
|
25599
25701
|
this._last401Response = response;
|
|
25600
25702
|
if (response.headers.has("www-authenticate")) {
|
|
@@ -25609,31 +25711,41 @@ var init_dist4 = __esm({
|
|
|
25609
25711
|
this._abortController = new AbortController();
|
|
25610
25712
|
this._eventSource.onerror = (event) => {
|
|
25611
25713
|
if (event.code === 401 && this._authProvider) {
|
|
25612
|
-
if (this._authProvider.onUnauthorized && this._last401Response) {
|
|
25714
|
+
if (this._authProvider.onUnauthorized && this._last401Response && !this._connectAuthRetried) {
|
|
25613
25715
|
const response = this._last401Response;
|
|
25614
25716
|
this._last401Response = void 0;
|
|
25717
|
+
this._connectAuthRetried = true;
|
|
25615
25718
|
this._eventSource?.close();
|
|
25616
25719
|
this._authProvider.onUnauthorized({
|
|
25617
25720
|
response,
|
|
25618
25721
|
serverUrl: this._url,
|
|
25619
25722
|
fetchFn: this._fetchWithInit
|
|
25620
25723
|
}).then(() => this._startOrAuth().then(resolve5, reject), (error$2) => {
|
|
25724
|
+
this._connectAuthRetried = false;
|
|
25621
25725
|
markAuthSeamEscape(error$2);
|
|
25622
25726
|
this.onerror?.(error$2);
|
|
25623
25727
|
reject(error$2);
|
|
25624
25728
|
});
|
|
25625
25729
|
return;
|
|
25626
25730
|
}
|
|
25627
|
-
const
|
|
25731
|
+
const retried = this._connectAuthRetried;
|
|
25732
|
+
this._connectAuthRetried = false;
|
|
25733
|
+
const error$1 = markAuthSeamEscape(retried ? new SdkHttpError(SdkErrorCode.ClientHttpAuthentication, "Server returned 401 after re-authentication", {
|
|
25734
|
+
status: 401,
|
|
25735
|
+
statusText: this._last401Response?.statusText ?? ""
|
|
25736
|
+
}) : new UnauthorizedError());
|
|
25737
|
+
this._last401Response = void 0;
|
|
25628
25738
|
reject(error$1);
|
|
25629
25739
|
this.onerror?.(error$1);
|
|
25630
25740
|
return;
|
|
25631
25741
|
}
|
|
25632
|
-
|
|
25742
|
+
this._connectAuthRetried = false;
|
|
25743
|
+
const error2 = new SseError(event.code, redirect ?? event.message, event);
|
|
25633
25744
|
reject(error2);
|
|
25634
25745
|
this.onerror?.(error2);
|
|
25635
25746
|
};
|
|
25636
25747
|
this._eventSource.onopen = () => {
|
|
25748
|
+
this._connectAuthRetried = false;
|
|
25637
25749
|
};
|
|
25638
25750
|
this._eventSource.addEventListener("endpoint", (event) => {
|
|
25639
25751
|
const messageEvent = event;
|
|
@@ -25701,7 +25813,7 @@ var init_dist4 = __esm({
|
|
|
25701
25813
|
body: JSON.stringify(message),
|
|
25702
25814
|
signal: this._abortController?.signal
|
|
25703
25815
|
};
|
|
25704
|
-
const response = await (this._fetch ?? fetch)(this._endpoint, init);
|
|
25816
|
+
const response = await this._redirects(this._fetch ?? fetch)(this._endpoint, init);
|
|
25705
25817
|
if (!response.ok) {
|
|
25706
25818
|
if (response.status === 401 && this._authProvider) {
|
|
25707
25819
|
if (response.headers.has("www-authenticate")) {
|
|
@@ -25732,7 +25844,7 @@ var init_dist4 = __esm({
|
|
|
25732
25844
|
throw markAuthSeamEscape(new UnauthorizedError());
|
|
25733
25845
|
}
|
|
25734
25846
|
const text = await response.text?.().catch(() => null);
|
|
25735
|
-
throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${text}`);
|
|
25847
|
+
throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${this._unfollowedRedirect(this._endpoint, response) ?? text}`);
|
|
25736
25848
|
}
|
|
25737
25849
|
await response.text?.().catch(() => {
|
|
25738
25850
|
});
|
|
@@ -25772,6 +25884,7 @@ var init_dist4 = __esm({
|
|
|
25772
25884
|
_skipIssuerMetadataValidation;
|
|
25773
25885
|
_fetch;
|
|
25774
25886
|
_fetchWithInit;
|
|
25887
|
+
_redirectPolicy;
|
|
25775
25888
|
_sessionId;
|
|
25776
25889
|
_reconnectionOptions;
|
|
25777
25890
|
_protocolVersion;
|
|
@@ -25802,7 +25915,9 @@ var init_dist4 = __esm({
|
|
|
25802
25915
|
this._authProvider = adaptOAuthProvider(opts.authProvider, { skipIssuerMetadataValidation: opts.skipIssuerMetadataValidation });
|
|
25803
25916
|
if (opts.authProvider.dpop) this._fetch = withDpopFromProvider(opts.authProvider)(opts.fetch ?? fetch);
|
|
25804
25917
|
} else this._authProvider = opts?.authProvider;
|
|
25918
|
+
this._redirectPolicy = opts?.redirectPolicy;
|
|
25805
25919
|
this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
|
|
25920
|
+
if (this._redirectPolicy === "follow") this._fetchWithInit = fetchLeavingRedirects(this._fetchWithInit);
|
|
25806
25921
|
this._sessionId = opts?.sessionId;
|
|
25807
25922
|
this._protocolVersion = opts?.protocolVersion;
|
|
25808
25923
|
this._reconnectionOptions = opts?.reconnectionOptions ?? DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS;
|
|
@@ -25854,6 +25969,15 @@ var init_dist4 = __esm({
|
|
|
25854
25969
|
skipIssuerMetadataValidation: this._skipIssuerMetadataValidation
|
|
25855
25970
|
});
|
|
25856
25971
|
}
|
|
25972
|
+
/** `baseFetch` with redirects handled as `redirectPolicy` says. */
|
|
25973
|
+
_redirects(baseFetch) {
|
|
25974
|
+
return this._redirectPolicy === "follow" ? baseFetch : fetchWithinOrigin(baseFetch);
|
|
25975
|
+
}
|
|
25976
|
+
/** Error text for a redirect `response` that was not followed, or `undefined` for any other response. */
|
|
25977
|
+
_unfollowedRedirect(url2, response) {
|
|
25978
|
+
const text = this._redirectPolicy === "follow" ? void 0 : unfollowedRedirect(url2, response);
|
|
25979
|
+
return text && `${text} (redirectPolicy: 'same-origin')`;
|
|
25980
|
+
}
|
|
25857
25981
|
async _commonHeaders() {
|
|
25858
25982
|
const headers = new Headers(this._requestInit?.headers || void 0);
|
|
25859
25983
|
let token;
|
|
@@ -25905,7 +26029,7 @@ var init_dist4 = __esm({
|
|
|
25905
26029
|
if (resumptionToken) headers.set("last-event-id", resumptionToken);
|
|
25906
26030
|
const transportSignal = this._abortController?.signal;
|
|
25907
26031
|
const signal = requestSignal !== void 0 && transportSignal !== void 0 ? anySignal(transportSignal, requestSignal) : requestSignal ?? transportSignal;
|
|
25908
|
-
const response = await (this._fetch ?? fetch)(this._url, {
|
|
26032
|
+
const response = await this._redirects(this._fetch ?? fetch)(this._url, {
|
|
25909
26033
|
...this._requestInit,
|
|
25910
26034
|
method: "GET",
|
|
25911
26035
|
headers,
|
|
@@ -25960,7 +26084,8 @@ var init_dist4 = __esm({
|
|
|
25960
26084
|
options.onRequestStreamEnd?.();
|
|
25961
26085
|
return;
|
|
25962
26086
|
}
|
|
25963
|
-
|
|
26087
|
+
const reason = this._unfollowedRedirect(this._url, response) ?? response.statusText;
|
|
26088
|
+
throw new SdkHttpError(SdkErrorCode.ClientHttpFailedToOpenStream, `Failed to open SSE stream: ${reason}`, {
|
|
25964
26089
|
status: response.status,
|
|
25965
26090
|
statusText: response.statusText
|
|
25966
26091
|
});
|
|
@@ -26149,7 +26274,7 @@ var init_dist4 = __esm({
|
|
|
26149
26274
|
body: JSON.stringify(message),
|
|
26150
26275
|
signal
|
|
26151
26276
|
};
|
|
26152
|
-
const response = await (this._fetch ?? fetch)(this._url, init);
|
|
26277
|
+
const response = await this._redirects(this._fetch ?? fetch)(this._url, init);
|
|
26153
26278
|
if (isHandshake && response.ok) this._sessionId = response.headers.get("mcp-session-id") || void 0;
|
|
26154
26279
|
if (!response.ok) {
|
|
26155
26280
|
if (response.status === 401 && this._authProvider) {
|
|
@@ -26203,7 +26328,8 @@ var init_dist4 = __esm({
|
|
|
26203
26328
|
}
|
|
26204
26329
|
} catch {
|
|
26205
26330
|
}
|
|
26206
|
-
|
|
26331
|
+
const reason = this._unfollowedRedirect(this._url, response) ?? text;
|
|
26332
|
+
throw new SdkHttpError(SdkErrorCode.ClientHttpNotImplemented, `Error POSTing to endpoint: ${reason}`, {
|
|
26207
26333
|
status: response.status,
|
|
26208
26334
|
statusText: response.statusText,
|
|
26209
26335
|
text
|
|
@@ -26263,10 +26389,10 @@ var init_dist4 = __esm({
|
|
|
26263
26389
|
headers,
|
|
26264
26390
|
signal: this._abortController?.signal
|
|
26265
26391
|
};
|
|
26266
|
-
const response = await (this._fetch ?? fetch)(this._url, init);
|
|
26392
|
+
const response = await this._redirects(this._fetch ?? fetch)(this._url, init);
|
|
26267
26393
|
await response.text?.().catch(() => {
|
|
26268
26394
|
});
|
|
26269
|
-
if (!response.ok && response.status !== 405) throw new SdkHttpError(SdkErrorCode.ClientHttpFailedToTerminateSession, `Failed to terminate session: ${response.statusText}`, {
|
|
26395
|
+
if (!response.ok && response.status !== 405) throw new SdkHttpError(SdkErrorCode.ClientHttpFailedToTerminateSession, `Failed to terminate session: ${this._unfollowedRedirect(this._url, response) ?? response.statusText}`, {
|
|
26270
26396
|
status: response.status,
|
|
26271
26397
|
statusText: response.statusText
|
|
26272
26398
|
});
|
|
@@ -29575,7 +29701,7 @@ var init_package = __esm({
|
|
|
29575
29701
|
"package.json"() {
|
|
29576
29702
|
package_default = {
|
|
29577
29703
|
name: "@prefecthq/fastmcp-ts",
|
|
29578
|
-
version: "1.8.
|
|
29704
|
+
version: "1.8.1",
|
|
29579
29705
|
description: "\u{1F3CE}\uFE0F The official FastMCP TypeScript library - build MCP servers and clients, fast \u{1F3CE}\uFE0F",
|
|
29580
29706
|
type: "module",
|
|
29581
29707
|
exports: {
|
|
@@ -29703,11 +29829,11 @@ var init_package = __esm({
|
|
|
29703
29829
|
},
|
|
29704
29830
|
dependencies: {
|
|
29705
29831
|
"@clack/prompts": "^1.2.0",
|
|
29706
|
-
"@modelcontextprotocol/client": "^2.
|
|
29832
|
+
"@modelcontextprotocol/client": "^2.3.1",
|
|
29707
29833
|
"@modelcontextprotocol/core": "^2.0.0",
|
|
29708
29834
|
"@modelcontextprotocol/node": "^2.0.0",
|
|
29709
|
-
"@modelcontextprotocol/server": "^2.
|
|
29710
|
-
"@modelcontextprotocol/server-legacy": "^2.
|
|
29835
|
+
"@modelcontextprotocol/server": "^2.3.1",
|
|
29836
|
+
"@modelcontextprotocol/server-legacy": "^2.3.1",
|
|
29711
29837
|
"@standard-schema/spec": "^1.1.0",
|
|
29712
29838
|
"@types/express": "^5.0.6",
|
|
29713
29839
|
chalk: "^5.6.2",
|
|
@@ -30274,7 +30400,7 @@ var import_node_process4, import_node_stream2, import_cross_spawn, DEFAULT_INHER
|
|
|
30274
30400
|
var init_stdio = __esm({
|
|
30275
30401
|
"node_modules/@modelcontextprotocol/client/dist/stdio.mjs"() {
|
|
30276
30402
|
"use strict";
|
|
30277
|
-
|
|
30403
|
+
init_src_WCy6ifGf();
|
|
30278
30404
|
import_node_process4 = __toESM(require("process"), 1);
|
|
30279
30405
|
import_node_stream2 = require("stream");
|
|
30280
30406
|
import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
@@ -33973,8 +34099,8 @@ var init_inspect = __esm({
|
|
|
33973
34099
|
// only case Python's inspect supports); over --url/--command the
|
|
33974
34100
|
// generation is unknowable from the wire.
|
|
33975
34101
|
generation: mode.kind === "inprocess" ? 2 : null,
|
|
33976
|
-
fastmcpVersion: "1.8.
|
|
33977
|
-
mcpVersion: "2.
|
|
34102
|
+
fastmcpVersion: "1.8.1",
|
|
34103
|
+
mcpVersion: "2.3.1",
|
|
33978
34104
|
tools: tools2,
|
|
33979
34105
|
prompts: prompts2,
|
|
33980
34106
|
resources: resources2,
|
|
@@ -47502,7 +47628,7 @@ init_format();
|
|
|
47502
47628
|
var main = defineCommand({
|
|
47503
47629
|
meta: {
|
|
47504
47630
|
name: "fastmcp",
|
|
47505
|
-
version: "1.8.
|
|
47631
|
+
version: "1.8.1",
|
|
47506
47632
|
description: "FastMCP CLI \u2014 build, run, and manage MCP servers"
|
|
47507
47633
|
},
|
|
47508
47634
|
args: {
|
|
@@ -47527,7 +47653,7 @@ var main = defineCommand({
|
|
|
47527
47653
|
runMain(main);
|
|
47528
47654
|
/*! Bundled license information:
|
|
47529
47655
|
|
|
47530
|
-
@modelcontextprotocol/client/dist/src-
|
|
47656
|
+
@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs:
|
|
47531
47657
|
(*!
|
|
47532
47658
|
* content-type
|
|
47533
47659
|
* Copyright(c) 2015 Douglas Christopher Wilson
|