@poe-platform/safe-bash 0.1.713 → 0.1.715
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/README.md +20 -0
- package/dist/safe-bash-mcp/index.d.ts +1339 -0
- package/dist/safe-bash-mcp/index.js +15221 -0
- package/dist/safe-playwright-cloudflare/browser-code-executor.d.ts +1 -1
- package/dist/safe-playwright-cloudflare/shell-browser-resource.d.ts +1 -1
- package/dist/safe-playwright-cloudflare/shell-playwright.d.ts +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,1339 @@
|
|
|
1
|
+
import { Readable, Writable } from 'node:stream';
|
|
2
|
+
import http from 'node:http';
|
|
3
|
+
import { CommandDefinition, VirtualShellPlugin } from '@poe-platform/safe-bash/contracts';
|
|
4
|
+
|
|
5
|
+
interface Implementation {
|
|
6
|
+
name: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
version: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
websiteUrl?: string;
|
|
11
|
+
icons?: Icon[];
|
|
12
|
+
}
|
|
13
|
+
interface Tool$1 {
|
|
14
|
+
name: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
inputSchema: JSONSchema;
|
|
18
|
+
outputSchema?: OutputSchema;
|
|
19
|
+
annotations?: ToolAnnotations;
|
|
20
|
+
execution?: ToolExecution;
|
|
21
|
+
icons?: Icon[];
|
|
22
|
+
_meta?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
interface ToolAnnotations {
|
|
25
|
+
title?: string;
|
|
26
|
+
readOnlyHint?: boolean;
|
|
27
|
+
destructiveHint?: boolean;
|
|
28
|
+
idempotentHint?: boolean;
|
|
29
|
+
openWorldHint?: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface ToolExecution {
|
|
32
|
+
taskSupport?: "optional" | "required" | "forbidden";
|
|
33
|
+
}
|
|
34
|
+
interface Icon {
|
|
35
|
+
src: string;
|
|
36
|
+
mimeType?: string;
|
|
37
|
+
sizes?: string[];
|
|
38
|
+
theme?: "light" | "dark";
|
|
39
|
+
}
|
|
40
|
+
interface ContentAnnotations {
|
|
41
|
+
audience?: Array<"user" | "assistant">;
|
|
42
|
+
priority?: number;
|
|
43
|
+
lastModified?: string;
|
|
44
|
+
}
|
|
45
|
+
interface ResourceLink extends Resource {
|
|
46
|
+
type: "resource_link";
|
|
47
|
+
}
|
|
48
|
+
interface PromptArgument {
|
|
49
|
+
name: string;
|
|
50
|
+
title?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
required?: boolean;
|
|
53
|
+
}
|
|
54
|
+
interface Prompt {
|
|
55
|
+
name: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
arguments?: PromptArgument[];
|
|
59
|
+
icons?: Icon[];
|
|
60
|
+
_meta?: Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
interface Resource {
|
|
63
|
+
uri: string;
|
|
64
|
+
name: string;
|
|
65
|
+
title?: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
mimeType?: string;
|
|
68
|
+
size?: number;
|
|
69
|
+
annotations?: ContentAnnotations;
|
|
70
|
+
icons?: Icon[];
|
|
71
|
+
_meta?: Record<string, unknown>;
|
|
72
|
+
}
|
|
73
|
+
interface ResourceTemplate {
|
|
74
|
+
uriTemplate: string;
|
|
75
|
+
name: string;
|
|
76
|
+
title?: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
mimeType?: string;
|
|
79
|
+
annotations?: ContentAnnotations;
|
|
80
|
+
icons?: Icon[];
|
|
81
|
+
_meta?: Record<string, unknown>;
|
|
82
|
+
}
|
|
83
|
+
type ResourceContents$1 = {
|
|
84
|
+
uri: string;
|
|
85
|
+
mimeType?: string;
|
|
86
|
+
text: string;
|
|
87
|
+
_meta?: Record<string, unknown>;
|
|
88
|
+
} | {
|
|
89
|
+
uri: string;
|
|
90
|
+
mimeType?: string;
|
|
91
|
+
blob: string;
|
|
92
|
+
_meta?: Record<string, unknown>;
|
|
93
|
+
};
|
|
94
|
+
type PromptContentItem = {
|
|
95
|
+
type: "text";
|
|
96
|
+
text: string;
|
|
97
|
+
annotations?: ContentAnnotations;
|
|
98
|
+
_meta?: Record<string, unknown>;
|
|
99
|
+
} | {
|
|
100
|
+
type: "image";
|
|
101
|
+
data: string;
|
|
102
|
+
mimeType: string;
|
|
103
|
+
annotations?: ContentAnnotations;
|
|
104
|
+
_meta?: Record<string, unknown>;
|
|
105
|
+
} | {
|
|
106
|
+
type: "audio";
|
|
107
|
+
data: string;
|
|
108
|
+
mimeType: string;
|
|
109
|
+
annotations?: ContentAnnotations;
|
|
110
|
+
_meta?: Record<string, unknown>;
|
|
111
|
+
} | {
|
|
112
|
+
type: "resource";
|
|
113
|
+
annotations?: ContentAnnotations;
|
|
114
|
+
_meta?: Record<string, unknown>;
|
|
115
|
+
resource: {
|
|
116
|
+
uri: string;
|
|
117
|
+
mimeType?: string;
|
|
118
|
+
text: string;
|
|
119
|
+
_meta?: Record<string, unknown>;
|
|
120
|
+
} | {
|
|
121
|
+
uri: string;
|
|
122
|
+
mimeType?: string;
|
|
123
|
+
blob: string;
|
|
124
|
+
_meta?: Record<string, unknown>;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
type ContentItem$1 = PromptContentItem | ResourceLink;
|
|
128
|
+
interface JSONSchema {
|
|
129
|
+
type: "object";
|
|
130
|
+
properties?: Record<string, JSONSchemaProperty>;
|
|
131
|
+
required?: string[];
|
|
132
|
+
[keyword: string]: unknown;
|
|
133
|
+
}
|
|
134
|
+
interface OutputSchema {
|
|
135
|
+
$schema?: string;
|
|
136
|
+
[keyword: string]: unknown;
|
|
137
|
+
}
|
|
138
|
+
interface JSONSchemaProperty extends Record<string, unknown> {
|
|
139
|
+
type?: string | string[];
|
|
140
|
+
description?: string;
|
|
141
|
+
[keyword: string]: unknown;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
interface NotificationFilter {
|
|
145
|
+
toolsListChanged?: boolean;
|
|
146
|
+
promptsListChanged?: boolean;
|
|
147
|
+
resourcesListChanged?: boolean;
|
|
148
|
+
resourceSubscriptions?: string[];
|
|
149
|
+
}
|
|
150
|
+
interface SubscriptionOptions {
|
|
151
|
+
signal?: AbortSignal;
|
|
152
|
+
}
|
|
153
|
+
interface McpSubscription {
|
|
154
|
+
readonly id: RequestId;
|
|
155
|
+
readonly notifications: NotificationFilter;
|
|
156
|
+
readonly closed: Promise<void>;
|
|
157
|
+
cancel(): void;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface SecretStoreLockFileSystem$1 {
|
|
161
|
+
mkdir(path: string, options?: {
|
|
162
|
+
recursive?: boolean;
|
|
163
|
+
mode?: number;
|
|
164
|
+
}): Promise<unknown>;
|
|
165
|
+
readdir(path: string): Promise<string[]>;
|
|
166
|
+
readFile(path: string, encoding: BufferEncoding): Promise<string>;
|
|
167
|
+
writeFile(path: string, value: string, options: {
|
|
168
|
+
encoding: BufferEncoding;
|
|
169
|
+
flag: string;
|
|
170
|
+
mode: number;
|
|
171
|
+
}): Promise<void>;
|
|
172
|
+
rename(from: string, to: string): Promise<void>;
|
|
173
|
+
unlink(path: string): Promise<void>;
|
|
174
|
+
lstat(path: string): Promise<{
|
|
175
|
+
isSymbolicLink(): boolean;
|
|
176
|
+
}>;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface MachineIdentity$1 {
|
|
180
|
+
hostname: string;
|
|
181
|
+
username: string;
|
|
182
|
+
}
|
|
183
|
+
interface EncryptedFileStoreFileSystem$1 {
|
|
184
|
+
readdir?(path: string): Promise<string[]>;
|
|
185
|
+
readFile(path: string, encoding: BufferEncoding): Promise<string>;
|
|
186
|
+
writeFile(path: string, data: string | NodeJS.ArrayBufferView, options?: {
|
|
187
|
+
encoding?: BufferEncoding;
|
|
188
|
+
flag?: string;
|
|
189
|
+
mode?: number;
|
|
190
|
+
}): Promise<void>;
|
|
191
|
+
mkdir(path: string, options?: {
|
|
192
|
+
recursive?: boolean;
|
|
193
|
+
}): Promise<void | string | undefined>;
|
|
194
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
195
|
+
lstat(path: string): Promise<{
|
|
196
|
+
isSymbolicLink(): boolean;
|
|
197
|
+
}>;
|
|
198
|
+
unlink(path: string): Promise<void>;
|
|
199
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
200
|
+
}
|
|
201
|
+
interface EncryptedFileStoreInput$1 {
|
|
202
|
+
fs?: EncryptedFileStoreFileSystem$1;
|
|
203
|
+
filePath?: string;
|
|
204
|
+
salt: string;
|
|
205
|
+
defaultDirectory?: string;
|
|
206
|
+
defaultFileName?: string;
|
|
207
|
+
getMachineIdentity?: () => MachineIdentity$1 | Promise<MachineIdentity$1>;
|
|
208
|
+
getHomeDirectory?: () => string;
|
|
209
|
+
getRandomBytes?: (size: number) => Buffer;
|
|
210
|
+
/** Fail closed instead of treating malformed or unauthenticated documents as absent. */
|
|
211
|
+
throwOnInvalidDocument?: boolean;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
interface KeychainCommandResult$1 {
|
|
215
|
+
stdout: string;
|
|
216
|
+
stderr: string;
|
|
217
|
+
exitCode: number;
|
|
218
|
+
}
|
|
219
|
+
interface KeychainCommandOptions$1 {
|
|
220
|
+
stdin?: string;
|
|
221
|
+
}
|
|
222
|
+
type KeychainCommandRunner$1 = (command: string, args: string[], options?: KeychainCommandOptions$1) => Promise<KeychainCommandResult$1>;
|
|
223
|
+
interface KeychainStoreInput$1 {
|
|
224
|
+
runCommand?: KeychainCommandRunner$1;
|
|
225
|
+
service: string;
|
|
226
|
+
account: string;
|
|
227
|
+
lock?: {
|
|
228
|
+
fs?: SecretStoreLockFileSystem$1;
|
|
229
|
+
directory?: string;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
type StoreBackend$1 = "file" | "keychain";
|
|
234
|
+
interface CreateSecretStoreInput$1 {
|
|
235
|
+
backend?: StoreBackend$1;
|
|
236
|
+
env?: NodeJS.ProcessEnv;
|
|
237
|
+
platform?: NodeJS.Platform;
|
|
238
|
+
backendEnvVar?: string;
|
|
239
|
+
fileStore?: EncryptedFileStoreInput$1;
|
|
240
|
+
keychainStore?: KeychainStoreInput$1;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
type OAuthMetadataFetch$1 = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
244
|
+
interface OAuthProtectedResourceMetadata$1 extends Record<string, unknown> {
|
|
245
|
+
resource: string;
|
|
246
|
+
authorization_servers: string[];
|
|
247
|
+
}
|
|
248
|
+
interface OAuthAuthorizationServerMetadata$1 extends Record<string, unknown> {
|
|
249
|
+
issuer: string;
|
|
250
|
+
authorization_endpoint: string;
|
|
251
|
+
token_endpoint: string;
|
|
252
|
+
registration_endpoint?: string;
|
|
253
|
+
response_types_supported: string[];
|
|
254
|
+
code_challenge_methods_supported: string[];
|
|
255
|
+
authorization_response_iss_parameter_supported?: boolean;
|
|
256
|
+
}
|
|
257
|
+
interface OAuthDiscoveryResult$1 {
|
|
258
|
+
resource: string;
|
|
259
|
+
resourceMetadataUrl: string;
|
|
260
|
+
resourceMetadata: OAuthProtectedResourceMetadata$1;
|
|
261
|
+
authorizationServer: string;
|
|
262
|
+
authorizationServerMetadataUrl: string;
|
|
263
|
+
authorizationServerMetadata: OAuthAuthorizationServerMetadata$1;
|
|
264
|
+
}
|
|
265
|
+
interface OAuthUnauthorizedChallenge$1 {
|
|
266
|
+
scheme: "Bearer";
|
|
267
|
+
params: Record<string, string>;
|
|
268
|
+
raw: string;
|
|
269
|
+
}
|
|
270
|
+
interface OAuthClientProvider$1 {
|
|
271
|
+
/** Establish a grant explicitly, including when resource initialization is public. */
|
|
272
|
+
authenticate?(input: {
|
|
273
|
+
requestUrl: URL;
|
|
274
|
+
fetch: OAuthMetadataFetch$1;
|
|
275
|
+
/** Lazy validated discovery. Without it, recover/reuse known grants only. */
|
|
276
|
+
discover?: () => Promise<OAuthDiscoveryResult$1>;
|
|
277
|
+
signal?: AbortSignal;
|
|
278
|
+
}): Promise<StoredOAuthTokens$1 | void>;
|
|
279
|
+
authorizeRequest?(input: {
|
|
280
|
+
requestUrl: URL;
|
|
281
|
+
headers: Headers;
|
|
282
|
+
fetch: OAuthMetadataFetch$1;
|
|
283
|
+
signal?: AbortSignal;
|
|
284
|
+
}): Promise<StoredOAuthTokens$1 | void> | StoredOAuthTokens$1 | void;
|
|
285
|
+
handleUnauthorized(input: {
|
|
286
|
+
requestUrl: URL;
|
|
287
|
+
response: Response;
|
|
288
|
+
challenge: OAuthUnauthorizedChallenge$1 | null;
|
|
289
|
+
discovery: OAuthDiscoveryResult$1;
|
|
290
|
+
fetch: OAuthMetadataFetch$1;
|
|
291
|
+
signal?: AbortSignal;
|
|
292
|
+
/** Headers actually attached to this rejected request. */
|
|
293
|
+
requestHeaders?: Headers;
|
|
294
|
+
/** Owned snapshot returned when this request was authorized, or null if absent. */
|
|
295
|
+
presentedTokens?: StoredOAuthTokens$1 | null;
|
|
296
|
+
}): Promise<{
|
|
297
|
+
action: "retry";
|
|
298
|
+
} | {
|
|
299
|
+
action: "fail";
|
|
300
|
+
error?: Error;
|
|
301
|
+
}> | {
|
|
302
|
+
action: "retry";
|
|
303
|
+
} | {
|
|
304
|
+
action: "fail";
|
|
305
|
+
error?: Error;
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
interface OAuthClientMetadata$1 {
|
|
309
|
+
clientName?: string;
|
|
310
|
+
scope?: string;
|
|
311
|
+
softwareId?: string;
|
|
312
|
+
softwareVersion?: string;
|
|
313
|
+
}
|
|
314
|
+
interface StoredOAuthTokens$1 {
|
|
315
|
+
accessToken: string;
|
|
316
|
+
refreshToken?: string;
|
|
317
|
+
tokenType: "Bearer";
|
|
318
|
+
expiresAt: number | null;
|
|
319
|
+
scope?: string;
|
|
320
|
+
}
|
|
321
|
+
/** Import-time lifetimes are normalized once into persisted epoch milliseconds. */
|
|
322
|
+
interface ImportedOAuthTokens$1 extends Omit<StoredOAuthTokens$1, "expiresAt"> {
|
|
323
|
+
expiresAt?: number | null;
|
|
324
|
+
/** Remaining lifetime at import, or total lifetime when issuedAt is provided. */
|
|
325
|
+
expiresIn?: number;
|
|
326
|
+
/** Original issuance time in Unix epoch milliseconds. */
|
|
327
|
+
issuedAt?: number;
|
|
328
|
+
}
|
|
329
|
+
/** Full RFC 7591 response, including JSON provider extensions. */
|
|
330
|
+
interface OAuthClientRegistration$1 extends Record<string, unknown> {
|
|
331
|
+
client_id: string;
|
|
332
|
+
client_secret?: string | null;
|
|
333
|
+
redirect_uris?: string[] | null;
|
|
334
|
+
grant_types?: string[] | null;
|
|
335
|
+
response_types?: string[] | null;
|
|
336
|
+
contacts?: string[] | null;
|
|
337
|
+
client_id_issued_at?: number | null;
|
|
338
|
+
client_secret_expires_at?: number | null;
|
|
339
|
+
token_endpoint_auth_method?: string | null;
|
|
340
|
+
}
|
|
341
|
+
interface StoredOAuthClient$1 {
|
|
342
|
+
clientId: string;
|
|
343
|
+
/** Externally registered apps must never be replaced by native DCR on reload. */
|
|
344
|
+
registrationOwnership?: "caller";
|
|
345
|
+
/** Actual listener URI submitted when this native client was registered. */
|
|
346
|
+
requestedRedirectUri?: string;
|
|
347
|
+
clientSecret?: string;
|
|
348
|
+
registration?: OAuthClientRegistration$1;
|
|
349
|
+
tokenEndpointAuthMethod?: OAuthTokenEndpointAuthMethod$1;
|
|
350
|
+
}
|
|
351
|
+
type OAuthTokenEndpointAuthMethod$1 = "none" | "client_secret_post" | "client_secret_basic";
|
|
352
|
+
interface StoredOAuthSession$1 {
|
|
353
|
+
resource: string;
|
|
354
|
+
authorizationServer: string;
|
|
355
|
+
client: StoredOAuthClient$1;
|
|
356
|
+
tokens?: StoredOAuthTokens$1;
|
|
357
|
+
/** A refresh was begun; its winning response may not have been persisted. */
|
|
358
|
+
refreshState?: "pending";
|
|
359
|
+
/** Canonical explicitly requested scope set when the server omits token scope. */
|
|
360
|
+
requestedScope?: string;
|
|
361
|
+
discovery: {
|
|
362
|
+
resourceMetadataUrl: string;
|
|
363
|
+
resourceMetadata: Record<string, unknown>;
|
|
364
|
+
authorizationServerMetadata: Record<string, unknown>;
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
interface OAuthSessionStore$1 {
|
|
368
|
+
load(resource: string): Promise<StoredOAuthSession$1 | null>;
|
|
369
|
+
save(resource: string, session: StoredOAuthSession$1): Promise<void>;
|
|
370
|
+
clear(resource: string): Promise<void>;
|
|
371
|
+
/** Backend-wide lock covering a complete read/redeem/write transaction. */
|
|
372
|
+
withLock?<T>(resource: string, operation: () => Promise<T>, options: {
|
|
373
|
+
signal?: AbortSignal;
|
|
374
|
+
timeoutMs: number;
|
|
375
|
+
}): Promise<T>;
|
|
376
|
+
}
|
|
377
|
+
/** Configuration values are captured at creation; selected host dependencies remain live. */
|
|
378
|
+
interface DefaultOAuthClientProviderOptions$1 {
|
|
379
|
+
client: {
|
|
380
|
+
mode: "dynamic";
|
|
381
|
+
clientId?: string;
|
|
382
|
+
clientSecret?: string;
|
|
383
|
+
metadata?: OAuthClientMetadata$1;
|
|
384
|
+
/** Import a complete registration owned by the caller. */
|
|
385
|
+
registration?: OAuthClientRegistration$1;
|
|
386
|
+
tokenEndpointAuthMethod?: OAuthTokenEndpointAuthMethod$1;
|
|
387
|
+
} | {
|
|
388
|
+
mode: "static";
|
|
389
|
+
clientId: string;
|
|
390
|
+
clientSecret?: string;
|
|
391
|
+
metadata?: OAuthClientMetadata$1;
|
|
392
|
+
registration?: OAuthClientRegistration$1;
|
|
393
|
+
tokenEndpointAuthMethod?: OAuthTokenEndpointAuthMethod$1;
|
|
394
|
+
};
|
|
395
|
+
/** Disable interactive authorization while allowing cached tokens and silent refresh. */
|
|
396
|
+
allowInteractive?: boolean;
|
|
397
|
+
/** Maximum wait to acquire a session transaction lock (default 30,000 ms). */
|
|
398
|
+
sessionLockTimeoutMs?: number;
|
|
399
|
+
/** Isolate native persisted sessions and registrations for a named profile. */
|
|
400
|
+
persistenceNamespace?: string;
|
|
401
|
+
/** Native-owned durable logical server identity; changing URL retires its credentials. */
|
|
402
|
+
resourceIdentity?: string;
|
|
403
|
+
/** Import an existing grant for one resource. Persisted sessions take precedence. */
|
|
404
|
+
initialGrant?: {
|
|
405
|
+
resource: string;
|
|
406
|
+
tokens: ImportedOAuthTokens$1;
|
|
407
|
+
};
|
|
408
|
+
browser: {
|
|
409
|
+
openBrowser?(url: string): Promise<void>;
|
|
410
|
+
/** Exact registered HTTP loopback redirect URI. */
|
|
411
|
+
redirectUri?: string;
|
|
412
|
+
signal?: AbortSignal;
|
|
413
|
+
timeoutMs?: number;
|
|
414
|
+
readLine?: () => Promise<string>;
|
|
415
|
+
createServer?: () => http.Server;
|
|
416
|
+
landingPage?: {
|
|
417
|
+
title: string;
|
|
418
|
+
body: string;
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
sessionStore?: OAuthSessionStore$1;
|
|
422
|
+
authStore?: CreateSecretStoreInput$1;
|
|
423
|
+
now?: () => number;
|
|
424
|
+
}
|
|
425
|
+
type OAuthClientProviderOptions = {
|
|
426
|
+
provider: OAuthClientProvider$1;
|
|
427
|
+
} | DefaultOAuthClientProviderOptions$1;
|
|
428
|
+
|
|
429
|
+
interface OAuthDiscoveryCache {
|
|
430
|
+
get(resourceUrl: string): OAuthDiscoveryResult$1 | null | undefined | Promise<OAuthDiscoveryResult$1 | null | undefined>;
|
|
431
|
+
set(resourceUrl: string, value: OAuthDiscoveryResult$1): void | Promise<void>;
|
|
432
|
+
delete?(resourceUrl: string): void | Promise<void>;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
type RequestId = number | string;
|
|
436
|
+
interface ClientCapabilities {
|
|
437
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
438
|
+
elicitation?: {
|
|
439
|
+
form?: Record<string, unknown>;
|
|
440
|
+
url?: Record<string, unknown>;
|
|
441
|
+
};
|
|
442
|
+
roots?: {
|
|
443
|
+
listChanged?: boolean;
|
|
444
|
+
[key: string]: unknown;
|
|
445
|
+
};
|
|
446
|
+
sampling?: {
|
|
447
|
+
[key: string]: unknown;
|
|
448
|
+
};
|
|
449
|
+
experimental?: Record<string, unknown>;
|
|
450
|
+
}
|
|
451
|
+
interface ServerCapabilities {
|
|
452
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
453
|
+
prompts?: {
|
|
454
|
+
listChanged?: boolean;
|
|
455
|
+
[key: string]: unknown;
|
|
456
|
+
};
|
|
457
|
+
resources?: {
|
|
458
|
+
subscribe?: boolean;
|
|
459
|
+
listChanged?: boolean;
|
|
460
|
+
[key: string]: unknown;
|
|
461
|
+
};
|
|
462
|
+
tools?: {
|
|
463
|
+
listChanged?: boolean;
|
|
464
|
+
[key: string]: unknown;
|
|
465
|
+
};
|
|
466
|
+
logging?: {
|
|
467
|
+
[key: string]: unknown;
|
|
468
|
+
};
|
|
469
|
+
completions?: {
|
|
470
|
+
[key: string]: unknown;
|
|
471
|
+
};
|
|
472
|
+
experimental?: Record<string, unknown>;
|
|
473
|
+
}
|
|
474
|
+
interface ConnectResult {
|
|
475
|
+
protocolVersion: string;
|
|
476
|
+
capabilities: ServerCapabilities;
|
|
477
|
+
serverInfo?: Implementation;
|
|
478
|
+
instructions?: string;
|
|
479
|
+
}
|
|
480
|
+
type ElicitationParams = {
|
|
481
|
+
mode?: "form";
|
|
482
|
+
message: string;
|
|
483
|
+
requestedSchema: Record<string, unknown>;
|
|
484
|
+
} | {
|
|
485
|
+
mode: "url";
|
|
486
|
+
message: string;
|
|
487
|
+
url: string;
|
|
488
|
+
elicitationId: string;
|
|
489
|
+
};
|
|
490
|
+
interface ElicitationResult {
|
|
491
|
+
_meta?: Record<string, unknown>;
|
|
492
|
+
action: "accept" | "decline" | "cancel";
|
|
493
|
+
content?: Record<string, string | number | boolean | string[]>;
|
|
494
|
+
}
|
|
495
|
+
declare const MCP_PROTOCOL_VERSIONS: readonly ["2025-03-26", "2025-06-18", "2025-11-25", "2026-07-28"];
|
|
496
|
+
type McpProtocolVersion = typeof MCP_PROTOCOL_VERSIONS[number];
|
|
497
|
+
interface McpClientOptions {
|
|
498
|
+
clientInfo: Implementation;
|
|
499
|
+
requestTimeoutMs?: number;
|
|
500
|
+
maxConcurrentRequests?: number;
|
|
501
|
+
protocolVersion?: McpProtocolVersion;
|
|
502
|
+
capabilities?: ClientCapabilities;
|
|
503
|
+
onToolsChanged?: () => void | Promise<void>;
|
|
504
|
+
onResourcesChanged?: () => void | Promise<void>;
|
|
505
|
+
onResourceUpdated?: (uri: string) => void | Promise<void>;
|
|
506
|
+
onPromptsChanged?: () => void | Promise<void>;
|
|
507
|
+
onLog?: (message: LogMessage) => void | Promise<void>;
|
|
508
|
+
onProgress?: (params: ProgressParams) => void | Promise<void>;
|
|
509
|
+
onSamplingRequest?: (params: CreateMessageParams, context: McpRequestContext) => CreateMessageResult | Promise<CreateMessageResult>;
|
|
510
|
+
onRootsList?: (context: McpRequestContext) => Root[] | Promise<Root[]>;
|
|
511
|
+
onElicitationRequest?: (params: ElicitationParams, context: McpRequestContext) => ElicitationResult | Promise<ElicitationResult>;
|
|
512
|
+
}
|
|
513
|
+
declare class McpClient {
|
|
514
|
+
private currentState;
|
|
515
|
+
private currentServerCapabilities;
|
|
516
|
+
private currentClientCapabilities;
|
|
517
|
+
private currentServerInfo;
|
|
518
|
+
private currentInstructions;
|
|
519
|
+
private readonly subscribedResourceUris;
|
|
520
|
+
private readonly activeProgressTokens;
|
|
521
|
+
private readonly options;
|
|
522
|
+
private transport;
|
|
523
|
+
private messageLayer;
|
|
524
|
+
private subscriptions;
|
|
525
|
+
private readonly resourceSubscriptions;
|
|
526
|
+
constructor(options: McpClientOptions);
|
|
527
|
+
get state(): "disconnected" | "initializing" | "ready" | "closed";
|
|
528
|
+
get serverCapabilities(): ServerCapabilities | null;
|
|
529
|
+
get serverInfo(): Implementation | null;
|
|
530
|
+
get instructions(): string | undefined;
|
|
531
|
+
private getMessageLayerOrThrow;
|
|
532
|
+
connect(transport: McpTransport, options?: {
|
|
533
|
+
signal?: AbortSignal;
|
|
534
|
+
}): Promise<ConnectResult>;
|
|
535
|
+
private getServerCapabilitiesOrThrow;
|
|
536
|
+
listTools(params?: PaginatedParams, options?: {
|
|
537
|
+
signal?: AbortSignal;
|
|
538
|
+
}): Promise<PaginatedResult & {
|
|
539
|
+
tools: Tool[];
|
|
540
|
+
}>;
|
|
541
|
+
callTool(params: CallToolParams, options?: CallToolOptions): Promise<CallToolResult>;
|
|
542
|
+
listResources(params?: PaginatedParams, options?: {
|
|
543
|
+
signal?: AbortSignal;
|
|
544
|
+
}): Promise<PaginatedResult & {
|
|
545
|
+
resources: Resource[];
|
|
546
|
+
}>;
|
|
547
|
+
listResourceTemplates(params?: PaginatedParams, options?: {
|
|
548
|
+
signal?: AbortSignal;
|
|
549
|
+
}): Promise<PaginatedResult & {
|
|
550
|
+
resourceTemplates: ResourceTemplate[];
|
|
551
|
+
}>;
|
|
552
|
+
readResource(params: ReadResourceParams, options?: {
|
|
553
|
+
signal?: AbortSignal;
|
|
554
|
+
}): Promise<CacheableResultMetadata & {
|
|
555
|
+
contents: ResourceContents[];
|
|
556
|
+
}>;
|
|
557
|
+
listenNotifications(filter: NotificationFilter, options?: SubscriptionOptions): Promise<McpSubscription>;
|
|
558
|
+
subscribe(uri: string, options?: {
|
|
559
|
+
signal?: AbortSignal;
|
|
560
|
+
}): Promise<void>;
|
|
561
|
+
unsubscribe(uri: string, options?: {
|
|
562
|
+
signal?: AbortSignal;
|
|
563
|
+
}): Promise<void>;
|
|
564
|
+
listPrompts(params?: PaginatedParams, options?: {
|
|
565
|
+
signal?: AbortSignal;
|
|
566
|
+
}): Promise<PaginatedResult & {
|
|
567
|
+
prompts: Prompt[];
|
|
568
|
+
}>;
|
|
569
|
+
getPrompt(params: GetPromptParams, options?: {
|
|
570
|
+
signal?: AbortSignal;
|
|
571
|
+
}): Promise<GetPromptResult>;
|
|
572
|
+
complete(params: CompleteParams, options?: {
|
|
573
|
+
signal?: AbortSignal;
|
|
574
|
+
}): Promise<CompleteResult>;
|
|
575
|
+
setLogLevel(level: LogLevel, options?: {
|
|
576
|
+
signal?: AbortSignal;
|
|
577
|
+
}): Promise<void>;
|
|
578
|
+
cancel(requestId: RequestId, reason?: string): Promise<void>;
|
|
579
|
+
sendRootsChanged(): Promise<void>;
|
|
580
|
+
ping(options?: {
|
|
581
|
+
signal?: AbortSignal;
|
|
582
|
+
}): Promise<void>;
|
|
583
|
+
close(): Promise<void>;
|
|
584
|
+
}
|
|
585
|
+
interface Tool extends Omit<Tool$1, "inputSchema" | "outputSchema"> {
|
|
586
|
+
inputSchema: Record<string, unknown>;
|
|
587
|
+
outputSchema?: Record<string, unknown>;
|
|
588
|
+
}
|
|
589
|
+
interface CallToolParams {
|
|
590
|
+
name: string;
|
|
591
|
+
arguments?: Record<string, unknown>;
|
|
592
|
+
}
|
|
593
|
+
interface CallToolOptions {
|
|
594
|
+
signal?: AbortSignal;
|
|
595
|
+
progressToken?: ProgressToken;
|
|
596
|
+
}
|
|
597
|
+
interface ReadResourceParams {
|
|
598
|
+
uri: string;
|
|
599
|
+
}
|
|
600
|
+
interface PaginatedParams {
|
|
601
|
+
cursor?: string;
|
|
602
|
+
}
|
|
603
|
+
interface ResultMetadata {
|
|
604
|
+
resultType?: "complete";
|
|
605
|
+
_meta?: Record<string, unknown>;
|
|
606
|
+
}
|
|
607
|
+
interface CacheableResultMetadata extends ResultMetadata {
|
|
608
|
+
ttlMs?: number;
|
|
609
|
+
cacheScope?: "public" | "private";
|
|
610
|
+
}
|
|
611
|
+
interface PaginatedResult extends CacheableResultMetadata {
|
|
612
|
+
nextCursor?: string;
|
|
613
|
+
}
|
|
614
|
+
type ResourceContents = ResourceContents$1;
|
|
615
|
+
type TextContent = Extract<ContentItem$1, {
|
|
616
|
+
type: "text";
|
|
617
|
+
}>;
|
|
618
|
+
type ImageContent = Extract<ContentItem$1, {
|
|
619
|
+
type: "image";
|
|
620
|
+
}>;
|
|
621
|
+
type AudioContent = Extract<ContentItem$1, {
|
|
622
|
+
type: "audio";
|
|
623
|
+
}>;
|
|
624
|
+
type ContentItem = ContentItem$1;
|
|
625
|
+
interface PromptMessage {
|
|
626
|
+
role: "user" | "assistant";
|
|
627
|
+
content: ContentItem;
|
|
628
|
+
}
|
|
629
|
+
interface GetPromptResult extends ResultMetadata {
|
|
630
|
+
description?: string;
|
|
631
|
+
messages: PromptMessage[];
|
|
632
|
+
}
|
|
633
|
+
interface GetPromptParams {
|
|
634
|
+
name: string;
|
|
635
|
+
arguments?: Record<string, string>;
|
|
636
|
+
}
|
|
637
|
+
interface CallToolResult extends ResultMetadata {
|
|
638
|
+
content: ContentItem[];
|
|
639
|
+
structuredContent?: unknown;
|
|
640
|
+
isError?: boolean;
|
|
641
|
+
}
|
|
642
|
+
interface Root {
|
|
643
|
+
_meta?: Record<string, unknown>;
|
|
644
|
+
uri: string;
|
|
645
|
+
name?: string;
|
|
646
|
+
}
|
|
647
|
+
type LogLevel = "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency";
|
|
648
|
+
interface LogMessage {
|
|
649
|
+
level: LogLevel;
|
|
650
|
+
logger?: string;
|
|
651
|
+
data: unknown;
|
|
652
|
+
}
|
|
653
|
+
type ProgressToken = RequestId;
|
|
654
|
+
interface ProgressParams {
|
|
655
|
+
progressToken: ProgressToken;
|
|
656
|
+
progress: number;
|
|
657
|
+
total?: number;
|
|
658
|
+
message?: string;
|
|
659
|
+
}
|
|
660
|
+
interface ModelHint {
|
|
661
|
+
name?: string;
|
|
662
|
+
}
|
|
663
|
+
interface ModelPreferences {
|
|
664
|
+
hints?: ModelHint[];
|
|
665
|
+
costPriority?: number;
|
|
666
|
+
speedPriority?: number;
|
|
667
|
+
intelligencePriority?: number;
|
|
668
|
+
}
|
|
669
|
+
interface ToolUseContent {
|
|
670
|
+
_meta?: Record<string, unknown>;
|
|
671
|
+
type: "tool_use";
|
|
672
|
+
id: string;
|
|
673
|
+
name: string;
|
|
674
|
+
input: Record<string, unknown>;
|
|
675
|
+
}
|
|
676
|
+
interface ToolResultContent {
|
|
677
|
+
_meta?: Record<string, unknown>;
|
|
678
|
+
type: "tool_result";
|
|
679
|
+
toolUseId: string;
|
|
680
|
+
content: ContentItem[];
|
|
681
|
+
structuredContent?: unknown;
|
|
682
|
+
isError?: boolean;
|
|
683
|
+
}
|
|
684
|
+
type SamplingContent = TextContent | ImageContent | AudioContent | ToolUseContent | ToolResultContent;
|
|
685
|
+
interface SamplingMessage {
|
|
686
|
+
_meta?: Record<string, unknown>;
|
|
687
|
+
role: "user" | "assistant";
|
|
688
|
+
content: SamplingContent | SamplingContent[];
|
|
689
|
+
}
|
|
690
|
+
type IncludeContext = "none" | "thisServer" | "allServers";
|
|
691
|
+
interface CreateMessageParams {
|
|
692
|
+
messages: SamplingMessage[];
|
|
693
|
+
modelPreferences?: ModelPreferences;
|
|
694
|
+
systemPrompt?: string;
|
|
695
|
+
includeContext?: IncludeContext;
|
|
696
|
+
temperature?: number;
|
|
697
|
+
maxTokens: number;
|
|
698
|
+
tools?: Tool[];
|
|
699
|
+
toolChoice?: {
|
|
700
|
+
mode: "auto" | "required" | "none";
|
|
701
|
+
};
|
|
702
|
+
stopSequences?: string[];
|
|
703
|
+
metadata?: Record<string, unknown>;
|
|
704
|
+
}
|
|
705
|
+
interface CreateMessageResult {
|
|
706
|
+
_meta?: Record<string, unknown>;
|
|
707
|
+
model: string;
|
|
708
|
+
content: SamplingContent | SamplingContent[];
|
|
709
|
+
role: "user" | "assistant";
|
|
710
|
+
stopReason?: string;
|
|
711
|
+
}
|
|
712
|
+
interface PromptReference {
|
|
713
|
+
type: "ref/prompt";
|
|
714
|
+
name: string;
|
|
715
|
+
}
|
|
716
|
+
interface ResourceReference {
|
|
717
|
+
type: "ref/resource";
|
|
718
|
+
uri: string;
|
|
719
|
+
}
|
|
720
|
+
interface CompleteArgument {
|
|
721
|
+
name: string;
|
|
722
|
+
value: string;
|
|
723
|
+
}
|
|
724
|
+
interface CompleteParams {
|
|
725
|
+
context?: {
|
|
726
|
+
arguments?: Record<string, string>;
|
|
727
|
+
};
|
|
728
|
+
ref: PromptReference | ResourceReference;
|
|
729
|
+
argument: CompleteArgument;
|
|
730
|
+
}
|
|
731
|
+
interface Completion {
|
|
732
|
+
values: string[];
|
|
733
|
+
hasMore?: boolean;
|
|
734
|
+
total?: number;
|
|
735
|
+
}
|
|
736
|
+
interface CompleteResult extends ResultMetadata {
|
|
737
|
+
completion: Completion;
|
|
738
|
+
}
|
|
739
|
+
interface McpTransportClosedEvent {
|
|
740
|
+
reason: Error;
|
|
741
|
+
code?: number;
|
|
742
|
+
signal?: NodeJS.Signals;
|
|
743
|
+
}
|
|
744
|
+
interface McpTransport {
|
|
745
|
+
readable: Readable;
|
|
746
|
+
writable: Writable;
|
|
747
|
+
closed: Promise<McpTransportClosedEvent>;
|
|
748
|
+
/** Primary close reason, available before asynchronous transport cleanup finishes. */
|
|
749
|
+
readonly closeReason?: Promise<Error>;
|
|
750
|
+
dispose(reason?: Error): void;
|
|
751
|
+
filterTools?(tools: Tool[], reset?: boolean): Tool[];
|
|
752
|
+
/** Complete a legacy initialization handshake before the client reports ready. */
|
|
753
|
+
completeInitialization?(options: {
|
|
754
|
+
signal?: AbortSignal;
|
|
755
|
+
timeoutMs: number;
|
|
756
|
+
protocolVersion?: string;
|
|
757
|
+
}): Promise<void>;
|
|
758
|
+
}
|
|
759
|
+
type HttpTransportFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
760
|
+
interface HttpTransportOptions {
|
|
761
|
+
url: string;
|
|
762
|
+
/** Legacy SSE uses a GET stream that announces the RPC POST endpoint. */
|
|
763
|
+
mode?: "streamable-http" | "sse";
|
|
764
|
+
headers?: RequestInit["headers"];
|
|
765
|
+
fetch?: HttpTransportFetch;
|
|
766
|
+
oauth?: OAuthClientProviderOptions;
|
|
767
|
+
oauthDiscoveryCache?: OAuthDiscoveryCache;
|
|
768
|
+
onWarning?: (message: string) => void;
|
|
769
|
+
/** Maximum JSON response bytes or individual SSE event bytes; not a stream lifetime cap. */
|
|
770
|
+
maxResponseBytes?: number;
|
|
771
|
+
}
|
|
772
|
+
interface McpRequestContext {
|
|
773
|
+
readonly id: RequestId;
|
|
774
|
+
readonly method: string;
|
|
775
|
+
readonly signal: AbortSignal;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/** A caller-owned remote registry entry. An empty tools array disables discovery. */
|
|
779
|
+
interface RemoteMcpServer {
|
|
780
|
+
readonly name: string;
|
|
781
|
+
readonly url: string;
|
|
782
|
+
readonly transport?: "http" | "sse";
|
|
783
|
+
readonly tools?: readonly Tool[];
|
|
784
|
+
readonly instructions?: string;
|
|
785
|
+
readonly headers?: HttpTransportOptions["headers"];
|
|
786
|
+
readonly oauth?: HttpTransportOptions["oauth"];
|
|
787
|
+
readonly protocolVersion?: McpProtocolVersion;
|
|
788
|
+
}
|
|
789
|
+
interface RemoteMcpSchema {
|
|
790
|
+
readonly name: string;
|
|
791
|
+
readonly url: string;
|
|
792
|
+
readonly source: "provided" | "discovered";
|
|
793
|
+
readonly tools: Tool[];
|
|
794
|
+
readonly serverInfo?: Implementation;
|
|
795
|
+
readonly capabilities?: ServerCapabilities;
|
|
796
|
+
readonly instructions?: string;
|
|
797
|
+
}
|
|
798
|
+
interface SchemaFetchOptions {
|
|
799
|
+
readonly signal?: AbortSignal;
|
|
800
|
+
readonly fetch?: HttpTransportOptions["fetch"];
|
|
801
|
+
readonly oauthDiscoveryCache?: HttpTransportOptions["oauthDiscoveryCache"];
|
|
802
|
+
readonly onWarning?: HttpTransportOptions["onWarning"];
|
|
803
|
+
readonly maxPages?: number;
|
|
804
|
+
readonly maxTools?: number;
|
|
805
|
+
/** Bounds each complete JSON response body or individual SSE event. */
|
|
806
|
+
readonly maxResponseBytes?: number;
|
|
807
|
+
readonly requestTimeoutMs?: number;
|
|
808
|
+
/** Handle server input explicitly. Without a hook, input is declined. */
|
|
809
|
+
readonly onElicitationRequest?: RemoteMcpElicitationHandler;
|
|
810
|
+
}
|
|
811
|
+
interface RemoteMcpElicitationContext extends McpRequestContext {
|
|
812
|
+
readonly server: {
|
|
813
|
+
readonly name: string;
|
|
814
|
+
readonly url: string;
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
type RemoteMcpElicitationHandler = (params: ElicitationParams, context: RemoteMcpElicitationContext) => ElicitationResult | Promise<ElicitationResult>;
|
|
818
|
+
/** Discover every tool page, or return an isolated copy of authoritative supplied schemas. */
|
|
819
|
+
declare function fetchRemoteMcpSchema(server: RemoteMcpServer, options?: SchemaFetchOptions): Promise<RemoteMcpSchema>;
|
|
820
|
+
/** Validate the complete registry before connecting, then preserve caller order. */
|
|
821
|
+
declare function resolveRemoteMcpSchemas(servers: readonly RemoteMcpServer[], options?: SchemaFetchOptions): Promise<RemoteMcpSchema[]>;
|
|
822
|
+
|
|
823
|
+
type JsonSchemaRegistry = Record<string, unknown>;
|
|
824
|
+
interface CompileJsonSchemaOptions {
|
|
825
|
+
registry?: JsonSchemaRegistry;
|
|
826
|
+
formats?: Readonly<Record<string, (value: string) => boolean>>;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
interface ToolParameter {
|
|
830
|
+
readonly name: string;
|
|
831
|
+
readonly flag: string;
|
|
832
|
+
readonly required: boolean;
|
|
833
|
+
readonly schemas: readonly unknown[];
|
|
834
|
+
readonly description?: string;
|
|
835
|
+
}
|
|
836
|
+
interface ToolArgumentParseOptions {
|
|
837
|
+
readonly yes?: boolean;
|
|
838
|
+
readonly maxInputBytes?: number;
|
|
839
|
+
}
|
|
840
|
+
interface ToolArgumentParser {
|
|
841
|
+
readonly toolName: string;
|
|
842
|
+
readonly parameters: readonly ToolParameter[];
|
|
843
|
+
parse(args: readonly string[], options?: ToolArgumentParseOptions): Record<string, unknown>;
|
|
844
|
+
}
|
|
845
|
+
/** Compile a tool's complete JSON Schema plus stable, collision-safe flag metadata. */
|
|
846
|
+
declare function compileToolArguments(tool: Tool, options?: CompileJsonSchemaOptions): ToolArgumentParser;
|
|
847
|
+
|
|
848
|
+
interface RemoteMcpCommandOptions extends SchemaFetchOptions, ToolArgumentParseOptions {
|
|
849
|
+
readonly maxOutputBytes?: number;
|
|
850
|
+
readonly schemaValidation?: CompileJsonSchemaOptions;
|
|
851
|
+
}
|
|
852
|
+
/** Generate a safe-bash command for each server, discovering only absent schemas. */
|
|
853
|
+
declare function createRemoteMcpCommands(servers: readonly RemoteMcpServer[], options?: RemoteMcpCommandOptions): Promise<CommandDefinition[]>;
|
|
854
|
+
/** Register generated commands after checking all conflicts, avoiding partial setup. */
|
|
855
|
+
declare function remoteMcpCommands(servers: readonly RemoteMcpServer[], options?: RemoteMcpCommandOptions): Promise<VirtualShellPlugin>;
|
|
856
|
+
|
|
857
|
+
interface SecretStoreLockFileSystem {
|
|
858
|
+
mkdir(path: string, options?: {
|
|
859
|
+
recursive?: boolean;
|
|
860
|
+
mode?: number;
|
|
861
|
+
}): Promise<unknown>;
|
|
862
|
+
readdir(path: string): Promise<string[]>;
|
|
863
|
+
readFile(path: string, encoding: BufferEncoding): Promise<string>;
|
|
864
|
+
writeFile(path: string, value: string, options: {
|
|
865
|
+
encoding: BufferEncoding;
|
|
866
|
+
flag: string;
|
|
867
|
+
mode: number;
|
|
868
|
+
}): Promise<void>;
|
|
869
|
+
rename(from: string, to: string): Promise<void>;
|
|
870
|
+
unlink(path: string): Promise<void>;
|
|
871
|
+
lstat(path: string): Promise<{
|
|
872
|
+
isSymbolicLink(): boolean;
|
|
873
|
+
}>;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
interface MachineIdentity {
|
|
877
|
+
hostname: string;
|
|
878
|
+
username: string;
|
|
879
|
+
}
|
|
880
|
+
interface EncryptedFileStoreFileSystem {
|
|
881
|
+
readdir?(path: string): Promise<string[]>;
|
|
882
|
+
readFile(path: string, encoding: BufferEncoding): Promise<string>;
|
|
883
|
+
writeFile(path: string, data: string | NodeJS.ArrayBufferView, options?: {
|
|
884
|
+
encoding?: BufferEncoding;
|
|
885
|
+
flag?: string;
|
|
886
|
+
mode?: number;
|
|
887
|
+
}): Promise<void>;
|
|
888
|
+
mkdir(path: string, options?: {
|
|
889
|
+
recursive?: boolean;
|
|
890
|
+
}): Promise<void | string | undefined>;
|
|
891
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
892
|
+
lstat(path: string): Promise<{
|
|
893
|
+
isSymbolicLink(): boolean;
|
|
894
|
+
}>;
|
|
895
|
+
unlink(path: string): Promise<void>;
|
|
896
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
897
|
+
}
|
|
898
|
+
interface EncryptedFileStoreInput {
|
|
899
|
+
fs?: EncryptedFileStoreFileSystem;
|
|
900
|
+
filePath?: string;
|
|
901
|
+
salt: string;
|
|
902
|
+
defaultDirectory?: string;
|
|
903
|
+
defaultFileName?: string;
|
|
904
|
+
getMachineIdentity?: () => MachineIdentity | Promise<MachineIdentity>;
|
|
905
|
+
getHomeDirectory?: () => string;
|
|
906
|
+
getRandomBytes?: (size: number) => Buffer;
|
|
907
|
+
/** Fail closed instead of treating malformed or unauthenticated documents as absent. */
|
|
908
|
+
throwOnInvalidDocument?: boolean;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
interface KeychainCommandResult {
|
|
912
|
+
stdout: string;
|
|
913
|
+
stderr: string;
|
|
914
|
+
exitCode: number;
|
|
915
|
+
}
|
|
916
|
+
interface KeychainCommandOptions {
|
|
917
|
+
stdin?: string;
|
|
918
|
+
}
|
|
919
|
+
type KeychainCommandRunner = (command: string, args: string[], options?: KeychainCommandOptions) => Promise<KeychainCommandResult>;
|
|
920
|
+
interface KeychainStoreInput {
|
|
921
|
+
runCommand?: KeychainCommandRunner;
|
|
922
|
+
service: string;
|
|
923
|
+
account: string;
|
|
924
|
+
lock?: {
|
|
925
|
+
fs?: SecretStoreLockFileSystem;
|
|
926
|
+
directory?: string;
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
type StoreBackend = "file" | "keychain";
|
|
931
|
+
interface CreateSecretStoreInput {
|
|
932
|
+
backend?: StoreBackend;
|
|
933
|
+
env?: NodeJS.ProcessEnv;
|
|
934
|
+
platform?: NodeJS.Platform;
|
|
935
|
+
backendEnvVar?: string;
|
|
936
|
+
fileStore?: EncryptedFileStoreInput;
|
|
937
|
+
keychainStore?: KeychainStoreInput;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
type OAuthMetadataFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
941
|
+
interface OAuthProtectedResourceMetadata extends Record<string, unknown> {
|
|
942
|
+
resource: string;
|
|
943
|
+
authorization_servers: string[];
|
|
944
|
+
}
|
|
945
|
+
interface OAuthAuthorizationServerMetadata extends Record<string, unknown> {
|
|
946
|
+
issuer: string;
|
|
947
|
+
authorization_endpoint: string;
|
|
948
|
+
token_endpoint: string;
|
|
949
|
+
registration_endpoint?: string;
|
|
950
|
+
response_types_supported: string[];
|
|
951
|
+
code_challenge_methods_supported: string[];
|
|
952
|
+
authorization_response_iss_parameter_supported?: boolean;
|
|
953
|
+
}
|
|
954
|
+
interface OAuthDiscoveryResult {
|
|
955
|
+
resource: string;
|
|
956
|
+
resourceMetadataUrl: string;
|
|
957
|
+
resourceMetadata: OAuthProtectedResourceMetadata;
|
|
958
|
+
authorizationServer: string;
|
|
959
|
+
authorizationServerMetadataUrl: string;
|
|
960
|
+
authorizationServerMetadata: OAuthAuthorizationServerMetadata;
|
|
961
|
+
}
|
|
962
|
+
interface OAuthUnauthorizedChallenge {
|
|
963
|
+
scheme: "Bearer";
|
|
964
|
+
params: Record<string, string>;
|
|
965
|
+
raw: string;
|
|
966
|
+
}
|
|
967
|
+
interface OAuthClientProvider {
|
|
968
|
+
/** Establish a grant explicitly, including when resource initialization is public. */
|
|
969
|
+
authenticate?(input: {
|
|
970
|
+
requestUrl: URL;
|
|
971
|
+
fetch: OAuthMetadataFetch;
|
|
972
|
+
/** Lazy validated discovery. Without it, recover/reuse known grants only. */
|
|
973
|
+
discover?: () => Promise<OAuthDiscoveryResult>;
|
|
974
|
+
signal?: AbortSignal;
|
|
975
|
+
}): Promise<StoredOAuthTokens | void>;
|
|
976
|
+
authorizeRequest?(input: {
|
|
977
|
+
requestUrl: URL;
|
|
978
|
+
headers: Headers;
|
|
979
|
+
fetch: OAuthMetadataFetch;
|
|
980
|
+
signal?: AbortSignal;
|
|
981
|
+
}): Promise<StoredOAuthTokens | void> | StoredOAuthTokens | void;
|
|
982
|
+
handleUnauthorized(input: {
|
|
983
|
+
requestUrl: URL;
|
|
984
|
+
response: Response;
|
|
985
|
+
challenge: OAuthUnauthorizedChallenge | null;
|
|
986
|
+
discovery: OAuthDiscoveryResult;
|
|
987
|
+
fetch: OAuthMetadataFetch;
|
|
988
|
+
signal?: AbortSignal;
|
|
989
|
+
/** Headers actually attached to this rejected request. */
|
|
990
|
+
requestHeaders?: Headers;
|
|
991
|
+
/** Owned snapshot returned when this request was authorized, or null if absent. */
|
|
992
|
+
presentedTokens?: StoredOAuthTokens | null;
|
|
993
|
+
}): Promise<{
|
|
994
|
+
action: "retry";
|
|
995
|
+
} | {
|
|
996
|
+
action: "fail";
|
|
997
|
+
error?: Error;
|
|
998
|
+
}> | {
|
|
999
|
+
action: "retry";
|
|
1000
|
+
} | {
|
|
1001
|
+
action: "fail";
|
|
1002
|
+
error?: Error;
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
interface OAuthClientMetadata {
|
|
1006
|
+
clientName?: string;
|
|
1007
|
+
scope?: string;
|
|
1008
|
+
softwareId?: string;
|
|
1009
|
+
softwareVersion?: string;
|
|
1010
|
+
}
|
|
1011
|
+
interface StoredOAuthTokens {
|
|
1012
|
+
accessToken: string;
|
|
1013
|
+
refreshToken?: string;
|
|
1014
|
+
tokenType: "Bearer";
|
|
1015
|
+
expiresAt: number | null;
|
|
1016
|
+
scope?: string;
|
|
1017
|
+
}
|
|
1018
|
+
/** Import-time lifetimes are normalized once into persisted epoch milliseconds. */
|
|
1019
|
+
interface ImportedOAuthTokens extends Omit<StoredOAuthTokens, "expiresAt"> {
|
|
1020
|
+
expiresAt?: number | null;
|
|
1021
|
+
/** Remaining lifetime at import, or total lifetime when issuedAt is provided. */
|
|
1022
|
+
expiresIn?: number;
|
|
1023
|
+
/** Original issuance time in Unix epoch milliseconds. */
|
|
1024
|
+
issuedAt?: number;
|
|
1025
|
+
}
|
|
1026
|
+
/** Full RFC 7591 response, including JSON provider extensions. */
|
|
1027
|
+
interface OAuthClientRegistration extends Record<string, unknown> {
|
|
1028
|
+
client_id: string;
|
|
1029
|
+
client_secret?: string | null;
|
|
1030
|
+
redirect_uris?: string[] | null;
|
|
1031
|
+
grant_types?: string[] | null;
|
|
1032
|
+
response_types?: string[] | null;
|
|
1033
|
+
contacts?: string[] | null;
|
|
1034
|
+
client_id_issued_at?: number | null;
|
|
1035
|
+
client_secret_expires_at?: number | null;
|
|
1036
|
+
token_endpoint_auth_method?: string | null;
|
|
1037
|
+
}
|
|
1038
|
+
interface StoredOAuthClient {
|
|
1039
|
+
clientId: string;
|
|
1040
|
+
/** Externally registered apps must never be replaced by native DCR on reload. */
|
|
1041
|
+
registrationOwnership?: "caller";
|
|
1042
|
+
/** Actual listener URI submitted when this native client was registered. */
|
|
1043
|
+
requestedRedirectUri?: string;
|
|
1044
|
+
clientSecret?: string;
|
|
1045
|
+
registration?: OAuthClientRegistration;
|
|
1046
|
+
tokenEndpointAuthMethod?: OAuthTokenEndpointAuthMethod;
|
|
1047
|
+
}
|
|
1048
|
+
type OAuthTokenEndpointAuthMethod = "none" | "client_secret_post" | "client_secret_basic";
|
|
1049
|
+
interface StoredOAuthSession {
|
|
1050
|
+
resource: string;
|
|
1051
|
+
authorizationServer: string;
|
|
1052
|
+
client: StoredOAuthClient;
|
|
1053
|
+
tokens?: StoredOAuthTokens;
|
|
1054
|
+
/** A refresh was begun; its winning response may not have been persisted. */
|
|
1055
|
+
refreshState?: "pending";
|
|
1056
|
+
/** Canonical explicitly requested scope set when the server omits token scope. */
|
|
1057
|
+
requestedScope?: string;
|
|
1058
|
+
discovery: {
|
|
1059
|
+
resourceMetadataUrl: string;
|
|
1060
|
+
resourceMetadata: Record<string, unknown>;
|
|
1061
|
+
authorizationServerMetadata: Record<string, unknown>;
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
interface OAuthSessionStore {
|
|
1065
|
+
load(resource: string): Promise<StoredOAuthSession | null>;
|
|
1066
|
+
save(resource: string, session: StoredOAuthSession): Promise<void>;
|
|
1067
|
+
clear(resource: string): Promise<void>;
|
|
1068
|
+
/** Backend-wide lock covering a complete read/redeem/write transaction. */
|
|
1069
|
+
withLock?<T>(resource: string, operation: () => Promise<T>, options: {
|
|
1070
|
+
signal?: AbortSignal;
|
|
1071
|
+
timeoutMs: number;
|
|
1072
|
+
}): Promise<T>;
|
|
1073
|
+
}
|
|
1074
|
+
/** Configuration values are captured at creation; selected host dependencies remain live. */
|
|
1075
|
+
interface DefaultOAuthClientProviderOptions {
|
|
1076
|
+
client: {
|
|
1077
|
+
mode: "dynamic";
|
|
1078
|
+
clientId?: string;
|
|
1079
|
+
clientSecret?: string;
|
|
1080
|
+
metadata?: OAuthClientMetadata;
|
|
1081
|
+
/** Import a complete registration owned by the caller. */
|
|
1082
|
+
registration?: OAuthClientRegistration;
|
|
1083
|
+
tokenEndpointAuthMethod?: OAuthTokenEndpointAuthMethod;
|
|
1084
|
+
} | {
|
|
1085
|
+
mode: "static";
|
|
1086
|
+
clientId: string;
|
|
1087
|
+
clientSecret?: string;
|
|
1088
|
+
metadata?: OAuthClientMetadata;
|
|
1089
|
+
registration?: OAuthClientRegistration;
|
|
1090
|
+
tokenEndpointAuthMethod?: OAuthTokenEndpointAuthMethod;
|
|
1091
|
+
};
|
|
1092
|
+
/** Disable interactive authorization while allowing cached tokens and silent refresh. */
|
|
1093
|
+
allowInteractive?: boolean;
|
|
1094
|
+
/** Maximum wait to acquire a session transaction lock (default 30,000 ms). */
|
|
1095
|
+
sessionLockTimeoutMs?: number;
|
|
1096
|
+
/** Isolate native persisted sessions and registrations for a named profile. */
|
|
1097
|
+
persistenceNamespace?: string;
|
|
1098
|
+
/** Native-owned durable logical server identity; changing URL retires its credentials. */
|
|
1099
|
+
resourceIdentity?: string;
|
|
1100
|
+
/** Import an existing grant for one resource. Persisted sessions take precedence. */
|
|
1101
|
+
initialGrant?: {
|
|
1102
|
+
resource: string;
|
|
1103
|
+
tokens: ImportedOAuthTokens;
|
|
1104
|
+
};
|
|
1105
|
+
browser: {
|
|
1106
|
+
openBrowser?(url: string): Promise<void>;
|
|
1107
|
+
/** Exact registered HTTP loopback redirect URI. */
|
|
1108
|
+
redirectUri?: string;
|
|
1109
|
+
signal?: AbortSignal;
|
|
1110
|
+
timeoutMs?: number;
|
|
1111
|
+
readLine?: () => Promise<string>;
|
|
1112
|
+
createServer?: () => http.Server;
|
|
1113
|
+
landingPage?: {
|
|
1114
|
+
title: string;
|
|
1115
|
+
body: string;
|
|
1116
|
+
};
|
|
1117
|
+
};
|
|
1118
|
+
sessionStore?: OAuthSessionStore;
|
|
1119
|
+
authStore?: CreateSecretStoreInput;
|
|
1120
|
+
now?: () => number;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
interface EnvironmentReference {
|
|
1124
|
+
readonly env: string;
|
|
1125
|
+
}
|
|
1126
|
+
interface PublicEnvironmentReference extends EnvironmentReference {
|
|
1127
|
+
readonly fallback?: string;
|
|
1128
|
+
}
|
|
1129
|
+
interface OAuthCredentialReferences {
|
|
1130
|
+
readonly clientId: EnvironmentReference;
|
|
1131
|
+
readonly clientSecret: EnvironmentReference;
|
|
1132
|
+
readonly scope: PublicEnvironmentReference;
|
|
1133
|
+
readonly redirectUri: PublicEnvironmentReference;
|
|
1134
|
+
readonly accessToken: EnvironmentReference;
|
|
1135
|
+
readonly refreshToken: EnvironmentReference;
|
|
1136
|
+
readonly expiresAt: EnvironmentReference;
|
|
1137
|
+
readonly expiresIn?: EnvironmentReference;
|
|
1138
|
+
readonly issuedAt?: EnvironmentReference;
|
|
1139
|
+
}
|
|
1140
|
+
type RemoteMcpAuthenticationConfiguration = {
|
|
1141
|
+
readonly type: "bearer";
|
|
1142
|
+
readonly token: EnvironmentReference;
|
|
1143
|
+
} | {
|
|
1144
|
+
readonly type: "oauth";
|
|
1145
|
+
readonly clientMode: "static" | "dynamic";
|
|
1146
|
+
readonly persistenceNamespace?: string;
|
|
1147
|
+
readonly clientName?: string;
|
|
1148
|
+
readonly tokenEndpointAuthMethod?: OAuthTokenEndpointAuthMethod;
|
|
1149
|
+
readonly credentials: OAuthCredentialReferences;
|
|
1150
|
+
};
|
|
1151
|
+
interface RemoteMcpServerConfiguration extends Omit<RemoteMcpServer, "headers" | "oauth"> {
|
|
1152
|
+
readonly headers?: Readonly<Record<string, EnvironmentReference>>;
|
|
1153
|
+
readonly auth?: RemoteMcpAuthenticationConfiguration;
|
|
1154
|
+
}
|
|
1155
|
+
interface RemoteMcpConfiguration {
|
|
1156
|
+
readonly version: 1;
|
|
1157
|
+
readonly servers: readonly RemoteMcpServerConfiguration[];
|
|
1158
|
+
}
|
|
1159
|
+
interface InitRemoteMcpServer extends Omit<RemoteMcpServerConfiguration, "auth"> {
|
|
1160
|
+
readonly auth?: {
|
|
1161
|
+
readonly type: "bearer";
|
|
1162
|
+
readonly env?: string;
|
|
1163
|
+
} | {
|
|
1164
|
+
readonly type: "oauth";
|
|
1165
|
+
readonly clientMode: "static" | "dynamic";
|
|
1166
|
+
readonly clientName?: string;
|
|
1167
|
+
readonly persistenceNamespace?: string;
|
|
1168
|
+
readonly tokenEndpointAuthMethod?: OAuthTokenEndpointAuthMethod;
|
|
1169
|
+
readonly env?: Partial<Record<keyof OAuthCredentialReferences, string>>;
|
|
1170
|
+
readonly scope?: string;
|
|
1171
|
+
readonly redirectUri?: string;
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
interface ConfigurationOptions {
|
|
1175
|
+
readonly maxConfigurationBytes?: number;
|
|
1176
|
+
readonly maxTools?: number;
|
|
1177
|
+
}
|
|
1178
|
+
interface RemoteMcpInitialization {
|
|
1179
|
+
readonly configuration: RemoteMcpConfiguration;
|
|
1180
|
+
readonly envTemplate: string;
|
|
1181
|
+
}
|
|
1182
|
+
/** Parse a versioned JSON-only configuration without reading credentials or connecting. */
|
|
1183
|
+
declare function parseRemoteMcpConfiguration(value: unknown, options?: ConfigurationOptions): RemoteMcpConfiguration;
|
|
1184
|
+
/** Produce declarative credential references and empty dotenv entries, with no network or secret reads. */
|
|
1185
|
+
declare function initRemoteMcpConfiguration(servers: readonly InitRemoteMcpServer[], options?: ConfigurationOptions): RemoteMcpInitialization;
|
|
1186
|
+
|
|
1187
|
+
interface ConfigurationBindingOptions extends ConfigurationOptions {
|
|
1188
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
1189
|
+
readonly maxCredentialBytes?: number;
|
|
1190
|
+
readonly oauth?: {
|
|
1191
|
+
readonly allowInteractive?: boolean;
|
|
1192
|
+
readonly sessionLockTimeoutMs?: number;
|
|
1193
|
+
readonly browser?: Omit<DefaultOAuthClientProviderOptions["browser"], "redirectUri">;
|
|
1194
|
+
readonly sessionStore?: (server: RemoteMcpServerConfiguration) => OAuthSessionStore;
|
|
1195
|
+
/** Host-owned reset must retire credentials and suppress stale initial imports durably. */
|
|
1196
|
+
readonly reset?: (server: RemoteMcpServerConfiguration, options: {
|
|
1197
|
+
signal?: AbortSignal;
|
|
1198
|
+
timeoutMs: number;
|
|
1199
|
+
}) => Promise<void>;
|
|
1200
|
+
/** Atomically install a grant/client and suppress stale automatic imports durably. */
|
|
1201
|
+
readonly importSession?: (server: RemoteMcpServerConfiguration, session: StoredOAuthSession, options: {
|
|
1202
|
+
signal?: AbortSignal;
|
|
1203
|
+
timeoutMs: number;
|
|
1204
|
+
}) => Promise<void>;
|
|
1205
|
+
readonly authStore?: DefaultOAuthClientProviderOptions["authStore"];
|
|
1206
|
+
readonly now?: () => number;
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
interface BoundRemoteMcpServer extends Omit<RemoteMcpServer, "oauth"> {
|
|
1210
|
+
readonly oauth?: {
|
|
1211
|
+
readonly provider: OAuthClientProvider;
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
/** Resolve explicit environment references into runtime-only credentials without network or artifact writes. */
|
|
1215
|
+
declare function bindRemoteMcpConfiguration(value: unknown, options: ConfigurationBindingOptions): BoundRemoteMcpServer[];
|
|
1216
|
+
|
|
1217
|
+
interface RemoteMcpArtifact {
|
|
1218
|
+
readonly version: 1;
|
|
1219
|
+
readonly configuration: RemoteMcpConfiguration;
|
|
1220
|
+
readonly schemas: readonly RemoteMcpSchema[];
|
|
1221
|
+
readonly schemaRegistry?: Readonly<Record<string, unknown>>;
|
|
1222
|
+
readonly digest: string;
|
|
1223
|
+
}
|
|
1224
|
+
interface ArtifactOptions extends ConfigurationOptions {
|
|
1225
|
+
readonly maxArtifactBytes?: number;
|
|
1226
|
+
}
|
|
1227
|
+
interface ArtifactGenerationOptions extends ArtifactOptions {
|
|
1228
|
+
readonly binding?: ConfigurationBindingOptions;
|
|
1229
|
+
readonly schema?: SchemaFetchOptions;
|
|
1230
|
+
/** JSON-only external schema documents captured with the artifact. */
|
|
1231
|
+
readonly schemaRegistry?: Readonly<Record<string, unknown>>;
|
|
1232
|
+
}
|
|
1233
|
+
interface GeneratedRemoteMcpArtifact {
|
|
1234
|
+
readonly artifact: RemoteMcpArtifact;
|
|
1235
|
+
readonly json: string;
|
|
1236
|
+
/** Dependency-free ESM data module exporting the artifact as default. */
|
|
1237
|
+
readonly module: string;
|
|
1238
|
+
}
|
|
1239
|
+
interface ArtifactPluginOptions extends ArtifactOptions {
|
|
1240
|
+
readonly binding: ConfigurationBindingOptions;
|
|
1241
|
+
readonly commands?: RemoteMcpCommandOptions;
|
|
1242
|
+
}
|
|
1243
|
+
/** Discover only absent schemas and produce deterministic, credential-free artifacts. */
|
|
1244
|
+
declare function generateRemoteMcpArtifact(value: unknown, options?: ArtifactGenerationOptions): Promise<GeneratedRemoteMcpArtifact>;
|
|
1245
|
+
/** Validate bounded JSON, integrity and snapshot/configuration agreement before runtime binding. */
|
|
1246
|
+
declare function parseRemoteMcpArtifact(value: unknown, options?: ArtifactOptions): RemoteMcpArtifact;
|
|
1247
|
+
/** Prepare an artifact's commands without rediscovery, using explicit runtime credentials. */
|
|
1248
|
+
declare function remoteMcpArtifactPlugin(value: unknown, options: ArtifactPluginOptions): Promise<Awaited<ReturnType<typeof remoteMcpCommands>>>;
|
|
1249
|
+
|
|
1250
|
+
interface RemoteMcpAuthorizationRequest {
|
|
1251
|
+
readonly authorizationUrl: string;
|
|
1252
|
+
readonly redirectUri: string;
|
|
1253
|
+
}
|
|
1254
|
+
interface RemoteMcpAuthenticationOptions extends SchemaFetchOptions {
|
|
1255
|
+
readonly binding: ConfigurationBindingOptions;
|
|
1256
|
+
/** Defaults to headless URL delivery. Browser launch requires an explicit false. */
|
|
1257
|
+
readonly noBrowser?: boolean;
|
|
1258
|
+
/** Explicitly retire old credentials before establishing access again. */
|
|
1259
|
+
readonly reset?: boolean;
|
|
1260
|
+
readonly onAuthorizationUrl?: (request: RemoteMcpAuthorizationRequest) => void | Promise<void>;
|
|
1261
|
+
}
|
|
1262
|
+
interface RemoteMcpAuthenticationResult {
|
|
1263
|
+
readonly name: string;
|
|
1264
|
+
readonly url: string;
|
|
1265
|
+
readonly serverInfo?: Implementation;
|
|
1266
|
+
readonly capabilities?: ServerCapabilities;
|
|
1267
|
+
readonly instructions?: string;
|
|
1268
|
+
}
|
|
1269
|
+
/** Establish access explicitly, without listing tools or invoking any tool. */
|
|
1270
|
+
declare function authenticateRemoteMcpServer(value: RemoteMcpServerConfiguration, options: RemoteMcpAuthenticationOptions): Promise<RemoteMcpAuthenticationResult>;
|
|
1271
|
+
|
|
1272
|
+
interface RemoteMcpCredentialImportOptions extends ConfigurationOptions {
|
|
1273
|
+
readonly binding?: ConfigurationBindingOptions;
|
|
1274
|
+
readonly signal?: AbortSignal;
|
|
1275
|
+
readonly fetch?: SchemaFetchOptions["fetch"];
|
|
1276
|
+
readonly oauthDiscoveryCache?: SchemaFetchOptions["oauthDiscoveryCache"];
|
|
1277
|
+
/** Bounds discovery and the complete persistence operation. Default 30000. */
|
|
1278
|
+
readonly requestTimeoutMs?: number;
|
|
1279
|
+
/** Maximum native transaction lock wait. Default 30000. */
|
|
1280
|
+
readonly timeoutMs?: number;
|
|
1281
|
+
readonly maxImportBytes?: number;
|
|
1282
|
+
}
|
|
1283
|
+
interface RemoteMcpCredentialImportResult {
|
|
1284
|
+
readonly name: string;
|
|
1285
|
+
readonly url: string;
|
|
1286
|
+
readonly imported: true;
|
|
1287
|
+
}
|
|
1288
|
+
/** Install a raw token response with its original app under validated discovery. */
|
|
1289
|
+
declare function importRemoteMcpAuthentication(value: RemoteMcpServerConfiguration, payload: unknown, options?: RemoteMcpCredentialImportOptions): Promise<RemoteMcpCredentialImportResult>;
|
|
1290
|
+
|
|
1291
|
+
type RemoteMcpResourceRequest = {
|
|
1292
|
+
readonly operation: "list" | "templates";
|
|
1293
|
+
readonly cursor?: string;
|
|
1294
|
+
} | {
|
|
1295
|
+
readonly operation: "read";
|
|
1296
|
+
readonly uri: string;
|
|
1297
|
+
};
|
|
1298
|
+
interface RemoteMcpResourceOptions extends SchemaFetchOptions {
|
|
1299
|
+
readonly maxInputBytes?: number;
|
|
1300
|
+
}
|
|
1301
|
+
type RemoteMcpResourceResult = Awaited<ReturnType<McpClient["listResources"]>> | Awaited<ReturnType<McpClient["listResourceTemplates"]>> | Awaited<ReturnType<McpClient["readResource"]>>;
|
|
1302
|
+
/** Access a remote resource directly, preserving one page/result without tool discovery. */
|
|
1303
|
+
declare function accessRemoteMcpResources(server: RemoteMcpServer, request: RemoteMcpResourceRequest, options?: RemoteMcpResourceOptions): Promise<RemoteMcpResourceResult>;
|
|
1304
|
+
|
|
1305
|
+
interface RemoteMcpCredentialResetOptions extends ConfigurationOptions {
|
|
1306
|
+
readonly binding?: Pick<ConfigurationBindingOptions, "oauth"> & {
|
|
1307
|
+
readonly env?: ConfigurationBindingOptions["env"];
|
|
1308
|
+
};
|
|
1309
|
+
readonly signal?: AbortSignal;
|
|
1310
|
+
readonly timeoutMs?: number;
|
|
1311
|
+
}
|
|
1312
|
+
interface RemoteMcpCredentialResetResult {
|
|
1313
|
+
readonly name: string;
|
|
1314
|
+
readonly url: string;
|
|
1315
|
+
readonly reset: true;
|
|
1316
|
+
}
|
|
1317
|
+
/** Retire a named OAuth identity without resolving credentials or reading its old document. */
|
|
1318
|
+
declare function resetRemoteMcpAuthentication(value: RemoteMcpServerConfiguration, options?: RemoteMcpCredentialResetOptions): Promise<RemoteMcpCredentialResetResult>;
|
|
1319
|
+
|
|
1320
|
+
interface RemoteMcpManagementOptions extends ConfigurationOptions {
|
|
1321
|
+
readonly name?: string;
|
|
1322
|
+
readonly signal?: AbortSignal;
|
|
1323
|
+
readonly maxInputBytes?: number;
|
|
1324
|
+
readonly maxOutputBytes?: number;
|
|
1325
|
+
readonly generation?: ArtifactGenerationOptions;
|
|
1326
|
+
readonly authentication?: Omit<RemoteMcpAuthenticationOptions, "binding"> & {
|
|
1327
|
+
readonly binding?: ConfigurationBindingOptions;
|
|
1328
|
+
};
|
|
1329
|
+
readonly reset?: RemoteMcpCredentialResetOptions;
|
|
1330
|
+
readonly credentialImport?: RemoteMcpCredentialImportOptions;
|
|
1331
|
+
readonly resources?: RemoteMcpResourceOptions & {
|
|
1332
|
+
readonly binding?: ConfigurationBindingOptions;
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1335
|
+
/** Create configuration and artifact commands for a host-owned static remote registry. */
|
|
1336
|
+
declare function createRemoteMcpManagementCommand(servers: readonly InitRemoteMcpServer[], options?: RemoteMcpManagementOptions): CommandDefinition;
|
|
1337
|
+
|
|
1338
|
+
export { accessRemoteMcpResources, authenticateRemoteMcpServer, bindRemoteMcpConfiguration, compileToolArguments, createRemoteMcpCommands, createRemoteMcpManagementCommand, fetchRemoteMcpSchema, generateRemoteMcpArtifact, importRemoteMcpAuthentication, initRemoteMcpConfiguration, parseRemoteMcpArtifact, parseRemoteMcpConfiguration, remoteMcpArtifactPlugin, remoteMcpCommands, resetRemoteMcpAuthentication, resolveRemoteMcpSchemas };
|
|
1339
|
+
export type { ArtifactGenerationOptions, ArtifactOptions, ArtifactPluginOptions, BoundRemoteMcpServer, ConfigurationBindingOptions, ConfigurationOptions, EnvironmentReference, GeneratedRemoteMcpArtifact, InitRemoteMcpServer, OAuthCredentialReferences, PublicEnvironmentReference, RemoteMcpArtifact, RemoteMcpAuthenticationConfiguration, RemoteMcpAuthenticationOptions, RemoteMcpAuthenticationResult, RemoteMcpAuthorizationRequest, RemoteMcpCommandOptions, RemoteMcpConfiguration, RemoteMcpCredentialImportOptions, RemoteMcpCredentialImportResult, RemoteMcpCredentialResetOptions, RemoteMcpCredentialResetResult, RemoteMcpElicitationContext, RemoteMcpElicitationHandler, RemoteMcpInitialization, RemoteMcpManagementOptions, RemoteMcpResourceOptions, RemoteMcpResourceRequest, RemoteMcpResourceResult, RemoteMcpSchema, RemoteMcpServer, RemoteMcpServerConfiguration, SchemaFetchOptions, ToolArgumentParseOptions, ToolArgumentParser, ToolParameter };
|