@kadoa/mcp 0.5.32 → 0.6.0-rc.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.
Files changed (3) hide show
  1. package/README.md +10 -0
  2. package/dist/index.js +1087 -151
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -19875,6 +19875,803 @@ var init_mcp = __esm(() => {
19875
19875
  };
19876
19876
  });
19877
19877
 
19878
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
19879
+ var RELATED_TASK_META_KEY2 = "io.modelcontextprotocol/related-task", JSONRPC_VERSION2 = "2.0", AssertObjectSchema2, ProgressTokenSchema2, CursorSchema2, TaskCreationParamsSchema2, TaskMetadataSchema2, RelatedTaskMetadataSchema2, RequestMetaSchema2, BaseRequestParamsSchema2, TaskAugmentedRequestParamsSchema2, RequestSchema2, NotificationsParamsSchema2, NotificationSchema2, ResultSchema2, RequestIdSchema2, JSONRPCRequestSchema2, JSONRPCNotificationSchema2, JSONRPCResultResponseSchema2, ErrorCode2, JSONRPCErrorResponseSchema2, JSONRPCMessageSchema2, JSONRPCResponseSchema2, EmptyResultSchema2, CancelledNotificationParamsSchema2, CancelledNotificationSchema2, IconSchema2, IconsSchema2, BaseMetadataSchema2, ImplementationSchema2, FormElicitationCapabilitySchema2, ElicitationCapabilitySchema2, ClientTasksCapabilitySchema2, ServerTasksCapabilitySchema2, ClientCapabilitiesSchema2, InitializeRequestParamsSchema2, InitializeRequestSchema2, ServerCapabilitiesSchema2, InitializeResultSchema2, InitializedNotificationSchema2, PingRequestSchema2, ProgressSchema2, ProgressNotificationParamsSchema2, ProgressNotificationSchema2, PaginatedRequestParamsSchema2, PaginatedRequestSchema2, PaginatedResultSchema2, TaskStatusSchema2, TaskSchema2, CreateTaskResultSchema2, TaskStatusNotificationParamsSchema2, TaskStatusNotificationSchema2, GetTaskRequestSchema2, GetTaskResultSchema2, GetTaskPayloadRequestSchema2, GetTaskPayloadResultSchema2, ListTasksRequestSchema2, ListTasksResultSchema2, CancelTaskRequestSchema2, CancelTaskResultSchema2, ResourceContentsSchema2, TextResourceContentsSchema2, Base64Schema2, BlobResourceContentsSchema2, RoleSchema2, AnnotationsSchema2, ResourceSchema2, ResourceTemplateSchema2, ListResourcesRequestSchema2, ListResourcesResultSchema2, ListResourceTemplatesRequestSchema2, ListResourceTemplatesResultSchema2, ResourceRequestParamsSchema2, ReadResourceRequestParamsSchema2, ReadResourceRequestSchema2, ReadResourceResultSchema2, ResourceListChangedNotificationSchema2, SubscribeRequestParamsSchema2, SubscribeRequestSchema2, UnsubscribeRequestParamsSchema2, UnsubscribeRequestSchema2, ResourceUpdatedNotificationParamsSchema2, ResourceUpdatedNotificationSchema2, PromptArgumentSchema2, PromptSchema2, ListPromptsRequestSchema2, ListPromptsResultSchema2, GetPromptRequestParamsSchema2, GetPromptRequestSchema2, TextContentSchema2, ImageContentSchema2, AudioContentSchema2, ToolUseContentSchema2, EmbeddedResourceSchema2, ResourceLinkSchema2, ContentBlockSchema2, PromptMessageSchema2, GetPromptResultSchema2, PromptListChangedNotificationSchema2, ToolAnnotationsSchema2, ToolExecutionSchema2, ToolSchema2, ListToolsRequestSchema2, ListToolsResultSchema2, CallToolResultSchema2, CompatibilityCallToolResultSchema2, CallToolRequestParamsSchema2, CallToolRequestSchema2, ToolListChangedNotificationSchema2, ListChangedOptionsBaseSchema2, LoggingLevelSchema2, SetLevelRequestParamsSchema2, SetLevelRequestSchema2, LoggingMessageNotificationParamsSchema2, LoggingMessageNotificationSchema2, ModelHintSchema2, ModelPreferencesSchema2, ToolChoiceSchema2, ToolResultContentSchema2, SamplingContentSchema2, SamplingMessageContentBlockSchema2, SamplingMessageSchema2, CreateMessageRequestParamsSchema2, CreateMessageRequestSchema2, CreateMessageResultSchema2, CreateMessageResultWithToolsSchema2, BooleanSchemaSchema2, StringSchemaSchema2, NumberSchemaSchema2, UntitledSingleSelectEnumSchemaSchema2, TitledSingleSelectEnumSchemaSchema2, LegacyTitledEnumSchemaSchema2, SingleSelectEnumSchemaSchema2, UntitledMultiSelectEnumSchemaSchema2, TitledMultiSelectEnumSchemaSchema2, MultiSelectEnumSchemaSchema2, EnumSchemaSchema2, PrimitiveSchemaDefinitionSchema2, ElicitRequestFormParamsSchema2, ElicitRequestURLParamsSchema2, ElicitRequestParamsSchema2, ElicitRequestSchema2, ElicitationCompleteNotificationParamsSchema2, ElicitationCompleteNotificationSchema2, ElicitResultSchema2, ResourceTemplateReferenceSchema2, PromptReferenceSchema2, CompleteRequestParamsSchema2, CompleteRequestSchema2, CompleteResultSchema2, RootSchema2, ListRootsRequestSchema2, ListRootsResultSchema2, RootsListChangedNotificationSchema2, ClientRequestSchema2, ClientNotificationSchema2, ClientResultSchema2, ServerRequestSchema2, ServerNotificationSchema2, ServerResultSchema2;
19880
+ var init_types3 = __esm(() => {
19881
+ init_v4();
19882
+ AssertObjectSchema2 = custom((v) => v !== null && (typeof v === "object" || typeof v === "function"));
19883
+ ProgressTokenSchema2 = union([string2(), number2().int()]);
19884
+ CursorSchema2 = string2();
19885
+ TaskCreationParamsSchema2 = looseObject({
19886
+ ttl: union([number2(), _null3()]).optional(),
19887
+ pollInterval: number2().optional()
19888
+ });
19889
+ TaskMetadataSchema2 = object2({
19890
+ ttl: number2().optional()
19891
+ });
19892
+ RelatedTaskMetadataSchema2 = object2({
19893
+ taskId: string2()
19894
+ });
19895
+ RequestMetaSchema2 = looseObject({
19896
+ progressToken: ProgressTokenSchema2.optional(),
19897
+ [RELATED_TASK_META_KEY2]: RelatedTaskMetadataSchema2.optional()
19898
+ });
19899
+ BaseRequestParamsSchema2 = object2({
19900
+ _meta: RequestMetaSchema2.optional()
19901
+ });
19902
+ TaskAugmentedRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
19903
+ task: TaskMetadataSchema2.optional()
19904
+ });
19905
+ RequestSchema2 = object2({
19906
+ method: string2(),
19907
+ params: BaseRequestParamsSchema2.loose().optional()
19908
+ });
19909
+ NotificationsParamsSchema2 = object2({
19910
+ _meta: RequestMetaSchema2.optional()
19911
+ });
19912
+ NotificationSchema2 = object2({
19913
+ method: string2(),
19914
+ params: NotificationsParamsSchema2.loose().optional()
19915
+ });
19916
+ ResultSchema2 = looseObject({
19917
+ _meta: RequestMetaSchema2.optional()
19918
+ });
19919
+ RequestIdSchema2 = union([string2(), number2().int()]);
19920
+ JSONRPCRequestSchema2 = object2({
19921
+ jsonrpc: literal(JSONRPC_VERSION2),
19922
+ id: RequestIdSchema2,
19923
+ ...RequestSchema2.shape
19924
+ }).strict();
19925
+ JSONRPCNotificationSchema2 = object2({
19926
+ jsonrpc: literal(JSONRPC_VERSION2),
19927
+ ...NotificationSchema2.shape
19928
+ }).strict();
19929
+ JSONRPCResultResponseSchema2 = object2({
19930
+ jsonrpc: literal(JSONRPC_VERSION2),
19931
+ id: RequestIdSchema2,
19932
+ result: ResultSchema2
19933
+ }).strict();
19934
+ (function(ErrorCode) {
19935
+ ErrorCode[ErrorCode["ConnectionClosed"] = -32000] = "ConnectionClosed";
19936
+ ErrorCode[ErrorCode["RequestTimeout"] = -32001] = "RequestTimeout";
19937
+ ErrorCode[ErrorCode["ParseError"] = -32700] = "ParseError";
19938
+ ErrorCode[ErrorCode["InvalidRequest"] = -32600] = "InvalidRequest";
19939
+ ErrorCode[ErrorCode["MethodNotFound"] = -32601] = "MethodNotFound";
19940
+ ErrorCode[ErrorCode["InvalidParams"] = -32602] = "InvalidParams";
19941
+ ErrorCode[ErrorCode["InternalError"] = -32603] = "InternalError";
19942
+ ErrorCode[ErrorCode["UrlElicitationRequired"] = -32042] = "UrlElicitationRequired";
19943
+ })(ErrorCode2 || (ErrorCode2 = {}));
19944
+ JSONRPCErrorResponseSchema2 = object2({
19945
+ jsonrpc: literal(JSONRPC_VERSION2),
19946
+ id: RequestIdSchema2.optional(),
19947
+ error: object2({
19948
+ code: number2().int(),
19949
+ message: string2(),
19950
+ data: unknown().optional()
19951
+ })
19952
+ }).strict();
19953
+ JSONRPCMessageSchema2 = union([
19954
+ JSONRPCRequestSchema2,
19955
+ JSONRPCNotificationSchema2,
19956
+ JSONRPCResultResponseSchema2,
19957
+ JSONRPCErrorResponseSchema2
19958
+ ]);
19959
+ JSONRPCResponseSchema2 = union([JSONRPCResultResponseSchema2, JSONRPCErrorResponseSchema2]);
19960
+ EmptyResultSchema2 = ResultSchema2.strict();
19961
+ CancelledNotificationParamsSchema2 = NotificationsParamsSchema2.extend({
19962
+ requestId: RequestIdSchema2.optional(),
19963
+ reason: string2().optional()
19964
+ });
19965
+ CancelledNotificationSchema2 = NotificationSchema2.extend({
19966
+ method: literal("notifications/cancelled"),
19967
+ params: CancelledNotificationParamsSchema2
19968
+ });
19969
+ IconSchema2 = object2({
19970
+ src: string2(),
19971
+ mimeType: string2().optional(),
19972
+ sizes: array(string2()).optional(),
19973
+ theme: _enum(["light", "dark"]).optional()
19974
+ });
19975
+ IconsSchema2 = object2({
19976
+ icons: array(IconSchema2).optional()
19977
+ });
19978
+ BaseMetadataSchema2 = object2({
19979
+ name: string2(),
19980
+ title: string2().optional()
19981
+ });
19982
+ ImplementationSchema2 = BaseMetadataSchema2.extend({
19983
+ ...BaseMetadataSchema2.shape,
19984
+ ...IconsSchema2.shape,
19985
+ version: string2(),
19986
+ websiteUrl: string2().optional(),
19987
+ description: string2().optional()
19988
+ });
19989
+ FormElicitationCapabilitySchema2 = intersection(object2({
19990
+ applyDefaults: boolean2().optional()
19991
+ }), record(string2(), unknown()));
19992
+ ElicitationCapabilitySchema2 = preprocess((value) => {
19993
+ if (value && typeof value === "object" && !Array.isArray(value)) {
19994
+ if (Object.keys(value).length === 0) {
19995
+ return { form: {} };
19996
+ }
19997
+ }
19998
+ return value;
19999
+ }, intersection(object2({
20000
+ form: FormElicitationCapabilitySchema2.optional(),
20001
+ url: AssertObjectSchema2.optional()
20002
+ }), record(string2(), unknown()).optional()));
20003
+ ClientTasksCapabilitySchema2 = looseObject({
20004
+ list: AssertObjectSchema2.optional(),
20005
+ cancel: AssertObjectSchema2.optional(),
20006
+ requests: looseObject({
20007
+ sampling: looseObject({
20008
+ createMessage: AssertObjectSchema2.optional()
20009
+ }).optional(),
20010
+ elicitation: looseObject({
20011
+ create: AssertObjectSchema2.optional()
20012
+ }).optional()
20013
+ }).optional()
20014
+ });
20015
+ ServerTasksCapabilitySchema2 = looseObject({
20016
+ list: AssertObjectSchema2.optional(),
20017
+ cancel: AssertObjectSchema2.optional(),
20018
+ requests: looseObject({
20019
+ tools: looseObject({
20020
+ call: AssertObjectSchema2.optional()
20021
+ }).optional()
20022
+ }).optional()
20023
+ });
20024
+ ClientCapabilitiesSchema2 = object2({
20025
+ experimental: record(string2(), AssertObjectSchema2).optional(),
20026
+ sampling: object2({
20027
+ context: AssertObjectSchema2.optional(),
20028
+ tools: AssertObjectSchema2.optional()
20029
+ }).optional(),
20030
+ elicitation: ElicitationCapabilitySchema2.optional(),
20031
+ roots: object2({
20032
+ listChanged: boolean2().optional()
20033
+ }).optional(),
20034
+ tasks: ClientTasksCapabilitySchema2.optional()
20035
+ });
20036
+ InitializeRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
20037
+ protocolVersion: string2(),
20038
+ capabilities: ClientCapabilitiesSchema2,
20039
+ clientInfo: ImplementationSchema2
20040
+ });
20041
+ InitializeRequestSchema2 = RequestSchema2.extend({
20042
+ method: literal("initialize"),
20043
+ params: InitializeRequestParamsSchema2
20044
+ });
20045
+ ServerCapabilitiesSchema2 = object2({
20046
+ experimental: record(string2(), AssertObjectSchema2).optional(),
20047
+ logging: AssertObjectSchema2.optional(),
20048
+ completions: AssertObjectSchema2.optional(),
20049
+ prompts: object2({
20050
+ listChanged: boolean2().optional()
20051
+ }).optional(),
20052
+ resources: object2({
20053
+ subscribe: boolean2().optional(),
20054
+ listChanged: boolean2().optional()
20055
+ }).optional(),
20056
+ tools: object2({
20057
+ listChanged: boolean2().optional()
20058
+ }).optional(),
20059
+ tasks: ServerTasksCapabilitySchema2.optional()
20060
+ });
20061
+ InitializeResultSchema2 = ResultSchema2.extend({
20062
+ protocolVersion: string2(),
20063
+ capabilities: ServerCapabilitiesSchema2,
20064
+ serverInfo: ImplementationSchema2,
20065
+ instructions: string2().optional()
20066
+ });
20067
+ InitializedNotificationSchema2 = NotificationSchema2.extend({
20068
+ method: literal("notifications/initialized"),
20069
+ params: NotificationsParamsSchema2.optional()
20070
+ });
20071
+ PingRequestSchema2 = RequestSchema2.extend({
20072
+ method: literal("ping"),
20073
+ params: BaseRequestParamsSchema2.optional()
20074
+ });
20075
+ ProgressSchema2 = object2({
20076
+ progress: number2(),
20077
+ total: optional(number2()),
20078
+ message: optional(string2())
20079
+ });
20080
+ ProgressNotificationParamsSchema2 = object2({
20081
+ ...NotificationsParamsSchema2.shape,
20082
+ ...ProgressSchema2.shape,
20083
+ progressToken: ProgressTokenSchema2
20084
+ });
20085
+ ProgressNotificationSchema2 = NotificationSchema2.extend({
20086
+ method: literal("notifications/progress"),
20087
+ params: ProgressNotificationParamsSchema2
20088
+ });
20089
+ PaginatedRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
20090
+ cursor: CursorSchema2.optional()
20091
+ });
20092
+ PaginatedRequestSchema2 = RequestSchema2.extend({
20093
+ params: PaginatedRequestParamsSchema2.optional()
20094
+ });
20095
+ PaginatedResultSchema2 = ResultSchema2.extend({
20096
+ nextCursor: CursorSchema2.optional()
20097
+ });
20098
+ TaskStatusSchema2 = _enum(["working", "input_required", "completed", "failed", "cancelled"]);
20099
+ TaskSchema2 = object2({
20100
+ taskId: string2(),
20101
+ status: TaskStatusSchema2,
20102
+ ttl: union([number2(), _null3()]),
20103
+ createdAt: string2(),
20104
+ lastUpdatedAt: string2(),
20105
+ pollInterval: optional(number2()),
20106
+ statusMessage: optional(string2())
20107
+ });
20108
+ CreateTaskResultSchema2 = ResultSchema2.extend({
20109
+ task: TaskSchema2
20110
+ });
20111
+ TaskStatusNotificationParamsSchema2 = NotificationsParamsSchema2.merge(TaskSchema2);
20112
+ TaskStatusNotificationSchema2 = NotificationSchema2.extend({
20113
+ method: literal("notifications/tasks/status"),
20114
+ params: TaskStatusNotificationParamsSchema2
20115
+ });
20116
+ GetTaskRequestSchema2 = RequestSchema2.extend({
20117
+ method: literal("tasks/get"),
20118
+ params: BaseRequestParamsSchema2.extend({
20119
+ taskId: string2()
20120
+ })
20121
+ });
20122
+ GetTaskResultSchema2 = ResultSchema2.merge(TaskSchema2);
20123
+ GetTaskPayloadRequestSchema2 = RequestSchema2.extend({
20124
+ method: literal("tasks/result"),
20125
+ params: BaseRequestParamsSchema2.extend({
20126
+ taskId: string2()
20127
+ })
20128
+ });
20129
+ GetTaskPayloadResultSchema2 = ResultSchema2.loose();
20130
+ ListTasksRequestSchema2 = PaginatedRequestSchema2.extend({
20131
+ method: literal("tasks/list")
20132
+ });
20133
+ ListTasksResultSchema2 = PaginatedResultSchema2.extend({
20134
+ tasks: array(TaskSchema2)
20135
+ });
20136
+ CancelTaskRequestSchema2 = RequestSchema2.extend({
20137
+ method: literal("tasks/cancel"),
20138
+ params: BaseRequestParamsSchema2.extend({
20139
+ taskId: string2()
20140
+ })
20141
+ });
20142
+ CancelTaskResultSchema2 = ResultSchema2.merge(TaskSchema2);
20143
+ ResourceContentsSchema2 = object2({
20144
+ uri: string2(),
20145
+ mimeType: optional(string2()),
20146
+ _meta: record(string2(), unknown()).optional()
20147
+ });
20148
+ TextResourceContentsSchema2 = ResourceContentsSchema2.extend({
20149
+ text: string2()
20150
+ });
20151
+ Base64Schema2 = string2().refine((val) => {
20152
+ try {
20153
+ atob(val);
20154
+ return true;
20155
+ } catch {
20156
+ return false;
20157
+ }
20158
+ }, { message: "Invalid Base64 string" });
20159
+ BlobResourceContentsSchema2 = ResourceContentsSchema2.extend({
20160
+ blob: Base64Schema2
20161
+ });
20162
+ RoleSchema2 = _enum(["user", "assistant"]);
20163
+ AnnotationsSchema2 = object2({
20164
+ audience: array(RoleSchema2).optional(),
20165
+ priority: number2().min(0).max(1).optional(),
20166
+ lastModified: datetime2({ offset: true }).optional()
20167
+ });
20168
+ ResourceSchema2 = object2({
20169
+ ...BaseMetadataSchema2.shape,
20170
+ ...IconsSchema2.shape,
20171
+ uri: string2(),
20172
+ description: optional(string2()),
20173
+ mimeType: optional(string2()),
20174
+ annotations: AnnotationsSchema2.optional(),
20175
+ _meta: optional(looseObject({}))
20176
+ });
20177
+ ResourceTemplateSchema2 = object2({
20178
+ ...BaseMetadataSchema2.shape,
20179
+ ...IconsSchema2.shape,
20180
+ uriTemplate: string2(),
20181
+ description: optional(string2()),
20182
+ mimeType: optional(string2()),
20183
+ annotations: AnnotationsSchema2.optional(),
20184
+ _meta: optional(looseObject({}))
20185
+ });
20186
+ ListResourcesRequestSchema2 = PaginatedRequestSchema2.extend({
20187
+ method: literal("resources/list")
20188
+ });
20189
+ ListResourcesResultSchema2 = PaginatedResultSchema2.extend({
20190
+ resources: array(ResourceSchema2)
20191
+ });
20192
+ ListResourceTemplatesRequestSchema2 = PaginatedRequestSchema2.extend({
20193
+ method: literal("resources/templates/list")
20194
+ });
20195
+ ListResourceTemplatesResultSchema2 = PaginatedResultSchema2.extend({
20196
+ resourceTemplates: array(ResourceTemplateSchema2)
20197
+ });
20198
+ ResourceRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
20199
+ uri: string2()
20200
+ });
20201
+ ReadResourceRequestParamsSchema2 = ResourceRequestParamsSchema2;
20202
+ ReadResourceRequestSchema2 = RequestSchema2.extend({
20203
+ method: literal("resources/read"),
20204
+ params: ReadResourceRequestParamsSchema2
20205
+ });
20206
+ ReadResourceResultSchema2 = ResultSchema2.extend({
20207
+ contents: array(union([TextResourceContentsSchema2, BlobResourceContentsSchema2]))
20208
+ });
20209
+ ResourceListChangedNotificationSchema2 = NotificationSchema2.extend({
20210
+ method: literal("notifications/resources/list_changed"),
20211
+ params: NotificationsParamsSchema2.optional()
20212
+ });
20213
+ SubscribeRequestParamsSchema2 = ResourceRequestParamsSchema2;
20214
+ SubscribeRequestSchema2 = RequestSchema2.extend({
20215
+ method: literal("resources/subscribe"),
20216
+ params: SubscribeRequestParamsSchema2
20217
+ });
20218
+ UnsubscribeRequestParamsSchema2 = ResourceRequestParamsSchema2;
20219
+ UnsubscribeRequestSchema2 = RequestSchema2.extend({
20220
+ method: literal("resources/unsubscribe"),
20221
+ params: UnsubscribeRequestParamsSchema2
20222
+ });
20223
+ ResourceUpdatedNotificationParamsSchema2 = NotificationsParamsSchema2.extend({
20224
+ uri: string2()
20225
+ });
20226
+ ResourceUpdatedNotificationSchema2 = NotificationSchema2.extend({
20227
+ method: literal("notifications/resources/updated"),
20228
+ params: ResourceUpdatedNotificationParamsSchema2
20229
+ });
20230
+ PromptArgumentSchema2 = object2({
20231
+ name: string2(),
20232
+ description: optional(string2()),
20233
+ required: optional(boolean2())
20234
+ });
20235
+ PromptSchema2 = object2({
20236
+ ...BaseMetadataSchema2.shape,
20237
+ ...IconsSchema2.shape,
20238
+ description: optional(string2()),
20239
+ arguments: optional(array(PromptArgumentSchema2)),
20240
+ _meta: optional(looseObject({}))
20241
+ });
20242
+ ListPromptsRequestSchema2 = PaginatedRequestSchema2.extend({
20243
+ method: literal("prompts/list")
20244
+ });
20245
+ ListPromptsResultSchema2 = PaginatedResultSchema2.extend({
20246
+ prompts: array(PromptSchema2)
20247
+ });
20248
+ GetPromptRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
20249
+ name: string2(),
20250
+ arguments: record(string2(), string2()).optional()
20251
+ });
20252
+ GetPromptRequestSchema2 = RequestSchema2.extend({
20253
+ method: literal("prompts/get"),
20254
+ params: GetPromptRequestParamsSchema2
20255
+ });
20256
+ TextContentSchema2 = object2({
20257
+ type: literal("text"),
20258
+ text: string2(),
20259
+ annotations: AnnotationsSchema2.optional(),
20260
+ _meta: record(string2(), unknown()).optional()
20261
+ });
20262
+ ImageContentSchema2 = object2({
20263
+ type: literal("image"),
20264
+ data: Base64Schema2,
20265
+ mimeType: string2(),
20266
+ annotations: AnnotationsSchema2.optional(),
20267
+ _meta: record(string2(), unknown()).optional()
20268
+ });
20269
+ AudioContentSchema2 = object2({
20270
+ type: literal("audio"),
20271
+ data: Base64Schema2,
20272
+ mimeType: string2(),
20273
+ annotations: AnnotationsSchema2.optional(),
20274
+ _meta: record(string2(), unknown()).optional()
20275
+ });
20276
+ ToolUseContentSchema2 = object2({
20277
+ type: literal("tool_use"),
20278
+ name: string2(),
20279
+ id: string2(),
20280
+ input: record(string2(), unknown()),
20281
+ _meta: record(string2(), unknown()).optional()
20282
+ });
20283
+ EmbeddedResourceSchema2 = object2({
20284
+ type: literal("resource"),
20285
+ resource: union([TextResourceContentsSchema2, BlobResourceContentsSchema2]),
20286
+ annotations: AnnotationsSchema2.optional(),
20287
+ _meta: record(string2(), unknown()).optional()
20288
+ });
20289
+ ResourceLinkSchema2 = ResourceSchema2.extend({
20290
+ type: literal("resource_link")
20291
+ });
20292
+ ContentBlockSchema2 = union([
20293
+ TextContentSchema2,
20294
+ ImageContentSchema2,
20295
+ AudioContentSchema2,
20296
+ ResourceLinkSchema2,
20297
+ EmbeddedResourceSchema2
20298
+ ]);
20299
+ PromptMessageSchema2 = object2({
20300
+ role: RoleSchema2,
20301
+ content: ContentBlockSchema2
20302
+ });
20303
+ GetPromptResultSchema2 = ResultSchema2.extend({
20304
+ description: string2().optional(),
20305
+ messages: array(PromptMessageSchema2)
20306
+ });
20307
+ PromptListChangedNotificationSchema2 = NotificationSchema2.extend({
20308
+ method: literal("notifications/prompts/list_changed"),
20309
+ params: NotificationsParamsSchema2.optional()
20310
+ });
20311
+ ToolAnnotationsSchema2 = object2({
20312
+ title: string2().optional(),
20313
+ readOnlyHint: boolean2().optional(),
20314
+ destructiveHint: boolean2().optional(),
20315
+ idempotentHint: boolean2().optional(),
20316
+ openWorldHint: boolean2().optional()
20317
+ });
20318
+ ToolExecutionSchema2 = object2({
20319
+ taskSupport: _enum(["required", "optional", "forbidden"]).optional()
20320
+ });
20321
+ ToolSchema2 = object2({
20322
+ ...BaseMetadataSchema2.shape,
20323
+ ...IconsSchema2.shape,
20324
+ description: string2().optional(),
20325
+ inputSchema: object2({
20326
+ type: literal("object"),
20327
+ properties: record(string2(), AssertObjectSchema2).optional(),
20328
+ required: array(string2()).optional()
20329
+ }).catchall(unknown()),
20330
+ outputSchema: object2({
20331
+ type: literal("object"),
20332
+ properties: record(string2(), AssertObjectSchema2).optional(),
20333
+ required: array(string2()).optional()
20334
+ }).catchall(unknown()).optional(),
20335
+ annotations: ToolAnnotationsSchema2.optional(),
20336
+ execution: ToolExecutionSchema2.optional(),
20337
+ _meta: record(string2(), unknown()).optional()
20338
+ });
20339
+ ListToolsRequestSchema2 = PaginatedRequestSchema2.extend({
20340
+ method: literal("tools/list")
20341
+ });
20342
+ ListToolsResultSchema2 = PaginatedResultSchema2.extend({
20343
+ tools: array(ToolSchema2)
20344
+ });
20345
+ CallToolResultSchema2 = ResultSchema2.extend({
20346
+ content: array(ContentBlockSchema2).default([]),
20347
+ structuredContent: record(string2(), unknown()).optional(),
20348
+ isError: boolean2().optional()
20349
+ });
20350
+ CompatibilityCallToolResultSchema2 = CallToolResultSchema2.or(ResultSchema2.extend({
20351
+ toolResult: unknown()
20352
+ }));
20353
+ CallToolRequestParamsSchema2 = TaskAugmentedRequestParamsSchema2.extend({
20354
+ name: string2(),
20355
+ arguments: record(string2(), unknown()).optional()
20356
+ });
20357
+ CallToolRequestSchema2 = RequestSchema2.extend({
20358
+ method: literal("tools/call"),
20359
+ params: CallToolRequestParamsSchema2
20360
+ });
20361
+ ToolListChangedNotificationSchema2 = NotificationSchema2.extend({
20362
+ method: literal("notifications/tools/list_changed"),
20363
+ params: NotificationsParamsSchema2.optional()
20364
+ });
20365
+ ListChangedOptionsBaseSchema2 = object2({
20366
+ autoRefresh: boolean2().default(true),
20367
+ debounceMs: number2().int().nonnegative().default(300)
20368
+ });
20369
+ LoggingLevelSchema2 = _enum(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
20370
+ SetLevelRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
20371
+ level: LoggingLevelSchema2
20372
+ });
20373
+ SetLevelRequestSchema2 = RequestSchema2.extend({
20374
+ method: literal("logging/setLevel"),
20375
+ params: SetLevelRequestParamsSchema2
20376
+ });
20377
+ LoggingMessageNotificationParamsSchema2 = NotificationsParamsSchema2.extend({
20378
+ level: LoggingLevelSchema2,
20379
+ logger: string2().optional(),
20380
+ data: unknown()
20381
+ });
20382
+ LoggingMessageNotificationSchema2 = NotificationSchema2.extend({
20383
+ method: literal("notifications/message"),
20384
+ params: LoggingMessageNotificationParamsSchema2
20385
+ });
20386
+ ModelHintSchema2 = object2({
20387
+ name: string2().optional()
20388
+ });
20389
+ ModelPreferencesSchema2 = object2({
20390
+ hints: array(ModelHintSchema2).optional(),
20391
+ costPriority: number2().min(0).max(1).optional(),
20392
+ speedPriority: number2().min(0).max(1).optional(),
20393
+ intelligencePriority: number2().min(0).max(1).optional()
20394
+ });
20395
+ ToolChoiceSchema2 = object2({
20396
+ mode: _enum(["auto", "required", "none"]).optional()
20397
+ });
20398
+ ToolResultContentSchema2 = object2({
20399
+ type: literal("tool_result"),
20400
+ toolUseId: string2().describe("The unique identifier for the corresponding tool call."),
20401
+ content: array(ContentBlockSchema2).default([]),
20402
+ structuredContent: object2({}).loose().optional(),
20403
+ isError: boolean2().optional(),
20404
+ _meta: record(string2(), unknown()).optional()
20405
+ });
20406
+ SamplingContentSchema2 = discriminatedUnion("type", [TextContentSchema2, ImageContentSchema2, AudioContentSchema2]);
20407
+ SamplingMessageContentBlockSchema2 = discriminatedUnion("type", [
20408
+ TextContentSchema2,
20409
+ ImageContentSchema2,
20410
+ AudioContentSchema2,
20411
+ ToolUseContentSchema2,
20412
+ ToolResultContentSchema2
20413
+ ]);
20414
+ SamplingMessageSchema2 = object2({
20415
+ role: RoleSchema2,
20416
+ content: union([SamplingMessageContentBlockSchema2, array(SamplingMessageContentBlockSchema2)]),
20417
+ _meta: record(string2(), unknown()).optional()
20418
+ });
20419
+ CreateMessageRequestParamsSchema2 = TaskAugmentedRequestParamsSchema2.extend({
20420
+ messages: array(SamplingMessageSchema2),
20421
+ modelPreferences: ModelPreferencesSchema2.optional(),
20422
+ systemPrompt: string2().optional(),
20423
+ includeContext: _enum(["none", "thisServer", "allServers"]).optional(),
20424
+ temperature: number2().optional(),
20425
+ maxTokens: number2().int(),
20426
+ stopSequences: array(string2()).optional(),
20427
+ metadata: AssertObjectSchema2.optional(),
20428
+ tools: array(ToolSchema2).optional(),
20429
+ toolChoice: ToolChoiceSchema2.optional()
20430
+ });
20431
+ CreateMessageRequestSchema2 = RequestSchema2.extend({
20432
+ method: literal("sampling/createMessage"),
20433
+ params: CreateMessageRequestParamsSchema2
20434
+ });
20435
+ CreateMessageResultSchema2 = ResultSchema2.extend({
20436
+ model: string2(),
20437
+ stopReason: optional(_enum(["endTurn", "stopSequence", "maxTokens"]).or(string2())),
20438
+ role: RoleSchema2,
20439
+ content: SamplingContentSchema2
20440
+ });
20441
+ CreateMessageResultWithToolsSchema2 = ResultSchema2.extend({
20442
+ model: string2(),
20443
+ stopReason: optional(_enum(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(string2())),
20444
+ role: RoleSchema2,
20445
+ content: union([SamplingMessageContentBlockSchema2, array(SamplingMessageContentBlockSchema2)])
20446
+ });
20447
+ BooleanSchemaSchema2 = object2({
20448
+ type: literal("boolean"),
20449
+ title: string2().optional(),
20450
+ description: string2().optional(),
20451
+ default: boolean2().optional()
20452
+ });
20453
+ StringSchemaSchema2 = object2({
20454
+ type: literal("string"),
20455
+ title: string2().optional(),
20456
+ description: string2().optional(),
20457
+ minLength: number2().optional(),
20458
+ maxLength: number2().optional(),
20459
+ format: _enum(["email", "uri", "date", "date-time"]).optional(),
20460
+ default: string2().optional()
20461
+ });
20462
+ NumberSchemaSchema2 = object2({
20463
+ type: _enum(["number", "integer"]),
20464
+ title: string2().optional(),
20465
+ description: string2().optional(),
20466
+ minimum: number2().optional(),
20467
+ maximum: number2().optional(),
20468
+ default: number2().optional()
20469
+ });
20470
+ UntitledSingleSelectEnumSchemaSchema2 = object2({
20471
+ type: literal("string"),
20472
+ title: string2().optional(),
20473
+ description: string2().optional(),
20474
+ enum: array(string2()),
20475
+ default: string2().optional()
20476
+ });
20477
+ TitledSingleSelectEnumSchemaSchema2 = object2({
20478
+ type: literal("string"),
20479
+ title: string2().optional(),
20480
+ description: string2().optional(),
20481
+ oneOf: array(object2({
20482
+ const: string2(),
20483
+ title: string2()
20484
+ })),
20485
+ default: string2().optional()
20486
+ });
20487
+ LegacyTitledEnumSchemaSchema2 = object2({
20488
+ type: literal("string"),
20489
+ title: string2().optional(),
20490
+ description: string2().optional(),
20491
+ enum: array(string2()),
20492
+ enumNames: array(string2()).optional(),
20493
+ default: string2().optional()
20494
+ });
20495
+ SingleSelectEnumSchemaSchema2 = union([UntitledSingleSelectEnumSchemaSchema2, TitledSingleSelectEnumSchemaSchema2]);
20496
+ UntitledMultiSelectEnumSchemaSchema2 = object2({
20497
+ type: literal("array"),
20498
+ title: string2().optional(),
20499
+ description: string2().optional(),
20500
+ minItems: number2().optional(),
20501
+ maxItems: number2().optional(),
20502
+ items: object2({
20503
+ type: literal("string"),
20504
+ enum: array(string2())
20505
+ }),
20506
+ default: array(string2()).optional()
20507
+ });
20508
+ TitledMultiSelectEnumSchemaSchema2 = object2({
20509
+ type: literal("array"),
20510
+ title: string2().optional(),
20511
+ description: string2().optional(),
20512
+ minItems: number2().optional(),
20513
+ maxItems: number2().optional(),
20514
+ items: object2({
20515
+ anyOf: array(object2({
20516
+ const: string2(),
20517
+ title: string2()
20518
+ }))
20519
+ }),
20520
+ default: array(string2()).optional()
20521
+ });
20522
+ MultiSelectEnumSchemaSchema2 = union([UntitledMultiSelectEnumSchemaSchema2, TitledMultiSelectEnumSchemaSchema2]);
20523
+ EnumSchemaSchema2 = union([LegacyTitledEnumSchemaSchema2, SingleSelectEnumSchemaSchema2, MultiSelectEnumSchemaSchema2]);
20524
+ PrimitiveSchemaDefinitionSchema2 = union([EnumSchemaSchema2, BooleanSchemaSchema2, StringSchemaSchema2, NumberSchemaSchema2]);
20525
+ ElicitRequestFormParamsSchema2 = TaskAugmentedRequestParamsSchema2.extend({
20526
+ mode: literal("form").optional(),
20527
+ message: string2(),
20528
+ requestedSchema: object2({
20529
+ type: literal("object"),
20530
+ properties: record(string2(), PrimitiveSchemaDefinitionSchema2),
20531
+ required: array(string2()).optional()
20532
+ })
20533
+ });
20534
+ ElicitRequestURLParamsSchema2 = TaskAugmentedRequestParamsSchema2.extend({
20535
+ mode: literal("url"),
20536
+ message: string2(),
20537
+ elicitationId: string2(),
20538
+ url: string2().url()
20539
+ });
20540
+ ElicitRequestParamsSchema2 = union([ElicitRequestFormParamsSchema2, ElicitRequestURLParamsSchema2]);
20541
+ ElicitRequestSchema2 = RequestSchema2.extend({
20542
+ method: literal("elicitation/create"),
20543
+ params: ElicitRequestParamsSchema2
20544
+ });
20545
+ ElicitationCompleteNotificationParamsSchema2 = NotificationsParamsSchema2.extend({
20546
+ elicitationId: string2()
20547
+ });
20548
+ ElicitationCompleteNotificationSchema2 = NotificationSchema2.extend({
20549
+ method: literal("notifications/elicitation/complete"),
20550
+ params: ElicitationCompleteNotificationParamsSchema2
20551
+ });
20552
+ ElicitResultSchema2 = ResultSchema2.extend({
20553
+ action: _enum(["accept", "decline", "cancel"]),
20554
+ content: preprocess((val) => val === null ? undefined : val, record(string2(), union([string2(), number2(), boolean2(), array(string2())])).optional())
20555
+ });
20556
+ ResourceTemplateReferenceSchema2 = object2({
20557
+ type: literal("ref/resource"),
20558
+ uri: string2()
20559
+ });
20560
+ PromptReferenceSchema2 = object2({
20561
+ type: literal("ref/prompt"),
20562
+ name: string2()
20563
+ });
20564
+ CompleteRequestParamsSchema2 = BaseRequestParamsSchema2.extend({
20565
+ ref: union([PromptReferenceSchema2, ResourceTemplateReferenceSchema2]),
20566
+ argument: object2({
20567
+ name: string2(),
20568
+ value: string2()
20569
+ }),
20570
+ context: object2({
20571
+ arguments: record(string2(), string2()).optional()
20572
+ }).optional()
20573
+ });
20574
+ CompleteRequestSchema2 = RequestSchema2.extend({
20575
+ method: literal("completion/complete"),
20576
+ params: CompleteRequestParamsSchema2
20577
+ });
20578
+ CompleteResultSchema2 = ResultSchema2.extend({
20579
+ completion: looseObject({
20580
+ values: array(string2()).max(100),
20581
+ total: optional(number2().int()),
20582
+ hasMore: optional(boolean2())
20583
+ })
20584
+ });
20585
+ RootSchema2 = object2({
20586
+ uri: string2().startsWith("file://"),
20587
+ name: string2().optional(),
20588
+ _meta: record(string2(), unknown()).optional()
20589
+ });
20590
+ ListRootsRequestSchema2 = RequestSchema2.extend({
20591
+ method: literal("roots/list"),
20592
+ params: BaseRequestParamsSchema2.optional()
20593
+ });
20594
+ ListRootsResultSchema2 = ResultSchema2.extend({
20595
+ roots: array(RootSchema2)
20596
+ });
20597
+ RootsListChangedNotificationSchema2 = NotificationSchema2.extend({
20598
+ method: literal("notifications/roots/list_changed"),
20599
+ params: NotificationsParamsSchema2.optional()
20600
+ });
20601
+ ClientRequestSchema2 = union([
20602
+ PingRequestSchema2,
20603
+ InitializeRequestSchema2,
20604
+ CompleteRequestSchema2,
20605
+ SetLevelRequestSchema2,
20606
+ GetPromptRequestSchema2,
20607
+ ListPromptsRequestSchema2,
20608
+ ListResourcesRequestSchema2,
20609
+ ListResourceTemplatesRequestSchema2,
20610
+ ReadResourceRequestSchema2,
20611
+ SubscribeRequestSchema2,
20612
+ UnsubscribeRequestSchema2,
20613
+ CallToolRequestSchema2,
20614
+ ListToolsRequestSchema2,
20615
+ GetTaskRequestSchema2,
20616
+ GetTaskPayloadRequestSchema2,
20617
+ ListTasksRequestSchema2,
20618
+ CancelTaskRequestSchema2
20619
+ ]);
20620
+ ClientNotificationSchema2 = union([
20621
+ CancelledNotificationSchema2,
20622
+ ProgressNotificationSchema2,
20623
+ InitializedNotificationSchema2,
20624
+ RootsListChangedNotificationSchema2,
20625
+ TaskStatusNotificationSchema2
20626
+ ]);
20627
+ ClientResultSchema2 = union([
20628
+ EmptyResultSchema2,
20629
+ CreateMessageResultSchema2,
20630
+ CreateMessageResultWithToolsSchema2,
20631
+ ElicitResultSchema2,
20632
+ ListRootsResultSchema2,
20633
+ GetTaskResultSchema2,
20634
+ ListTasksResultSchema2,
20635
+ CreateTaskResultSchema2
20636
+ ]);
20637
+ ServerRequestSchema2 = union([
20638
+ PingRequestSchema2,
20639
+ CreateMessageRequestSchema2,
20640
+ ElicitRequestSchema2,
20641
+ ListRootsRequestSchema2,
20642
+ GetTaskRequestSchema2,
20643
+ GetTaskPayloadRequestSchema2,
20644
+ ListTasksRequestSchema2,
20645
+ CancelTaskRequestSchema2
20646
+ ]);
20647
+ ServerNotificationSchema2 = union([
20648
+ CancelledNotificationSchema2,
20649
+ ProgressNotificationSchema2,
20650
+ LoggingMessageNotificationSchema2,
20651
+ ResourceUpdatedNotificationSchema2,
20652
+ ResourceListChangedNotificationSchema2,
20653
+ ToolListChangedNotificationSchema2,
20654
+ PromptListChangedNotificationSchema2,
20655
+ TaskStatusNotificationSchema2,
20656
+ ElicitationCompleteNotificationSchema2
20657
+ ]);
20658
+ ServerResultSchema2 = union([
20659
+ EmptyResultSchema2,
20660
+ InitializeResultSchema2,
20661
+ CompleteResultSchema2,
20662
+ GetPromptResultSchema2,
20663
+ ListPromptsResultSchema2,
20664
+ ListResourcesResultSchema2,
20665
+ ListResourceTemplatesResultSchema2,
20666
+ ReadResourceResultSchema2,
20667
+ CallToolResultSchema2,
20668
+ ListToolsResultSchema2,
20669
+ GetTaskResultSchema2,
20670
+ ListTasksResultSchema2,
20671
+ CreateTaskResultSchema2
20672
+ ]);
20673
+ });
20674
+
19878
20675
  // node_modules/axios/lib/helpers/bind.js
19879
20676
  function bind(fn, thisArg) {
19880
20677
  return function wrap() {
@@ -36563,29 +37360,6 @@ function buildAgenticPrompt2(params) {
36563
37360
  }
36564
37361
  return `extract all records from this page and return these fields: ${fieldList}`;
36565
37362
  }
36566
- function mapInboxItem(item) {
36567
- return {
36568
- id: item.id,
36569
- type: knownInboxItemTypes[item.type] ?? item.type,
36570
- subjectId: item.subjectId,
36571
- workflowId: item.workflowId,
36572
- title: item.title,
36573
- payload: item.payload,
36574
- isRead: item.isRead,
36575
- readAt: item.readAt,
36576
- createdAt: item.createdAt,
36577
- updatedAt: item.updatedAt
36578
- };
36579
- }
36580
- function mapInboxListResponse(response) {
36581
- return {
36582
- unreadCount: response.data.unreadCount,
36583
- items: response.data.items.map(mapInboxItem)
36584
- };
36585
- }
36586
- function mapInboxMarkReadResponse(response) {
36587
- return { readCount: response.data.readCount };
36588
- }
36589
37363
  function validateEmailChannelConfig(config) {
36590
37364
  const issues = [];
36591
37365
  if (!config.recipients?.length) {
@@ -36748,7 +37522,6 @@ function createClientDomains(params) {
36748
37522
  const { client } = params;
36749
37523
  const assistantService = new AssistantService(client.apis.agent);
36750
37524
  const changesService = new ChangesService(client);
36751
- const inboxService = new InboxService(client.apis.inbox);
36752
37525
  const userService = new UserService(client);
36753
37526
  const dataFetcherService = new DataFetcherService(client.apis.workflows);
36754
37527
  const channelsService = new NotificationChannelsService(client.apis.notifications, userService);
@@ -36778,7 +37551,6 @@ function createClientDomains(params) {
36778
37551
  extraction: extractionService,
36779
37552
  workflow: workflowsCoreService,
36780
37553
  notification,
36781
- inbox: inboxService,
36782
37554
  schema: schemasService,
36783
37555
  scrape: scrapeService,
36784
37556
  user: userService,
@@ -36967,8 +37739,8 @@ var import_debug, __require2, FREEFORM_ASSISTANT_ANSWER_KEY = "_freeform", Kadoa
36967
37739
  return needsSerialization ? JSON.stringify(value !== undefined ? value : {}, replaceWithSerializableTypeIfNeeded) : value || "";
36968
37740
  }, toPathString = function(url) {
36969
37741
  return url.pathname + url.search + url.hash;
36970
- }, createRequestFunction = function(axiosArgs, globalAxios13, BASE_PATH2, configuration) {
36971
- return (axios2 = globalAxios13, basePath = BASE_PATH2) => {
37742
+ }, createRequestFunction = function(axiosArgs, globalAxios12, BASE_PATH2, configuration) {
37743
+ return (axios2 = globalAxios12, basePath = BASE_PATH2) => {
36972
37744
  const axiosRequestArgs = { ...axiosArgs.options, url: (axios2.defaults.baseURL ? "" : configuration?.basePath ?? basePath) + axiosArgs.url };
36973
37745
  return axios2.request(axiosRequestArgs);
36974
37746
  };
@@ -38290,67 +39062,7 @@ var import_debug, __require2, FREEFORM_ASSISTANT_ANSWER_KEY = "_freeform", Kadoa
38290
39062
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
38291
39063
  }
38292
39064
  };
38293
- }, DataValidationApi, InboxApiAxiosParamCreator = function(configuration) {
38294
- return {
38295
- v5InboxList: async (options = {}) => {
38296
- const localVarPath = `/v5/inbox`;
38297
- const localVarUrlObj = new URL$1(localVarPath, DUMMY_BASE_URL);
38298
- let baseOptions;
38299
- if (configuration) {
38300
- baseOptions = configuration.baseOptions;
38301
- }
38302
- const localVarRequestOptions = { method: "GET", ...baseOptions, ...options };
38303
- const localVarHeaderParameter = {};
38304
- const localVarQueryParameter = {};
38305
- await setApiKeyToObject(localVarHeaderParameter, "x-api-key", configuration);
38306
- localVarHeaderParameter["Accept"] = "application/json";
38307
- setSearchParams(localVarUrlObj, localVarQueryParameter);
38308
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
38309
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
38310
- return {
38311
- url: toPathString(localVarUrlObj),
38312
- options: localVarRequestOptions
38313
- };
38314
- },
38315
- v5InboxMarkRead: async (itemId, options = {}) => {
38316
- assertParamExists("v5InboxMarkRead", "itemId", itemId);
38317
- const localVarPath = `/v5/inbox/{itemId}/mark-read`.replace(`{${"itemId"}}`, encodeURIComponent(String(itemId)));
38318
- const localVarUrlObj = new URL$1(localVarPath, DUMMY_BASE_URL);
38319
- let baseOptions;
38320
- if (configuration) {
38321
- baseOptions = configuration.baseOptions;
38322
- }
38323
- const localVarRequestOptions = { method: "POST", ...baseOptions, ...options };
38324
- const localVarHeaderParameter = {};
38325
- const localVarQueryParameter = {};
38326
- await setApiKeyToObject(localVarHeaderParameter, "x-api-key", configuration);
38327
- localVarHeaderParameter["Accept"] = "application/json";
38328
- setSearchParams(localVarUrlObj, localVarQueryParameter);
38329
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
38330
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
38331
- return {
38332
- url: toPathString(localVarUrlObj),
38333
- options: localVarRequestOptions
38334
- };
38335
- }
38336
- };
38337
- }, InboxApiFp = function(configuration) {
38338
- const localVarAxiosParamCreator = InboxApiAxiosParamCreator(configuration);
38339
- return {
38340
- async v5InboxList(options) {
38341
- const localVarAxiosArgs = await localVarAxiosParamCreator.v5InboxList(options);
38342
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
38343
- const localVarOperationServerBasePath = operationServerMap["InboxApi.v5InboxList"]?.[localVarOperationServerIndex]?.url;
38344
- return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
38345
- },
38346
- async v5InboxMarkRead(itemId, options) {
38347
- const localVarAxiosArgs = await localVarAxiosParamCreator.v5InboxMarkRead(itemId, options);
38348
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
38349
- const localVarOperationServerBasePath = operationServerMap["InboxApi.v5InboxMarkRead"]?.[localVarOperationServerIndex]?.url;
38350
- return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
38351
- }
38352
- };
38353
- }, InboxApi, MeApiAxiosParamCreator = function(configuration) {
39065
+ }, DataValidationApi, MeApiAxiosParamCreator = function(configuration) {
38354
39066
  return {
38355
39067
  v4MeFeaturesGet: async (options = {}) => {
38356
39068
  const localVarPath = `/v4/me/features`;
@@ -39891,7 +40603,7 @@ var import_debug, __require2, FREEFORM_ASSISTANT_ANSWER_KEY = "_freeform", Kadoa
39891
40603
  options: localVarRequestOptions
39892
40604
  };
39893
40605
  },
39894
- v4WorkflowsGet: async (search, skip, limit, state, runState, displayState, inSupport, tags, statusFilters, userId, channelId, monitoring, updateInterval, scheduleType, templateId, includeDeleted, format, options = {}) => {
40606
+ v4WorkflowsGet: async (search, skip, limit, state, runState, displayState, inSupport, tags, statusFilters, groupWindows, userId, channelId, monitoring, updateInterval, scheduleType, templateId, includeDeleted, format, options = {}) => {
39895
40607
  const localVarPath = `/v4/workflows`;
39896
40608
  const localVarUrlObj = new URL$1(localVarPath, DUMMY_BASE_URL);
39897
40609
  let baseOptions;
@@ -39929,6 +40641,9 @@ var import_debug, __require2, FREEFORM_ASSISTANT_ANSWER_KEY = "_freeform", Kadoa
39929
40641
  if (statusFilters) {
39930
40642
  localVarQueryParameter["statusFilters"] = statusFilters;
39931
40643
  }
40644
+ if (groupWindows !== undefined) {
40645
+ localVarQueryParameter["groupWindows"] = groupWindows;
40646
+ }
39932
40647
  if (userId) {
39933
40648
  localVarQueryParameter["userId"] = userId;
39934
40649
  }
@@ -40633,8 +41348,8 @@ var import_debug, __require2, FREEFORM_ASSISTANT_ANSWER_KEY = "_freeform", Kadoa
40633
41348
  const localVarOperationServerBasePath = operationServerMap["WorkflowsApi.v4WorkflowsBulkPost"]?.[localVarOperationServerIndex]?.url;
40634
41349
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
40635
41350
  },
40636
- async v4WorkflowsGet(search, skip, limit, state, runState, displayState, inSupport, tags, statusFilters, userId, channelId, monitoring, updateInterval, scheduleType, templateId, includeDeleted, format, options) {
40637
- const localVarAxiosArgs = await localVarAxiosParamCreator.v4WorkflowsGet(search, skip, limit, state, runState, displayState, inSupport, tags, statusFilters, userId, channelId, monitoring, updateInterval, scheduleType, templateId, includeDeleted, format, options);
41351
+ async v4WorkflowsGet(search, skip, limit, state, runState, displayState, inSupport, tags, statusFilters, groupWindows, userId, channelId, monitoring, updateInterval, scheduleType, templateId, includeDeleted, format, options) {
41352
+ const localVarAxiosArgs = await localVarAxiosParamCreator.v4WorkflowsGet(search, skip, limit, state, runState, displayState, inSupport, tags, statusFilters, groupWindows, userId, channelId, monitoring, updateInterval, scheduleType, templateId, includeDeleted, format, options);
40638
41353
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
40639
41354
  const localVarOperationServerBasePath = operationServerMap["WorkflowsApi.v4WorkflowsGet"]?.[localVarOperationServerIndex]?.url;
40640
41355
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
@@ -40799,7 +41514,7 @@ var import_debug, __require2, FREEFORM_ASSISTANT_ANSWER_KEY = "_freeform", Kadoa
40799
41514
  const jsonMime = new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$", "i");
40800
41515
  return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === "application/json-patch+json");
40801
41516
  }
40802
- }, DataFieldDataTypeEnum, InboxItemTypeEnum, CrawlerConfigService = class {
41517
+ }, DataFieldDataTypeEnum, CrawlerConfigService = class {
40803
41518
  constructor(client) {
40804
41519
  this.client = client;
40805
41520
  }
@@ -41562,18 +42277,6 @@ var import_debug, __require2, FREEFORM_ASSISTANT_ANSWER_KEY = "_freeform", Kadoa
41562
42277
  }
41563
42278
  return typeof error.message === "string" ? error.message.includes(BUILD_NOT_READY_ERROR) : false;
41564
42279
  }
41565
- }, InboxItemType, knownInboxItemTypes, InboxService = class {
41566
- constructor(inboxApi) {
41567
- this.inboxApi = inboxApi;
41568
- }
41569
- async list() {
41570
- const response = await this.inboxApi.v5InboxList();
41571
- return mapInboxListResponse(response.data);
41572
- }
41573
- async markRead(itemId) {
41574
- const response = await this.inboxApi.v5InboxMarkRead({ itemId });
41575
- return mapInboxMarkReadResponse(response.data);
41576
- }
41577
42280
  }, NotificationChannelType, EMAIL_REGEX, _NotificationChannelsService = class _NotificationChannelsService {
41578
42281
  constructor(notificationsApi, userService) {
41579
42282
  this.api = notificationsApi;
@@ -41900,7 +42603,7 @@ var import_debug, __require2, FREEFORM_ASSISTANT_ANSWER_KEY = "_freeform", Kadoa
41900
42603
  }));
41901
42604
  return channels;
41902
42605
  }
41903
- }, PUBLIC_API_URI, WSS_API_URI, REALTIME_API_URI, SDK_VERSION = "0.41.0", SDK_NAME = "kadoa-node-sdk", SDK_LANGUAGE = "node", debug6, isDrainControlMessage = (message) => message.type === "control.draining", isRealtimeEvent = (message) => message.type !== "heartbeat" && message.type !== "control.draining", _Realtime = class _Realtime {
42606
+ }, PUBLIC_API_URI, WSS_API_URI, REALTIME_API_URI, SDK_VERSION = "0.42.0", SDK_NAME = "kadoa-node-sdk", SDK_LANGUAGE = "node", debug6, isDrainControlMessage = (message) => message.type === "control.draining", isRealtimeEvent = (message) => message.type !== "heartbeat" && message.type !== "control.draining", _Realtime = class _Realtime {
41904
42607
  constructor(config) {
41905
42608
  this.drainingSockets = /* @__PURE__ */ new Set;
41906
42609
  this.lastHeartbeat = Date.now();
@@ -42693,7 +43396,7 @@ var import_debug, __require2, FREEFORM_ASSISTANT_ANSWER_KEY = "_freeform", Kadoa
42693
43396
  variableId
42694
43397
  });
42695
43398
  }
42696
- }, JobStateEnum, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES2, debug9, WorkflowsCoreService = class {
43399
+ }, JobStateEnum, WorkflowStatusFilter, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES2, debug9, WorkflowsCoreService = class {
42697
43400
  constructor(workflowsApi) {
42698
43401
  this.workflowsApi = workflowsApi;
42699
43402
  }
@@ -42948,9 +43651,6 @@ var import_debug, __require2, FREEFORM_ASSISTANT_ANSWER_KEY = "_freeform", Kadoa
42948
43651
  get notifications() {
42949
43652
  return this.get(NotificationsApi);
42950
43653
  }
42951
- get inbox() {
42952
- return this.get(InboxApi);
42953
- }
42954
43654
  get templates() {
42955
43655
  return this.get(TemplatesApi);
42956
43656
  }
@@ -42990,7 +43690,6 @@ var import_debug, __require2, FREEFORM_ASSISTANT_ANSWER_KEY = "_freeform", Kadoa
42990
43690
  this.schema = domains.schema;
42991
43691
  this.scrape = domains.scrape;
42992
43692
  this.notification = domains.notification;
42993
- this.inbox = domains.inbox;
42994
43693
  this.template = domains.template;
42995
43694
  this.validation = domains.validation;
42996
43695
  this.variable = domains.variable;
@@ -43440,14 +44139,6 @@ var init_dist2 = __esm(() => {
43440
44139
  return DataValidationApiFp(this.configuration).v4DataValidationWorkflowsWorkflowIdValidationsLatestGet(requestParameters.workflowId, requestParameters.includeDryRun, options).then((request) => request(this.axios, this.basePath));
43441
44140
  }
43442
44141
  };
43443
- InboxApi = class extends BaseAPI {
43444
- v5InboxList(options) {
43445
- return InboxApiFp(this.configuration).v5InboxList(options).then((request) => request(this.axios, this.basePath));
43446
- }
43447
- v5InboxMarkRead(requestParameters, options) {
43448
- return InboxApiFp(this.configuration).v5InboxMarkRead(requestParameters.itemId, options).then((request) => request(this.axios, this.basePath));
43449
- }
43450
- };
43451
44142
  MeApi = class extends BaseAPI {
43452
44143
  v4MeFeaturesGet(options) {
43453
44144
  return MeApiFp(this.configuration).v4MeFeaturesGet(options).then((request) => request(this.axios, this.basePath));
@@ -43629,7 +44320,7 @@ var init_dist2 = __esm(() => {
43629
44320
  return WorkflowsApiFp(this.configuration).v4WorkflowsBulkPost(requestParameters.v4WorkflowsBulkPostRequest, options).then((request) => request(this.axios, this.basePath));
43630
44321
  }
43631
44322
  v4WorkflowsGet(requestParameters = {}, options) {
43632
- return WorkflowsApiFp(this.configuration).v4WorkflowsGet(requestParameters.search, requestParameters.skip, requestParameters.limit, requestParameters.state, requestParameters.runState, requestParameters.displayState, requestParameters.inSupport, requestParameters.tags, requestParameters.statusFilters, requestParameters.userId, requestParameters.channelId, requestParameters.monitoring, requestParameters.updateInterval, requestParameters.scheduleType, requestParameters.templateId, requestParameters.includeDeleted, requestParameters.format, options).then((request) => request(this.axios, this.basePath));
44323
+ return WorkflowsApiFp(this.configuration).v4WorkflowsGet(requestParameters.search, requestParameters.skip, requestParameters.limit, requestParameters.state, requestParameters.runState, requestParameters.displayState, requestParameters.inSupport, requestParameters.tags, requestParameters.statusFilters, requestParameters.groupWindows, requestParameters.userId, requestParameters.channelId, requestParameters.monitoring, requestParameters.updateInterval, requestParameters.scheduleType, requestParameters.templateId, requestParameters.includeDeleted, requestParameters.format, options).then((request) => request(this.axios, this.basePath));
43633
44324
  }
43634
44325
  v4WorkflowsPost(requestParameters = {}, options) {
43635
44326
  return WorkflowsApiFp(this.configuration).v4WorkflowsPost(requestParameters.createWorkflowBody, options).then((request) => request(this.axios, this.basePath));
@@ -43713,11 +44404,6 @@ var init_dist2 = __esm(() => {
43713
44404
  Object: "OBJECT",
43714
44405
  Array: "ARRAY"
43715
44406
  };
43716
- InboxItemTypeEnum = {
43717
- ShellyQuestion: "shelly_question",
43718
- DataQualityIssues: "data_quality_issues",
43719
- SampleDataReady: "sample_data_ready"
43720
- };
43721
44407
  CanonicalSchemaFieldDataType = {
43722
44408
  String: DataFieldDataTypeEnum.String,
43723
44409
  Number: DataFieldDataTypeEnum.Number,
@@ -43776,16 +44462,6 @@ This is the main page content.`
43776
44462
  };
43777
44463
  debug4 = logger.extraction;
43778
44464
  TERMINAL_RUN_STATES = /* @__PURE__ */ new Set(["FINISHED", "SUCCESS", "FAILED", "ERROR", "STOPPED", "CANCELLED"]);
43779
- InboxItemType = {
43780
- AssistantQuestion: InboxItemTypeEnum.ShellyQuestion,
43781
- DataQualityIssues: InboxItemTypeEnum.DataQualityIssues,
43782
- PreviewDataReady: InboxItemTypeEnum.SampleDataReady
43783
- };
43784
- knownInboxItemTypes = {
43785
- [InboxItemTypeEnum.ShellyQuestion]: InboxItemType.AssistantQuestion,
43786
- [InboxItemTypeEnum.DataQualityIssues]: InboxItemType.DataQualityIssues,
43787
- [InboxItemTypeEnum.SampleDataReady]: InboxItemType.PreviewDataReady
43788
- };
43789
44465
  NotificationChannelType = {
43790
44466
  EMAIL: "EMAIL",
43791
44467
  SLACK: "SLACK",
@@ -43823,6 +44499,15 @@ This is the main page content.`
43823
44499
  NotSupported: "NOT_SUPPORTED",
43824
44500
  FailedInsufficientFunds: "FAILED_INSUFFICIENT_FUNDS"
43825
44501
  };
44502
+ WorkflowStatusFilter = {
44503
+ Attention: "group:attention",
44504
+ Working: "group:working",
44505
+ Support: "group:support",
44506
+ Failed: "group:failed",
44507
+ Active: "group:active",
44508
+ Complete: "group:complete",
44509
+ Paused: "group:paused"
44510
+ };
43826
44511
  TERMINAL_JOB_STATES = /* @__PURE__ */ new Set([
43827
44512
  JobStateEnum.Finished,
43828
44513
  JobStateEnum.Failed,
@@ -43853,7 +44538,7 @@ function isScrapeRequest(url) {
43853
44538
  function createKadoaClient(auth) {
43854
44539
  const { principal } = auth;
43855
44540
  const client = new KadoaClient({
43856
- bearerToken: principal.type === "user" ? principal.supabaseJwt : principal.kadoaAccessToken
44541
+ bearerToken: principal.type === "user" ? principal.supabaseJwt : principal.type === "kadoa" ? principal.accessToken : principal.kadoaAccessToken
43857
44542
  });
43858
44543
  client.axiosInstance.interceptors.request.use((config) => {
43859
44544
  config.headers["x-kadoa-source"] = "mcp";
@@ -44386,6 +45071,16 @@ function registerTools(server, ctx, capabilities) {
44386
45071
  teamId: ctx.principal.teamId
44387
45072
  });
44388
45073
  }
45074
+ if (ctx.principal.type === "kadoa") {
45075
+ const user = await ctx.client.user.getCurrentUser();
45076
+ return jsonResult({
45077
+ email: user.email,
45078
+ authMethod: ctx.principal.actor ? `Kadoa Assistant (delegated via ${ctx.principal.actor.sub})` : "Kadoa access token",
45079
+ teamId: ctx.principal.teamId,
45080
+ ...ctx.principal.teamRole ? { memberRole: ctx.principal.teamRole } : {},
45081
+ scopes: ctx.principal.scopes
45082
+ });
45083
+ }
44389
45084
  const jwt = await getValidJwt(ctx);
44390
45085
  const user = await ctx.client.user.getCurrentUser();
44391
45086
  const teams = await ctx.client.listTeams(jwt ? { bearerToken: jwt } : undefined);
@@ -44720,7 +45415,7 @@ function registerTools(server, ctx, capabilities) {
44720
45415
  monitoring: preprocess(coerceBoolean(), boolean2()).optional().describe("Filter by monitoring/real-time status"),
44721
45416
  updateInterval: _enum(["HOURLY", "DAILY", "WEEKLY", "MONTHLY", "REAL_TIME"]).optional().describe("Filter by scheduled update frequency or realtime workflows"),
44722
45417
  templateId: string2().optional().describe("Filter to workflows instantiated from this template ID"),
44723
- statusFilters: array(_enum(WORKFLOW_STATUS_FILTERS)).optional().describe("Dashboard category filters. group:attention = workflows waiting on the requesting user (Assistant question, unfinished setup, or preview approval). Other groups: working, support, failed, active, complete, paused.")
45418
+ statusFilters: array(_enum(Object.values(WorkflowStatusFilter))).optional().describe("Dashboard category filters. group:attention = workflows waiting on the requesting user (Assistant question, unfinished setup, or preview approval). Other groups: working, support, failed, active, complete, paused.")
44724
45419
  },
44725
45420
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }
44726
45421
  }, withErrorHandling("list_workflows", async (args) => {
@@ -45689,6 +46384,13 @@ function registerTools(server, ctx, capabilities) {
45689
46384
  activeTeamId: ctx.principal.teamId
45690
46385
  });
45691
46386
  }
46387
+ if (ctx.principal.type === "kadoa") {
46388
+ return jsonResult({
46389
+ teams: [{ id: ctx.principal.teamId, active: true }],
46390
+ activeTeamId: ctx.principal.teamId,
46391
+ note: "Team is fixed for this credential; reconnect to switch."
46392
+ });
46393
+ }
45692
46394
  const jwt = await getValidJwt(ctx);
45693
46395
  const teams = await ctx.client.listTeams(jwt ? { bearerToken: jwt } : undefined);
45694
46396
  const activeTeamId = ctx.teamId ?? teams[0]?.id;
@@ -45713,6 +46415,9 @@ function registerTools(server, ctx, capabilities) {
45713
46415
  if (ctx.principal.type === "serviceAccount") {
45714
46416
  return errorResult("This shared organization connector is fixed to one team and cannot switch teams.");
45715
46417
  }
46418
+ if (ctx.principal.type === "kadoa") {
46419
+ return errorResult("team_switch is not available for this credential. Reconnect and choose the team at sign-in.");
46420
+ }
45716
46421
  const jwt = await getValidJwt(ctx);
45717
46422
  const teams = await ctx.client.listTeams({ bearerToken: jwt });
45718
46423
  const identifier = args.teamIdentifier;
@@ -46109,7 +46814,7 @@ function registerTools(server, ctx, capabilities) {
46109
46814
  });
46110
46815
  }));
46111
46816
  }
46112
- var SchemaFieldShape, SchemaValidationAttributionShape, SchemaValidationPresenceRule, SchemaValidationUniquenessRule, SchemaValidationStringLengthRule, SchemaValidationStringFormatRule, SchemaValidationFieldRulesSchema, SchemaValidationRulesSchema, LocationSchema, MonitoringValueOperators, MonitoringValuelessOperators, MonitoringConditionOperatorSchema, MonitoringConditionSchema, MonitoringSchema, WORKFLOW_STATUS_FILTERS, RESUMABLE_ASSISTANT_STATUSES, ACTIVE_ASSISTANT_STATUSES, IDLE_ASSISTANT_STATUSES, CLOSED_ASSISTANT_STATUSES, DASHBOARD_BASE_URL = "https://www.kadoa.com", WORKFLOW_AUDIT_WATCHED_KEYS;
46817
+ var SchemaFieldShape, SchemaValidationAttributionShape, SchemaValidationPresenceRule, SchemaValidationUniquenessRule, SchemaValidationStringLengthRule, SchemaValidationStringFormatRule, SchemaValidationFieldRulesSchema, SchemaValidationRulesSchema, LocationSchema, MonitoringValueOperators, MonitoringValuelessOperators, MonitoringConditionOperatorSchema, MonitoringConditionSchema, MonitoringSchema, RESUMABLE_ASSISTANT_STATUSES, ACTIVE_ASSISTANT_STATUSES, IDLE_ASSISTANT_STATUSES, CLOSED_ASSISTANT_STATUSES, DASHBOARD_BASE_URL = "https://www.kadoa.com", WORKFLOW_AUDIT_WATCHED_KEYS;
46113
46818
  var init_tools = __esm(() => {
46114
46819
  init_dist2();
46115
46820
  init_zod();
@@ -46284,15 +46989,6 @@ var init_tools = __esm(() => {
46284
46989
  conditions: preprocess(coerceArray(), array(MonitoringConditionSchema).min(1))
46285
46990
  }).strict().optional()
46286
46991
  }).strict();
46287
- WORKFLOW_STATUS_FILTERS = [
46288
- "group:attention",
46289
- "group:working",
46290
- "group:support",
46291
- "group:failed",
46292
- "group:active",
46293
- "group:complete",
46294
- "group:paused"
46295
- ];
46296
46992
  RESUMABLE_ASSISTANT_STATUSES = new Set(["pending", "created", "active", "idle", "inactive", "interrupted"]);
46297
46993
  ACTIVE_ASSISTANT_STATUSES = new Set(["pending", "created", "active"]);
46298
46994
  IDLE_ASSISTANT_STATUSES = new Set(["idle", "inactive", "interrupted"]);
@@ -46315,7 +47011,7 @@ var package_default;
46315
47011
  var init_package = __esm(() => {
46316
47012
  package_default = {
46317
47013
  name: "@kadoa/mcp",
46318
- version: "0.5.32",
47014
+ version: "0.6.0-rc.1",
46319
47015
  description: "Kadoa MCP Server — manage workflows from Claude Desktop, Cursor, and other MCP clients",
46320
47016
  type: "module",
46321
47017
  main: "dist/index.js",
@@ -46339,7 +47035,7 @@ var init_package = __esm(() => {
46339
47035
  prepublishOnly: "bun run check-types && bun run test:unit && bun run build"
46340
47036
  },
46341
47037
  dependencies: {
46342
- "@kadoa/node-sdk": "^0.41.0",
47038
+ "@kadoa/node-sdk": "^0.42.0",
46343
47039
  "@modelcontextprotocol/sdk": "^1.26.0",
46344
47040
  express: "^5.2.1",
46345
47041
  "express-rate-limit": "^8.2.1",
@@ -50429,8 +51125,12 @@ function randomToken(bytes = 32) {
50429
51125
  return randomBytes(bytes).toString("hex");
50430
51126
  }
50431
51127
  function readPrincipal(entry) {
50432
- if (entry.principal)
51128
+ if (entry.principal) {
51129
+ if (entry.principal.type === "kadoa") {
51130
+ throw new InvalidTokenError("Stored token has no valid principal");
51131
+ }
50433
51132
  return entry.principal;
51133
+ }
50434
51134
  if (entry.supabaseJwt && entry.supabaseRefreshToken) {
50435
51135
  return {
50436
51136
  type: "user",
@@ -50442,6 +51142,9 @@ function readPrincipal(entry) {
50442
51142
  throw new InvalidTokenError("Stored token has no valid principal");
50443
51143
  }
50444
51144
  function persistPrincipal(principal) {
51145
+ if (principal.type === "kadoa") {
51146
+ throw new InvalidTokenError("Stored token has no valid principal");
51147
+ }
50445
51148
  if (principal.type === "serviceAccount") {
50446
51149
  return { principal, teamId: principal.teamId };
50447
51150
  }
@@ -50867,6 +51570,9 @@ class KadoaOAuthProvider {
50867
51570
  const persistedEntry = entry;
50868
51571
  await this.store.del("refresh_tokens", refreshToken);
50869
51572
  const storedPrincipal = readPrincipal(persistedEntry);
51573
+ if (storedPrincipal.type === "kadoa") {
51574
+ throw new InvalidTokenError("Stored token has no valid principal");
51575
+ }
50870
51576
  if (storedPrincipal.type === "serviceAccount") {
50871
51577
  const newAccessToken = randomToken();
50872
51578
  const newRefreshToken = randomToken();
@@ -51668,6 +52374,179 @@ var init_managed_token_handler = __esm(() => {
51668
52374
  init_managed_connector_registry();
51669
52375
  });
51670
52376
 
52377
+ // src/kadoa-access-token.ts
52378
+ import { createPublicKey, verify } from "node:crypto";
52379
+ function loadKadoaAccessTokenVerifierConfig(env = process.env) {
52380
+ const issuer = env.MCP_AUTH_ISSUER?.trim();
52381
+ const jwksUrl = env.MCP_AUTH_JWKS_URL?.trim();
52382
+ const audience = env.MCP_AUTH_AUDIENCE?.trim();
52383
+ if (!issuer || !jwksUrl || !audience)
52384
+ return;
52385
+ return { issuer, jwksUrl, audience };
52386
+ }
52387
+ function decodeSegment(segment, label) {
52388
+ try {
52389
+ const value = JSON.parse(Buffer.from(segment, "base64url").toString("utf8"));
52390
+ if (!value || typeof value !== "object" || Array.isArray(value))
52391
+ throw new Error("not an object");
52392
+ return value;
52393
+ } catch {
52394
+ throw new KadoaAccessTokenError(`Kadoa access token ${label} is malformed`);
52395
+ }
52396
+ }
52397
+ function isJwtShaped(token) {
52398
+ const parts = token.split(".");
52399
+ if (parts.length !== 3 || parts.some((part) => !part))
52400
+ return false;
52401
+ try {
52402
+ const header = decodeSegment(parts[0], "header");
52403
+ return header.alg === "RS256";
52404
+ } catch {
52405
+ return false;
52406
+ }
52407
+ }
52408
+
52409
+ class KadoaAccessTokenVerifier {
52410
+ config;
52411
+ keys = new Map;
52412
+ fetchedAt = 0;
52413
+ lastUnknownKidRefetchAt = 0;
52414
+ inFlightRefresh;
52415
+ fetchImpl;
52416
+ cacheTtlMs;
52417
+ now;
52418
+ constructor(config, options = {}) {
52419
+ this.config = config;
52420
+ this.fetchImpl = options.fetchImpl ?? fetch;
52421
+ this.cacheTtlMs = options.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;
52422
+ this.now = options.now ?? (() => Date.now());
52423
+ }
52424
+ refreshKeys() {
52425
+ if (this.inFlightRefresh)
52426
+ return this.inFlightRefresh;
52427
+ const run = this.doRefreshKeys().finally(() => {
52428
+ this.inFlightRefresh = undefined;
52429
+ });
52430
+ this.inFlightRefresh = run;
52431
+ return run;
52432
+ }
52433
+ async doRefreshKeys() {
52434
+ let response;
52435
+ try {
52436
+ response = await this.fetchImpl(this.config.jwksUrl, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS) });
52437
+ } catch (error) {
52438
+ if (error instanceof Error && error.name === "TimeoutError") {
52439
+ throw new KadoaAccessTokenError("JWKS fetch timed out");
52440
+ }
52441
+ throw new KadoaAccessTokenError(`JWKS fetch failed: ${error instanceof Error ? error.message : String(error)}`);
52442
+ }
52443
+ if (!response.ok)
52444
+ throw new KadoaAccessTokenError(`JWKS fetch returned HTTP ${response.status}`);
52445
+ const body = await response.json();
52446
+ if (!Array.isArray(body.keys))
52447
+ throw new KadoaAccessTokenError("JWKS response has no keys");
52448
+ const next = new Map;
52449
+ for (const key of body.keys) {
52450
+ if (typeof key.kid !== "string" || key.kty !== "RSA")
52451
+ continue;
52452
+ if (key.use !== undefined && key.use !== "sig")
52453
+ continue;
52454
+ if (key.alg !== undefined && key.alg !== "RS256")
52455
+ continue;
52456
+ try {
52457
+ next.set(key.kid, createPublicKey({ key, format: "jwk" }));
52458
+ } catch {}
52459
+ }
52460
+ this.keys = next;
52461
+ this.fetchedAt = this.now();
52462
+ }
52463
+ async keyFor(kid) {
52464
+ const stale = this.now() - this.fetchedAt > this.cacheTtlMs;
52465
+ if (stale || this.keys.size === 0)
52466
+ await this.refreshKeys();
52467
+ let key = this.keys.get(kid);
52468
+ if (!key && !stale) {
52469
+ const nowMs = this.now();
52470
+ if (nowMs - this.lastUnknownKidRefetchAt >= UNKNOWN_KID_REFETCH_INTERVAL_MS) {
52471
+ this.lastUnknownKidRefetchAt = nowMs;
52472
+ await this.refreshKeys();
52473
+ key = this.keys.get(kid);
52474
+ }
52475
+ }
52476
+ if (!key)
52477
+ throw new KadoaAccessTokenError("Kadoa access token signing key is not recognized");
52478
+ return key;
52479
+ }
52480
+ async verify(token) {
52481
+ const parts = token.split(".");
52482
+ if (parts.length !== 3 || parts.some((part) => !part))
52483
+ throw new KadoaAccessTokenError("Kadoa access token is malformed");
52484
+ const header = decodeSegment(parts[0], "header");
52485
+ if (header.alg !== "RS256")
52486
+ throw new KadoaAccessTokenError("Kadoa access token alg must be RS256");
52487
+ if (typeof header.kid !== "string" || !header.kid)
52488
+ throw new KadoaAccessTokenError("Kadoa access token signing key is missing");
52489
+ const key = await this.keyFor(header.kid);
52490
+ const signed = Buffer.from(`${parts[0]}.${parts[1]}`);
52491
+ const signature = Buffer.from(parts[2], "base64url");
52492
+ if (!signature.length || !verify("RSA-SHA256", signed, key, signature)) {
52493
+ throw new KadoaAccessTokenError("Kadoa access token signature is invalid");
52494
+ }
52495
+ const claims = decodeSegment(parts[1], "claims");
52496
+ const nowSeconds = Math.floor(this.now() / 1000);
52497
+ if (claims.iss !== this.config.issuer)
52498
+ throw new KadoaAccessTokenError("Kadoa access token issuer is invalid");
52499
+ const audiences = Array.isArray(claims.aud) ? claims.aud : [claims.aud];
52500
+ if (!audiences.includes(this.config.audience))
52501
+ throw new KadoaAccessTokenError("Kadoa access token audience is invalid");
52502
+ if (typeof claims.exp !== "number" || claims.exp <= nowSeconds)
52503
+ throw new KadoaAccessTokenError("Kadoa access token has expired");
52504
+ if (typeof claims.iat !== "number" || claims.iat > nowSeconds + CLOCK_SKEW_SECONDS) {
52505
+ throw new KadoaAccessTokenError("Kadoa access token issued-at is invalid");
52506
+ }
52507
+ if (typeof claims.nbf === "number" && claims.nbf > nowSeconds + CLOCK_SKEW_SECONDS) {
52508
+ throw new KadoaAccessTokenError("Kadoa access token is not yet valid");
52509
+ }
52510
+ if (claims.purpose !== KADOA_ACCESS_TOKEN_PURPOSE)
52511
+ throw new KadoaAccessTokenError("Kadoa access token purpose is invalid");
52512
+ if (typeof claims.sub !== "string" || !UUID_PATTERN.test(claims.sub))
52513
+ throw new KadoaAccessTokenError("Kadoa access token subject is invalid");
52514
+ if (typeof claims.active_team_id !== "string" || !UUID_PATTERN.test(claims.active_team_id)) {
52515
+ throw new KadoaAccessTokenError("Kadoa access token active_team_id is invalid");
52516
+ }
52517
+ let actor;
52518
+ if (claims.act !== undefined) {
52519
+ const act = claims.act;
52520
+ if (typeof act?.sub !== "string" || typeof act?.session_id !== "string" || !UUID_PATTERN.test(act.session_id)) {
52521
+ throw new KadoaAccessTokenError("Kadoa access token actor claim is malformed");
52522
+ }
52523
+ actor = { sub: act.sub, sessionId: act.session_id };
52524
+ }
52525
+ return {
52526
+ type: "kadoa",
52527
+ userId: claims.sub,
52528
+ teamId: claims.active_team_id,
52529
+ ...typeof claims.team_role === "string" ? { teamRole: claims.team_role } : {},
52530
+ scopes: typeof claims.scope === "string" ? claims.scope.split(" ").filter(Boolean) : [],
52531
+ ...actor ? { actor } : {},
52532
+ accessToken: token,
52533
+ expiresAt: claims.exp
52534
+ };
52535
+ }
52536
+ }
52537
+ var UUID_PATTERN, CLOCK_SKEW_SECONDS = 30, DEFAULT_CACHE_TTL_MS, UNKNOWN_KID_REFETCH_INTERVAL_MS, JWKS_FETCH_TIMEOUT_MS = 5000, KADOA_ACCESS_TOKEN_PURPOSE = "kadoa-mcp", KadoaAccessTokenError;
52538
+ var init_kadoa_access_token = __esm(() => {
52539
+ UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
52540
+ DEFAULT_CACHE_TTL_MS = 10 * 60 * 1000;
52541
+ UNKNOWN_KID_REFETCH_INTERVAL_MS = 60 * 1000;
52542
+ KadoaAccessTokenError = class KadoaAccessTokenError extends Error {
52543
+ constructor(message) {
52544
+ super(message);
52545
+ this.name = "KadoaAccessTokenError";
52546
+ }
52547
+ };
52548
+ });
52549
+
51671
52550
  // src/http.ts
51672
52551
  import express8 from "express";
51673
52552
  function jwtClaims2(jwt) {
@@ -51691,6 +52570,9 @@ function resolveAuth(req) {
51691
52570
  }
51692
52571
  return { principal, mcpToken: req.auth.token };
51693
52572
  }
52573
+ if (principal.type === "kadoa") {
52574
+ return { principal, mcpToken: req.auth.token };
52575
+ }
51694
52576
  if (principal.type === "user") {
51695
52577
  const claims = jwtClaims2(principal.supabaseJwt);
51696
52578
  if (!claims.sub) {
@@ -51719,6 +52601,11 @@ async function startHttpServer(options) {
51719
52601
  const managedRegistry = options?.managedRegistry ?? (process.env.MCP_REGISTRY_SERVICE_TOKEN ? new ManagedConnectorRegistry : undefined);
51720
52602
  const provider = new KadoaOAuthProvider(store, managedRegistry);
51721
52603
  const serverUrl = process.env.MCP_SERVER_URL || `http://localhost:${port}`;
52604
+ const verifierConfig = loadKadoaAccessTokenVerifierConfig();
52605
+ const kadoaTokenVerifier = options?.kadoaTokenVerifier ?? (verifierConfig ? new KadoaAccessTokenVerifier(verifierConfig) : undefined);
52606
+ if (!kadoaTokenVerifier) {
52607
+ console.warn("[AUTH] Kadoa access-token verifier disabled (MCP_AUTH_ISSUER, MCP_AUTH_JWKS_URL, MCP_AUTH_AUDIENCE unset); RS256 bearers will be rejected");
52608
+ }
51722
52609
  app.post("/token", express8.urlencoded({ extended: false }), rate_limit_default({
51723
52610
  windowMs: 15 * 60 * 1000,
51724
52611
  limit: 50,
@@ -51757,7 +52644,41 @@ async function startHttpServer(options) {
51757
52644
  redis: store.isConnected() ? "connected" : "fallback"
51758
52645
  });
51759
52646
  });
51760
- const bearerAuth = requireBearerAuth({ verifier: provider });
52647
+ const oauthBearerAuth = requireBearerAuth({ verifier: provider });
52648
+ const bearerAuth = async (req, res, next) => {
52649
+ const match = req.header("authorization")?.match(/^Bearer ([^\s]+)$/i);
52650
+ const token = match?.[1];
52651
+ if (!token || !isJwtShaped(token))
52652
+ return oauthBearerAuth(req, res, next);
52653
+ if (!kadoaTokenVerifier) {
52654
+ res.status(401).json({
52655
+ jsonrpc: "2.0",
52656
+ error: { code: -32001, message: "Unauthorized: Kadoa access tokens are not accepted by this server" },
52657
+ id: req.body?.id ?? null
52658
+ });
52659
+ return;
52660
+ }
52661
+ try {
52662
+ const principal = await kadoaTokenVerifier.verify(token);
52663
+ req.auth = {
52664
+ token,
52665
+ clientId: principal.actor ? `kadoa-delegated:${principal.actor.sub}` : "kadoa-access-token",
52666
+ scopes: principal.scopes,
52667
+ expiresAt: principal.expiresAt,
52668
+ extra: { principal, teamId: principal.teamId }
52669
+ };
52670
+ next();
52671
+ } catch (error) {
52672
+ const message = error instanceof KadoaAccessTokenError ? error.message : "Kadoa access token rejected";
52673
+ console.error(`[AUTH] KADOA_TOKEN_FAIL: ${message}`);
52674
+ const publicMessage = message.startsWith("JWKS") ? "Kadoa access token could not be verified" : message;
52675
+ res.status(401).json({
52676
+ jsonrpc: "2.0",
52677
+ error: { code: -32001, message: `Unauthorized: ${publicMessage}` },
52678
+ id: req.body?.id ?? null
52679
+ });
52680
+ }
52681
+ };
51761
52682
  app.post("/mcp", bearerAuth, async (req, res) => {
51762
52683
  const auth = resolveAuth(req);
51763
52684
  const method = req.body?.method ?? "unknown";
@@ -51771,7 +52692,8 @@ async function startHttpServer(options) {
51771
52692
  return;
51772
52693
  }
51773
52694
  let principal = auth.principal;
51774
- const identity = `mode=${principal.type}:team=${principal.teamId.slice(0, 8)}...`;
52695
+ const delegatedSession = principal.type === "kadoa" && principal.actor ? `:session=${principal.actor.sessionId}` : "";
52696
+ const identity = `mode=${principal.type}:team=${principal.teamId.slice(0, 8)}...${delegatedSession}`;
51775
52697
  if (principal.type === "user" && isJwtExpired(principal.supabaseJwt)) {
51776
52698
  try {
51777
52699
  const refreshed = await refreshSupabaseJwtRaw(principal.supabaseRefreshToken);
@@ -51892,6 +52814,7 @@ var init_http2 = __esm(async () => {
51892
52814
  init_managed_connector_client();
51893
52815
  init_managed_connector_registry();
51894
52816
  init_managed_token_handler();
52817
+ init_kadoa_access_token();
51895
52818
  await init_src();
51896
52819
  });
51897
52820
 
@@ -51946,11 +52869,24 @@ async function createServer(auth, options) {
51946
52869
  }
51947
52870
  }
51948
52871
  registerTools(server, ctx, capabilities);
52872
+ if (principal.type === "kadoa") {
52873
+ const hidden = new Set(["team_switch"]);
52874
+ const rawServer = server.server;
52875
+ const baseHandler = rawServer._requestHandlers.get("tools/list");
52876
+ if (!baseHandler) {
52877
+ throw new Error("SDK tools/list handler not found; cannot hide team_switch");
52878
+ }
52879
+ server.server.setRequestHandler(ListToolsRequestSchema2, async (request, extra) => {
52880
+ const result = await baseHandler(request, extra);
52881
+ return { ...result, tools: result.tools.filter((tool) => !hidden.has(tool.name)) };
52882
+ });
52883
+ }
51949
52884
  server.server.onerror = (error) => console.error("[MCP Error]", safeErrorSummary(error));
51950
52885
  return server;
51951
52886
  }
51952
52887
  var init_src = __esm(async () => {
51953
52888
  init_mcp();
52889
+ init_types3();
51954
52890
  init_client();
51955
52891
  init_tools();
51956
52892
  init_package();