@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/browser.js
CHANGED
|
@@ -2579,69 +2579,136 @@ var mcpAuthTypes = [
|
|
|
2579
2579
|
"authorization_code"
|
|
2580
2580
|
];
|
|
2581
2581
|
var mcpAuthConfigSchema = {
|
|
2582
|
-
|
|
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
|
-
|
|
2582
|
+
properties: {
|
|
2583
|
+
auth_type: {
|
|
2584
|
+
type: "string",
|
|
2585
|
+
enum: mcpAuthTypes,
|
|
2586
|
+
title: "Auth Type",
|
|
2587
|
+
description: "Authentication method for connecting to the MCP server",
|
|
2588
|
+
default: "none"
|
|
2589
|
+
},
|
|
2590
|
+
auth_token: {
|
|
2591
|
+
type: "string",
|
|
2592
|
+
format: "credential",
|
|
2593
|
+
title: "Bearer Token",
|
|
2594
|
+
description: "Static bearer token or API key (for bearer auth)"
|
|
2595
|
+
},
|
|
2596
|
+
auth_client_id: {
|
|
2597
|
+
type: "string",
|
|
2598
|
+
title: "Client ID",
|
|
2599
|
+
description: "OAuth client ID (for OAuth auth types)"
|
|
2600
|
+
},
|
|
2601
|
+
auth_client_secret: {
|
|
2602
|
+
type: "string",
|
|
2603
|
+
format: "credential",
|
|
2604
|
+
title: "Client Secret",
|
|
2605
|
+
description: "OAuth client secret (for client_credentials auth)"
|
|
2606
|
+
},
|
|
2607
|
+
auth_private_key: {
|
|
2608
|
+
type: "string",
|
|
2609
|
+
format: "credential",
|
|
2610
|
+
title: "Private Key",
|
|
2611
|
+
description: "PEM or JWK private key (for private_key_jwt auth)"
|
|
2612
|
+
},
|
|
2613
|
+
auth_algorithm: {
|
|
2614
|
+
type: "string",
|
|
2615
|
+
title: "Algorithm",
|
|
2616
|
+
description: "JWT signing algorithm, e.g. RS256, ES256 (for private_key_jwt auth)"
|
|
2617
|
+
},
|
|
2618
|
+
auth_jwt_bearer_assertion: {
|
|
2619
|
+
type: "string",
|
|
2620
|
+
format: "credential",
|
|
2621
|
+
title: "JWT Assertion",
|
|
2622
|
+
description: "Pre-built JWT assertion (for static_private_key_jwt auth)"
|
|
2623
|
+
},
|
|
2624
|
+
auth_redirect_url: {
|
|
2625
|
+
type: "string",
|
|
2626
|
+
format: "uri",
|
|
2627
|
+
title: "Redirect URL",
|
|
2628
|
+
description: "OAuth redirect URL (for authorization_code auth)"
|
|
2629
|
+
},
|
|
2630
|
+
auth_scope: {
|
|
2631
|
+
type: "string",
|
|
2632
|
+
title: "Scope",
|
|
2633
|
+
description: "OAuth scope (space-separated)"
|
|
2634
|
+
},
|
|
2635
|
+
auth_client_name: {
|
|
2636
|
+
type: "string",
|
|
2637
|
+
title: "Client Name",
|
|
2638
|
+
description: "Optional OAuth client display name"
|
|
2639
|
+
},
|
|
2640
|
+
auth_jwt_lifetime_seconds: {
|
|
2641
|
+
type: "number",
|
|
2642
|
+
title: "JWT Lifetime",
|
|
2643
|
+
description: "JWT lifetime in seconds (default: 300)",
|
|
2644
|
+
minimum: 1
|
|
2645
|
+
}
|
|
2638
2646
|
},
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2647
|
+
allOf: [
|
|
2648
|
+
{
|
|
2649
|
+
if: { properties: { auth_type: { const: "bearer" } }, required: ["auth_type"] },
|
|
2650
|
+
then: {
|
|
2651
|
+
required: ["auth_token"],
|
|
2652
|
+
properties: { auth_token: true }
|
|
2653
|
+
}
|
|
2654
|
+
},
|
|
2655
|
+
{
|
|
2656
|
+
if: {
|
|
2657
|
+
properties: { auth_type: { const: "client_credentials" } },
|
|
2658
|
+
required: ["auth_type"]
|
|
2659
|
+
},
|
|
2660
|
+
then: {
|
|
2661
|
+
required: ["auth_client_id", "auth_client_secret"],
|
|
2662
|
+
properties: {
|
|
2663
|
+
auth_client_id: true,
|
|
2664
|
+
auth_client_secret: true,
|
|
2665
|
+
auth_client_name: true,
|
|
2666
|
+
auth_scope: true
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
},
|
|
2670
|
+
{
|
|
2671
|
+
if: { properties: { auth_type: { const: "private_key_jwt" } }, required: ["auth_type"] },
|
|
2672
|
+
then: {
|
|
2673
|
+
required: ["auth_client_id", "auth_private_key", "auth_algorithm"],
|
|
2674
|
+
properties: {
|
|
2675
|
+
auth_client_id: true,
|
|
2676
|
+
auth_private_key: true,
|
|
2677
|
+
auth_algorithm: true,
|
|
2678
|
+
auth_client_name: true,
|
|
2679
|
+
auth_jwt_lifetime_seconds: true,
|
|
2680
|
+
auth_scope: true
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
},
|
|
2684
|
+
{
|
|
2685
|
+
if: {
|
|
2686
|
+
properties: { auth_type: { const: "static_private_key_jwt" } },
|
|
2687
|
+
required: ["auth_type"]
|
|
2688
|
+
},
|
|
2689
|
+
then: {
|
|
2690
|
+
required: ["auth_client_id", "auth_jwt_bearer_assertion"],
|
|
2691
|
+
properties: {
|
|
2692
|
+
auth_client_id: true,
|
|
2693
|
+
auth_jwt_bearer_assertion: true,
|
|
2694
|
+
auth_client_name: true,
|
|
2695
|
+
auth_scope: true
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
},
|
|
2699
|
+
{
|
|
2700
|
+
if: { properties: { auth_type: { const: "authorization_code" } }, required: ["auth_type"] },
|
|
2701
|
+
then: {
|
|
2702
|
+
required: ["auth_client_id", "auth_redirect_url"],
|
|
2703
|
+
properties: {
|
|
2704
|
+
auth_client_id: true,
|
|
2705
|
+
auth_client_secret: true,
|
|
2706
|
+
auth_redirect_url: true,
|
|
2707
|
+
auth_scope: true
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2711
|
+
]
|
|
2645
2712
|
};
|
|
2646
2713
|
function isMcpAuthType(value) {
|
|
2647
2714
|
return typeof value === "string" && mcpAuthTypes.includes(value);
|
|
@@ -2734,6 +2801,7 @@ import {
|
|
|
2734
2801
|
StaticPrivateKeyJwtProvider,
|
|
2735
2802
|
createPrivateKeyJwtAuth
|
|
2736
2803
|
} from "@modelcontextprotocol/sdk/client/auth-extensions.js";
|
|
2804
|
+
import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
2737
2805
|
function normalizeServerUrl(serverUrl) {
|
|
2738
2806
|
try {
|
|
2739
2807
|
const u = new URL(serverUrl);
|
|
@@ -3184,19 +3252,22 @@ import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
|
3184
3252
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
3185
3253
|
var mcpTransportTypes = ["streamable-http", "sse"];
|
|
3186
3254
|
var mcpServerConfigSchema = {
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3255
|
+
properties: {
|
|
3256
|
+
transport: {
|
|
3257
|
+
type: "string",
|
|
3258
|
+
enum: mcpTransportTypes,
|
|
3259
|
+
title: "Transport",
|
|
3260
|
+
description: "The transport type to use for connecting to the MCP server"
|
|
3261
|
+
},
|
|
3262
|
+
server_url: {
|
|
3263
|
+
type: "string",
|
|
3264
|
+
format: "uri",
|
|
3265
|
+
title: "Server URL",
|
|
3266
|
+
description: "The URL of the MCP server (for streamable-http transport)"
|
|
3267
|
+
},
|
|
3268
|
+
...mcpAuthConfigSchema.properties
|
|
3198
3269
|
},
|
|
3199
|
-
|
|
3270
|
+
allOf: mcpAuthConfigSchema.allOf
|
|
3200
3271
|
};
|
|
3201
3272
|
async function createMcpClient(config, signal) {
|
|
3202
3273
|
let transport;
|
|
@@ -3204,7 +3275,7 @@ async function createMcpClient(config, signal) {
|
|
|
3204
3275
|
if (auth && auth.type !== "none") {
|
|
3205
3276
|
auth = await resolveAuthSecrets(auth, getGlobalCredentialStore());
|
|
3206
3277
|
}
|
|
3207
|
-
const authProvider = auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore()) : undefined;
|
|
3278
|
+
const authProvider = config.authProvider ?? (auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore()) : undefined);
|
|
3208
3279
|
const headers = {
|
|
3209
3280
|
...auth?.type === "bearer" ? { Authorization: `Bearer ${auth.token}` } : {}
|
|
3210
3281
|
};
|
|
@@ -3386,6 +3457,7 @@ export {
|
|
|
3386
3457
|
Worker,
|
|
3387
3458
|
WORKER_SERVER,
|
|
3388
3459
|
WORKER_MANAGER,
|
|
3460
|
+
UnauthorizedError,
|
|
3389
3461
|
TypedArraySchema,
|
|
3390
3462
|
TensorType,
|
|
3391
3463
|
TensorSchema,
|
|
@@ -3416,4 +3488,4 @@ export {
|
|
|
3416
3488
|
BaseError
|
|
3417
3489
|
};
|
|
3418
3490
|
|
|
3419
|
-
//# debugId=
|
|
3491
|
+
//# debugId=F92FC9473BBE2EE764756E2164756E21
|