@poe-platform/safe-bash 0.1.787 → 0.1.789
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 +1 -1
- package/dist/safe-bash/chunks/{chunk-WHURJBET.js → chunk-2MUJ7RLZ.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-PYTLIUST.js → chunk-CTUHLNJM.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Z3HX3ZBA.js → chunk-D4PHJK4T.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-O6356Z27.js → chunk-H7MMJS26.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Q3E6C3DX.js → chunk-KHJGUF2W.js} +14 -0
- package/dist/safe-bash/chunks/{chunk-FJZNUUOQ.js → chunk-VUVKC6HV.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-ZMYVCRAF.js → chunk-X5ZCECM6.js} +2 -2
- package/dist/safe-bash/chunks/{git-UFNPAOYZ.js → git-HO7WDPHZ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-PFBJR2PY.js → chunk-2KRKKW5S.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4DSJDVBM.js → chunk-32F3RBUW.js} +10 -749
- package/dist/safe-bash/command-chunks/{chunk-WVWWRMFD.js → chunk-3KROFHBT.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-L3MLMXL4.js → chunk-3ZK5F23O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4QX6XCDD.js → chunk-4RNIZ3RT.js} +79 -0
- package/dist/safe-bash/command-chunks/{chunk-IFUNAM4D.js → chunk-5L62A5RO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-D7TADAYG.js → chunk-64LG3EVJ.js} +17 -0
- package/dist/safe-bash/command-chunks/{chunk-JUDOV5MJ.js → chunk-6F7QJMJ3.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IJ3FXP4Q.js → chunk-A3ZX6SCY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-DREUDEQG.js → chunk-AT6ZSOE6.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-BUKYQBXO.js → chunk-BJ6DGYJA.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-KSIGF4AG.js → chunk-BK4CMEE6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-NSEUBSOD.js → chunk-CXMOCPPH.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-XGMWWUHV.js → chunk-CZ5DAK4K.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z57TV6TC.js → chunk-EZ2DTOLI.js} +4 -2
- package/dist/safe-bash/command-chunks/{chunk-ADCGH6A7.js → chunk-FH3D75FC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WYJTWJZ5.js → chunk-G3G6W5ZE.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3HDIDEUJ.js → chunk-GF54KE2M.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3JS4FOLB.js → chunk-HETU7MYN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z7TYZG3A.js → chunk-IHHTTQX6.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-INDIFLBW.js → chunk-JTAGNROA.js} +4 -0
- package/dist/safe-bash/command-chunks/{chunk-Z47EO74H.js → chunk-MYKK3Q5G.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GZOUGVVV.js → chunk-OYZ534IK.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-PGEYORBZ.js +25 -0
- package/dist/safe-bash/command-chunks/chunk-QM4UZF3C.js +753 -0
- package/dist/safe-bash/command-chunks/{chunk-TOSM3T3A.js → chunk-UJOO6DKY.js} +20 -9
- package/dist/safe-bash/command-chunks/{chunk-TFZEYNMX.js → chunk-VQLFJCG7.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-BIXN77VL.js → chunk-VUG324ER.js} +10 -0
- package/dist/safe-bash/command-chunks/{chunk-2LP3VMPA.js → chunk-WFDW4XXD.js} +1 -17
- package/dist/safe-bash/command-chunks/chunk-WR37IS4O.js +318 -0
- package/dist/safe-bash/command-chunks/{chunk-Y5IHIAY3.js → chunk-XNHSCU6I.js} +7 -3
- package/dist/safe-bash/commands/basic.js +148 -48
- package/dist/safe-bash/commands/bytes/compression/index.js +5 -6
- package/dist/safe-bash/commands/cmp.d.ts +2 -3
- package/dist/safe-bash/commands/cmp.js +2 -689
- package/dist/safe-bash/commands/docx/index.browser.js +3 -46
- package/dist/safe-bash/commands/docx/index.d.ts +2 -24
- package/dist/safe-bash/commands/docx/index.js +2 -41
- package/dist/safe-bash/commands/docx/io.d.ts +1 -14
- package/dist/safe-bash/commands/docx/io.js +1 -15
- package/dist/safe-bash/commands/llm/index.browser.js +3 -3
- package/dist/safe-bash/commands/network/index.browser.js +3 -3
- package/dist/safe-bash/commands/node/index.browser.js +3 -3
- package/dist/safe-bash/commands/pptx/index.d.ts +2 -28
- package/dist/safe-bash/commands/pptx/index.js +2 -152
- package/dist/safe-bash/commands/printf-float.d.ts +1 -0
- package/dist/safe-bash/commands/printf-float.js +48 -38
- package/dist/safe-bash/commands/printf-format.js +9 -6
- package/dist/safe-bash/commands/printf-quote.d.ts +3 -0
- package/dist/safe-bash/commands/printf-quote.js +62 -0
- package/dist/safe-bash/commands/printf-wide.d.ts +5 -0
- package/dist/safe-bash/commands/printf-wide.js +41 -0
- package/dist/safe-bash/commands/python/index.browser.js +2 -2
- package/dist/safe-bash/commands/truncate.d.ts +2 -3
- package/dist/safe-bash/commands/truncate.js +2 -686
- package/dist/safe-bash/contracts/diagnostics.d.ts +2 -0
- package/dist/safe-bash/contracts/diagnostics.js +2 -0
- package/dist/safe-bash/contracts/runtime-control.d.ts +2 -0
- package/dist/safe-bash/contracts/runtime-control.js +2 -0
- package/dist/safe-bash/core.browser.d.ts +1 -1
- package/dist/safe-bash/core.browser.js +2651 -4871
- package/dist/safe-bash/core.d.ts +10 -0
- package/dist/safe-bash/opt-in/commands/cmp/index.d.ts +6 -2
- package/dist/safe-bash/opt-in/commands/cmp/index.js +776 -79
- package/dist/safe-bash/opt-in/commands/cmp/options.d.ts +0 -12
- package/dist/safe-bash/opt-in/commands/cmp/options.js +0 -153
- package/dist/safe-bash/opt-in/commands/truncate/index.d.ts +8 -3
- package/dist/safe-bash/opt-in/commands/truncate/index.js +790 -272
- package/dist/safe-bash/opt-in/commands/truncate/sync.d.ts +1 -0
- package/dist/safe-bash/opt-in/commands/truncate/sync.js +60 -0
- package/dist/safe-bash/optional-host.browser.js +9 -1
- package/dist/safe-bash/optional-host.d.ts +3 -1
- package/dist/safe-bash/optional-host.js +3 -1
- package/dist/safe-bash/shell/runtime.js +10 -6
- package/dist/safe-bash-checksum-engine/index.d.ts +1 -1
- package/dist/safe-bash-checksum-engine/index.js +14 -2
- package/dist/safe-bash-command-bzip2/index.js +2 -1
- package/dist/safe-bash-command-cmp/index.d.ts +10 -0
- package/dist/safe-bash-command-cmp/index.js +796 -0
- package/dist/safe-bash-command-cmp/options.d.ts +12 -0
- package/dist/safe-bash-command-cmp/options.js +42 -0
- package/dist/safe-bash-command-csvcut/index.js +11 -8
- package/dist/safe-bash-command-csvgrep/index.js +35 -7
- package/dist/safe-bash-command-csvkit/codecs/python.js +4 -3
- package/dist/safe-bash-command-csvkit/codecs/utf8.js +3 -2
- package/dist/safe-bash-command-csvkit/index.js +80 -324
- package/dist/safe-bash-command-csvkit/python-regex.d.ts +5 -0
- package/dist/safe-bash-command-csvkit/python-regex.js +14 -0
- package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/sync-support.js +4 -2
- package/dist/safe-bash-command-diff3/index.js +3 -0
- package/dist/safe-bash-command-docx/LICENSE +21 -0
- package/dist/safe-bash-command-docx/index.d.ts +30 -0
- package/dist/safe-bash-command-docx/index.js +67 -0
- package/dist/safe-bash-command-docx/io.d.ts +14 -0
- package/dist/safe-bash-command-docx/io.js +26 -0
- package/dist/safe-bash-command-envsubst/index.js +34 -3
- package/dist/safe-bash-command-exiftool/index.js +3 -0
- package/dist/safe-bash-command-ffmpeg/index.js +1102 -1088
- package/dist/safe-bash-command-fold/family.js +1 -1
- package/dist/safe-bash-command-fold/index.js +1 -1
- package/dist/safe-bash-command-htmlq/index.js +5 -0
- package/dist/safe-bash-command-imagemagick/index.d.ts +25 -21
- package/dist/safe-bash-command-imagemagick/index.js +669 -271
- package/dist/safe-bash-command-mmdc/index.js +48 -10
- package/dist/safe-bash-command-mmdc/svg.d.ts +1 -0
- package/dist/safe-bash-command-op/index.js +19 -14
- package/dist/safe-bash-command-pandoc/command.js +1 -1
- package/dist/safe-bash-command-pandoc/index.js +1 -1
- package/dist/safe-bash-command-pdfimages/index.d.ts +7 -1
- package/dist/safe-bash-command-pdfimages/index.js +63 -33
- package/dist/safe-bash-command-pdfinfo/index.d.ts +24 -20
- package/dist/safe-bash-command-pdfinfo/index.js +370 -161
- package/dist/safe-bash-command-pdftk/index.d.ts +7 -3
- package/dist/safe-bash-command-pdftk/index.js +114 -45
- package/dist/safe-bash-command-pdftoppm/index.d.ts +15 -7
- package/dist/safe-bash-command-pdftoppm/index.js +179 -109
- package/dist/safe-bash-command-pdftotext/index.d.ts +9 -5
- package/dist/safe-bash-command-pdftotext/index.js +90 -27
- package/dist/safe-bash-command-pptx/LICENSE +21 -0
- package/dist/safe-bash-command-pptx/index.d.ts +33 -0
- package/dist/safe-bash-command-pptx/index.js +168 -0
- package/dist/safe-bash-command-qpdf/index.d.ts +9 -3
- package/dist/safe-bash-command-qpdf/index.js +80 -29
- package/dist/safe-bash-command-sha512sum/index.js +12 -475
- package/dist/safe-bash-command-sips/index.d.ts +9 -5
- package/dist/safe-bash-command-sips/index.js +63 -44
- package/dist/safe-bash-command-soffice/index.d.ts +9 -3
- package/dist/safe-bash-command-soffice/index.js +65 -24
- package/dist/safe-bash-command-sqlite3/engine.d.ts +9 -0
- package/dist/safe-bash-command-sqlite3/index.d.ts +1 -0
- package/dist/safe-bash-command-sqlite3/index.js +851 -352
- package/dist/safe-bash-command-ssconvert/formats/xls.js +3 -3
- package/dist/safe-bash-command-timeout/index.js +3 -3
- package/dist/safe-bash-command-truncate/index.d.ts +8 -3
- package/dist/safe-bash-command-truncate/index.js +790 -272
- package/dist/safe-bash-command-truncate/sync.d.ts +1 -0
- package/dist/safe-bash-command-truncate/sync.js +60 -0
- package/dist/safe-bash-command-wkhtmltopdf/index.js +92 -38
- package/dist/safe-bash-command-wkhtmltopdf/pdf-renderer.d.ts +1 -1
- package/dist/safe-bash-command-xxd/index.js +78 -20
- package/dist/safe-bash-command-xz/command.d.ts +4 -0
- package/dist/safe-bash-command-xz/index.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +1 -1
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +6 -6
- package/dist/safe-bash-compression-engine/index.js +5 -5
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/stream.js +5 -5
- package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
- package/dist/safe-bash-contracts/command.js +3 -3
- package/dist/safe-bash-contracts/diagnostics.js +3 -3
- package/dist/safe-bash-contracts/escaping.js +9 -9
- package/dist/safe-bash-contracts/filesystem-descriptor.js +3 -3
- package/dist/safe-bash-contracts/filesystem-output.js +8 -8
- package/dist/safe-bash-contracts/index.js +21 -19
- package/dist/safe-bash-contracts/io.d.ts +12 -0
- package/dist/safe-bash-contracts/io.js +4 -1
- package/dist/safe-bash-contracts/output.js +3 -2
- package/dist/safe-bash-contracts/runtime-control.js +2 -2
- package/dist/safe-bash-contracts/signals.js +1 -1
- package/dist/safe-bash-contracts/yield.d.ts +1 -0
- package/dist/safe-bash-contracts/yield.js +3 -1
- package/dist/safe-bash-csv-engine/index.d.ts +10 -1
- package/dist/safe-bash-csv-engine/index.js +78 -6
- package/dist/safe-bash-io-engine/commands/search/requirements.js +3 -3
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +3 -3
- package/dist/safe-bash-io-engine/gnu-information.js +1 -1
- package/dist/safe-bash-io-engine/internal.d.ts +1 -1
- package/dist/safe-bash-io-engine/internal.js +2 -2
- package/dist/safe-bash-mcp/index.browser.d.ts +875 -0
- package/dist/safe-bash-mcp/index.browser.js +8740 -0
- package/dist/safe-bash-mcp/index.js +32 -31
- package/dist/safe-bash-query-engine/capture.js +3 -3
- package/dist/safe-bash-query-engine/delpaths.js +3 -3
- package/dist/safe-bash-query-engine/formats.js +2 -2
- package/dist/safe-bash-query-engine/index.js +12 -12
- package/dist/safe-bash-query-engine/indices.js +3 -3
- package/dist/safe-bash-query-engine/input.js +1 -1
- package/dist/safe-bash-query-engine/interpreter.js +10 -10
- package/dist/safe-bash-query-engine/query-core.js +12 -12
- package/dist/safe-bash-query-engine/regex.js +3 -3
- package/dist/safe-bash-query-engine/splits.js +4 -4
- package/dist/safe-bash-query-engine/values.js +2 -2
- package/package.json +9 -3
- package/dist/safe-bash/opt-in/commands/cmp/compare.js +0 -95
- package/dist/safe-bash/opt-in/commands/cmp/io.js +0 -218
- package/dist/safe-bash/command-chunks/{chunk-FXYWQ6S4.js → chunk-2VTMZTV3.js} +0 -0
- package/dist/safe-bash/command-chunks/{chunk-DEH3CMGL.js → chunk-QJ3ONEBI.js} +3 -3
|
@@ -0,0 +1,875 @@
|
|
|
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
|
+
type JsonSchemaRegistry = Record<string, unknown>;
|
|
6
|
+
interface CompileJsonSchemaOptions {
|
|
7
|
+
registry?: JsonSchemaRegistry;
|
|
8
|
+
formats?: Readonly<Record<string, (value: string) => boolean>>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface Implementation {
|
|
12
|
+
name: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
version: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
websiteUrl?: string;
|
|
17
|
+
icons?: Icon[];
|
|
18
|
+
}
|
|
19
|
+
interface Tool$1 {
|
|
20
|
+
name: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
inputSchema: JSONSchema;
|
|
24
|
+
outputSchema?: OutputSchema;
|
|
25
|
+
annotations?: ToolAnnotations;
|
|
26
|
+
execution?: ToolExecution;
|
|
27
|
+
icons?: Icon[];
|
|
28
|
+
_meta?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
interface ToolAnnotations {
|
|
31
|
+
title?: string;
|
|
32
|
+
readOnlyHint?: boolean;
|
|
33
|
+
destructiveHint?: boolean;
|
|
34
|
+
idempotentHint?: boolean;
|
|
35
|
+
openWorldHint?: boolean;
|
|
36
|
+
}
|
|
37
|
+
interface ToolExecution {
|
|
38
|
+
taskSupport?: "optional" | "required" | "forbidden";
|
|
39
|
+
}
|
|
40
|
+
interface Icon {
|
|
41
|
+
src: string;
|
|
42
|
+
mimeType?: string;
|
|
43
|
+
sizes?: string[];
|
|
44
|
+
theme?: "light" | "dark";
|
|
45
|
+
}
|
|
46
|
+
interface ContentAnnotations {
|
|
47
|
+
audience?: Array<"user" | "assistant">;
|
|
48
|
+
priority?: number;
|
|
49
|
+
lastModified?: string;
|
|
50
|
+
}
|
|
51
|
+
interface ResourceLink extends Resource {
|
|
52
|
+
type: "resource_link";
|
|
53
|
+
}
|
|
54
|
+
interface PromptArgument {
|
|
55
|
+
name: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
required?: boolean;
|
|
59
|
+
}
|
|
60
|
+
interface Prompt {
|
|
61
|
+
name: string;
|
|
62
|
+
title?: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
arguments?: PromptArgument[];
|
|
65
|
+
icons?: Icon[];
|
|
66
|
+
_meta?: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
interface Resource {
|
|
69
|
+
uri: string;
|
|
70
|
+
name: string;
|
|
71
|
+
title?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
mimeType?: string;
|
|
74
|
+
size?: number;
|
|
75
|
+
annotations?: ContentAnnotations;
|
|
76
|
+
icons?: Icon[];
|
|
77
|
+
_meta?: Record<string, unknown>;
|
|
78
|
+
}
|
|
79
|
+
interface ResourceTemplate {
|
|
80
|
+
uriTemplate: string;
|
|
81
|
+
name: string;
|
|
82
|
+
title?: string;
|
|
83
|
+
description?: string;
|
|
84
|
+
mimeType?: string;
|
|
85
|
+
annotations?: ContentAnnotations;
|
|
86
|
+
icons?: Icon[];
|
|
87
|
+
_meta?: Record<string, unknown>;
|
|
88
|
+
}
|
|
89
|
+
type ResourceContents$1 = {
|
|
90
|
+
uri: string;
|
|
91
|
+
mimeType?: string;
|
|
92
|
+
text: string;
|
|
93
|
+
_meta?: Record<string, unknown>;
|
|
94
|
+
} | {
|
|
95
|
+
uri: string;
|
|
96
|
+
mimeType?: string;
|
|
97
|
+
blob: string;
|
|
98
|
+
_meta?: Record<string, unknown>;
|
|
99
|
+
};
|
|
100
|
+
type PromptContentItem = {
|
|
101
|
+
type: "text";
|
|
102
|
+
text: string;
|
|
103
|
+
annotations?: ContentAnnotations;
|
|
104
|
+
_meta?: Record<string, unknown>;
|
|
105
|
+
} | {
|
|
106
|
+
type: "image";
|
|
107
|
+
data: string;
|
|
108
|
+
mimeType: string;
|
|
109
|
+
annotations?: ContentAnnotations;
|
|
110
|
+
_meta?: Record<string, unknown>;
|
|
111
|
+
} | {
|
|
112
|
+
type: "audio";
|
|
113
|
+
data: string;
|
|
114
|
+
mimeType: string;
|
|
115
|
+
annotations?: ContentAnnotations;
|
|
116
|
+
_meta?: Record<string, unknown>;
|
|
117
|
+
} | {
|
|
118
|
+
type: "resource";
|
|
119
|
+
annotations?: ContentAnnotations;
|
|
120
|
+
_meta?: Record<string, unknown>;
|
|
121
|
+
resource: {
|
|
122
|
+
uri: string;
|
|
123
|
+
mimeType?: string;
|
|
124
|
+
text: string;
|
|
125
|
+
_meta?: Record<string, unknown>;
|
|
126
|
+
} | {
|
|
127
|
+
uri: string;
|
|
128
|
+
mimeType?: string;
|
|
129
|
+
blob: string;
|
|
130
|
+
_meta?: Record<string, unknown>;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
type ContentItem$1 = PromptContentItem | ResourceLink;
|
|
134
|
+
interface JSONSchema {
|
|
135
|
+
type: "object";
|
|
136
|
+
properties?: Record<string, JSONSchemaProperty>;
|
|
137
|
+
required?: string[];
|
|
138
|
+
[keyword: string]: unknown;
|
|
139
|
+
}
|
|
140
|
+
interface OutputSchema {
|
|
141
|
+
$schema?: string;
|
|
142
|
+
[keyword: string]: unknown;
|
|
143
|
+
}
|
|
144
|
+
interface JSONSchemaProperty extends Record<string, unknown> {
|
|
145
|
+
type?: string | string[];
|
|
146
|
+
description?: string;
|
|
147
|
+
[keyword: string]: unknown;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface NotificationFilter {
|
|
151
|
+
toolsListChanged?: boolean;
|
|
152
|
+
promptsListChanged?: boolean;
|
|
153
|
+
resourcesListChanged?: boolean;
|
|
154
|
+
resourceSubscriptions?: string[];
|
|
155
|
+
}
|
|
156
|
+
interface SubscriptionOptions {
|
|
157
|
+
signal?: AbortSignal;
|
|
158
|
+
}
|
|
159
|
+
interface McpSubscription {
|
|
160
|
+
readonly id: RequestId;
|
|
161
|
+
readonly notifications: NotificationFilter;
|
|
162
|
+
readonly closed: Promise<void>;
|
|
163
|
+
cancel(): void;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
interface SecretStoreLockFileSystem {
|
|
167
|
+
mkdir(path: string, options?: {
|
|
168
|
+
recursive?: boolean;
|
|
169
|
+
mode?: number;
|
|
170
|
+
}): Promise<unknown>;
|
|
171
|
+
readdir(path: string): Promise<string[]>;
|
|
172
|
+
readFile(path: string, encoding: BufferEncoding): Promise<string>;
|
|
173
|
+
writeFile(path: string, value: string, options: {
|
|
174
|
+
encoding: BufferEncoding;
|
|
175
|
+
flag: string;
|
|
176
|
+
mode: number;
|
|
177
|
+
}): Promise<void>;
|
|
178
|
+
rename(from: string, to: string): Promise<void>;
|
|
179
|
+
unlink(path: string): Promise<void>;
|
|
180
|
+
lstat(path: string): Promise<{
|
|
181
|
+
isSymbolicLink(): boolean;
|
|
182
|
+
}>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface MachineIdentity {
|
|
186
|
+
hostname: string;
|
|
187
|
+
username: string;
|
|
188
|
+
}
|
|
189
|
+
interface EncryptedFileStoreFileSystem {
|
|
190
|
+
readdir?(path: string): Promise<string[]>;
|
|
191
|
+
readFile(path: string, encoding: BufferEncoding): Promise<string>;
|
|
192
|
+
writeFile(path: string, data: string | NodeJS.ArrayBufferView, options?: {
|
|
193
|
+
encoding?: BufferEncoding;
|
|
194
|
+
flag?: string;
|
|
195
|
+
mode?: number;
|
|
196
|
+
}): Promise<void>;
|
|
197
|
+
mkdir(path: string, options?: {
|
|
198
|
+
recursive?: boolean;
|
|
199
|
+
}): Promise<void | string | undefined>;
|
|
200
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
201
|
+
lstat(path: string): Promise<{
|
|
202
|
+
isSymbolicLink(): boolean;
|
|
203
|
+
}>;
|
|
204
|
+
unlink(path: string): Promise<void>;
|
|
205
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
206
|
+
}
|
|
207
|
+
interface EncryptedFileStoreInput {
|
|
208
|
+
fs?: EncryptedFileStoreFileSystem;
|
|
209
|
+
filePath?: string;
|
|
210
|
+
salt: string;
|
|
211
|
+
defaultDirectory?: string;
|
|
212
|
+
defaultFileName?: string;
|
|
213
|
+
getMachineIdentity?: () => MachineIdentity | Promise<MachineIdentity>;
|
|
214
|
+
getHomeDirectory?: () => string;
|
|
215
|
+
getRandomBytes?: (size: number) => Buffer;
|
|
216
|
+
/** Fail closed instead of treating malformed or unauthenticated documents as absent. */
|
|
217
|
+
throwOnInvalidDocument?: boolean;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
interface KeychainCommandResult {
|
|
221
|
+
stdout: string;
|
|
222
|
+
stderr: string;
|
|
223
|
+
exitCode: number;
|
|
224
|
+
}
|
|
225
|
+
interface KeychainCommandOptions {
|
|
226
|
+
stdin?: string;
|
|
227
|
+
}
|
|
228
|
+
type KeychainCommandRunner = (command: string, args: string[], options?: KeychainCommandOptions) => Promise<KeychainCommandResult>;
|
|
229
|
+
interface KeychainStoreInput {
|
|
230
|
+
runCommand?: KeychainCommandRunner;
|
|
231
|
+
service: string;
|
|
232
|
+
account: string;
|
|
233
|
+
lock?: {
|
|
234
|
+
fs?: SecretStoreLockFileSystem;
|
|
235
|
+
directory?: string;
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
type StoreBackend = "file" | "keychain";
|
|
240
|
+
interface CreateSecretStoreInput {
|
|
241
|
+
backend?: StoreBackend;
|
|
242
|
+
env?: NodeJS.ProcessEnv;
|
|
243
|
+
platform?: NodeJS.Platform;
|
|
244
|
+
backendEnvVar?: string;
|
|
245
|
+
fileStore?: EncryptedFileStoreInput;
|
|
246
|
+
keychainStore?: KeychainStoreInput;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
type OAuthMetadataFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
250
|
+
interface OAuthProtectedResourceMetadata extends Record<string, unknown> {
|
|
251
|
+
resource: string;
|
|
252
|
+
authorization_servers: string[];
|
|
253
|
+
}
|
|
254
|
+
interface OAuthAuthorizationServerMetadata extends Record<string, unknown> {
|
|
255
|
+
issuer: string;
|
|
256
|
+
authorization_endpoint: string;
|
|
257
|
+
token_endpoint: string;
|
|
258
|
+
registration_endpoint?: string;
|
|
259
|
+
response_types_supported: string[];
|
|
260
|
+
code_challenge_methods_supported: string[];
|
|
261
|
+
authorization_response_iss_parameter_supported?: boolean;
|
|
262
|
+
}
|
|
263
|
+
interface OAuthDiscoveryResult {
|
|
264
|
+
resource: string;
|
|
265
|
+
resourceMetadataUrl: string;
|
|
266
|
+
resourceMetadata: OAuthProtectedResourceMetadata;
|
|
267
|
+
authorizationServer: string;
|
|
268
|
+
authorizationServerMetadataUrl: string;
|
|
269
|
+
authorizationServerMetadata: OAuthAuthorizationServerMetadata;
|
|
270
|
+
}
|
|
271
|
+
interface OAuthUnauthorizedChallenge {
|
|
272
|
+
scheme: "Bearer";
|
|
273
|
+
params: Record<string, string>;
|
|
274
|
+
raw: string;
|
|
275
|
+
}
|
|
276
|
+
interface OAuthClientProvider {
|
|
277
|
+
/** Establish a grant explicitly, including when resource initialization is public. */
|
|
278
|
+
authenticate?(input: {
|
|
279
|
+
requestUrl: URL;
|
|
280
|
+
fetch: OAuthMetadataFetch;
|
|
281
|
+
/** Lazy validated discovery. Without it, recover/reuse known grants only. */
|
|
282
|
+
discover?: () => Promise<OAuthDiscoveryResult>;
|
|
283
|
+
signal?: AbortSignal;
|
|
284
|
+
}): Promise<StoredOAuthTokens | void>;
|
|
285
|
+
authorizeRequest?(input: {
|
|
286
|
+
requestUrl: URL;
|
|
287
|
+
headers: Headers;
|
|
288
|
+
fetch: OAuthMetadataFetch;
|
|
289
|
+
signal?: AbortSignal;
|
|
290
|
+
}): Promise<StoredOAuthTokens | void> | StoredOAuthTokens | void;
|
|
291
|
+
handleUnauthorized(input: {
|
|
292
|
+
requestUrl: URL;
|
|
293
|
+
response: Response;
|
|
294
|
+
challenge: OAuthUnauthorizedChallenge | null;
|
|
295
|
+
/** Validated metadata supplied by direct callers, if already available. */
|
|
296
|
+
discovery?: OAuthDiscoveryResult;
|
|
297
|
+
/** Lazy validated metadata; invoke only when OAuth recovery needs it. */
|
|
298
|
+
discover?: () => Promise<OAuthDiscoveryResult>;
|
|
299
|
+
fetch: OAuthMetadataFetch;
|
|
300
|
+
signal?: AbortSignal;
|
|
301
|
+
/** Headers actually attached to this rejected request. */
|
|
302
|
+
requestHeaders?: Headers;
|
|
303
|
+
/** Owned snapshot returned when this request was authorized, or null if absent. */
|
|
304
|
+
presentedTokens?: StoredOAuthTokens | null;
|
|
305
|
+
}): Promise<{
|
|
306
|
+
action: "retry";
|
|
307
|
+
} | {
|
|
308
|
+
action: "fail";
|
|
309
|
+
error?: Error;
|
|
310
|
+
}> | {
|
|
311
|
+
action: "retry";
|
|
312
|
+
} | {
|
|
313
|
+
action: "fail";
|
|
314
|
+
error?: Error;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
interface OAuthClientMetadata {
|
|
318
|
+
clientName?: string;
|
|
319
|
+
scope?: string;
|
|
320
|
+
softwareId?: string;
|
|
321
|
+
softwareVersion?: string;
|
|
322
|
+
}
|
|
323
|
+
interface StoredOAuthTokens {
|
|
324
|
+
accessToken: string;
|
|
325
|
+
refreshToken?: string;
|
|
326
|
+
tokenType: "Bearer";
|
|
327
|
+
expiresAt: number | null;
|
|
328
|
+
scope?: string;
|
|
329
|
+
}
|
|
330
|
+
/** Import-time lifetimes are normalized once into persisted epoch milliseconds. */
|
|
331
|
+
interface ImportedOAuthTokens extends Omit<StoredOAuthTokens, "expiresAt"> {
|
|
332
|
+
expiresAt?: number | null;
|
|
333
|
+
/** Remaining lifetime at import, or total lifetime when issuedAt is provided. */
|
|
334
|
+
expiresIn?: number;
|
|
335
|
+
/** Original issuance time in Unix epoch milliseconds. */
|
|
336
|
+
issuedAt?: number;
|
|
337
|
+
}
|
|
338
|
+
/** Full RFC 7591 response, including JSON provider extensions. */
|
|
339
|
+
interface OAuthClientRegistration extends Record<string, unknown> {
|
|
340
|
+
client_id: string;
|
|
341
|
+
client_secret?: string | null;
|
|
342
|
+
redirect_uris?: string[] | null;
|
|
343
|
+
grant_types?: string[] | null;
|
|
344
|
+
response_types?: string[] | null;
|
|
345
|
+
contacts?: string[] | null;
|
|
346
|
+
client_id_issued_at?: number | null;
|
|
347
|
+
client_secret_expires_at?: number | null;
|
|
348
|
+
token_endpoint_auth_method?: string | null;
|
|
349
|
+
}
|
|
350
|
+
interface StoredOAuthClient {
|
|
351
|
+
clientId: string;
|
|
352
|
+
/** Externally registered apps must never be replaced by native DCR on reload. */
|
|
353
|
+
registrationOwnership?: "caller";
|
|
354
|
+
/** Actual listener URI submitted when this native client was registered. */
|
|
355
|
+
requestedRedirectUri?: string;
|
|
356
|
+
clientSecret?: string;
|
|
357
|
+
registration?: OAuthClientRegistration;
|
|
358
|
+
tokenEndpointAuthMethod?: OAuthTokenEndpointAuthMethod;
|
|
359
|
+
}
|
|
360
|
+
type OAuthTokenEndpointAuthMethod = "none" | "client_secret_post" | "client_secret_basic";
|
|
361
|
+
interface StoredOAuthSession {
|
|
362
|
+
resource: string;
|
|
363
|
+
authorizationServer: string;
|
|
364
|
+
client: StoredOAuthClient;
|
|
365
|
+
tokens?: StoredOAuthTokens;
|
|
366
|
+
/** A refresh was begun; its winning response may not have been persisted. */
|
|
367
|
+
refreshState?: "pending";
|
|
368
|
+
/** Canonical explicitly requested scope set when the server omits token scope. */
|
|
369
|
+
requestedScope?: string;
|
|
370
|
+
discovery: {
|
|
371
|
+
resourceMetadataUrl: string;
|
|
372
|
+
resourceMetadata: Record<string, unknown>;
|
|
373
|
+
authorizationServerMetadata: Record<string, unknown>;
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
interface OAuthSessionStore {
|
|
377
|
+
load(resource: string): Promise<StoredOAuthSession | null>;
|
|
378
|
+
save(resource: string, session: StoredOAuthSession): Promise<void>;
|
|
379
|
+
clear(resource: string): Promise<void>;
|
|
380
|
+
/** Backend-wide lock covering a complete read/redeem/write transaction. */
|
|
381
|
+
withLock?<T>(resource: string, operation: () => Promise<T>, options: {
|
|
382
|
+
signal?: AbortSignal;
|
|
383
|
+
timeoutMs: number;
|
|
384
|
+
}): Promise<T>;
|
|
385
|
+
}
|
|
386
|
+
/** Configuration values are captured at creation; selected host dependencies remain live. */
|
|
387
|
+
interface DefaultOAuthClientProviderOptions {
|
|
388
|
+
client: {
|
|
389
|
+
mode: "dynamic";
|
|
390
|
+
clientId?: string;
|
|
391
|
+
clientSecret?: string;
|
|
392
|
+
metadata?: OAuthClientMetadata;
|
|
393
|
+
/** Import a complete registration owned by the caller. */
|
|
394
|
+
registration?: OAuthClientRegistration;
|
|
395
|
+
tokenEndpointAuthMethod?: OAuthTokenEndpointAuthMethod;
|
|
396
|
+
} | {
|
|
397
|
+
mode: "static";
|
|
398
|
+
clientId: string;
|
|
399
|
+
clientSecret?: string;
|
|
400
|
+
metadata?: OAuthClientMetadata;
|
|
401
|
+
registration?: OAuthClientRegistration;
|
|
402
|
+
tokenEndpointAuthMethod?: OAuthTokenEndpointAuthMethod;
|
|
403
|
+
};
|
|
404
|
+
/** Disable interactive authorization while allowing cached tokens and silent refresh. */
|
|
405
|
+
allowInteractive?: boolean;
|
|
406
|
+
/** Maximum wait to acquire a session transaction lock (default 30,000 ms). */
|
|
407
|
+
sessionLockTimeoutMs?: number;
|
|
408
|
+
/** Isolate native persisted sessions and registrations for a named profile. */
|
|
409
|
+
persistenceNamespace?: string;
|
|
410
|
+
/** Native-owned durable logical server identity; changing URL retires its credentials. */
|
|
411
|
+
resourceIdentity?: string;
|
|
412
|
+
/** Import an existing grant for one resource. Persisted sessions take precedence. */
|
|
413
|
+
initialGrant?: {
|
|
414
|
+
resource: string;
|
|
415
|
+
tokens: ImportedOAuthTokens;
|
|
416
|
+
};
|
|
417
|
+
browser: {
|
|
418
|
+
openBrowser?(url: string): Promise<void>;
|
|
419
|
+
/** Exact registered HTTP loopback redirect URI. */
|
|
420
|
+
redirectUri?: string;
|
|
421
|
+
signal?: AbortSignal;
|
|
422
|
+
timeoutMs?: number;
|
|
423
|
+
readLine?: () => Promise<string>;
|
|
424
|
+
createServer?: () => http.Server;
|
|
425
|
+
landingPage?: {
|
|
426
|
+
title: string;
|
|
427
|
+
body: string;
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
sessionStore?: OAuthSessionStore;
|
|
431
|
+
authStore?: CreateSecretStoreInput;
|
|
432
|
+
now?: () => number;
|
|
433
|
+
}
|
|
434
|
+
type OAuthClientProviderOptions = {
|
|
435
|
+
provider: OAuthClientProvider;
|
|
436
|
+
} | DefaultOAuthClientProviderOptions;
|
|
437
|
+
|
|
438
|
+
interface OAuthDiscoveryCache {
|
|
439
|
+
get(resourceUrl: string): OAuthDiscoveryResult | null | undefined | Promise<OAuthDiscoveryResult | null | undefined>;
|
|
440
|
+
set(resourceUrl: string, value: OAuthDiscoveryResult): void | Promise<void>;
|
|
441
|
+
delete?(resourceUrl: string): void | Promise<void>;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
type RequestId = number | string;
|
|
445
|
+
interface ClientCapabilities {
|
|
446
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
447
|
+
elicitation?: {
|
|
448
|
+
form?: Record<string, unknown>;
|
|
449
|
+
url?: Record<string, unknown>;
|
|
450
|
+
};
|
|
451
|
+
roots?: {
|
|
452
|
+
listChanged?: boolean;
|
|
453
|
+
[key: string]: unknown;
|
|
454
|
+
};
|
|
455
|
+
sampling?: {
|
|
456
|
+
[key: string]: unknown;
|
|
457
|
+
};
|
|
458
|
+
experimental?: Record<string, unknown>;
|
|
459
|
+
}
|
|
460
|
+
interface ServerCapabilities {
|
|
461
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
462
|
+
prompts?: {
|
|
463
|
+
listChanged?: boolean;
|
|
464
|
+
[key: string]: unknown;
|
|
465
|
+
};
|
|
466
|
+
resources?: {
|
|
467
|
+
subscribe?: boolean;
|
|
468
|
+
listChanged?: boolean;
|
|
469
|
+
[key: string]: unknown;
|
|
470
|
+
};
|
|
471
|
+
tools?: {
|
|
472
|
+
listChanged?: boolean;
|
|
473
|
+
[key: string]: unknown;
|
|
474
|
+
};
|
|
475
|
+
logging?: {
|
|
476
|
+
[key: string]: unknown;
|
|
477
|
+
};
|
|
478
|
+
completions?: {
|
|
479
|
+
[key: string]: unknown;
|
|
480
|
+
};
|
|
481
|
+
experimental?: Record<string, unknown>;
|
|
482
|
+
}
|
|
483
|
+
interface ConnectResult {
|
|
484
|
+
protocolVersion: string;
|
|
485
|
+
capabilities: ServerCapabilities;
|
|
486
|
+
serverInfo?: Implementation;
|
|
487
|
+
instructions?: string;
|
|
488
|
+
}
|
|
489
|
+
type ElicitationParams = {
|
|
490
|
+
mode?: "form";
|
|
491
|
+
message: string;
|
|
492
|
+
requestedSchema: Record<string, unknown>;
|
|
493
|
+
} | {
|
|
494
|
+
mode: "url";
|
|
495
|
+
message: string;
|
|
496
|
+
url: string;
|
|
497
|
+
elicitationId: string;
|
|
498
|
+
};
|
|
499
|
+
interface ElicitationResult {
|
|
500
|
+
_meta?: Record<string, unknown>;
|
|
501
|
+
action: "accept" | "decline" | "cancel";
|
|
502
|
+
content?: Record<string, string | number | boolean | string[]>;
|
|
503
|
+
}
|
|
504
|
+
declare const MCP_PROTOCOL_VERSIONS: readonly ["2025-03-26", "2025-06-18", "2025-11-25", "2026-07-28"];
|
|
505
|
+
type McpProtocolVersion = typeof MCP_PROTOCOL_VERSIONS[number];
|
|
506
|
+
interface McpClientOptions {
|
|
507
|
+
clientInfo: Implementation;
|
|
508
|
+
requestTimeoutMs?: number;
|
|
509
|
+
maxConcurrentRequests?: number;
|
|
510
|
+
protocolVersion?: McpProtocolVersion;
|
|
511
|
+
capabilities?: ClientCapabilities;
|
|
512
|
+
onToolsChanged?: () => void | Promise<void>;
|
|
513
|
+
onResourcesChanged?: () => void | Promise<void>;
|
|
514
|
+
onResourceUpdated?: (uri: string) => void | Promise<void>;
|
|
515
|
+
onPromptsChanged?: () => void | Promise<void>;
|
|
516
|
+
onLog?: (message: LogMessage) => void | Promise<void>;
|
|
517
|
+
onProgress?: (params: ProgressParams) => void | Promise<void>;
|
|
518
|
+
onSamplingRequest?: (params: CreateMessageParams, context: McpRequestContext) => CreateMessageResult | Promise<CreateMessageResult>;
|
|
519
|
+
onRootsList?: (context: McpRequestContext) => Root[] | Promise<Root[]>;
|
|
520
|
+
onElicitationRequest?: (params: ElicitationParams, context: McpRequestContext) => ElicitationResult | Promise<ElicitationResult>;
|
|
521
|
+
}
|
|
522
|
+
declare class McpClient {
|
|
523
|
+
private currentState;
|
|
524
|
+
private currentServerCapabilities;
|
|
525
|
+
private currentClientCapabilities;
|
|
526
|
+
private currentServerInfo;
|
|
527
|
+
private currentInstructions;
|
|
528
|
+
private readonly subscribedResourceUris;
|
|
529
|
+
private readonly activeProgressTokens;
|
|
530
|
+
private readonly options;
|
|
531
|
+
private transport;
|
|
532
|
+
private messageLayer;
|
|
533
|
+
private subscriptions;
|
|
534
|
+
private readonly resourceSubscriptions;
|
|
535
|
+
constructor(options: McpClientOptions);
|
|
536
|
+
get state(): "disconnected" | "initializing" | "ready" | "closed";
|
|
537
|
+
get serverCapabilities(): ServerCapabilities | null;
|
|
538
|
+
get serverInfo(): Implementation | null;
|
|
539
|
+
get instructions(): string | undefined;
|
|
540
|
+
private getMessageLayerOrThrow;
|
|
541
|
+
connect(transport: McpTransport, options?: {
|
|
542
|
+
signal?: AbortSignal;
|
|
543
|
+
}): Promise<ConnectResult>;
|
|
544
|
+
private getServerCapabilitiesOrThrow;
|
|
545
|
+
listTools(params?: PaginatedParams, options?: {
|
|
546
|
+
signal?: AbortSignal;
|
|
547
|
+
}): Promise<PaginatedResult & {
|
|
548
|
+
tools: Tool[];
|
|
549
|
+
}>;
|
|
550
|
+
callTool(params: CallToolParams, options?: CallToolOptions): Promise<CallToolResult>;
|
|
551
|
+
listResources(params?: PaginatedParams, options?: {
|
|
552
|
+
signal?: AbortSignal;
|
|
553
|
+
}): Promise<PaginatedResult & {
|
|
554
|
+
resources: Resource[];
|
|
555
|
+
}>;
|
|
556
|
+
listResourceTemplates(params?: PaginatedParams, options?: {
|
|
557
|
+
signal?: AbortSignal;
|
|
558
|
+
}): Promise<PaginatedResult & {
|
|
559
|
+
resourceTemplates: ResourceTemplate[];
|
|
560
|
+
}>;
|
|
561
|
+
readResource(params: ReadResourceParams, options?: {
|
|
562
|
+
signal?: AbortSignal;
|
|
563
|
+
}): Promise<CacheableResultMetadata & {
|
|
564
|
+
contents: ResourceContents[];
|
|
565
|
+
}>;
|
|
566
|
+
listenNotifications(filter: NotificationFilter, options?: SubscriptionOptions): Promise<McpSubscription>;
|
|
567
|
+
subscribe(uri: string, options?: {
|
|
568
|
+
signal?: AbortSignal;
|
|
569
|
+
}): Promise<void>;
|
|
570
|
+
unsubscribe(uri: string, options?: {
|
|
571
|
+
signal?: AbortSignal;
|
|
572
|
+
}): Promise<void>;
|
|
573
|
+
listPrompts(params?: PaginatedParams, options?: {
|
|
574
|
+
signal?: AbortSignal;
|
|
575
|
+
}): Promise<PaginatedResult & {
|
|
576
|
+
prompts: Prompt[];
|
|
577
|
+
}>;
|
|
578
|
+
getPrompt(params: GetPromptParams, options?: {
|
|
579
|
+
signal?: AbortSignal;
|
|
580
|
+
}): Promise<GetPromptResult>;
|
|
581
|
+
complete(params: CompleteParams, options?: {
|
|
582
|
+
signal?: AbortSignal;
|
|
583
|
+
}): Promise<CompleteResult>;
|
|
584
|
+
setLogLevel(level: LogLevel, options?: {
|
|
585
|
+
signal?: AbortSignal;
|
|
586
|
+
}): Promise<void>;
|
|
587
|
+
cancel(requestId: RequestId, reason?: string): Promise<void>;
|
|
588
|
+
sendRootsChanged(): Promise<void>;
|
|
589
|
+
ping(options?: {
|
|
590
|
+
signal?: AbortSignal;
|
|
591
|
+
}): Promise<void>;
|
|
592
|
+
close(): Promise<void>;
|
|
593
|
+
}
|
|
594
|
+
interface Tool extends Omit<Tool$1, "inputSchema" | "outputSchema"> {
|
|
595
|
+
inputSchema: Record<string, unknown>;
|
|
596
|
+
outputSchema?: Record<string, unknown>;
|
|
597
|
+
}
|
|
598
|
+
interface CallToolParams {
|
|
599
|
+
name: string;
|
|
600
|
+
arguments?: Record<string, unknown>;
|
|
601
|
+
}
|
|
602
|
+
interface CallToolOptions {
|
|
603
|
+
signal?: AbortSignal;
|
|
604
|
+
progressToken?: ProgressToken;
|
|
605
|
+
}
|
|
606
|
+
interface ReadResourceParams {
|
|
607
|
+
uri: string;
|
|
608
|
+
}
|
|
609
|
+
interface PaginatedParams {
|
|
610
|
+
cursor?: string;
|
|
611
|
+
}
|
|
612
|
+
interface ResultMetadata {
|
|
613
|
+
resultType?: "complete";
|
|
614
|
+
_meta?: Record<string, unknown>;
|
|
615
|
+
}
|
|
616
|
+
interface CacheableResultMetadata extends ResultMetadata {
|
|
617
|
+
ttlMs?: number;
|
|
618
|
+
cacheScope?: "public" | "private";
|
|
619
|
+
}
|
|
620
|
+
interface PaginatedResult extends CacheableResultMetadata {
|
|
621
|
+
nextCursor?: string;
|
|
622
|
+
}
|
|
623
|
+
type ResourceContents = ResourceContents$1;
|
|
624
|
+
type TextContent = Extract<ContentItem$1, {
|
|
625
|
+
type: "text";
|
|
626
|
+
}>;
|
|
627
|
+
type ImageContent = Extract<ContentItem$1, {
|
|
628
|
+
type: "image";
|
|
629
|
+
}>;
|
|
630
|
+
type AudioContent = Extract<ContentItem$1, {
|
|
631
|
+
type: "audio";
|
|
632
|
+
}>;
|
|
633
|
+
type ContentItem = ContentItem$1;
|
|
634
|
+
interface PromptMessage {
|
|
635
|
+
role: "user" | "assistant";
|
|
636
|
+
content: ContentItem;
|
|
637
|
+
}
|
|
638
|
+
interface GetPromptResult extends ResultMetadata {
|
|
639
|
+
description?: string;
|
|
640
|
+
messages: PromptMessage[];
|
|
641
|
+
}
|
|
642
|
+
interface GetPromptParams {
|
|
643
|
+
name: string;
|
|
644
|
+
arguments?: Record<string, string>;
|
|
645
|
+
}
|
|
646
|
+
interface CallToolResult extends ResultMetadata {
|
|
647
|
+
content: ContentItem[];
|
|
648
|
+
structuredContent?: unknown;
|
|
649
|
+
isError?: boolean;
|
|
650
|
+
}
|
|
651
|
+
interface Root {
|
|
652
|
+
_meta?: Record<string, unknown>;
|
|
653
|
+
uri: string;
|
|
654
|
+
name?: string;
|
|
655
|
+
}
|
|
656
|
+
type LogLevel = "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency";
|
|
657
|
+
interface LogMessage {
|
|
658
|
+
level: LogLevel;
|
|
659
|
+
logger?: string;
|
|
660
|
+
data: unknown;
|
|
661
|
+
}
|
|
662
|
+
type ProgressToken = RequestId;
|
|
663
|
+
interface ProgressParams {
|
|
664
|
+
progressToken: ProgressToken;
|
|
665
|
+
progress: number;
|
|
666
|
+
total?: number;
|
|
667
|
+
message?: string;
|
|
668
|
+
}
|
|
669
|
+
interface ModelHint {
|
|
670
|
+
name?: string;
|
|
671
|
+
}
|
|
672
|
+
interface ModelPreferences {
|
|
673
|
+
hints?: ModelHint[];
|
|
674
|
+
costPriority?: number;
|
|
675
|
+
speedPriority?: number;
|
|
676
|
+
intelligencePriority?: number;
|
|
677
|
+
}
|
|
678
|
+
interface ToolUseContent {
|
|
679
|
+
_meta?: Record<string, unknown>;
|
|
680
|
+
type: "tool_use";
|
|
681
|
+
id: string;
|
|
682
|
+
name: string;
|
|
683
|
+
input: Record<string, unknown>;
|
|
684
|
+
}
|
|
685
|
+
interface ToolResultContent {
|
|
686
|
+
_meta?: Record<string, unknown>;
|
|
687
|
+
type: "tool_result";
|
|
688
|
+
toolUseId: string;
|
|
689
|
+
content: ContentItem[];
|
|
690
|
+
structuredContent?: unknown;
|
|
691
|
+
isError?: boolean;
|
|
692
|
+
}
|
|
693
|
+
type SamplingContent = TextContent | ImageContent | AudioContent | ToolUseContent | ToolResultContent;
|
|
694
|
+
interface SamplingMessage {
|
|
695
|
+
_meta?: Record<string, unknown>;
|
|
696
|
+
role: "user" | "assistant";
|
|
697
|
+
content: SamplingContent | SamplingContent[];
|
|
698
|
+
}
|
|
699
|
+
type IncludeContext = "none" | "thisServer" | "allServers";
|
|
700
|
+
interface CreateMessageParams {
|
|
701
|
+
messages: SamplingMessage[];
|
|
702
|
+
modelPreferences?: ModelPreferences;
|
|
703
|
+
systemPrompt?: string;
|
|
704
|
+
includeContext?: IncludeContext;
|
|
705
|
+
temperature?: number;
|
|
706
|
+
maxTokens: number;
|
|
707
|
+
tools?: Tool[];
|
|
708
|
+
toolChoice?: {
|
|
709
|
+
mode: "auto" | "required" | "none";
|
|
710
|
+
};
|
|
711
|
+
stopSequences?: string[];
|
|
712
|
+
metadata?: Record<string, unknown>;
|
|
713
|
+
}
|
|
714
|
+
interface CreateMessageResult {
|
|
715
|
+
_meta?: Record<string, unknown>;
|
|
716
|
+
model: string;
|
|
717
|
+
content: SamplingContent | SamplingContent[];
|
|
718
|
+
role: "user" | "assistant";
|
|
719
|
+
stopReason?: string;
|
|
720
|
+
}
|
|
721
|
+
interface PromptReference {
|
|
722
|
+
type: "ref/prompt";
|
|
723
|
+
name: string;
|
|
724
|
+
}
|
|
725
|
+
interface ResourceReference {
|
|
726
|
+
type: "ref/resource";
|
|
727
|
+
uri: string;
|
|
728
|
+
}
|
|
729
|
+
interface CompleteArgument {
|
|
730
|
+
name: string;
|
|
731
|
+
value: string;
|
|
732
|
+
}
|
|
733
|
+
interface CompleteParams {
|
|
734
|
+
context?: {
|
|
735
|
+
arguments?: Record<string, string>;
|
|
736
|
+
};
|
|
737
|
+
ref: PromptReference | ResourceReference;
|
|
738
|
+
argument: CompleteArgument;
|
|
739
|
+
}
|
|
740
|
+
interface Completion {
|
|
741
|
+
values: string[];
|
|
742
|
+
hasMore?: boolean;
|
|
743
|
+
total?: number;
|
|
744
|
+
}
|
|
745
|
+
interface CompleteResult extends ResultMetadata {
|
|
746
|
+
completion: Completion;
|
|
747
|
+
}
|
|
748
|
+
interface McpTransportClosedEvent {
|
|
749
|
+
reason: Error;
|
|
750
|
+
code?: number;
|
|
751
|
+
signal?: NodeJS.Signals;
|
|
752
|
+
}
|
|
753
|
+
interface McpTransport {
|
|
754
|
+
readable: Readable;
|
|
755
|
+
writable: Writable;
|
|
756
|
+
closed: Promise<McpTransportClosedEvent>;
|
|
757
|
+
/** Primary close reason, available before asynchronous transport cleanup finishes. */
|
|
758
|
+
readonly closeReason?: Promise<Error>;
|
|
759
|
+
dispose(reason?: Error): void;
|
|
760
|
+
filterTools?(tools: Tool[], reset?: boolean): Tool[];
|
|
761
|
+
/** Complete a legacy initialization handshake before the client reports ready. */
|
|
762
|
+
completeInitialization?(options: {
|
|
763
|
+
signal?: AbortSignal;
|
|
764
|
+
timeoutMs: number;
|
|
765
|
+
protocolVersion?: string;
|
|
766
|
+
}): Promise<void>;
|
|
767
|
+
}
|
|
768
|
+
type HttpTransportFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
769
|
+
interface HttpTransportOptions {
|
|
770
|
+
url: string;
|
|
771
|
+
/** Legacy SSE uses a GET stream that announces the RPC POST endpoint. */
|
|
772
|
+
mode?: "streamable-http" | "sse";
|
|
773
|
+
headers?: RequestInit["headers"];
|
|
774
|
+
fetch?: HttpTransportFetch;
|
|
775
|
+
oauth?: OAuthClientProviderOptions;
|
|
776
|
+
oauthDiscoveryCache?: OAuthDiscoveryCache;
|
|
777
|
+
onWarning?: (message: string) => void;
|
|
778
|
+
/** Maximum JSON response bytes or individual SSE event bytes; not a stream lifetime cap. */
|
|
779
|
+
maxResponseBytes?: number;
|
|
780
|
+
}
|
|
781
|
+
interface McpRequestContext {
|
|
782
|
+
readonly id: RequestId;
|
|
783
|
+
readonly method: string;
|
|
784
|
+
readonly signal: AbortSignal;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/** A caller-owned remote registry entry. An empty tools array disables discovery. */
|
|
788
|
+
interface RemoteMcpServer {
|
|
789
|
+
readonly name: string;
|
|
790
|
+
readonly url: string;
|
|
791
|
+
readonly transport?: "http" | "sse";
|
|
792
|
+
readonly tools?: readonly Tool[];
|
|
793
|
+
readonly instructions?: string;
|
|
794
|
+
readonly headers?: HttpTransportOptions["headers"];
|
|
795
|
+
readonly oauth?: HttpTransportOptions["oauth"];
|
|
796
|
+
readonly protocolVersion?: McpProtocolVersion;
|
|
797
|
+
}
|
|
798
|
+
interface RemoteMcpSchema {
|
|
799
|
+
readonly name: string;
|
|
800
|
+
readonly url: string;
|
|
801
|
+
readonly source: "provided" | "discovered";
|
|
802
|
+
readonly tools: Tool[];
|
|
803
|
+
readonly serverInfo?: Implementation;
|
|
804
|
+
readonly capabilities?: ServerCapabilities;
|
|
805
|
+
readonly instructions?: string;
|
|
806
|
+
}
|
|
807
|
+
interface SchemaFetchOptions {
|
|
808
|
+
readonly signal?: AbortSignal;
|
|
809
|
+
readonly fetch?: HttpTransportOptions["fetch"];
|
|
810
|
+
readonly oauthDiscoveryCache?: HttpTransportOptions["oauthDiscoveryCache"];
|
|
811
|
+
readonly onWarning?: HttpTransportOptions["onWarning"];
|
|
812
|
+
readonly maxPages?: number;
|
|
813
|
+
readonly maxTools?: number;
|
|
814
|
+
/** Bounds each complete JSON response body or individual SSE event. */
|
|
815
|
+
readonly maxResponseBytes?: number;
|
|
816
|
+
readonly requestTimeoutMs?: number;
|
|
817
|
+
/** Handle server input explicitly. Without a hook, input is declined. */
|
|
818
|
+
readonly onElicitationRequest?: RemoteMcpElicitationHandler;
|
|
819
|
+
}
|
|
820
|
+
interface RemoteMcpElicitationContext extends McpRequestContext {
|
|
821
|
+
readonly server: {
|
|
822
|
+
readonly name: string;
|
|
823
|
+
readonly url: string;
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
type RemoteMcpElicitationHandler = (params: ElicitationParams, context: RemoteMcpElicitationContext) => ElicitationResult | Promise<ElicitationResult>;
|
|
827
|
+
/** Discover every tool page, or return an isolated copy of authoritative supplied schemas. */
|
|
828
|
+
declare function fetchRemoteMcpSchema(server: RemoteMcpServer, options?: SchemaFetchOptions): Promise<RemoteMcpSchema>;
|
|
829
|
+
/** Validate the complete registry before connecting, then preserve caller order. */
|
|
830
|
+
declare function resolveRemoteMcpSchemas(servers: readonly RemoteMcpServer[], options?: SchemaFetchOptions): Promise<RemoteMcpSchema[]>;
|
|
831
|
+
|
|
832
|
+
interface ToolParameter {
|
|
833
|
+
readonly name: string;
|
|
834
|
+
readonly flag: string;
|
|
835
|
+
readonly required: boolean;
|
|
836
|
+
readonly schemas: readonly unknown[];
|
|
837
|
+
readonly description?: string;
|
|
838
|
+
}
|
|
839
|
+
interface ToolArgumentParseOptions {
|
|
840
|
+
readonly yes?: boolean;
|
|
841
|
+
readonly maxInputBytes?: number;
|
|
842
|
+
}
|
|
843
|
+
interface ToolArgumentParser {
|
|
844
|
+
readonly toolName: string;
|
|
845
|
+
readonly parameters: readonly ToolParameter[];
|
|
846
|
+
parse(args: readonly string[], options?: ToolArgumentParseOptions): Record<string, unknown>;
|
|
847
|
+
}
|
|
848
|
+
/** Compile a tool's complete JSON Schema plus stable, collision-safe flag metadata. */
|
|
849
|
+
declare function compileToolArguments(tool: Tool, options?: CompileJsonSchemaOptions): ToolArgumentParser;
|
|
850
|
+
|
|
851
|
+
interface RemoteMcpCommandOptions extends SchemaFetchOptions, ToolArgumentParseOptions {
|
|
852
|
+
readonly maxOutputBytes?: number;
|
|
853
|
+
readonly schemaValidation?: CompileJsonSchemaOptions;
|
|
854
|
+
}
|
|
855
|
+
/** Generate a safe-bash command for each server, discovering only absent schemas. */
|
|
856
|
+
declare function createRemoteMcpCommands(servers: readonly RemoteMcpServer[], options?: RemoteMcpCommandOptions): Promise<CommandDefinition[]>;
|
|
857
|
+
/** Register generated commands after checking all conflicts, avoiding partial setup. */
|
|
858
|
+
declare function remoteMcpCommands(servers: readonly RemoteMcpServer[], options?: RemoteMcpCommandOptions): Promise<VirtualShellPlugin>;
|
|
859
|
+
|
|
860
|
+
type RemoteMcpResourceRequest = {
|
|
861
|
+
readonly operation: "list" | "templates";
|
|
862
|
+
readonly cursor?: string;
|
|
863
|
+
} | {
|
|
864
|
+
readonly operation: "read";
|
|
865
|
+
readonly uri: string;
|
|
866
|
+
};
|
|
867
|
+
interface RemoteMcpResourceOptions extends SchemaFetchOptions {
|
|
868
|
+
readonly maxInputBytes?: number;
|
|
869
|
+
}
|
|
870
|
+
type RemoteMcpResourceResult = Awaited<ReturnType<McpClient["listResources"]>> | Awaited<ReturnType<McpClient["listResourceTemplates"]>> | Awaited<ReturnType<McpClient["readResource"]>>;
|
|
871
|
+
/** Access a remote resource directly, preserving one page/result without tool discovery. */
|
|
872
|
+
declare function accessRemoteMcpResources(server: RemoteMcpServer, request: RemoteMcpResourceRequest, options?: RemoteMcpResourceOptions): Promise<RemoteMcpResourceResult>;
|
|
873
|
+
|
|
874
|
+
export { accessRemoteMcpResources, compileToolArguments, createRemoteMcpCommands, fetchRemoteMcpSchema, remoteMcpCommands, resolveRemoteMcpSchemas };
|
|
875
|
+
export type { RemoteMcpCommandOptions, RemoteMcpElicitationContext, RemoteMcpElicitationHandler, RemoteMcpResourceOptions, RemoteMcpResourceRequest, RemoteMcpResourceResult, RemoteMcpSchema, RemoteMcpServer, SchemaFetchOptions, ToolArgumentParseOptions, ToolArgumentParser, ToolParameter };
|