@workglow/util 0.0.109 → 0.0.111

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/common.d.ts CHANGED
@@ -27,4 +27,6 @@ export * from "./worker/WorkerManager";
27
27
  export * from "./worker/WorkerServer";
28
28
  export * from "./credentials";
29
29
  export * from "./crypto/WebCrypto";
30
+ export * from "./mcp/McpAuthTypes";
31
+ export * from "./mcp/McpAuthProvider";
30
32
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,MAAM,CAAC;AACrB,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,MAAM,CAAC;AACrB,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"LoggerRegistry.d.ts","sourceRoot":"","sources":["../../src/logging/LoggerRegistry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC;;GAEG;AACH,eAAO,MAAM,MAAM,uCAAwC,CAAC;AAqC5D;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAE/C"}
1
+ {"version":3,"file":"LoggerRegistry.d.ts","sourceRoot":"","sources":["../../src/logging/LoggerRegistry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC;;GAEG;AACH,eAAO,MAAM,MAAM,uCAAwC,CAAC;AA2C5D;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAE/C"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * MCP OAuth provider adapter backed by ICredentialStore, and factory function.
7
+ */
8
+ import type { OAuthClientProvider, OAuthDiscoveryState } from "@modelcontextprotocol/sdk/client/auth.js";
9
+ import type { OAuthClientMetadata, OAuthClientInformationMixed, OAuthTokens } from "@modelcontextprotocol/sdk/shared/auth.js";
10
+ import type { AddClientAuthentication } from "@modelcontextprotocol/sdk/client/auth.js";
11
+ import type { ICredentialStore } from "../credentials/ICredentialStore";
12
+ import type { McpAuthConfig } from "./McpAuthTypes";
13
+ /**
14
+ * OAuthClientProvider backed by ICredentialStore.
15
+ *
16
+ * Stores tokens, client info, code verifiers, and discovery state as JSON
17
+ * strings under namespaced keys. Enables token persistence across
18
+ * short-lived MCP connections that share the same server URL.
19
+ */
20
+ export declare class CredentialStoreOAuthProvider implements OAuthClientProvider {
21
+ private readonly store;
22
+ private readonly serverUrl;
23
+ private readonly _clientMetadata;
24
+ private readonly _redirectUrl;
25
+ private readonly _initialClientInfo;
26
+ /** Optional override for grant-specific token request preparation. */
27
+ prepareTokenRequest?: (scope?: string) => URLSearchParams | Promise<URLSearchParams | undefined> | undefined;
28
+ /** Optional override for custom client authentication on token requests. */
29
+ addClientAuthentication?: AddClientAuthentication;
30
+ constructor(options: {
31
+ store: ICredentialStore;
32
+ serverUrl: string;
33
+ clientMetadata: OAuthClientMetadata;
34
+ redirectUrl?: string | URL;
35
+ initialClientInfo?: OAuthClientInformationMixed;
36
+ prepareTokenRequest?: OAuthClientProvider["prepareTokenRequest"];
37
+ addClientAuthentication?: AddClientAuthentication;
38
+ });
39
+ get redirectUrl(): string | URL | undefined;
40
+ get clientMetadata(): OAuthClientMetadata;
41
+ clientInformation(): Promise<OAuthClientInformationMixed | undefined>;
42
+ saveClientInformation(info: OAuthClientInformationMixed): Promise<void>;
43
+ tokens(): Promise<OAuthTokens | undefined>;
44
+ saveTokens(tokens: OAuthTokens): Promise<void>;
45
+ redirectToAuthorization(authorizationUrl: URL): Promise<void>;
46
+ saveCodeVerifier(codeVerifier: string): Promise<void>;
47
+ codeVerifier(): Promise<string>;
48
+ saveDiscoveryState(state: OAuthDiscoveryState): Promise<void>;
49
+ discoveryState(): Promise<OAuthDiscoveryState | undefined>;
50
+ invalidateCredentials(scope: "all" | "client" | "tokens" | "verifier" | "discovery"): Promise<void>;
51
+ }
52
+ /**
53
+ * Creates an OAuthClientProvider for the given auth config, or returns
54
+ * `undefined` when no provider is needed (none / bearer).
55
+ *
56
+ * Bearer auth is handled at the transport level via request headers,
57
+ * so this function returns `undefined` for it.
58
+ */
59
+ export declare function createAuthProvider(auth: McpAuthConfig, serverUrl: string, credentialStore?: ICredentialStore): OAuthClientProvider | undefined;
60
+ /**
61
+ * Resolves credential-store keys in auth config to actual secret values.
62
+ *
63
+ * This is needed for the standalone MCP task path where config properties
64
+ * are NOT auto-resolved by `resolveSchemaInputs`. For the AgentTask path,
65
+ * credential resolution happens automatically via `format: "credential"`.
66
+ */
67
+ export declare function resolveAuthSecrets(auth: McpAuthConfig, credentialStore?: ICredentialStore): Promise<McpAuthConfig>;
68
+ //# sourceMappingURL=McpAuthProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpAuthProvider.d.ts","sourceRoot":"","sources":["../../src/mcp/McpAuthProvider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AACzG,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC9H,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAOxF,OAAO,KAAK,EAAE,gBAAgB,EAA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9C,uBAAuB,CAAC,gBAAgB,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAW7D,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAQ/B,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAO7D,cAAc,IAAI,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAQ1D,qBAAqB,CACzB,KAAK,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,GAC5D,OAAO,CAAC,IAAI,CAAC;CA0BjB;AAID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,gBAAgB,GACjC,mBAAmB,GAAG,SAAS,CAoJjC;AAID;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,aAAa,EACnB,eAAe,CAAC,EAAE,gBAAgB,GACjC,OAAO,CAAC,aAAa,CAAC,CA6CxB"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Shared MCP authentication type definitions and JSON Schema.
7
+ */
8
+ /**
9
+ * Supported MCP authentication types.
10
+ */
11
+ export declare const mcpAuthTypes: readonly ["none", "bearer", "client_credentials", "private_key_jwt", "static_private_key_jwt", "authorization_code"];
12
+ export type McpAuthType = (typeof mcpAuthTypes)[number];
13
+ export interface McpAuthNone {
14
+ readonly type: "none";
15
+ }
16
+ export interface McpAuthBearer {
17
+ readonly type: "bearer";
18
+ /** Static token or credential-store key (format: "credential"). */
19
+ readonly token: string;
20
+ }
21
+ export interface McpAuthClientCredentials {
22
+ readonly type: "client_credentials";
23
+ readonly client_id: string;
24
+ /** Client secret or credential-store key (format: "credential"). */
25
+ readonly client_secret: string;
26
+ readonly client_name?: string;
27
+ readonly scope?: string;
28
+ }
29
+ export interface McpAuthPrivateKeyJwt {
30
+ readonly type: "private_key_jwt";
31
+ readonly client_id: string;
32
+ /** PEM / JWK private key or credential-store key (format: "credential"). */
33
+ readonly private_key: string;
34
+ readonly algorithm: string;
35
+ readonly client_name?: string;
36
+ readonly jwt_lifetime_seconds?: number;
37
+ readonly scope?: string;
38
+ }
39
+ export interface McpAuthStaticPrivateKeyJwt {
40
+ readonly type: "static_private_key_jwt";
41
+ readonly client_id: string;
42
+ /** Pre-built JWT assertion or credential-store key (format: "credential"). */
43
+ readonly jwt_bearer_assertion: string;
44
+ readonly client_name?: string;
45
+ readonly scope?: string;
46
+ }
47
+ export interface McpAuthAuthorizationCode {
48
+ readonly type: "authorization_code";
49
+ readonly client_id: string;
50
+ readonly client_secret?: string;
51
+ readonly redirect_url: string;
52
+ readonly scope?: string;
53
+ }
54
+ export type McpAuthConfig = McpAuthNone | McpAuthBearer | McpAuthClientCredentials | McpAuthPrivateKeyJwt | McpAuthStaticPrivateKeyJwt | McpAuthAuthorizationCode;
55
+ export declare const mcpAuthConfigSchema: {
56
+ readonly auth_type: {
57
+ readonly type: "string";
58
+ readonly enum: readonly ["none", "bearer", "client_credentials", "private_key_jwt", "static_private_key_jwt", "authorization_code"];
59
+ readonly title: "Auth Type";
60
+ readonly description: "Authentication method for connecting to the MCP server";
61
+ readonly default: "none";
62
+ };
63
+ readonly auth_token: {
64
+ readonly type: "string";
65
+ readonly format: "credential";
66
+ readonly title: "Bearer Token";
67
+ readonly description: "Static bearer token or API key (for bearer auth)";
68
+ };
69
+ readonly auth_client_id: {
70
+ readonly type: "string";
71
+ readonly title: "Client ID";
72
+ readonly description: "OAuth client ID (for OAuth auth types)";
73
+ };
74
+ readonly auth_client_secret: {
75
+ readonly type: "string";
76
+ readonly format: "credential";
77
+ readonly title: "Client Secret";
78
+ readonly description: "OAuth client secret (for client_credentials auth)";
79
+ };
80
+ readonly auth_private_key: {
81
+ readonly type: "string";
82
+ readonly format: "credential";
83
+ readonly title: "Private Key";
84
+ readonly description: "PEM or JWK private key (for private_key_jwt auth)";
85
+ };
86
+ readonly auth_algorithm: {
87
+ readonly type: "string";
88
+ readonly title: "Algorithm";
89
+ readonly description: "JWT signing algorithm, e.g. RS256, ES256 (for private_key_jwt auth)";
90
+ };
91
+ readonly auth_jwt_bearer_assertion: {
92
+ readonly type: "string";
93
+ readonly format: "credential";
94
+ readonly title: "JWT Assertion";
95
+ readonly description: "Pre-built JWT assertion (for static_private_key_jwt auth)";
96
+ };
97
+ readonly auth_redirect_url: {
98
+ readonly type: "string";
99
+ readonly format: "uri";
100
+ readonly title: "Redirect URL";
101
+ readonly description: "OAuth redirect URL (for authorization_code auth)";
102
+ };
103
+ readonly auth_scope: {
104
+ readonly type: "string";
105
+ readonly title: "Scope";
106
+ readonly description: "OAuth scope (space-separated)";
107
+ };
108
+ readonly auth_client_name: {
109
+ readonly type: "string";
110
+ readonly title: "Client Name";
111
+ readonly description: "Optional OAuth client display name";
112
+ };
113
+ readonly auth_jwt_lifetime_seconds: {
114
+ readonly type: "number";
115
+ readonly title: "JWT Lifetime";
116
+ readonly description: "JWT lifetime in seconds (default: 300)";
117
+ readonly minimum: 1;
118
+ };
119
+ };
120
+ /**
121
+ * Constructs a typed McpAuthConfig from flat schema properties.
122
+ * Used by `createMcpClient()` to normalize the config.
123
+ * Returns `undefined` if required fields for the selected auth type are missing.
124
+ */
125
+ export declare function buildAuthConfig(flat: Record<string, unknown>): McpAuthConfig | undefined;
126
+ //# sourceMappingURL=McpAuthTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpAuthTypes.d.ts","sourceRoot":"","sources":["../../src/mcp/McpAuthTypes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,eAAO,MAAM,YAAY,sHAOf,CAAC;AAEX,MAAM,MAAM,WAA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ACvC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,aAAa,GACb,wBAAwB,GACxB,oBAAoB,GACpB,0BAA0B,GAC1B,wBAAwB,CAAC;AAI7B,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEuB,CAAC;AAqBxD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,GAAG,SAAS,CAqExF"}
@@ -8,8 +8,72 @@
8
8
  */
9
9
  import { Client } from "@modelcontextprotocol/sdk/client";
10
10
  import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
11
+ import type { McpAuthConfig } from "./McpAuthTypes";
11
12
  export declare const mcpTransportTypes: readonly ["streamable-http", "sse"];
12
13
  export declare const mcpServerConfigSchema: {
14
+ readonly auth_type: {
15
+ readonly type: "string";
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
+ };
13
77
  readonly transport: {
14
78
  readonly type: "string";
15
79
  readonly enum: readonly ["streamable-http", "sse"];
@@ -27,6 +91,8 @@ export type McpTransportType = (typeof mcpTransportTypes)[number];
27
91
  export interface McpServerConfig {
28
92
  transport: McpTransportType;
29
93
  server_url?: string;
94
+ auth?: McpAuthConfig;
95
+ auth_type?: string;
30
96
  }
31
97
  export declare function createMcpClient(config: McpServerConfig, signal?: AbortSignal): Promise<{
32
98
  client: Client;
@@ -1 +1 @@
1
- {"version":3,"file":"McpClientUtil.browser.d.ts","sourceRoot":"","sources":["../../src/mcp/McpClientUtil.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAM/E,eAAO,MAAM,iBAAiB,qCAAsC,CAAC;AAErE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;CAaqB,CAAC;AAExD,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;CACrB;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,CA0EnD;AAED,eAAO,MAAM,gBAAgB;;CAE5B,CAAC"}
1
+ {"version":3,"file":"McpClientUtil.browser.d.ts","sourceRoot":"","sources":["../../src/mcp/McpClientUtil.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAI/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD,eAAO,MAAM,iBAAiB,qCAAsC,CAAC;AAErE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcqB,CAAC;AAExD,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,IAAI,CAAC,EAAE,aAAa,CAAC;IAErB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;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,CA2FnD;AAED,eAAO,MAAM,gBAAgB;;CAE5B,CAAC"}
@@ -8,8 +8,72 @@
8
8
  */
9
9
  import { Client } from "@modelcontextprotocol/sdk/client";
10
10
  import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
11
+ import type { McpAuthConfig } from "./McpAuthTypes";
11
12
  export declare const mcpTransportTypes: readonly ["stdio", "sse", "streamable-http"];
12
13
  export declare const mcpServerConfigSchema: {
14
+ readonly auth_type: {
15
+ readonly type: "string";
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
+ };
13
77
  readonly transport: {
14
78
  readonly type: "string";
15
79
  readonly enum: readonly ["stdio", "sse", "streamable-http"];
@@ -51,6 +115,8 @@ export interface McpServerConfig {
51
115
  command?: string;
52
116
  args?: string[];
53
117
  env?: Record<string, string>;
118
+ auth?: McpAuthConfig;
119
+ auth_type?: string;
54
120
  }
55
121
  export declare function createMcpClient(config: McpServerConfig, signal?: AbortSignal): Promise<{
56
122
  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;AAG/E,eAAO,MAAM,iBAAiB,8CAA+C,CAAC;AAE9E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;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