@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
|
@@ -9,104 +9,197 @@
|
|
|
9
9
|
import { Client } from "@modelcontextprotocol/sdk/client";
|
|
10
10
|
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
11
11
|
import type { McpAuthConfig } from "./McpAuthTypes";
|
|
12
|
+
import type { OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
12
13
|
export declare const mcpTransportTypes: readonly ["stdio", "sse", "streamable-http"];
|
|
13
14
|
export declare const mcpServerConfigSchema: {
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
16
|
-
readonly enum: readonly ["none", "bearer", "client_credentials", "private_key_jwt", "static_private_key_jwt", "authorization_code"];
|
|
17
|
-
readonly title: "Auth Type";
|
|
18
|
-
readonly description: "Authentication method for connecting to the MCP server";
|
|
19
|
-
readonly default: "none";
|
|
20
|
-
};
|
|
21
|
-
readonly auth_token: {
|
|
22
|
-
readonly type: "string";
|
|
23
|
-
readonly format: "credential";
|
|
24
|
-
readonly title: "Bearer Token";
|
|
25
|
-
readonly description: "Static bearer token or API key (for bearer auth)";
|
|
26
|
-
};
|
|
27
|
-
readonly auth_client_id: {
|
|
28
|
-
readonly type: "string";
|
|
29
|
-
readonly title: "Client ID";
|
|
30
|
-
readonly description: "OAuth client ID (for OAuth auth types)";
|
|
31
|
-
};
|
|
32
|
-
readonly auth_client_secret: {
|
|
33
|
-
readonly type: "string";
|
|
34
|
-
readonly format: "credential";
|
|
35
|
-
readonly title: "Client Secret";
|
|
36
|
-
readonly description: "OAuth client secret (for client_credentials auth)";
|
|
37
|
-
};
|
|
38
|
-
readonly auth_private_key: {
|
|
39
|
-
readonly type: "string";
|
|
40
|
-
readonly format: "credential";
|
|
41
|
-
readonly title: "Private Key";
|
|
42
|
-
readonly description: "PEM or JWK private key (for private_key_jwt auth)";
|
|
43
|
-
};
|
|
44
|
-
readonly auth_algorithm: {
|
|
45
|
-
readonly type: "string";
|
|
46
|
-
readonly title: "Algorithm";
|
|
47
|
-
readonly description: "JWT signing algorithm, e.g. RS256, ES256 (for private_key_jwt auth)";
|
|
48
|
-
};
|
|
49
|
-
readonly auth_jwt_bearer_assertion: {
|
|
50
|
-
readonly type: "string";
|
|
51
|
-
readonly format: "credential";
|
|
52
|
-
readonly title: "JWT Assertion";
|
|
53
|
-
readonly description: "Pre-built JWT assertion (for static_private_key_jwt auth)";
|
|
54
|
-
};
|
|
55
|
-
readonly auth_redirect_url: {
|
|
56
|
-
readonly type: "string";
|
|
57
|
-
readonly format: "uri";
|
|
58
|
-
readonly title: "Redirect URL";
|
|
59
|
-
readonly description: "OAuth redirect URL (for authorization_code auth)";
|
|
60
|
-
};
|
|
61
|
-
readonly auth_scope: {
|
|
62
|
-
readonly type: "string";
|
|
63
|
-
readonly title: "Scope";
|
|
64
|
-
readonly description: "OAuth scope (space-separated)";
|
|
65
|
-
};
|
|
66
|
-
readonly auth_client_name: {
|
|
67
|
-
readonly type: "string";
|
|
68
|
-
readonly title: "Client Name";
|
|
69
|
-
readonly description: "Optional OAuth client display name";
|
|
70
|
-
};
|
|
71
|
-
readonly auth_jwt_lifetime_seconds: {
|
|
72
|
-
readonly type: "number";
|
|
73
|
-
readonly title: "JWT Lifetime";
|
|
74
|
-
readonly description: "JWT lifetime in seconds (default: 300)";
|
|
75
|
-
readonly minimum: 1;
|
|
76
|
-
};
|
|
77
|
-
readonly transport: {
|
|
78
|
-
readonly type: "string";
|
|
79
|
-
readonly enum: readonly ["stdio", "sse", "streamable-http"];
|
|
80
|
-
readonly title: "Transport";
|
|
81
|
-
readonly description: "The transport type to use for connecting to the MCP server";
|
|
82
|
-
};
|
|
83
|
-
readonly server_url: {
|
|
84
|
-
readonly type: "string";
|
|
85
|
-
readonly format: "string:uri";
|
|
86
|
-
readonly title: "Server URL";
|
|
87
|
-
readonly description: "The URL of the MCP server (for sse and streamable-http transports)";
|
|
88
|
-
};
|
|
89
|
-
readonly command: {
|
|
90
|
-
readonly type: "string";
|
|
91
|
-
readonly title: "Command";
|
|
92
|
-
readonly description: "The command to run (for stdio transport)";
|
|
93
|
-
};
|
|
94
|
-
readonly args: {
|
|
95
|
-
readonly type: "array";
|
|
96
|
-
readonly items: {
|
|
15
|
+
readonly properties: {
|
|
16
|
+
readonly auth_type: {
|
|
97
17
|
readonly type: "string";
|
|
18
|
+
readonly enum: readonly ["none", "bearer", "client_credentials", "private_key_jwt", "static_private_key_jwt", "authorization_code"];
|
|
19
|
+
readonly title: "Auth Type";
|
|
20
|
+
readonly description: "Authentication method for connecting to the MCP server";
|
|
21
|
+
readonly default: "none";
|
|
98
22
|
};
|
|
99
|
-
readonly
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
23
|
+
readonly auth_token: {
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
readonly format: "credential";
|
|
26
|
+
readonly title: "Bearer Token";
|
|
27
|
+
readonly description: "Static bearer token or API key (for bearer auth)";
|
|
28
|
+
};
|
|
29
|
+
readonly auth_client_id: {
|
|
30
|
+
readonly type: "string";
|
|
31
|
+
readonly title: "Client ID";
|
|
32
|
+
readonly description: "OAuth client ID (for OAuth auth types)";
|
|
33
|
+
};
|
|
34
|
+
readonly auth_client_secret: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
readonly format: "credential";
|
|
37
|
+
readonly title: "Client Secret";
|
|
38
|
+
readonly description: "OAuth client secret (for client_credentials auth)";
|
|
39
|
+
};
|
|
40
|
+
readonly auth_private_key: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
readonly format: "credential";
|
|
43
|
+
readonly title: "Private Key";
|
|
44
|
+
readonly description: "PEM or JWK private key (for private_key_jwt auth)";
|
|
45
|
+
};
|
|
46
|
+
readonly auth_algorithm: {
|
|
47
|
+
readonly type: "string";
|
|
48
|
+
readonly title: "Algorithm";
|
|
49
|
+
readonly description: "JWT signing algorithm, e.g. RS256, ES256 (for private_key_jwt auth)";
|
|
50
|
+
};
|
|
51
|
+
readonly auth_jwt_bearer_assertion: {
|
|
105
52
|
readonly type: "string";
|
|
53
|
+
readonly format: "credential";
|
|
54
|
+
readonly title: "JWT Assertion";
|
|
55
|
+
readonly description: "Pre-built JWT assertion (for static_private_key_jwt auth)";
|
|
56
|
+
};
|
|
57
|
+
readonly auth_redirect_url: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
readonly format: "uri";
|
|
60
|
+
readonly title: "Redirect URL";
|
|
61
|
+
readonly description: "OAuth redirect URL (for authorization_code auth)";
|
|
62
|
+
};
|
|
63
|
+
readonly auth_scope: {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
readonly title: "Scope";
|
|
66
|
+
readonly description: "OAuth scope (space-separated)";
|
|
67
|
+
};
|
|
68
|
+
readonly auth_client_name: {
|
|
69
|
+
readonly type: "string";
|
|
70
|
+
readonly title: "Client Name";
|
|
71
|
+
readonly description: "Optional OAuth client display name";
|
|
72
|
+
};
|
|
73
|
+
readonly auth_jwt_lifetime_seconds: {
|
|
74
|
+
readonly type: "number";
|
|
75
|
+
readonly title: "JWT Lifetime";
|
|
76
|
+
readonly description: "JWT lifetime in seconds (default: 300)";
|
|
77
|
+
readonly minimum: 1;
|
|
78
|
+
};
|
|
79
|
+
readonly transport: {
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
readonly enum: readonly ["stdio", "sse", "streamable-http"];
|
|
82
|
+
readonly title: "Transport";
|
|
83
|
+
readonly description: "The transport type to use for connecting to the MCP server";
|
|
84
|
+
};
|
|
85
|
+
readonly server_url: {
|
|
86
|
+
readonly type: "string";
|
|
87
|
+
readonly format: "string:uri";
|
|
88
|
+
readonly title: "Server URL";
|
|
89
|
+
readonly description: "The URL of the MCP server (for sse and streamable-http transports)";
|
|
90
|
+
};
|
|
91
|
+
readonly command: {
|
|
92
|
+
readonly type: "string";
|
|
93
|
+
readonly title: "Command";
|
|
94
|
+
readonly description: "The command to run (for stdio transport)";
|
|
95
|
+
};
|
|
96
|
+
readonly args: {
|
|
97
|
+
readonly type: "array";
|
|
98
|
+
readonly items: {
|
|
99
|
+
readonly type: "string";
|
|
100
|
+
};
|
|
101
|
+
readonly title: "Arguments";
|
|
102
|
+
readonly description: "Command arguments (for stdio transport)";
|
|
103
|
+
};
|
|
104
|
+
readonly env: {
|
|
105
|
+
readonly type: "object";
|
|
106
|
+
readonly additionalProperties: {
|
|
107
|
+
readonly type: "string";
|
|
108
|
+
};
|
|
109
|
+
readonly title: "Environment";
|
|
110
|
+
readonly description: "Environment variables (for stdio transport)";
|
|
106
111
|
};
|
|
107
|
-
readonly title: "Environment";
|
|
108
|
-
readonly description: "Environment variables (for stdio transport)";
|
|
109
112
|
};
|
|
113
|
+
readonly allOf: readonly [{
|
|
114
|
+
readonly if: {
|
|
115
|
+
readonly properties: {
|
|
116
|
+
readonly auth_type: {
|
|
117
|
+
readonly const: "bearer";
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
readonly required: readonly ["auth_type"];
|
|
121
|
+
};
|
|
122
|
+
readonly then: {
|
|
123
|
+
readonly required: readonly ["auth_token"];
|
|
124
|
+
readonly properties: {
|
|
125
|
+
readonly auth_token: true;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
}, {
|
|
129
|
+
readonly if: {
|
|
130
|
+
readonly properties: {
|
|
131
|
+
readonly auth_type: {
|
|
132
|
+
readonly const: "client_credentials";
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
readonly required: readonly ["auth_type"];
|
|
136
|
+
};
|
|
137
|
+
readonly then: {
|
|
138
|
+
readonly required: readonly ["auth_client_id", "auth_client_secret"];
|
|
139
|
+
readonly properties: {
|
|
140
|
+
readonly auth_client_id: true;
|
|
141
|
+
readonly auth_client_secret: true;
|
|
142
|
+
readonly auth_client_name: true;
|
|
143
|
+
readonly auth_scope: true;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
}, {
|
|
147
|
+
readonly if: {
|
|
148
|
+
readonly properties: {
|
|
149
|
+
readonly auth_type: {
|
|
150
|
+
readonly const: "private_key_jwt";
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
readonly required: readonly ["auth_type"];
|
|
154
|
+
};
|
|
155
|
+
readonly then: {
|
|
156
|
+
readonly required: readonly ["auth_client_id", "auth_private_key", "auth_algorithm"];
|
|
157
|
+
readonly properties: {
|
|
158
|
+
readonly auth_client_id: true;
|
|
159
|
+
readonly auth_private_key: true;
|
|
160
|
+
readonly auth_algorithm: true;
|
|
161
|
+
readonly auth_client_name: true;
|
|
162
|
+
readonly auth_jwt_lifetime_seconds: true;
|
|
163
|
+
readonly auth_scope: true;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
}, {
|
|
167
|
+
readonly if: {
|
|
168
|
+
readonly properties: {
|
|
169
|
+
readonly auth_type: {
|
|
170
|
+
readonly const: "static_private_key_jwt";
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
readonly required: readonly ["auth_type"];
|
|
174
|
+
};
|
|
175
|
+
readonly then: {
|
|
176
|
+
readonly required: readonly ["auth_client_id", "auth_jwt_bearer_assertion"];
|
|
177
|
+
readonly properties: {
|
|
178
|
+
readonly auth_client_id: true;
|
|
179
|
+
readonly auth_jwt_bearer_assertion: true;
|
|
180
|
+
readonly auth_client_name: true;
|
|
181
|
+
readonly auth_scope: true;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
}, {
|
|
185
|
+
readonly if: {
|
|
186
|
+
readonly properties: {
|
|
187
|
+
readonly auth_type: {
|
|
188
|
+
readonly const: "authorization_code";
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
readonly required: readonly ["auth_type"];
|
|
192
|
+
};
|
|
193
|
+
readonly then: {
|
|
194
|
+
readonly required: readonly ["auth_client_id", "auth_redirect_url"];
|
|
195
|
+
readonly properties: {
|
|
196
|
+
readonly auth_client_id: true;
|
|
197
|
+
readonly auth_client_secret: true;
|
|
198
|
+
readonly auth_redirect_url: true;
|
|
199
|
+
readonly auth_scope: true;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
}];
|
|
110
203
|
};
|
|
111
204
|
export type McpTransportType = (typeof mcpTransportTypes)[number];
|
|
112
205
|
export interface McpServerConfig {
|
|
@@ -117,6 +210,7 @@ export interface McpServerConfig {
|
|
|
117
210
|
env?: Record<string, string>;
|
|
118
211
|
auth?: McpAuthConfig;
|
|
119
212
|
auth_type?: string;
|
|
213
|
+
authProvider?: OAuthClientProvider;
|
|
120
214
|
}
|
|
121
215
|
export declare function createMcpClient(config: McpServerConfig, signal?: AbortSignal): Promise<{
|
|
122
216
|
client: Client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpClientUtil.node.d.ts","sourceRoot":"","sources":["../../src/mcp/McpClientUtil.node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAK1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"McpClientUtil.node.d.ts","sourceRoot":"","sources":["../../src/mcp/McpClientUtil.node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAK1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAK/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAEpF,eAAO,MAAM,iBAAiB,8CAA+C,CAAC;AAE9E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCxB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,aAAa,CAAC;IAErB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,eAAe,EACvB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAAC,CAwGnD;AAED,eAAO,MAAM,gBAAgB;;CAE5B,CAAC"}
|
package/dist/node.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);
|
|
@@ -3192,36 +3260,39 @@ import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
|
3192
3260
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
3193
3261
|
var mcpTransportTypes = ["stdio", "sse", "streamable-http"];
|
|
3194
3262
|
var mcpServerConfigSchema = {
|
|
3195
|
-
|
|
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
|
-
|
|
3263
|
+
properties: {
|
|
3264
|
+
transport: {
|
|
3265
|
+
type: "string",
|
|
3266
|
+
enum: mcpTransportTypes,
|
|
3267
|
+
title: "Transport",
|
|
3268
|
+
description: "The transport type to use for connecting to the MCP server"
|
|
3269
|
+
},
|
|
3270
|
+
server_url: {
|
|
3271
|
+
type: "string",
|
|
3272
|
+
format: "string:uri",
|
|
3273
|
+
title: "Server URL",
|
|
3274
|
+
description: "The URL of the MCP server (for sse and streamable-http transports)"
|
|
3275
|
+
},
|
|
3276
|
+
command: {
|
|
3277
|
+
type: "string",
|
|
3278
|
+
title: "Command",
|
|
3279
|
+
description: "The command to run (for stdio transport)"
|
|
3280
|
+
},
|
|
3281
|
+
args: {
|
|
3282
|
+
type: "array",
|
|
3283
|
+
items: { type: "string" },
|
|
3284
|
+
title: "Arguments",
|
|
3285
|
+
description: "Command arguments (for stdio transport)"
|
|
3286
|
+
},
|
|
3287
|
+
env: {
|
|
3288
|
+
type: "object",
|
|
3289
|
+
additionalProperties: { type: "string" },
|
|
3290
|
+
title: "Environment",
|
|
3291
|
+
description: "Environment variables (for stdio transport)"
|
|
3292
|
+
},
|
|
3293
|
+
...mcpAuthConfigSchema.properties
|
|
3223
3294
|
},
|
|
3224
|
-
|
|
3295
|
+
allOf: mcpAuthConfigSchema.allOf
|
|
3225
3296
|
};
|
|
3226
3297
|
async function createMcpClient(config, signal) {
|
|
3227
3298
|
let transport;
|
|
@@ -3229,7 +3300,7 @@ async function createMcpClient(config, signal) {
|
|
|
3229
3300
|
if (auth && auth.type !== "none") {
|
|
3230
3301
|
auth = await resolveAuthSecrets(auth, getGlobalCredentialStore());
|
|
3231
3302
|
}
|
|
3232
|
-
const authProvider = auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore()) : undefined;
|
|
3303
|
+
const authProvider = config.authProvider ?? (auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore()) : undefined);
|
|
3233
3304
|
const headers = {
|
|
3234
3305
|
...auth?.type === "bearer" ? { Authorization: `Bearer ${auth.token}` } : {}
|
|
3235
3306
|
};
|
|
@@ -3404,6 +3475,7 @@ export {
|
|
|
3404
3475
|
Worker,
|
|
3405
3476
|
WORKER_SERVER,
|
|
3406
3477
|
WORKER_MANAGER,
|
|
3478
|
+
UnauthorizedError,
|
|
3407
3479
|
TypedArraySchema,
|
|
3408
3480
|
TensorType,
|
|
3409
3481
|
TensorSchema,
|
|
@@ -3434,4 +3506,4 @@ export {
|
|
|
3434
3506
|
BaseError
|
|
3435
3507
|
};
|
|
3436
3508
|
|
|
3437
|
-
//# debugId=
|
|
3509
|
+
//# debugId=C39DB93A7008D84764756E2164756E21
|