@prefecthq/fastmcp-ts 1.7.2 → 1.8.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 +300 -140
- package/dist/cli/index.cjs.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/server.d.ts +71 -3
- package/dist/server.js +161 -22
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -1180,7 +1180,7 @@ var init_version = __esm({
|
|
|
1180
1180
|
async run({ args }) {
|
|
1181
1181
|
if (args.json) setJsonMode(true);
|
|
1182
1182
|
const data = {
|
|
1183
|
-
fastmcp: "1.
|
|
1183
|
+
fastmcp: "1.8.0",
|
|
1184
1184
|
"mcp-sdk": "2.0.0",
|
|
1185
1185
|
node: process.version,
|
|
1186
1186
|
platform: `${process.platform} ${process.arch}`
|
|
@@ -8965,10 +8965,10 @@ var init_v4 = __esm({
|
|
|
8965
8965
|
}
|
|
8966
8966
|
});
|
|
8967
8967
|
|
|
8968
|
-
// node_modules/@modelcontextprotocol/core/dist/auth-
|
|
8968
|
+
// node_modules/@modelcontextprotocol/client/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
|
-
var
|
|
8971
|
-
"node_modules/@modelcontextprotocol/core/dist/auth-
|
|
8970
|
+
var init_auth_BNDyLTqp = __esm({
|
|
8971
|
+
"node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/dist/auth-BNDyLTqp.mjs"() {
|
|
8972
8972
|
"use strict";
|
|
8973
8973
|
init_v4();
|
|
8974
8974
|
LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
@@ -9807,7 +9807,8 @@ var init_auth_CUe6YdwF = __esm({
|
|
|
9807
9807
|
introspection_endpoint_auth_signing_alg_values_supported: array(string2()).optional(),
|
|
9808
9808
|
code_challenge_methods_supported: array(string2()).optional(),
|
|
9809
9809
|
client_id_metadata_document_supported: boolean2().optional(),
|
|
9810
|
-
authorization_response_iss_parameter_supported: boolean2().optional().catch(void 0)
|
|
9810
|
+
authorization_response_iss_parameter_supported: boolean2().optional().catch(void 0),
|
|
9811
|
+
dpop_signing_alg_values_supported: array(string2()).optional()
|
|
9811
9812
|
});
|
|
9812
9813
|
OpenIdProviderMetadataSchema = looseObject({
|
|
9813
9814
|
issuer: string2(),
|
|
@@ -9858,7 +9859,8 @@ var init_auth_CUe6YdwF = __esm({
|
|
|
9858
9859
|
token_type: string2(),
|
|
9859
9860
|
expires_in: coerce_exports.number().optional(),
|
|
9860
9861
|
scope: string2().optional(),
|
|
9861
|
-
refresh_token: string2().optional()
|
|
9862
|
+
refresh_token: string2().optional(),
|
|
9863
|
+
issuer: string2().optional().catch(void 0)
|
|
9862
9864
|
}).strip();
|
|
9863
9865
|
IdJagTokenExchangeResponseSchema = object({
|
|
9864
9866
|
issued_token_type: literal("urn:ietf:params:oauth:token-type:id-jag"),
|
|
@@ -9896,7 +9898,8 @@ var init_auth_CUe6YdwF = __esm({
|
|
|
9896
9898
|
client_id: string2(),
|
|
9897
9899
|
client_secret: string2().optional(),
|
|
9898
9900
|
client_id_issued_at: number2().optional(),
|
|
9899
|
-
client_secret_expires_at: number2().optional()
|
|
9901
|
+
client_secret_expires_at: number2().optional(),
|
|
9902
|
+
issuer: string2().optional().catch(void 0)
|
|
9900
9903
|
}).strip();
|
|
9901
9904
|
OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
|
|
9902
9905
|
OAuthClientRegistrationErrorSchema = object({
|
|
@@ -9910,15 +9913,15 @@ var init_auth_CUe6YdwF = __esm({
|
|
|
9910
9913
|
}
|
|
9911
9914
|
});
|
|
9912
9915
|
|
|
9913
|
-
// node_modules/@modelcontextprotocol/core/dist/internal.mjs
|
|
9916
|
+
// node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/dist/internal.mjs
|
|
9914
9917
|
var init_internal = __esm({
|
|
9915
|
-
"node_modules/@modelcontextprotocol/core/dist/internal.mjs"() {
|
|
9918
|
+
"node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/dist/internal.mjs"() {
|
|
9916
9919
|
"use strict";
|
|
9917
|
-
|
|
9920
|
+
init_auth_BNDyLTqp();
|
|
9918
9921
|
}
|
|
9919
9922
|
});
|
|
9920
9923
|
|
|
9921
|
-
// node_modules/@modelcontextprotocol/client/dist/src-
|
|
9924
|
+
// node_modules/@modelcontextprotocol/client/dist/src-xKF0PJN-.mjs
|
|
9922
9925
|
function stampErrorBrands(instance, ctor) {
|
|
9923
9926
|
const brands = /* @__PURE__ */ new Set();
|
|
9924
9927
|
let current = ctor;
|
|
@@ -9949,6 +9952,12 @@ function resourceUrlFromServerUrl(url2) {
|
|
|
9949
9952
|
resourceURL.hash = "";
|
|
9950
9953
|
return resourceURL;
|
|
9951
9954
|
}
|
|
9955
|
+
function withoutIssuer(body) {
|
|
9956
|
+
if (typeof body !== "object" || body === null || Array.isArray(body)) return body;
|
|
9957
|
+
const copy = { ...body };
|
|
9958
|
+
delete copy.issuer;
|
|
9959
|
+
return copy;
|
|
9960
|
+
}
|
|
9952
9961
|
function checkResourceAllowed({ requestedResource, configuredResource }) {
|
|
9953
9962
|
const requested = typeof requestedResource === "string" ? new URL(requestedResource) : new URL(requestedResource.href);
|
|
9954
9963
|
const configured = typeof configuredResource === "string" ? new URL(configuredResource) : new URL(configuredResource.href);
|
|
@@ -10980,7 +10989,7 @@ function getRequestSchema(method) {
|
|
|
10980
10989
|
function getNotificationSchema(method) {
|
|
10981
10990
|
return hasNotificationMethod2025(method) ? registryMaps().notificationSchemas[method] : void 0;
|
|
10982
10991
|
}
|
|
10983
|
-
function isPlainObject$
|
|
10992
|
+
function isPlainObject$5(value) {
|
|
10984
10993
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10985
10994
|
}
|
|
10986
10995
|
function triState$1(schema, raw) {
|
|
@@ -10999,7 +11008,7 @@ function triState$1(schema, raw) {
|
|
|
10999
11008
|
};
|
|
11000
11009
|
}
|
|
11001
11010
|
function toolNeedsLegacyWrap(t2) {
|
|
11002
|
-
return isPlainObject$
|
|
11011
|
+
return isPlainObject$5(t2) && isPlainObject$5(t2["outputSchema"]) && isNonObjectJsonSchemaRoot(t2["outputSchema"]);
|
|
11003
11012
|
}
|
|
11004
11013
|
function toNeutralResult(value) {
|
|
11005
11014
|
return value;
|
|
@@ -11915,7 +11924,7 @@ function fillCacheFields(method, result) {
|
|
|
11915
11924
|
delete filled[RESULT_CACHE_HINT_FALLBACK];
|
|
11916
11925
|
return filled;
|
|
11917
11926
|
}
|
|
11918
|
-
function isPlainObject$
|
|
11927
|
+
function isPlainObject$4(value) {
|
|
11919
11928
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
11920
11929
|
}
|
|
11921
11930
|
function stampServerInfoMeta(result, serverInfo) {
|
|
@@ -11925,7 +11934,7 @@ function stampServerInfoMeta(result, serverInfo) {
|
|
|
11925
11934
|
...result,
|
|
11926
11935
|
_meta: { [SERVER_INFO_META_KEY]: serverInfo }
|
|
11927
11936
|
};
|
|
11928
|
-
if (!isPlainObject$
|
|
11937
|
+
if (!isPlainObject$4(meta3)) return result;
|
|
11929
11938
|
if (meta3[SERVER_INFO_META_KEY] !== void 0) return result;
|
|
11930
11939
|
return {
|
|
11931
11940
|
...result,
|
|
@@ -11999,7 +12008,7 @@ function getResultSchema2026(method) {
|
|
|
11999
12008
|
function getNotificationSchema2026(method) {
|
|
12000
12009
|
return hasNotificationMethod2026(method) ? buildSchemas2026().notificationSchemas2026[method] : void 0;
|
|
12001
12010
|
}
|
|
12002
|
-
function isPlainObject$
|
|
12011
|
+
function isPlainObject$3(value) {
|
|
12003
12012
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
12004
12013
|
}
|
|
12005
12014
|
function triState(schema, raw) {
|
|
@@ -12028,14 +12037,14 @@ function enforceDeletedFields(method, result) {
|
|
|
12028
12037
|
return next;
|
|
12029
12038
|
};
|
|
12030
12039
|
const tools = result.tools;
|
|
12031
|
-
if (method === "tools/list" && Array.isArray(tools) && tools.some((tool) => isPlainObject$
|
|
12032
|
-
if (!isPlainObject$
|
|
12040
|
+
if (method === "tools/list" && Array.isArray(tools) && tools.some((tool) => isPlainObject$3(tool) && "execution" in tool)) copy().tools = tools.map((tool) => {
|
|
12041
|
+
if (!isPlainObject$3(tool) || !("execution" in tool)) return tool;
|
|
12033
12042
|
const rest = { ...tool };
|
|
12034
12043
|
delete rest["execution"];
|
|
12035
12044
|
return rest;
|
|
12036
12045
|
});
|
|
12037
12046
|
const capabilities = result.capabilities;
|
|
12038
|
-
if (isPlainObject$
|
|
12047
|
+
if (isPlainObject$3(capabilities) && "tasks" in capabilities) {
|
|
12039
12048
|
const rest = { ...capabilities };
|
|
12040
12049
|
delete rest["tasks"];
|
|
12041
12050
|
copy().capabilities = rest;
|
|
@@ -12169,6 +12178,18 @@ function buildMcpParamHeaders(declarations, args) {
|
|
|
12169
12178
|
}
|
|
12170
12179
|
return out;
|
|
12171
12180
|
}
|
|
12181
|
+
function mcpNameSource(method, params) {
|
|
12182
|
+
const field = Object.hasOwn(MCP_NAME_HEADER_SOURCE, method) ? MCP_NAME_HEADER_SOURCE[method] : void 0;
|
|
12183
|
+
if (field === void 0) return;
|
|
12184
|
+
const raw = isPlainObject$2(params) ? params[field] : void 0;
|
|
12185
|
+
return {
|
|
12186
|
+
field,
|
|
12187
|
+
value: typeof raw === "string" ? raw : void 0
|
|
12188
|
+
};
|
|
12189
|
+
}
|
|
12190
|
+
function isPlainObject$2(value) {
|
|
12191
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
12192
|
+
}
|
|
12172
12193
|
function parseSchema(schema, data) {
|
|
12173
12194
|
return safeParse2(schema, data);
|
|
12174
12195
|
}
|
|
@@ -12649,7 +12670,8 @@ function manualInputRequiredValue(decoded) {
|
|
|
12649
12670
|
return {
|
|
12650
12671
|
resultType: "input_required",
|
|
12651
12672
|
inputRequests: decoded.inputRequests,
|
|
12652
|
-
...decoded.requestState !== void 0 && { requestState: decoded.requestState }
|
|
12673
|
+
...decoded.requestState !== void 0 && { requestState: decoded.requestState },
|
|
12674
|
+
...decoded._meta !== void 0 && { _meta: decoded._meta }
|
|
12653
12675
|
};
|
|
12654
12676
|
}
|
|
12655
12677
|
function mediaTypeEssence(header) {
|
|
@@ -12687,9 +12709,9 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
12687
12709
|
});
|
|
12688
12710
|
};
|
|
12689
12711
|
}
|
|
12690
|
-
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, 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, InMemoryTransport;
|
|
12691
|
-
var
|
|
12692
|
-
"node_modules/@modelcontextprotocol/client/dist/src-
|
|
12712
|
+
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, InMemoryTransport;
|
|
12713
|
+
var init_src_xKF0PJN = __esm({
|
|
12714
|
+
"node_modules/@modelcontextprotocol/client/dist/src-xKF0PJN-.mjs"() {
|
|
12693
12715
|
"use strict";
|
|
12694
12716
|
init_chunk_Br0eD_fh();
|
|
12695
12717
|
init_dialects_BOhdv1Fc();
|
|
@@ -12715,6 +12737,8 @@ var init_src_D_zzAWoS = __esm({
|
|
|
12715
12737
|
OAuthErrorCode$1["InvalidRedirectUri"] = "invalid_redirect_uri";
|
|
12716
12738
|
OAuthErrorCode$1["InsufficientScope"] = "insufficient_scope";
|
|
12717
12739
|
OAuthErrorCode$1["InvalidTarget"] = "invalid_target";
|
|
12740
|
+
OAuthErrorCode$1["InvalidDpopProof"] = "invalid_dpop_proof";
|
|
12741
|
+
OAuthErrorCode$1["UseDpopNonce"] = "use_dpop_nonce";
|
|
12718
12742
|
return OAuthErrorCode$1;
|
|
12719
12743
|
})({});
|
|
12720
12744
|
OAuthError = class OAuthError2 extends Error {
|
|
@@ -12804,8 +12828,18 @@ var init_src_D_zzAWoS = __esm({
|
|
|
12804
12828
|
if (typeof this !== "function") throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");
|
|
12805
12829
|
return brandedHasInstance(this, value);
|
|
12806
12830
|
}
|
|
12807
|
-
|
|
12808
|
-
|
|
12831
|
+
/**
|
|
12832
|
+
* @param code - Stable string code identifying the failure ({@linkcode SdkErrorCode}).
|
|
12833
|
+
* @param message - Human-readable description.
|
|
12834
|
+
* @param data - Optional structured payload (for example the HTTP status carried by
|
|
12835
|
+
* {@linkcode SdkHttpError}). Opaque to the SDK: a `cause` key inside `data` is not
|
|
12836
|
+
* promoted to `Error.cause`.
|
|
12837
|
+
* @param options - Standard `ErrorOptions`, forwarded to `Error`. Pass the underlying
|
|
12838
|
+
* failure as `{ cause }` so it is reachable through the `Error.cause` chain that
|
|
12839
|
+
* loggers and error trackers walk.
|
|
12840
|
+
*/
|
|
12841
|
+
constructor(code, message, data, options) {
|
|
12842
|
+
super(message, options);
|
|
12809
12843
|
this.code = code;
|
|
12810
12844
|
this.data = data;
|
|
12811
12845
|
this.name = "SdkError";
|
|
@@ -12816,8 +12850,11 @@ var init_src_D_zzAWoS = __esm({
|
|
|
12816
12850
|
static {
|
|
12817
12851
|
Object.defineProperty(this, "mcpBrand", { value: "mcp.SdkHttpError" });
|
|
12818
12852
|
}
|
|
12819
|
-
|
|
12820
|
-
|
|
12853
|
+
/**
|
|
12854
|
+
* @param options - Standard `ErrorOptions`, forwarded to `Error` (see {@linkcode SdkError}).
|
|
12855
|
+
*/
|
|
12856
|
+
constructor(code, message, data, options) {
|
|
12857
|
+
super(code, message, data, options);
|
|
12821
12858
|
this.name = "SdkHttpError";
|
|
12822
12859
|
}
|
|
12823
12860
|
get status() {
|
|
@@ -12936,7 +12973,7 @@ var init_src_D_zzAWoS = __esm({
|
|
|
12936
12973
|
};
|
|
12937
12974
|
},
|
|
12938
12975
|
decodeResult(_method, raw) {
|
|
12939
|
-
if (isPlainObject$
|
|
12976
|
+
if (isPlainObject$5(raw) && "resultType" in raw) {
|
|
12940
12977
|
const stripped = { ...raw };
|
|
12941
12978
|
delete stripped["resultType"];
|
|
12942
12979
|
return {
|
|
@@ -13177,7 +13214,7 @@ var init_src_D_zzAWoS = __esm({
|
|
|
13177
13214
|
projectCallToolResult: (result) => appendTextFallbackForNonObject(result),
|
|
13178
13215
|
inputRequestSchema: getInputRequestSchema2026,
|
|
13179
13216
|
decodeResult(method, raw) {
|
|
13180
|
-
if (!isPlainObject$
|
|
13217
|
+
if (!isPlainObject$3(raw)) return {
|
|
13181
13218
|
kind: "invalid",
|
|
13182
13219
|
error: new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${method}: not an object`, { method })
|
|
13183
13220
|
};
|
|
@@ -13198,8 +13235,10 @@ var init_src_D_zzAWoS = __esm({
|
|
|
13198
13235
|
};
|
|
13199
13236
|
if (rawResultType === "input_required") {
|
|
13200
13237
|
const rawInputRequests = raw["inputRequests"];
|
|
13201
|
-
const inputRequests = isPlainObject$
|
|
13238
|
+
const inputRequests = isPlainObject$3(rawInputRequests) ? rawInputRequests : {};
|
|
13202
13239
|
const requestState = raw["requestState"];
|
|
13240
|
+
const metaParse = raw["_meta"] === void 0 ? void 0 : buildSchemas2026().ResultMetaSchema.safeParse(raw["_meta"]);
|
|
13241
|
+
const meta3 = metaParse?.success ? metaParse.data : void 0;
|
|
13203
13242
|
if (Object.keys(inputRequests).length === 0 && typeof requestState !== "string") return {
|
|
13204
13243
|
kind: "invalid",
|
|
13205
13244
|
error: new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${method}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`, {
|
|
@@ -13210,7 +13249,8 @@ var init_src_D_zzAWoS = __esm({
|
|
|
13210
13249
|
return {
|
|
13211
13250
|
kind: "input_required",
|
|
13212
13251
|
inputRequests,
|
|
13213
|
-
...typeof requestState === "string" && { requestState }
|
|
13252
|
+
...typeof requestState === "string" && { requestState },
|
|
13253
|
+
...meta3 !== void 0 && { _meta: meta3 }
|
|
13214
13254
|
};
|
|
13215
13255
|
}
|
|
13216
13256
|
if (rawResultType !== "complete") return {
|
|
@@ -13520,7 +13560,7 @@ var init_src_D_zzAWoS = __esm({
|
|
|
13520
13560
|
evaluatedAt: "pre-dispatch",
|
|
13521
13561
|
codes: [HEADER_MISMATCH_ERROR_CODE],
|
|
13522
13562
|
conformance: ["http-header-validation"],
|
|
13523
|
-
rationale: "SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."
|
|
13563
|
+
rationale: "SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half \u2014 including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."
|
|
13524
13564
|
},
|
|
13525
13565
|
{
|
|
13526
13566
|
rung: "client-capabilities",
|
|
@@ -13547,6 +13587,14 @@ var init_src_D_zzAWoS = __esm({
|
|
|
13547
13587
|
[ProtocolErrorCode.MissingRequiredClientCapability]: 400,
|
|
13548
13588
|
[HEADER_MISMATCH_ERROR_CODE]: 400
|
|
13549
13589
|
};
|
|
13590
|
+
MCP_NAME_HEADER_SOURCE = {
|
|
13591
|
+
"tools/call": "name",
|
|
13592
|
+
"prompts/get": "name",
|
|
13593
|
+
"resources/read": "uri",
|
|
13594
|
+
"tasks/get": "taskId",
|
|
13595
|
+
"tasks/update": "taskId",
|
|
13596
|
+
"tasks/cancel": "taskId"
|
|
13597
|
+
};
|
|
13550
13598
|
warnedZodFallback = false;
|
|
13551
13599
|
JSON_SCHEMA_CONVERSION_TARGET = "draft-2020-12";
|
|
13552
13600
|
DATETIME_FRACTION_DIGITS = /\\\.\\d\{(\d+)\}/;
|
|
@@ -13938,7 +13986,7 @@ var init_src_D_zzAWoS = __esm({
|
|
|
13938
13986
|
return this._requestHandlers.get(method);
|
|
13939
13987
|
}
|
|
13940
13988
|
async _oncancel(notification) {
|
|
13941
|
-
if (
|
|
13989
|
+
if (notification.params.requestId === void 0) return;
|
|
13942
13990
|
this._requestHandlerAbortControllers.get(notification.params.requestId)?.abort(notification.params.reason);
|
|
13943
13991
|
}
|
|
13944
13992
|
_setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
|
|
@@ -14337,19 +14385,20 @@ var init_src_D_zzAWoS = __esm({
|
|
|
14337
14385
|
const cancel = (reason) => {
|
|
14338
14386
|
if (responseReceived) return;
|
|
14339
14387
|
this._progressHandlers.delete(messageId);
|
|
14340
|
-
if (requestAbort === void 0)
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14388
|
+
if (requestAbort === void 0) {
|
|
14389
|
+
if (request.method !== "initialize") this._transport?.send(this._envelopeOutbound({
|
|
14390
|
+
jsonrpc: "2.0",
|
|
14391
|
+
method: "notifications/cancelled",
|
|
14392
|
+
params: {
|
|
14393
|
+
requestId: messageId,
|
|
14394
|
+
reason: String(reason)
|
|
14395
|
+
}
|
|
14396
|
+
}), {
|
|
14397
|
+
relatedRequestId,
|
|
14398
|
+
resumptionToken,
|
|
14399
|
+
onresumptiontoken
|
|
14400
|
+
}).catch((error2) => this._onerror(/* @__PURE__ */ new Error(`Failed to send cancellation: ${error2}`)));
|
|
14401
|
+
} else requestAbort.abort();
|
|
14353
14402
|
reject(reason instanceof SdkError ? reason : new SdkError(SdkErrorCode.RequestTimeout, String(reason)));
|
|
14354
14403
|
};
|
|
14355
14404
|
this._responseHandlers.set(messageId, (response) => {
|
|
@@ -14411,7 +14460,7 @@ var init_src_D_zzAWoS = __esm({
|
|
|
14411
14460
|
* Emits a notification, which is a one-way message that does not expect a response.
|
|
14412
14461
|
*/
|
|
14413
14462
|
async notification(notification, options) {
|
|
14414
|
-
return this._notificationViaCodec(this._resolveOutboundCodec(notification.method), notification, options);
|
|
14463
|
+
return await this._notificationViaCodec(this._resolveOutboundCodec(notification.method), notification, options);
|
|
14415
14464
|
}
|
|
14416
14465
|
/**
|
|
14417
14466
|
* The notification funnel proper, keyed by the resolved era codec —
|
|
@@ -14429,7 +14478,7 @@ var init_src_D_zzAWoS = __esm({
|
|
|
14429
14478
|
jsonrpc: "2.0",
|
|
14430
14479
|
...notification
|
|
14431
14480
|
});
|
|
14432
|
-
if ((this._options?.debouncedNotificationMethods ?? []).includes(notification.method) && !notification.params &&
|
|
14481
|
+
if ((this._options?.debouncedNotificationMethods ?? []).includes(notification.method) && !notification.params && options?.relatedRequestId === void 0) {
|
|
14433
14482
|
if (this._pendingDebouncedNotifications.has(notification.method)) return;
|
|
14434
14483
|
this._pendingDebouncedNotifications.add(notification.method);
|
|
14435
14484
|
Promise.resolve().then(() => {
|
|
@@ -22216,10 +22265,13 @@ var init_stream = __esm({
|
|
|
22216
22265
|
|
|
22217
22266
|
// node_modules/@modelcontextprotocol/client/dist/index.mjs
|
|
22218
22267
|
function discardIfIssuerMismatch(stored, issuer, opts) {
|
|
22219
|
-
if (stored
|
|
22220
|
-
if (stored.issuer
|
|
22268
|
+
if (!stored) return void 0;
|
|
22269
|
+
if (typeof stored.issuer !== "string") {
|
|
22221
22270
|
if (opts?.canPersistStamp !== false) console.warn("[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field.");
|
|
22222
|
-
return stored
|
|
22271
|
+
return stored.issuer === void 0 ? stored : {
|
|
22272
|
+
...stored,
|
|
22273
|
+
issuer: void 0
|
|
22274
|
+
};
|
|
22223
22275
|
}
|
|
22224
22276
|
return issuersMatch(stored.issuer, issuer) ? stored : void 0;
|
|
22225
22277
|
}
|
|
@@ -22346,7 +22398,7 @@ function applyPublicAuth(clientId, params) {
|
|
|
22346
22398
|
params.set("client_id", clientId);
|
|
22347
22399
|
}
|
|
22348
22400
|
function isLoopbackHost(hostname3) {
|
|
22349
|
-
return hostname3 === "localhost" || hostname3 === "127.0.0.1" || hostname3 === "[::1]" || hostname3 === "::1";
|
|
22401
|
+
return hostname3 === "localhost" || hostname3.endsWith(".localhost") || hostname3 === "127.0.0.1" || hostname3 === "[::1]" || hostname3 === "::1";
|
|
22350
22402
|
}
|
|
22351
22403
|
function assertSecureTokenEndpoint(tokenEndpoint) {
|
|
22352
22404
|
const url2 = new URL(String(tokenEndpoint));
|
|
@@ -22385,16 +22437,22 @@ async function parseErrorResponse(input) {
|
|
|
22385
22437
|
return new OAuthError(OAuthErrorCode.ServerError, errorMessage);
|
|
22386
22438
|
}
|
|
22387
22439
|
}
|
|
22440
|
+
function warnCredentialInvalidation(provider, error2, invalidated) {
|
|
22441
|
+
const action = provider.invalidateCredentials === void 0 ? `retrying authorization without discarding the stored ${invalidated} (provider implements no invalidateCredentials())` : `invalidating the stored ${invalidated} and retrying authorization`;
|
|
22442
|
+
console.warn(`[mcp-sdk] OAuth ${JSON.stringify(error2.code)} \u2014 ${action}. Cause: ${JSON.stringify(error2.message)}`);
|
|
22443
|
+
}
|
|
22388
22444
|
async function auth(provider, options) {
|
|
22389
22445
|
try {
|
|
22390
22446
|
return await authInternal(provider, options);
|
|
22391
22447
|
} catch (error2) {
|
|
22392
22448
|
if (error2 instanceof OAuthError) {
|
|
22393
22449
|
if (error2.code === OAuthErrorCode.InvalidClient || error2.code === OAuthErrorCode.UnauthorizedClient) {
|
|
22450
|
+
warnCredentialInvalidation(provider, error2, "client credentials and tokens");
|
|
22394
22451
|
await provider.invalidateCredentials?.("client");
|
|
22395
22452
|
await provider.invalidateCredentials?.("tokens");
|
|
22396
22453
|
return await authInternal(provider, options);
|
|
22397
|
-
} else if (error2.code === OAuthErrorCode.InvalidGrant) {
|
|
22454
|
+
} else if (error2.code === OAuthErrorCode.InvalidGrant || error2.code === OAuthErrorCode.InvalidDpopProof) {
|
|
22455
|
+
warnCredentialInvalidation(provider, error2, "tokens");
|
|
22398
22456
|
await provider.invalidateCredentials?.("tokens");
|
|
22399
22457
|
return await authInternal(provider, options);
|
|
22400
22458
|
}
|
|
@@ -22462,8 +22520,9 @@ async function authInternal(provider, { serverUrl, authorizationCode, iss, scope
|
|
|
22462
22520
|
} else if (!issuersMatch(recordedIssuer, issuer)) throw new AuthorizationServerMismatchError(recordedIssuer, issuer);
|
|
22463
22521
|
}
|
|
22464
22522
|
if (freshDiscoveryState) await provider.saveDiscoveryState?.(freshDiscoveryState);
|
|
22465
|
-
const
|
|
22466
|
-
|
|
22523
|
+
const selectedResource = await selectResourceURL(serverUrl, provider, resourceMetadata);
|
|
22524
|
+
const resource = selectedResource && resourceMetadata && !provider.validateResourceURL ? resourceMetadata.resource : selectedResource;
|
|
22525
|
+
if (resource) await provider.saveResourceUrl?.(resourceIndicatorToString(resource));
|
|
22467
22526
|
const resolvedScope = determineScope({
|
|
22468
22527
|
requestedScope: scope,
|
|
22469
22528
|
resourceMetadata,
|
|
@@ -22534,24 +22593,30 @@ async function authInternal(provider, { serverUrl, authorizationCode, iss, scope
|
|
|
22534
22593
|
};
|
|
22535
22594
|
await provider.saveTokens(tokens, infoCtx);
|
|
22536
22595
|
}
|
|
22537
|
-
if (tokens?.refresh_token && !forceReauthorization)
|
|
22538
|
-
|
|
22539
|
-
|
|
22540
|
-
|
|
22541
|
-
|
|
22542
|
-
|
|
22543
|
-
|
|
22544
|
-
|
|
22545
|
-
|
|
22546
|
-
|
|
22547
|
-
|
|
22548
|
-
|
|
22549
|
-
}
|
|
22550
|
-
|
|
22551
|
-
|
|
22552
|
-
|
|
22553
|
-
|
|
22554
|
-
|
|
22596
|
+
if (tokens?.refresh_token && !forceReauthorization) {
|
|
22597
|
+
let newTokens;
|
|
22598
|
+
try {
|
|
22599
|
+
newTokens = await refreshAuthorization(authorizationServerUrl, {
|
|
22600
|
+
metadata,
|
|
22601
|
+
clientInformation,
|
|
22602
|
+
refreshToken: tokens.refresh_token,
|
|
22603
|
+
resource,
|
|
22604
|
+
addClientAuthentication: provider.addClientAuthentication,
|
|
22605
|
+
dpop: await provider.dpop?.(),
|
|
22606
|
+
fetchFn
|
|
22607
|
+
});
|
|
22608
|
+
} catch (error2) {
|
|
22609
|
+
if (error2 instanceof InsecureTokenEndpointError) throw error2;
|
|
22610
|
+
if (!(error2 instanceof OAuthError) || error2.code === OAuthErrorCode.ServerError) console.warn(`[mcp-sdk] Could not refresh OAuth tokens; falling back to a new authorization request. Cause: ${JSON.stringify(error2 instanceof Error ? error2.message : String(error2))}`);
|
|
22611
|
+
else throw error2;
|
|
22612
|
+
}
|
|
22613
|
+
if (newTokens) {
|
|
22614
|
+
await provider.saveTokens({
|
|
22615
|
+
...newTokens,
|
|
22616
|
+
issuer
|
|
22617
|
+
}, infoCtx);
|
|
22618
|
+
return "AUTHORIZED";
|
|
22619
|
+
}
|
|
22555
22620
|
}
|
|
22556
22621
|
const state = provider.state ? await provider.state() : void 0;
|
|
22557
22622
|
const { authorizationUrl, codeVerifier } = await startAuthorization(authorizationServerUrl, {
|
|
@@ -22592,7 +22657,7 @@ function extractWWWAuthenticateParams(res) {
|
|
|
22592
22657
|
const authenticateHeader = res.headers.get("WWW-Authenticate");
|
|
22593
22658
|
if (!authenticateHeader) return {};
|
|
22594
22659
|
const [type, scheme] = authenticateHeader.split(" ");
|
|
22595
|
-
if (type
|
|
22660
|
+
if (!type || !RECOGNIZED_CHALLENGE_SCHEMES.has(type.toLowerCase()) || !scheme) return {};
|
|
22596
22661
|
const resourceMetadataMatch = extractFieldFromWwwAuth(res, "resource_metadata") || void 0;
|
|
22597
22662
|
let resourceMetadataUrl;
|
|
22598
22663
|
if (resourceMetadataMatch) try {
|
|
@@ -22749,6 +22814,9 @@ async function discoverOAuthServerInfo(serverUrl, opts) {
|
|
|
22749
22814
|
resourceMetadata
|
|
22750
22815
|
};
|
|
22751
22816
|
}
|
|
22817
|
+
function resourceIndicatorToString(resource) {
|
|
22818
|
+
return typeof resource === "string" ? resource : resource.href;
|
|
22819
|
+
}
|
|
22752
22820
|
async function startAuthorization(authorizationServerUrl, { metadata, clientInformation, redirectUrl, scope, state, resource }) {
|
|
22753
22821
|
let authorizationUrl;
|
|
22754
22822
|
if (metadata) {
|
|
@@ -22767,7 +22835,7 @@ async function startAuthorization(authorizationServerUrl, { metadata, clientInfo
|
|
|
22767
22835
|
if (state) authorizationUrl.searchParams.set("state", state);
|
|
22768
22836
|
if (scope) authorizationUrl.searchParams.set("scope", scope);
|
|
22769
22837
|
if (scope?.split(" ").includes("offline_access")) authorizationUrl.searchParams.append("prompt", "consent");
|
|
22770
|
-
if (resource) authorizationUrl.searchParams.set("resource", resource
|
|
22838
|
+
if (resource) authorizationUrl.searchParams.set("resource", resourceIndicatorToString(resource));
|
|
22771
22839
|
return {
|
|
22772
22840
|
authorizationUrl,
|
|
22773
22841
|
codeVerifier
|
|
@@ -22781,30 +22849,46 @@ function prepareAuthorizationCodeRequest(authorizationCode, codeVerifier, redire
|
|
|
22781
22849
|
redirect_uri: String(redirectUri)
|
|
22782
22850
|
});
|
|
22783
22851
|
}
|
|
22784
|
-
async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequestParams, clientInformation, addClientAuthentication, resource, fetchFn }) {
|
|
22852
|
+
async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequestParams, clientInformation, addClientAuthentication, resource, dpop, fetchFn }) {
|
|
22785
22853
|
const tokenUrl = assertSecureTokenEndpoint(metadata?.token_endpoint ?? new URL("/token", authorizationServerUrl));
|
|
22786
22854
|
const headers = new Headers({
|
|
22787
22855
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
22788
22856
|
Accept: "application/json"
|
|
22789
22857
|
});
|
|
22790
|
-
if (resource) tokenRequestParams.set("resource", resource
|
|
22791
|
-
if (addClientAuthentication)
|
|
22792
|
-
|
|
22793
|
-
|
|
22794
|
-
|
|
22795
|
-
|
|
22796
|
-
|
|
22797
|
-
|
|
22858
|
+
if (resource) tokenRequestParams.set("resource", resourceIndicatorToString(resource));
|
|
22859
|
+
if (!addClientAuthentication && clientInformation) applyClientAuthentication(selectClientAuthMethod(clientInformation, metadata?.token_endpoint_auth_methods_supported ?? []), clientInformation, headers, tokenRequestParams);
|
|
22860
|
+
const requestOnce = async () => {
|
|
22861
|
+
const requestHeaders = new Headers(headers);
|
|
22862
|
+
if (addClientAuthentication) await addClientAuthentication(requestHeaders, tokenRequestParams, tokenUrl, metadata);
|
|
22863
|
+
if (dpop) requestHeaders.set("DPoP", await dpop.buildProof({
|
|
22864
|
+
htm: "POST",
|
|
22865
|
+
htu: tokenUrl
|
|
22866
|
+
}));
|
|
22867
|
+
return (fetchFn ?? fetch)(tokenUrl, {
|
|
22868
|
+
method: "POST",
|
|
22869
|
+
headers: requestHeaders,
|
|
22870
|
+
body: tokenRequestParams
|
|
22871
|
+
});
|
|
22872
|
+
};
|
|
22873
|
+
let response = await requestOnce();
|
|
22874
|
+
if (dpop && response.status === 400) {
|
|
22875
|
+
if ((await response.clone().json().catch(() => {
|
|
22876
|
+
}))?.error === OAuthErrorCode.UseDpopNonce) {
|
|
22877
|
+
dpop.observeNonce(response, tokenUrl);
|
|
22878
|
+
response = await requestOnce();
|
|
22879
|
+
}
|
|
22880
|
+
}
|
|
22881
|
+
dpop?.observeNonce(response, tokenUrl);
|
|
22798
22882
|
if (!response.ok) throw await parseErrorResponse(response);
|
|
22799
22883
|
const json2 = await response.json();
|
|
22800
22884
|
try {
|
|
22801
|
-
return OAuthTokensSchema.parse(json2);
|
|
22885
|
+
return OAuthTokensSchema.parse(withoutIssuer(json2));
|
|
22802
22886
|
} catch (parseError) {
|
|
22803
22887
|
if (typeof json2 === "object" && json2 !== null && "error" in json2) throw await parseErrorResponse(JSON.stringify(json2));
|
|
22804
22888
|
throw parseError;
|
|
22805
22889
|
}
|
|
22806
22890
|
}
|
|
22807
|
-
async function refreshAuthorization(authorizationServerUrl, { metadata, clientInformation, refreshToken, resource, addClientAuthentication, fetchFn }) {
|
|
22891
|
+
async function refreshAuthorization(authorizationServerUrl, { metadata, clientInformation, refreshToken, resource, addClientAuthentication, dpop, fetchFn }) {
|
|
22808
22892
|
return {
|
|
22809
22893
|
refresh_token: refreshToken,
|
|
22810
22894
|
...await executeTokenRequest(authorizationServerUrl, {
|
|
@@ -22816,6 +22900,7 @@ async function refreshAuthorization(authorizationServerUrl, { metadata, clientIn
|
|
|
22816
22900
|
clientInformation,
|
|
22817
22901
|
addClientAuthentication,
|
|
22818
22902
|
resource,
|
|
22903
|
+
dpop,
|
|
22819
22904
|
fetchFn
|
|
22820
22905
|
})
|
|
22821
22906
|
};
|
|
@@ -22826,6 +22911,14 @@ async function fetchToken(provider, authorizationServerUrl, { metadata, resource
|
|
|
22826
22911
|
expectedIssuer: metadata?.issuer,
|
|
22827
22912
|
issParameterSupported: isIssParameterSupported(metadata)
|
|
22828
22913
|
});
|
|
22914
|
+
const issuer = metadata?.issuer ?? String(authorizationServerUrl);
|
|
22915
|
+
const readClientInformation = async () => {
|
|
22916
|
+
const rawClientInfo = await provider.clientInformation({ issuer });
|
|
22917
|
+
const checked = discardIfIssuerMismatch(rawClientInfo, issuer, { canPersistStamp: false });
|
|
22918
|
+
if (rawClientInfo && checked === void 0) throw new AuthorizationServerMismatchError(String(rawClientInfo.issuer), issuer);
|
|
22919
|
+
return checked;
|
|
22920
|
+
};
|
|
22921
|
+
let clientInformation = await readClientInformation();
|
|
22829
22922
|
const effectiveScope = scope ?? provider.clientMetadata.scope;
|
|
22830
22923
|
let tokenRequestParams;
|
|
22831
22924
|
if (provider.prepareTokenRequest) tokenRequestParams = await provider.prepareTokenRequest(effectiveScope);
|
|
@@ -22834,13 +22927,14 @@ async function fetchToken(provider, authorizationServerUrl, { metadata, resource
|
|
|
22834
22927
|
if (!provider.redirectUrl) throw new Error("redirectUrl is required for authorization_code flow");
|
|
22835
22928
|
tokenRequestParams = prepareAuthorizationCodeRequest(authorizationCode, await provider.codeVerifier(), provider.redirectUrl);
|
|
22836
22929
|
}
|
|
22837
|
-
|
|
22930
|
+
clientInformation ??= await readClientInformation();
|
|
22838
22931
|
return executeTokenRequest(authorizationServerUrl, {
|
|
22839
22932
|
metadata,
|
|
22840
22933
|
tokenRequestParams,
|
|
22841
|
-
clientInformation
|
|
22934
|
+
clientInformation,
|
|
22842
22935
|
addClientAuthentication: provider.addClientAuthentication,
|
|
22843
22936
|
resource,
|
|
22937
|
+
dpop: await provider.dpop?.(),
|
|
22844
22938
|
fetchFn
|
|
22845
22939
|
});
|
|
22846
22940
|
}
|
|
@@ -22864,7 +22958,7 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
|
|
|
22864
22958
|
body: await response.text(),
|
|
22865
22959
|
submittedMetadata
|
|
22866
22960
|
});
|
|
22867
|
-
return OAuthClientInformationFullSchema.parse(await response.json());
|
|
22961
|
+
return OAuthClientInformationFullSchema.parse(withoutIssuer(await response.json()));
|
|
22868
22962
|
}
|
|
22869
22963
|
function keyOf(key) {
|
|
22870
22964
|
return `${key.method}\0${JSON.stringify([key.partition ?? "", key.params ?? ""])}`;
|
|
@@ -22996,7 +23090,7 @@ function classifyNetworkError(error2, context) {
|
|
|
22996
23090
|
if (context.environment === "browser" && isOpaqueFetchTypeError(error2)) return { kind: "legacy" };
|
|
22997
23091
|
return {
|
|
22998
23092
|
kind: "error",
|
|
22999
|
-
error: new SdkError(SdkErrorCode.EraNegotiationFailed, `Version negotiation probe failed: ${describeError(error2)}`, { cause: error2 })
|
|
23093
|
+
error: new SdkError(SdkErrorCode.EraNegotiationFailed, `Version negotiation probe failed: ${describeError(error2)}`, { cause: error2 }, { cause: error2 })
|
|
23000
23094
|
};
|
|
23001
23095
|
}
|
|
23002
23096
|
function isOpaqueFetchTypeError(error2) {
|
|
@@ -23268,6 +23362,14 @@ function validatePrior(prior) {
|
|
|
23268
23362
|
}
|
|
23269
23363
|
throw new SdkError(SdkErrorCode.EraNegotiationFailed, "connect({ prior }): unrecognized prior \u2014 expected { kind: 'modern', discover } or { kind: 'legacy' }");
|
|
23270
23364
|
}
|
|
23365
|
+
function hasDpopChallenge(wwwAuthenticate) {
|
|
23366
|
+
return /(?:^|,)\s*dpop(?:\s|$|,)/i.test(wwwAuthenticate);
|
|
23367
|
+
}
|
|
23368
|
+
function isDpopNonceChallenge(response) {
|
|
23369
|
+
if (response.status !== 401) return false;
|
|
23370
|
+
const wwwAuthenticate = response.headers.get("www-authenticate") ?? "";
|
|
23371
|
+
return hasDpopChallenge(wwwAuthenticate) && /use_dpop_nonce/i.test(wwwAuthenticate);
|
|
23372
|
+
}
|
|
23271
23373
|
function anySignal(a2, b) {
|
|
23272
23374
|
if (typeof AbortSignal.any === "function") return AbortSignal.any([a2, b]);
|
|
23273
23375
|
const controller = new AbortController();
|
|
@@ -23289,11 +23391,11 @@ function anySignal(a2, b) {
|
|
|
23289
23391
|
b.addEventListener("abort", onB, { once: true });
|
|
23290
23392
|
return controller.signal;
|
|
23291
23393
|
}
|
|
23292
|
-
var OAuthClientFlowError, IssuerMismatchError, RegistrationRejectedError, InsecureTokenEndpointError, AuthorizationServerMismatchError, InsufficientScopeError, UnauthorizedError, AUTHORIZATION_CODE_RESPONSE_TYPE, AUTHORIZATION_CODE_CHALLENGE_METHOD, CAP_EXEMPT_METHODS, InMemoryResponseCacheStore, MAX_CACHE_TTL_MS, ClientResponseCache, AUTH_SEAM, UNSUPPORTED_PROTOCOL_VERSION, NOT_PROBE_RECOGNIZED, DEFAULT_VERSION_NEGOTIATION_MODE, ProbeWindow, pendingSpentCloseGuards, LIST_CHANGED_EVICTIONS, DEFAULT_LIST_MAX_PAGES, Client, SseError, SSEClientTransport, DEFAULT_MAX_STEP_UP_RETRIES, DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS, RESERVED_REQUEST_HEADER_NAMES, StreamableHTTPClientTransport;
|
|
23394
|
+
var OAuthClientFlowError, IssuerMismatchError, RegistrationRejectedError, InsecureTokenEndpointError, AuthorizationServerMismatchError, InsufficientScopeError, UnauthorizedError, AUTHORIZATION_CODE_RESPONSE_TYPE, AUTHORIZATION_CODE_CHALLENGE_METHOD, RECOGNIZED_CHALLENGE_SCHEMES, CAP_EXEMPT_METHODS, InMemoryResponseCacheStore, MAX_CACHE_TTL_MS, ClientResponseCache, AUTH_SEAM, UNSUPPORTED_PROTOCOL_VERSION, NOT_PROBE_RECOGNIZED, DEFAULT_VERSION_NEGOTIATION_MODE, ProbeWindow, pendingSpentCloseGuards, LIST_CHANGED_EVICTIONS, DEFAULT_LIST_MAX_PAGES, Client, withDpop, withDpopFromProvider, SseError, SSEClientTransport, DEFAULT_MAX_STEP_UP_RETRIES, DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS, RESERVED_REQUEST_HEADER_NAMES, StreamableHTTPClientTransport;
|
|
23293
23395
|
var init_dist4 = __esm({
|
|
23294
23396
|
"node_modules/@modelcontextprotocol/client/dist/index.mjs"() {
|
|
23295
23397
|
"use strict";
|
|
23296
|
-
|
|
23398
|
+
init_src_xKF0PJN();
|
|
23297
23399
|
init_shimsNode();
|
|
23298
23400
|
init_index_node();
|
|
23299
23401
|
init_dist3();
|
|
@@ -23365,7 +23467,7 @@ var init_dist4 = __esm({
|
|
|
23365
23467
|
/** The token endpoint URL that was rejected. */
|
|
23366
23468
|
tokenEndpoint;
|
|
23367
23469
|
constructor(tokenEndpoint) {
|
|
23368
|
-
super(`Refusing to send credentials to non-https token endpoint '${tokenEndpoint}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`);
|
|
23470
|
+
super(`Refusing to send credentials to non-https token endpoint '${tokenEndpoint}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`);
|
|
23369
23471
|
this.tokenEndpoint = tokenEndpoint;
|
|
23370
23472
|
}
|
|
23371
23473
|
};
|
|
@@ -23374,7 +23476,7 @@ var init_dist4 = __esm({
|
|
|
23374
23476
|
Object.defineProperty(this, "mcpBrand", { value: "mcp.AuthorizationServerMismatchError" });
|
|
23375
23477
|
}
|
|
23376
23478
|
constructor(recordedIssuer, currentIssuer) {
|
|
23377
|
-
super(`Authorization server
|
|
23479
|
+
super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(recordedIssuer)} but this call resolved ${JSON.stringify(currentIssuer)}; refusing to present them to a different authorization server`);
|
|
23378
23480
|
this.recordedIssuer = recordedIssuer;
|
|
23379
23481
|
this.currentIssuer = currentIssuer;
|
|
23380
23482
|
}
|
|
@@ -23424,6 +23526,7 @@ var init_dist4 = __esm({
|
|
|
23424
23526
|
};
|
|
23425
23527
|
AUTHORIZATION_CODE_RESPONSE_TYPE = "code";
|
|
23426
23528
|
AUTHORIZATION_CODE_CHALLENGE_METHOD = "S256";
|
|
23529
|
+
RECOGNIZED_CHALLENGE_SCHEMES = /* @__PURE__ */ new Set(["bearer", "dpop"]);
|
|
23427
23530
|
CAP_EXEMPT_METHODS = /* @__PURE__ */ new Set([
|
|
23428
23531
|
"tools/list",
|
|
23429
23532
|
"prompts/list",
|
|
@@ -24640,7 +24743,7 @@ var init_dist4 = __esm({
|
|
|
24640
24743
|
}, options);
|
|
24641
24744
|
const hit = await this._serveFromCache("prompts/list", void 0, options);
|
|
24642
24745
|
if (hit !== void 0) return hit;
|
|
24643
|
-
return this._listAllPages("prompts/list", params, options, (
|
|
24746
|
+
return this._listAllPages("prompts/list", params, options, (r2) => r2.prompts);
|
|
24644
24747
|
}
|
|
24645
24748
|
/**
|
|
24646
24749
|
* Lists available resources.
|
|
@@ -24679,7 +24782,7 @@ var init_dist4 = __esm({
|
|
|
24679
24782
|
}, options);
|
|
24680
24783
|
const hit = await this._serveFromCache("resources/list", void 0, options);
|
|
24681
24784
|
if (hit !== void 0) return hit;
|
|
24682
|
-
return this._listAllPages("resources/list", params, options, (
|
|
24785
|
+
return this._listAllPages("resources/list", params, options, (r2) => r2.resources);
|
|
24683
24786
|
}
|
|
24684
24787
|
/**
|
|
24685
24788
|
* Lists available resource URI templates for dynamic resources.
|
|
@@ -24704,7 +24807,7 @@ var init_dist4 = __esm({
|
|
|
24704
24807
|
}, options);
|
|
24705
24808
|
const hit = await this._serveFromCache("resources/templates/list", void 0, options);
|
|
24706
24809
|
if (hit !== void 0) return hit;
|
|
24707
|
-
return this._listAllPages("resources/templates/list", params, options, (
|
|
24810
|
+
return this._listAllPages("resources/templates/list", params, options, (r2) => r2.resourceTemplates);
|
|
24708
24811
|
}
|
|
24709
24812
|
/**
|
|
24710
24813
|
* Walk every page of a paginated list verb, aggregate, and write ONE
|
|
@@ -24712,8 +24815,7 @@ var init_dist4 = __esm({
|
|
|
24712
24815
|
* methods' no-`cursor` auto-aggregate path. Page 1's result object is
|
|
24713
24816
|
* mutated in place (its items array is extended; `nextCursor` is
|
|
24714
24817
|
* cleared); page-1 metadata (`ttlMs`, `cacheScope`, `_meta`) is preserved.
|
|
24715
|
-
* A `nextCursor`
|
|
24716
|
-
* non-converging server, mcp.d's `drainList` guard);
|
|
24818
|
+
* A page with the same items and `nextCursor` as the previous page ends the walk;
|
|
24717
24819
|
* {@linkcode ClientOptions.listMaxPages} is a hard cap — hitting it
|
|
24718
24820
|
* throws, so a partial aggregate is never cached. The
|
|
24719
24821
|
* captured-generation guard skips the write when a `list_changed` landed
|
|
@@ -24728,7 +24830,7 @@ var init_dist4 = __esm({
|
|
|
24728
24830
|
* trace context) supplied to the public `list*()` reaches every wire
|
|
24729
24831
|
* request the walk issues.
|
|
24730
24832
|
*/
|
|
24731
|
-
async _listAllPages(method, baseParams, options,
|
|
24833
|
+
async _listAllPages(method, baseParams, options, items, finalize2) {
|
|
24732
24834
|
const bypass = options?.cacheMode === "bypass";
|
|
24733
24835
|
const generation = this._cache.captureGeneration(method);
|
|
24734
24836
|
const acc = await this.request({
|
|
@@ -24736,14 +24838,13 @@ var init_dist4 = __esm({
|
|
|
24736
24838
|
...baseParams && { params: { ...baseParams } }
|
|
24737
24839
|
}, options);
|
|
24738
24840
|
let cursor3 = acc.nextCursor;
|
|
24739
|
-
|
|
24841
|
+
let previous = acc;
|
|
24740
24842
|
let pages = 1;
|
|
24741
|
-
while (cursor3 !== void 0
|
|
24843
|
+
while (cursor3 !== void 0) {
|
|
24742
24844
|
if (this._listMaxPages !== 0 && pages >= this._listMaxPages) throw new SdkError(SdkErrorCode.ListPaginationExceeded, `${method}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`, {
|
|
24743
24845
|
method,
|
|
24744
24846
|
listMaxPages: this._listMaxPages
|
|
24745
24847
|
});
|
|
24746
|
-
seen.add(cursor3);
|
|
24747
24848
|
const page = await this.request({
|
|
24748
24849
|
method,
|
|
24749
24850
|
params: {
|
|
@@ -24751,7 +24852,9 @@ var init_dist4 = __esm({
|
|
|
24751
24852
|
cursor: cursor3
|
|
24752
24853
|
}
|
|
24753
24854
|
}, options);
|
|
24754
|
-
|
|
24855
|
+
if (page.nextCursor === cursor3 && JSON.stringify(items(page)) === JSON.stringify(items(previous))) break;
|
|
24856
|
+
items(acc).push(...items(page));
|
|
24857
|
+
previous = page;
|
|
24755
24858
|
cursor3 = page.nextCursor;
|
|
24756
24859
|
pages++;
|
|
24757
24860
|
}
|
|
@@ -25015,19 +25118,22 @@ var init_dist4 = __esm({
|
|
|
25015
25118
|
notifications: filter
|
|
25016
25119
|
}
|
|
25017
25120
|
};
|
|
25121
|
+
const routeSendFailure = (error2) => {
|
|
25122
|
+
settle({
|
|
25123
|
+
cause: "remote",
|
|
25124
|
+
error: error2 instanceof Error ? error2 : new Error(String(error2))
|
|
25125
|
+
});
|
|
25126
|
+
};
|
|
25018
25127
|
try {
|
|
25019
|
-
|
|
25128
|
+
this.transport.send(jsonrpcRequest, {
|
|
25020
25129
|
requestSignal: requestAbort.signal,
|
|
25021
25130
|
onRequestStreamEnd: () => settle({
|
|
25022
25131
|
cause: "remote",
|
|
25023
25132
|
error: /* @__PURE__ */ new Error("subscriptions/listen: stream ended")
|
|
25024
25133
|
})
|
|
25025
|
-
});
|
|
25134
|
+
}).catch(routeSendFailure);
|
|
25026
25135
|
} catch (error2) {
|
|
25027
|
-
|
|
25028
|
-
cause: "remote",
|
|
25029
|
-
error: error2 instanceof Error ? error2 : new Error(String(error2))
|
|
25030
|
-
});
|
|
25136
|
+
routeSendFailure(error2);
|
|
25031
25137
|
}
|
|
25032
25138
|
return {
|
|
25033
25139
|
honoredFilter: await opening,
|
|
@@ -25279,7 +25385,7 @@ var init_dist4 = __esm({
|
|
|
25279
25385
|
}
|
|
25280
25386
|
const hit = await this._serveFromCache("tools/list", void 0, options);
|
|
25281
25387
|
if (hit !== void 0) return hit;
|
|
25282
|
-
return this._listAllPages("tools/list", params, options, (
|
|
25388
|
+
return this._listAllPages("tools/list", params, options, (r2) => r2.tools, (acc) => this._excludeInvalidXMcpHeaderTools(acc));
|
|
25283
25389
|
}
|
|
25284
25390
|
/**
|
|
25285
25391
|
* SEP-2243 (protocol revision 2026-07-28): a Streamable HTTP client MUST
|
|
@@ -25350,6 +25456,55 @@ var init_dist4 = __esm({
|
|
|
25350
25456
|
return this.notification({ method: "notifications/roots/list_changed" });
|
|
25351
25457
|
}
|
|
25352
25458
|
};
|
|
25459
|
+
withDpop = (session, getToken) => (next) => {
|
|
25460
|
+
const resolveSession = typeof session === "function" ? session : () => session;
|
|
25461
|
+
return async (input, init) => {
|
|
25462
|
+
const method = (init?.method ?? "GET").toUpperCase();
|
|
25463
|
+
const url2 = new URL(input.toString());
|
|
25464
|
+
const activeSession = await resolveSession();
|
|
25465
|
+
if (!activeSession) return next(input, init);
|
|
25466
|
+
const makeRequest = async () => {
|
|
25467
|
+
const accessToken = await getToken();
|
|
25468
|
+
if (!accessToken) return next(input, init);
|
|
25469
|
+
const headers = new Headers(init?.headers);
|
|
25470
|
+
const proof = await activeSession.buildProof({
|
|
25471
|
+
htm: method,
|
|
25472
|
+
htu: url2,
|
|
25473
|
+
accessToken
|
|
25474
|
+
});
|
|
25475
|
+
headers.set("Authorization", `DPoP ${accessToken}`);
|
|
25476
|
+
headers.set("DPoP", proof);
|
|
25477
|
+
return next(input, {
|
|
25478
|
+
...init,
|
|
25479
|
+
headers
|
|
25480
|
+
});
|
|
25481
|
+
};
|
|
25482
|
+
let response = await makeRequest();
|
|
25483
|
+
if (isDpopNonceChallenge(response) && response.headers.has("dpop-nonce")) {
|
|
25484
|
+
activeSession.observeNonce(response, url2);
|
|
25485
|
+
await response.text?.().catch(() => {
|
|
25486
|
+
});
|
|
25487
|
+
response = await makeRequest();
|
|
25488
|
+
}
|
|
25489
|
+
activeSession.observeNonce(response, url2);
|
|
25490
|
+
return response;
|
|
25491
|
+
};
|
|
25492
|
+
};
|
|
25493
|
+
withDpopFromProvider = (provider) => withDpop(async () => {
|
|
25494
|
+
try {
|
|
25495
|
+
return await provider.dpop?.();
|
|
25496
|
+
} catch (error2) {
|
|
25497
|
+
throw markAuthSeamEscape(error2);
|
|
25498
|
+
}
|
|
25499
|
+
}, async () => {
|
|
25500
|
+
let tokens;
|
|
25501
|
+
try {
|
|
25502
|
+
tokens = await provider.tokens();
|
|
25503
|
+
} catch (error2) {
|
|
25504
|
+
throw markAuthSeamEscape(error2);
|
|
25505
|
+
}
|
|
25506
|
+
return tokens?.token_type?.toLowerCase() === "dpop" ? tokens.access_token : void 0;
|
|
25507
|
+
});
|
|
25353
25508
|
SseError = class extends Error {
|
|
25354
25509
|
static {
|
|
25355
25510
|
Object.defineProperty(this, "mcpBrand", { value: "mcp.SseError" });
|
|
@@ -25391,6 +25546,7 @@ var init_dist4 = __esm({
|
|
|
25391
25546
|
_skipIssuerMetadataValidation;
|
|
25392
25547
|
_fetch;
|
|
25393
25548
|
_fetchWithInit;
|
|
25549
|
+
_dpop;
|
|
25394
25550
|
_protocolVersion;
|
|
25395
25551
|
onclose;
|
|
25396
25552
|
onerror;
|
|
@@ -25402,32 +25558,33 @@ var init_dist4 = __esm({
|
|
|
25402
25558
|
this._eventSourceInit = opts?.eventSourceInit;
|
|
25403
25559
|
this._requestInit = opts?.requestInit;
|
|
25404
25560
|
this._skipIssuerMetadataValidation = opts?.skipIssuerMetadataValidation;
|
|
25561
|
+
this._fetch = opts?.fetch;
|
|
25405
25562
|
if (isOAuthClientProvider(opts?.authProvider)) {
|
|
25406
25563
|
this._oauthProvider = opts.authProvider;
|
|
25407
25564
|
this._authProvider = adaptOAuthProvider(opts.authProvider, { skipIssuerMetadataValidation: opts.skipIssuerMetadataValidation });
|
|
25565
|
+
if (opts.authProvider.dpop) {
|
|
25566
|
+
this._dpop = withDpopFromProvider(opts.authProvider);
|
|
25567
|
+
this._fetch = this._dpop(opts.fetch ?? fetch);
|
|
25568
|
+
}
|
|
25408
25569
|
} else this._authProvider = opts?.authProvider;
|
|
25409
|
-
this._fetch = opts?.fetch;
|
|
25410
25570
|
this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
|
|
25411
25571
|
}
|
|
25412
25572
|
_last401Response;
|
|
25413
25573
|
async _commonHeaders() {
|
|
25414
|
-
const headers =
|
|
25574
|
+
const headers = new Headers(this._requestInit?.headers || void 0);
|
|
25415
25575
|
let token;
|
|
25416
25576
|
try {
|
|
25417
25577
|
token = await this._authProvider?.token();
|
|
25418
25578
|
} catch (error2) {
|
|
25419
25579
|
throw markAuthSeamEscape(error2);
|
|
25420
25580
|
}
|
|
25421
|
-
if (token) headers
|
|
25422
|
-
if (this._protocolVersion) headers
|
|
25423
|
-
|
|
25424
|
-
return new Headers({
|
|
25425
|
-
...headers,
|
|
25426
|
-
...extraHeaders
|
|
25427
|
-
});
|
|
25581
|
+
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
25582
|
+
if (this._protocolVersion) headers.set("mcp-protocol-version", this._protocolVersion);
|
|
25583
|
+
return headers;
|
|
25428
25584
|
}
|
|
25429
25585
|
_startOrAuth() {
|
|
25430
|
-
const
|
|
25586
|
+
const eventSourceFetch = this._eventSourceInit?.fetch;
|
|
25587
|
+
const fetchImpl = eventSourceFetch ? this._dpop?.(eventSourceFetch) ?? eventSourceFetch : this._fetch ?? fetch;
|
|
25431
25588
|
return new Promise((resolve5, reject) => {
|
|
25432
25589
|
this._eventSource = new EventSource(this._url.href, {
|
|
25433
25590
|
...this._eventSourceInit,
|
|
@@ -25597,6 +25754,7 @@ var init_dist4 = __esm({
|
|
|
25597
25754
|
};
|
|
25598
25755
|
RESERVED_REQUEST_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
25599
25756
|
"authorization",
|
|
25757
|
+
"dpop",
|
|
25600
25758
|
"content-type",
|
|
25601
25759
|
"mcp-protocol-version",
|
|
25602
25760
|
"mcp-method",
|
|
@@ -25638,11 +25796,12 @@ var init_dist4 = __esm({
|
|
|
25638
25796
|
this._scope = void 0;
|
|
25639
25797
|
this._requestInit = opts?.requestInit;
|
|
25640
25798
|
this._skipIssuerMetadataValidation = opts?.skipIssuerMetadataValidation;
|
|
25799
|
+
this._fetch = opts?.fetch;
|
|
25641
25800
|
if (isOAuthClientProvider(opts?.authProvider)) {
|
|
25642
25801
|
this._oauthProvider = opts.authProvider;
|
|
25643
25802
|
this._authProvider = adaptOAuthProvider(opts.authProvider, { skipIssuerMetadataValidation: opts.skipIssuerMetadataValidation });
|
|
25803
|
+
if (opts.authProvider.dpop) this._fetch = withDpopFromProvider(opts.authProvider)(opts.fetch ?? fetch);
|
|
25644
25804
|
} else this._authProvider = opts?.authProvider;
|
|
25645
|
-
this._fetch = opts?.fetch;
|
|
25646
25805
|
this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
|
|
25647
25806
|
this._sessionId = opts?.sessionId;
|
|
25648
25807
|
this._protocolVersion = opts?.protocolVersion;
|
|
@@ -25696,21 +25855,17 @@ var init_dist4 = __esm({
|
|
|
25696
25855
|
});
|
|
25697
25856
|
}
|
|
25698
25857
|
async _commonHeaders() {
|
|
25699
|
-
const headers =
|
|
25858
|
+
const headers = new Headers(this._requestInit?.headers || void 0);
|
|
25700
25859
|
let token;
|
|
25701
25860
|
try {
|
|
25702
25861
|
token = await this._authProvider?.token();
|
|
25703
25862
|
} catch (error2) {
|
|
25704
25863
|
throw markAuthSeamEscape(error2);
|
|
25705
25864
|
}
|
|
25706
|
-
if (token) headers
|
|
25707
|
-
if (this._sessionId) headers
|
|
25708
|
-
if (this._protocolVersion) headers
|
|
25709
|
-
|
|
25710
|
-
return new Headers({
|
|
25711
|
-
...headers,
|
|
25712
|
-
...extraHeaders
|
|
25713
|
-
});
|
|
25865
|
+
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
25866
|
+
if (this._sessionId) headers.set("mcp-session-id", this._sessionId);
|
|
25867
|
+
if (this._protocolVersion) headers.set("mcp-protocol-version", this._protocolVersion);
|
|
25868
|
+
return headers;
|
|
25714
25869
|
}
|
|
25715
25870
|
/**
|
|
25716
25871
|
* Body-derived per-request headers: when an outgoing request carries a
|
|
@@ -25726,9 +25881,8 @@ var init_dist4 = __esm({
|
|
|
25726
25881
|
if (typeof envelopeVersion !== "string") return;
|
|
25727
25882
|
headers.set("mcp-protocol-version", envelopeVersion);
|
|
25728
25883
|
headers.set("mcp-method", message.method);
|
|
25729
|
-
const
|
|
25730
|
-
|
|
25731
|
-
if (nameHeader !== void 0) headers.set("mcp-name", encodeMcpParamValue(nameHeader));
|
|
25884
|
+
const source = mcpNameSource(message.method, message.params);
|
|
25885
|
+
if (source?.value !== void 0) headers.set("mcp-name", encodeMcpParamValue(source.value));
|
|
25732
25886
|
}
|
|
25733
25887
|
/**
|
|
25734
25888
|
* `true` when the outbound message is a single request carrying a
|
|
@@ -29421,7 +29575,7 @@ var init_package = __esm({
|
|
|
29421
29575
|
"package.json"() {
|
|
29422
29576
|
package_default = {
|
|
29423
29577
|
name: "@prefecthq/fastmcp-ts",
|
|
29424
|
-
version: "1.
|
|
29578
|
+
version: "1.8.0",
|
|
29425
29579
|
description: "\u{1F3CE}\uFE0F The official FastMCP TypeScript library - build MCP servers and clients, fast \u{1F3CE}\uFE0F",
|
|
29426
29580
|
type: "module",
|
|
29427
29581
|
exports: {
|
|
@@ -30120,23 +30274,29 @@ var import_node_process4, import_node_stream2, import_cross_spawn, DEFAULT_INHER
|
|
|
30120
30274
|
var init_stdio = __esm({
|
|
30121
30275
|
"node_modules/@modelcontextprotocol/client/dist/stdio.mjs"() {
|
|
30122
30276
|
"use strict";
|
|
30123
|
-
|
|
30277
|
+
init_src_xKF0PJN();
|
|
30124
30278
|
import_node_process4 = __toESM(require("process"), 1);
|
|
30125
30279
|
import_node_stream2 = require("stream");
|
|
30126
30280
|
import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
30127
30281
|
DEFAULT_INHERITED_ENV_VARS = import_node_process4.default.platform === "win32" ? [
|
|
30128
30282
|
"APPDATA",
|
|
30283
|
+
"COMSPEC",
|
|
30129
30284
|
"HOMEDRIVE",
|
|
30130
30285
|
"HOMEPATH",
|
|
30131
30286
|
"LOCALAPPDATA",
|
|
30132
30287
|
"PATH",
|
|
30288
|
+
"PATHEXT",
|
|
30133
30289
|
"PROCESSOR_ARCHITECTURE",
|
|
30290
|
+
"PROGRAMDATA",
|
|
30291
|
+
"PROGRAMFILES",
|
|
30292
|
+
"PROGRAMFILES(X86)",
|
|
30293
|
+
"PROGRAMW6432",
|
|
30134
30294
|
"SYSTEMDRIVE",
|
|
30135
30295
|
"SYSTEMROOT",
|
|
30136
30296
|
"TEMP",
|
|
30137
30297
|
"USERNAME",
|
|
30138
30298
|
"USERPROFILE",
|
|
30139
|
-
"
|
|
30299
|
+
"WINDIR"
|
|
30140
30300
|
] : [
|
|
30141
30301
|
"HOME",
|
|
30142
30302
|
"LOGNAME",
|
|
@@ -33813,7 +33973,7 @@ var init_inspect = __esm({
|
|
|
33813
33973
|
// only case Python's inspect supports); over --url/--command the
|
|
33814
33974
|
// generation is unknowable from the wire.
|
|
33815
33975
|
generation: mode.kind === "inprocess" ? 2 : null,
|
|
33816
|
-
fastmcpVersion: "1.
|
|
33976
|
+
fastmcpVersion: "1.8.0",
|
|
33817
33977
|
mcpVersion: "2.0.0",
|
|
33818
33978
|
tools: tools2,
|
|
33819
33979
|
prompts: prompts2,
|
|
@@ -47342,7 +47502,7 @@ init_format();
|
|
|
47342
47502
|
var main = defineCommand({
|
|
47343
47503
|
meta: {
|
|
47344
47504
|
name: "fastmcp",
|
|
47345
|
-
version: "1.
|
|
47505
|
+
version: "1.8.0",
|
|
47346
47506
|
description: "FastMCP CLI \u2014 build, run, and manage MCP servers"
|
|
47347
47507
|
},
|
|
47348
47508
|
args: {
|
|
@@ -47367,7 +47527,7 @@ var main = defineCommand({
|
|
|
47367
47527
|
runMain(main);
|
|
47368
47528
|
/*! Bundled license information:
|
|
47369
47529
|
|
|
47370
|
-
@modelcontextprotocol/client/dist/src-
|
|
47530
|
+
@modelcontextprotocol/client/dist/src-xKF0PJN-.mjs:
|
|
47371
47531
|
(*!
|
|
47372
47532
|
* content-type
|
|
47373
47533
|
* Copyright(c) 2015 Douglas Christopher Wilson
|