@workglow/util 0.0.117 → 0.0.119
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/browser.js +148 -76
- package/dist/browser.js.map +5 -5
- package/dist/bun.js +165 -93
- package/dist/bun.js.map +5 -5
- package/dist/json-schema/JsonSchema.d.ts +2 -0
- package/dist/json-schema/JsonSchema.d.ts.map +1 -1
- package/dist/mcp/McpAuthProvider.d.ts +3 -0
- package/dist/mcp/McpAuthProvider.d.ts.map +1 -1
- package/dist/mcp/McpAuthTypes.d.ts +154 -62
- package/dist/mcp/McpAuthTypes.d.ts.map +1 -1
- package/dist/mcp/McpClientUtil.browser.d.ts +168 -74
- package/dist/mcp/McpClientUtil.browser.d.ts.map +1 -1
- package/dist/mcp/McpClientUtil.node.d.ts +185 -91
- package/dist/mcp/McpClientUtil.node.d.ts.map +1 -1
- package/dist/node.js +165 -93
- package/dist/node.js.map +5 -5
- package/package.json +1 -1
package/dist/bun.js
CHANGED
|
@@ -2580,69 +2580,136 @@ var mcpAuthTypes = [
|
|
|
2580
2580
|
"authorization_code"
|
|
2581
2581
|
];
|
|
2582
2582
|
var mcpAuthConfigSchema = {
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2583
|
+
properties: {
|
|
2584
|
+
auth_type: {
|
|
2585
|
+
type: "string",
|
|
2586
|
+
enum: mcpAuthTypes,
|
|
2587
|
+
title: "Auth Type",
|
|
2588
|
+
description: "Authentication method for connecting to the MCP server",
|
|
2589
|
+
default: "none"
|
|
2590
|
+
},
|
|
2591
|
+
auth_token: {
|
|
2592
|
+
type: "string",
|
|
2593
|
+
format: "credential",
|
|
2594
|
+
title: "Bearer Token",
|
|
2595
|
+
description: "Static bearer token or API key (for bearer auth)"
|
|
2596
|
+
},
|
|
2597
|
+
auth_client_id: {
|
|
2598
|
+
type: "string",
|
|
2599
|
+
title: "Client ID",
|
|
2600
|
+
description: "OAuth client ID (for OAuth auth types)"
|
|
2601
|
+
},
|
|
2602
|
+
auth_client_secret: {
|
|
2603
|
+
type: "string",
|
|
2604
|
+
format: "credential",
|
|
2605
|
+
title: "Client Secret",
|
|
2606
|
+
description: "OAuth client secret (for client_credentials auth)"
|
|
2607
|
+
},
|
|
2608
|
+
auth_private_key: {
|
|
2609
|
+
type: "string",
|
|
2610
|
+
format: "credential",
|
|
2611
|
+
title: "Private Key",
|
|
2612
|
+
description: "PEM or JWK private key (for private_key_jwt auth)"
|
|
2613
|
+
},
|
|
2614
|
+
auth_algorithm: {
|
|
2615
|
+
type: "string",
|
|
2616
|
+
title: "Algorithm",
|
|
2617
|
+
description: "JWT signing algorithm, e.g. RS256, ES256 (for private_key_jwt auth)"
|
|
2618
|
+
},
|
|
2619
|
+
auth_jwt_bearer_assertion: {
|
|
2620
|
+
type: "string",
|
|
2621
|
+
format: "credential",
|
|
2622
|
+
title: "JWT Assertion",
|
|
2623
|
+
description: "Pre-built JWT assertion (for static_private_key_jwt auth)"
|
|
2624
|
+
},
|
|
2625
|
+
auth_redirect_url: {
|
|
2626
|
+
type: "string",
|
|
2627
|
+
format: "uri",
|
|
2628
|
+
title: "Redirect URL",
|
|
2629
|
+
description: "OAuth redirect URL (for authorization_code auth)"
|
|
2630
|
+
},
|
|
2631
|
+
auth_scope: {
|
|
2632
|
+
type: "string",
|
|
2633
|
+
title: "Scope",
|
|
2634
|
+
description: "OAuth scope (space-separated)"
|
|
2635
|
+
},
|
|
2636
|
+
auth_client_name: {
|
|
2637
|
+
type: "string",
|
|
2638
|
+
title: "Client Name",
|
|
2639
|
+
description: "Optional OAuth client display name"
|
|
2640
|
+
},
|
|
2641
|
+
auth_jwt_lifetime_seconds: {
|
|
2642
|
+
type: "number",
|
|
2643
|
+
title: "JWT Lifetime",
|
|
2644
|
+
description: "JWT lifetime in seconds (default: 300)",
|
|
2645
|
+
minimum: 1
|
|
2646
|
+
}
|
|
2639
2647
|
},
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2648
|
+
allOf: [
|
|
2649
|
+
{
|
|
2650
|
+
if: { properties: { auth_type: { const: "bearer" } }, required: ["auth_type"] },
|
|
2651
|
+
then: {
|
|
2652
|
+
required: ["auth_token"],
|
|
2653
|
+
properties: { auth_token: true }
|
|
2654
|
+
}
|
|
2655
|
+
},
|
|
2656
|
+
{
|
|
2657
|
+
if: {
|
|
2658
|
+
properties: { auth_type: { const: "client_credentials" } },
|
|
2659
|
+
required: ["auth_type"]
|
|
2660
|
+
},
|
|
2661
|
+
then: {
|
|
2662
|
+
required: ["auth_client_id", "auth_client_secret"],
|
|
2663
|
+
properties: {
|
|
2664
|
+
auth_client_id: true,
|
|
2665
|
+
auth_client_secret: true,
|
|
2666
|
+
auth_client_name: true,
|
|
2667
|
+
auth_scope: true
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
},
|
|
2671
|
+
{
|
|
2672
|
+
if: { properties: { auth_type: { const: "private_key_jwt" } }, required: ["auth_type"] },
|
|
2673
|
+
then: {
|
|
2674
|
+
required: ["auth_client_id", "auth_private_key", "auth_algorithm"],
|
|
2675
|
+
properties: {
|
|
2676
|
+
auth_client_id: true,
|
|
2677
|
+
auth_private_key: true,
|
|
2678
|
+
auth_algorithm: true,
|
|
2679
|
+
auth_client_name: true,
|
|
2680
|
+
auth_jwt_lifetime_seconds: true,
|
|
2681
|
+
auth_scope: true
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
},
|
|
2685
|
+
{
|
|
2686
|
+
if: {
|
|
2687
|
+
properties: { auth_type: { const: "static_private_key_jwt" } },
|
|
2688
|
+
required: ["auth_type"]
|
|
2689
|
+
},
|
|
2690
|
+
then: {
|
|
2691
|
+
required: ["auth_client_id", "auth_jwt_bearer_assertion"],
|
|
2692
|
+
properties: {
|
|
2693
|
+
auth_client_id: true,
|
|
2694
|
+
auth_jwt_bearer_assertion: true,
|
|
2695
|
+
auth_client_name: true,
|
|
2696
|
+
auth_scope: true
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
},
|
|
2700
|
+
{
|
|
2701
|
+
if: { properties: { auth_type: { const: "authorization_code" } }, required: ["auth_type"] },
|
|
2702
|
+
then: {
|
|
2703
|
+
required: ["auth_client_id", "auth_redirect_url"],
|
|
2704
|
+
properties: {
|
|
2705
|
+
auth_client_id: true,
|
|
2706
|
+
auth_client_secret: true,
|
|
2707
|
+
auth_redirect_url: true,
|
|
2708
|
+
auth_scope: true
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
]
|
|
2646
2713
|
};
|
|
2647
2714
|
function isMcpAuthType(value) {
|
|
2648
2715
|
return typeof value === "string" && mcpAuthTypes.includes(value);
|
|
@@ -2735,6 +2802,7 @@ import {
|
|
|
2735
2802
|
StaticPrivateKeyJwtProvider,
|
|
2736
2803
|
createPrivateKeyJwtAuth
|
|
2737
2804
|
} from "@modelcontextprotocol/sdk/client/auth-extensions.js";
|
|
2805
|
+
import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
2738
2806
|
function normalizeServerUrl(serverUrl) {
|
|
2739
2807
|
try {
|
|
2740
2808
|
const u = new URL(serverUrl);
|
|
@@ -3193,36 +3261,39 @@ import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
|
3193
3261
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
3194
3262
|
var mcpTransportTypes = ["stdio", "sse", "streamable-http"];
|
|
3195
3263
|
var mcpServerConfigSchema = {
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3264
|
+
properties: {
|
|
3265
|
+
transport: {
|
|
3266
|
+
type: "string",
|
|
3267
|
+
enum: mcpTransportTypes,
|
|
3268
|
+
title: "Transport",
|
|
3269
|
+
description: "The transport type to use for connecting to the MCP server"
|
|
3270
|
+
},
|
|
3271
|
+
server_url: {
|
|
3272
|
+
type: "string",
|
|
3273
|
+
format: "string:uri",
|
|
3274
|
+
title: "Server URL",
|
|
3275
|
+
description: "The URL of the MCP server (for sse and streamable-http transports)"
|
|
3276
|
+
},
|
|
3277
|
+
command: {
|
|
3278
|
+
type: "string",
|
|
3279
|
+
title: "Command",
|
|
3280
|
+
description: "The command to run (for stdio transport)"
|
|
3281
|
+
},
|
|
3282
|
+
args: {
|
|
3283
|
+
type: "array",
|
|
3284
|
+
items: { type: "string" },
|
|
3285
|
+
title: "Arguments",
|
|
3286
|
+
description: "Command arguments (for stdio transport)"
|
|
3287
|
+
},
|
|
3288
|
+
env: {
|
|
3289
|
+
type: "object",
|
|
3290
|
+
additionalProperties: { type: "string" },
|
|
3291
|
+
title: "Environment",
|
|
3292
|
+
description: "Environment variables (for stdio transport)"
|
|
3293
|
+
},
|
|
3294
|
+
...mcpAuthConfigSchema.properties
|
|
3224
3295
|
},
|
|
3225
|
-
|
|
3296
|
+
allOf: mcpAuthConfigSchema.allOf
|
|
3226
3297
|
};
|
|
3227
3298
|
async function createMcpClient(config, signal) {
|
|
3228
3299
|
let transport;
|
|
@@ -3230,7 +3301,7 @@ async function createMcpClient(config, signal) {
|
|
|
3230
3301
|
if (auth && auth.type !== "none") {
|
|
3231
3302
|
auth = await resolveAuthSecrets(auth, getGlobalCredentialStore());
|
|
3232
3303
|
}
|
|
3233
|
-
const authProvider = auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore()) : undefined;
|
|
3304
|
+
const authProvider = config.authProvider ?? (auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore()) : undefined);
|
|
3234
3305
|
const headers = {
|
|
3235
3306
|
...auth?.type === "bearer" ? { Authorization: `Bearer ${auth.token}` } : {}
|
|
3236
3307
|
};
|
|
@@ -3384,6 +3455,7 @@ export {
|
|
|
3384
3455
|
Worker,
|
|
3385
3456
|
WORKER_SERVER,
|
|
3386
3457
|
WORKER_MANAGER,
|
|
3458
|
+
UnauthorizedError,
|
|
3387
3459
|
TypedArraySchema,
|
|
3388
3460
|
TensorType,
|
|
3389
3461
|
TensorSchema,
|
|
@@ -3414,4 +3486,4 @@ export {
|
|
|
3414
3486
|
BaseError
|
|
3415
3487
|
};
|
|
3416
3488
|
|
|
3417
|
-
//# debugId=
|
|
3489
|
+
//# debugId=0CE726CD0D1049FD64756E2164756E21
|