@usemcpkit/core 0.0.0-stage → 0.1.0
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/build/mcpkit.core.d.ts +499 -0
- package/build/mcpkit.core.js +1668 -0
- package/package.json +42 -3
- package/README.md +0 -3
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
/** A copy of the manifest with `{domain}` filled in and each tool set to the domain's edition; without a domain the manifest is returned as is. */
|
|
2
|
+
export declare const applyDomain: (manifest: Manifest, domain: string | undefined) => Manifest;
|
|
3
|
+
|
|
4
|
+
/** A list passes args under their own names; a mapping is `{ outgoingKey: argName }`. */
|
|
5
|
+
export declare type ArgSpec = NameList | NameMapping;
|
|
6
|
+
|
|
7
|
+
export declare const array: (items: JsonSchema, description?: string) => Param;
|
|
8
|
+
|
|
9
|
+
export declare interface AuthContext {
|
|
10
|
+
env: Env;
|
|
11
|
+
fetchImpl: typeof fetch;
|
|
12
|
+
/** Shows the user the URL that starts a browser sign-in; without it a call never signs in. */
|
|
13
|
+
onAuthorizationUrl?: (url: string) => void;
|
|
14
|
+
/** Credentials saved from the credentials form; env vars win over them. */
|
|
15
|
+
secretStore?: SecretStore;
|
|
16
|
+
/** Asks the user for a domain and credentials when nothing provided works; without it no form is shown. */
|
|
17
|
+
requestCredentials?: (request: CredentialRequest) => Promise<CredentialResponse>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export declare class AuthError extends Error {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare type AuthSpec = NoneAuth | BearerAuth | HeaderAuth | QueryAuth | BasicAuth | OAuthAuth;
|
|
24
|
+
|
|
25
|
+
declare interface BasicAuth {
|
|
26
|
+
type: 'basic';
|
|
27
|
+
usernameEnv: string;
|
|
28
|
+
passwordEnv: string;
|
|
29
|
+
/** Shown for this option in the credentials form instead of its auth type and env vars. */
|
|
30
|
+
label?: string;
|
|
31
|
+
/** Texts, field labels and buttons of the credentials page for this entry. */
|
|
32
|
+
ui?: UiSpec;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare interface BearerAuth {
|
|
36
|
+
type: 'bearer';
|
|
37
|
+
env: string;
|
|
38
|
+
/** Shown for this option in the credentials form instead of its auth type and env vars. */
|
|
39
|
+
label?: string;
|
|
40
|
+
/** Texts, field labels and buttons of the credentials page for this entry. */
|
|
41
|
+
ui?: UiSpec;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare const boolean: (description?: string, options?: ParamOptions) => Param;
|
|
45
|
+
|
|
46
|
+
/** Expects args already passed through prepareToolArgs. */
|
|
47
|
+
export declare const buildRequest: (manifest: Manifest, tool: ToolSpec, args: ToolArgs, auth: ResolvedAuth) => HttpRequest;
|
|
48
|
+
|
|
49
|
+
/** A command that prints a token on stdout; run without a shell. */
|
|
50
|
+
export declare interface CliTokenCommand {
|
|
51
|
+
command: string;
|
|
52
|
+
args: readonly string[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export declare const compareVersions: (left: string, right: string) => number;
|
|
56
|
+
|
|
57
|
+
/** Plain text in a 0600 file under the mcpkit home, read on every call so all running servers see each other's saves. */
|
|
58
|
+
export declare const createFileSecretStore: (env?: Env) => SecretStore;
|
|
59
|
+
|
|
60
|
+
export declare interface CredentialField {
|
|
61
|
+
/** The env var that provides this value without the form. */
|
|
62
|
+
key: string;
|
|
63
|
+
label: string;
|
|
64
|
+
hint: string;
|
|
65
|
+
placeholder: string;
|
|
66
|
+
secret: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** One fallback auth entry the user can fill in. */
|
|
70
|
+
export declare interface CredentialOption {
|
|
71
|
+
/** Index of the entry in the manifest's `auth`. */
|
|
72
|
+
index: number;
|
|
73
|
+
label: string;
|
|
74
|
+
fields: readonly CredentialField[];
|
|
75
|
+
/** The buttons under the fields: links to create a token, or a CLI to take one from. */
|
|
76
|
+
actions: readonly UiAction[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Everything the credentials page shows, so the page itself holds no text. */
|
|
80
|
+
export declare interface CredentialRequest {
|
|
81
|
+
serverName: string;
|
|
82
|
+
texts: UiTexts;
|
|
83
|
+
/** Present when the user may choose the domain. */
|
|
84
|
+
domain?: DomainField;
|
|
85
|
+
/** The domain in use when the form opened; the form's own domain field wins when it has one. */
|
|
86
|
+
domainInUse?: string;
|
|
87
|
+
options: readonly CredentialOption[];
|
|
88
|
+
/** Whether the server offers an OAuth2 browser sign-in. */
|
|
89
|
+
signIn: boolean;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare type CredentialResponse = TokenCredentialResponse | SignInCredentialResponse;
|
|
93
|
+
|
|
94
|
+
/** HTTP contract between the CLI's loopback credentials form server and the page it serves. */
|
|
95
|
+
export declare const CREDENTIALS_FORM_API: {
|
|
96
|
+
readonly submit: "/api/submit";
|
|
97
|
+
readonly cancel: "/api/cancel";
|
|
98
|
+
readonly import: "/api/import";
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export declare const CREDENTIALS_FORM_SESSION_HEADER = "X-Mcpkit-Session";
|
|
102
|
+
|
|
103
|
+
export declare const CREDENTIALS_REQUEST_ELEMENT_ID = "mcpkit-request";
|
|
104
|
+
|
|
105
|
+
export declare const DEFAULT_UI_TEXTS: Readonly<UiTexts>;
|
|
106
|
+
|
|
107
|
+
export declare const defineServer: (manifest: Manifest) => Manifest;
|
|
108
|
+
|
|
109
|
+
export declare const defineTool: (tool: ToolSpec) => ToolSpec;
|
|
110
|
+
|
|
111
|
+
export declare const defineUI: (ui: UiSpec) => UiSpec;
|
|
112
|
+
|
|
113
|
+
export declare const describeAuth: (auth: readonly AuthSpec[] | undefined) => string;
|
|
114
|
+
|
|
115
|
+
export declare const describeAuthSpec: (auth: AuthSpec) => string;
|
|
116
|
+
|
|
117
|
+
export declare const describeError: (error: unknown) => string;
|
|
118
|
+
|
|
119
|
+
export declare interface DomainField {
|
|
120
|
+
label: string;
|
|
121
|
+
hint: string;
|
|
122
|
+
placeholder: string;
|
|
123
|
+
/** The domain in use, prefilled in the form; empty when there is none yet. */
|
|
124
|
+
value: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Lets one server talk to any host of the same API, for example a self-hosted GitHub Enterprise. */
|
|
128
|
+
export declare interface DomainSpec {
|
|
129
|
+
/** Shown next to the domain field of the credentials form. */
|
|
130
|
+
label?: string;
|
|
131
|
+
/** Shown under the domain field. */
|
|
132
|
+
hint?: string;
|
|
133
|
+
placeholder?: string;
|
|
134
|
+
default?: string;
|
|
135
|
+
/** Env var that sets the domain; when it is set the form does not ask for one. */
|
|
136
|
+
env?: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** A deployment of the same API that needs other requests, for example Atlassian Cloud next to Data Center. */
|
|
140
|
+
export declare interface EditionSpec {
|
|
141
|
+
label?: string;
|
|
142
|
+
/** Host suffixes such as `.atlassian.net`; a domain whose host ends with one of them uses this edition. */
|
|
143
|
+
hosts: readonly string[];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export declare type Env = Readonly<Record<string, string | undefined>>;
|
|
147
|
+
|
|
148
|
+
export declare interface ExecuteOptions {
|
|
149
|
+
fetchImpl?: typeof fetch;
|
|
150
|
+
timeoutMs?: number;
|
|
151
|
+
env?: Env;
|
|
152
|
+
onAuthorizationUrl?: AuthContext['onAuthorizationUrl'];
|
|
153
|
+
secretStore?: AuthContext['secretStore'];
|
|
154
|
+
requestCredentials?: AuthContext['requestCredentials'];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export declare const executeTool: (manifest: Manifest, tool: ToolSpec, rawArgs: ToolArgs | undefined, { fetchImpl, timeoutMs, env, ...hooks }?: ExecuteOptions) => Promise<unknown>;
|
|
158
|
+
|
|
159
|
+
/** Auth whose credentials are provided up front: an env var, a saved value or the credentials form. */
|
|
160
|
+
export declare type FallbackAuth = Exclude<AuthSpec, InteractiveAuth>;
|
|
161
|
+
|
|
162
|
+
/** A list keeps fields as-is; a mapping is `{ outputName: "source.path" }`, where `items[].name` maps arrays. */
|
|
163
|
+
export declare type FieldSpec = NameList | NameMapping;
|
|
164
|
+
|
|
165
|
+
/** Replaces `{name}` with its value; a placeholder without a value stays as it is. */
|
|
166
|
+
export declare const fillTemplate: (template: string, values: Readonly<Record<string, string>>) => string;
|
|
167
|
+
|
|
168
|
+
export declare type FixedValue = string | number | boolean;
|
|
169
|
+
|
|
170
|
+
/** Values sent on every call, keyed like the outgoing keys of the request part they belong to. */
|
|
171
|
+
export declare type FixedValues = Readonly<Record<string, FixedValue>>;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Resolves `a.b.c` paths; a `name[]` segment maps the rest of the path over an array.
|
|
175
|
+
* The return type is declared because TypeScript cannot infer it for this recursive function.
|
|
176
|
+
*/
|
|
177
|
+
export declare const getPath: (source: unknown, path: string) => unknown;
|
|
178
|
+
|
|
179
|
+
declare interface HeaderAuth {
|
|
180
|
+
type: 'header';
|
|
181
|
+
env: string;
|
|
182
|
+
name: string;
|
|
183
|
+
/** Shown for this option in the credentials form instead of its auth type and env vars. */
|
|
184
|
+
label?: string;
|
|
185
|
+
prefix?: string;
|
|
186
|
+
/** Texts, field labels and buttons of the credentials page for this entry. */
|
|
187
|
+
ui?: UiSpec;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
declare const HTTP_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
191
|
+
|
|
192
|
+
export declare type HttpMethod = (typeof HTTP_METHODS)[number];
|
|
193
|
+
|
|
194
|
+
export declare interface HttpRequest {
|
|
195
|
+
url: string;
|
|
196
|
+
method: HttpMethod;
|
|
197
|
+
headers: Readonly<Record<string, string>>;
|
|
198
|
+
body?: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** Builds an object input schema; `required` is derived from the params. */
|
|
202
|
+
export declare const input: (params?: ParamMap) => InputSchema;
|
|
203
|
+
|
|
204
|
+
export declare interface InputSchema extends JsonSchema {
|
|
205
|
+
type: 'object';
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export declare type InteractiveAuth = OAuthAuth;
|
|
209
|
+
|
|
210
|
+
export declare const isDomainValue: (value: unknown) => value is string;
|
|
211
|
+
|
|
212
|
+
/** OAuth2 auth signs in through the browser and keeps its token in `tokens.json`. */
|
|
213
|
+
export declare const isInteractiveAuth: (auth: AuthSpec) => auth is InteractiveAuth;
|
|
214
|
+
|
|
215
|
+
export declare const isJsonObject: (value: unknown) => value is Record<string, unknown>;
|
|
216
|
+
|
|
217
|
+
export declare const isMissingFileError: (error: unknown) => boolean;
|
|
218
|
+
|
|
219
|
+
export declare const isValidCredentialResponse: (request: CredentialRequest, response: unknown) => response is CredentialResponse;
|
|
220
|
+
|
|
221
|
+
export declare const isValidManifest: (value: unknown) => value is Manifest;
|
|
222
|
+
|
|
223
|
+
export declare interface JsonSchema {
|
|
224
|
+
type?: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
225
|
+
description?: string;
|
|
226
|
+
default?: unknown;
|
|
227
|
+
enum?: readonly unknown[];
|
|
228
|
+
items?: JsonSchema;
|
|
229
|
+
properties?: Readonly<Record<string, JsonSchema>>;
|
|
230
|
+
required?: readonly string[];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export declare const listAuthEnvNames: (auth: AuthSpec) => string[];
|
|
234
|
+
|
|
235
|
+
export declare interface Manifest {
|
|
236
|
+
name: string;
|
|
237
|
+
/** Groups servers of one kind, for example `git`. */
|
|
238
|
+
category: string;
|
|
239
|
+
version: string;
|
|
240
|
+
description?: string;
|
|
241
|
+
/** May contain `{domain}`, as may the oauth URLs; `domain` then says where the value comes from. */
|
|
242
|
+
baseUrl: string;
|
|
243
|
+
domain?: DomainSpec;
|
|
244
|
+
/** Deployments picked by the domain's host; a domain matching none uses the tools' own requests. */
|
|
245
|
+
editions?: Readonly<Record<string, EditionSpec>>;
|
|
246
|
+
headers?: Readonly<Record<string, string>>;
|
|
247
|
+
/** OAuth2 entries first, then fallbacks; tried top to bottom, the first that works is used. */
|
|
248
|
+
auth?: readonly AuthSpec[];
|
|
249
|
+
/** Page-wide texts of the credentials page, replacing mcpkit's defaults. */
|
|
250
|
+
ui?: UiSpec;
|
|
251
|
+
tools: readonly ToolSpec[];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export declare const mapResponse: (data: unknown, response?: ResponseSpec) => unknown;
|
|
255
|
+
|
|
256
|
+
declare type NameList = readonly string[];
|
|
257
|
+
|
|
258
|
+
export declare type NameMapping = Readonly<Record<string, string>>;
|
|
259
|
+
|
|
260
|
+
declare interface NoneAuth {
|
|
261
|
+
type: 'none';
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export declare const number: (description?: string, options?: ParamOptions) => Param;
|
|
265
|
+
|
|
266
|
+
/** OAuth 2.0 authorization code flow with PKCE; the browser sign-in starts on the first tool call without a stored token. */
|
|
267
|
+
export declare interface OAuthAuth {
|
|
268
|
+
type: 'oauth';
|
|
269
|
+
authorizationUrl: string;
|
|
270
|
+
tokenUrl: string;
|
|
271
|
+
clientId: string;
|
|
272
|
+
clientSecretEnv?: string;
|
|
273
|
+
scopes?: readonly string[];
|
|
274
|
+
/** Loopback port for the redirect URI; 0 picks a free port. */
|
|
275
|
+
redirectPort?: number;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export declare const oneOf: (values: readonly string[], description?: string, options?: ParamOptions) => Param;
|
|
279
|
+
|
|
280
|
+
/** Marks a param as not required. Params with a default are optional implicitly. */
|
|
281
|
+
export declare const optional: (param: Param) => Param;
|
|
282
|
+
|
|
283
|
+
/** Symbol keys are dropped by JSON.stringify, so the marker never reaches a manifest. */
|
|
284
|
+
declare const OPTIONAL_MARKER: unique symbol;
|
|
285
|
+
|
|
286
|
+
export declare interface Param extends JsonSchema {
|
|
287
|
+
[OPTIONAL_MARKER]?: true;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export declare type ParamMap = Readonly<Record<string, Param>>;
|
|
291
|
+
|
|
292
|
+
export declare type ParamOptions = Pick<JsonSchema, 'default' | 'enum'>;
|
|
293
|
+
|
|
294
|
+
export declare const prepareToolArgs: (tool: ToolSpec, rawArgs?: ToolArgs) => any;
|
|
295
|
+
|
|
296
|
+
declare interface QueryAuth {
|
|
297
|
+
type: 'query';
|
|
298
|
+
env: string;
|
|
299
|
+
name: string;
|
|
300
|
+
/** Shown for this option in the credentials form instead of its auth type and env vars. */
|
|
301
|
+
label?: string;
|
|
302
|
+
/** Texts, field labels and buttons of the credentials page for this entry. */
|
|
303
|
+
ui?: UiSpec;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
declare interface RequestSpec {
|
|
307
|
+
method: HttpMethod;
|
|
308
|
+
/** `{arg}` placeholders are replaced by URL-encoded argument values. */
|
|
309
|
+
path: string;
|
|
310
|
+
query?: ArgSpec;
|
|
311
|
+
/** Outgoing keys may be dotted paths such as `fields.project.key` or `ancestors.0.id` to build nested JSON. */
|
|
312
|
+
body?: ArgSpec;
|
|
313
|
+
fixedQuery?: FixedValues;
|
|
314
|
+
/** Dotted paths like `body`; an argument with the same key wins. */
|
|
315
|
+
fixedBody?: FixedValues;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export declare const resolveCliCommand: (action: UiCliAction, domain: string | undefined) => CliTokenCommand;
|
|
319
|
+
|
|
320
|
+
export declare interface ResolvedAuth {
|
|
321
|
+
headers: Readonly<Record<string, string>>;
|
|
322
|
+
query: Readonly<Record<string, string>>;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export declare const resolveHomeDir: (env?: Env) => string;
|
|
326
|
+
|
|
327
|
+
/** Undefined while the link needs a domain and there is none yet. */
|
|
328
|
+
export declare const resolveLinkUrl: (url: string, domain: string | undefined) => string | undefined;
|
|
329
|
+
|
|
330
|
+
/** Builds a fallback entry's auth from its credential values, keyed by env var name. */
|
|
331
|
+
export declare const resolveStaticAuth: (auth: FallbackAuth, serverName: string, env: Env) => ResolvedAuth;
|
|
332
|
+
|
|
333
|
+
export declare interface ResponseSpec {
|
|
334
|
+
root?: string;
|
|
335
|
+
fields?: FieldSpec;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** The server a stored secret belongs to. */
|
|
339
|
+
export declare type SecretOwner = Pick<Manifest, 'name' | 'category'>;
|
|
340
|
+
|
|
341
|
+
/** Where credentials and domains entered in the credentials form are kept, per server and key. */
|
|
342
|
+
export declare interface SecretStore {
|
|
343
|
+
get: (owner: SecretOwner, key: string) => Promise<string | undefined>;
|
|
344
|
+
set: (owner: SecretOwner, key: string, value: string) => Promise<void>;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export declare const SERVER_NAME_PATTERN: RegExp;
|
|
348
|
+
|
|
349
|
+
/** Runs the authorization code + PKCE flow through a loopback redirect and stores the token. */
|
|
350
|
+
export declare const signIn: (serverName: string, auth: InteractiveAuth, { context, onAuthorizationUrl }: SignInOptions) => Promise<SignInResult>;
|
|
351
|
+
|
|
352
|
+
export declare interface SignInCredentialResponse {
|
|
353
|
+
method: 'sign-in';
|
|
354
|
+
domain?: string;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
declare interface SignInOptions {
|
|
358
|
+
context: AuthContext;
|
|
359
|
+
/** Receives the URL the user must open to approve access. */
|
|
360
|
+
onAuthorizationUrl: (url: string) => void;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export declare interface SignInResult {
|
|
364
|
+
token: StoredToken;
|
|
365
|
+
tokensFile: string;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
declare interface StoredToken {
|
|
369
|
+
accessToken: string;
|
|
370
|
+
tokenType: string;
|
|
371
|
+
refreshToken?: string;
|
|
372
|
+
/** Epoch milliseconds; absent when the provider issues non-expiring tokens. */
|
|
373
|
+
expiresAt?: number;
|
|
374
|
+
scope?: string;
|
|
375
|
+
/** Identifies the manifest auth entry that issued the token, so it is refreshed against the same endpoint. */
|
|
376
|
+
authKey?: string;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export declare const string: (description?: string, options?: ParamOptions) => Param;
|
|
380
|
+
|
|
381
|
+
export declare interface TokenCredentialResponse {
|
|
382
|
+
method: 'token';
|
|
383
|
+
/** `index` of the chosen credential option. */
|
|
384
|
+
option: number;
|
|
385
|
+
/** Values per field key. */
|
|
386
|
+
values: Readonly<Record<string, string>>;
|
|
387
|
+
domain?: string;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** Asks the CLI to run the `cli` action `action` of `option`, and answer the form with the token it prints. */
|
|
391
|
+
export declare interface TokenImportRequest {
|
|
392
|
+
option: number;
|
|
393
|
+
/** Index into the option's actions. */
|
|
394
|
+
action: number;
|
|
395
|
+
domain?: string;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export declare const toNameMapping: (spec: NameList | NameMapping) => Readonly<Record<string, string>>;
|
|
399
|
+
|
|
400
|
+
export declare type ToolArgs = Readonly<Record<string, unknown>>;
|
|
401
|
+
|
|
402
|
+
/** Replaces the tool's request, and its response mapping when given, for one edition. */
|
|
403
|
+
export declare interface ToolEdition {
|
|
404
|
+
request: RequestSpec;
|
|
405
|
+
response?: ResponseSpec;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export declare class ToolError extends Error {
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export declare interface ToolSpec {
|
|
412
|
+
name: string;
|
|
413
|
+
description: string;
|
|
414
|
+
input: InputSchema;
|
|
415
|
+
request: RequestSpec;
|
|
416
|
+
response?: ResponseSpec;
|
|
417
|
+
/** Per-edition overrides, keyed by the manifest's `editions`. */
|
|
418
|
+
editions?: Readonly<Record<string, ToolEdition>>;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export declare type UiAction = UiLinkAction | UiCliAction;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* A button that takes the token from a local CLI. It runs only when the user clicks it, without a shell,
|
|
425
|
+
* and `args` may use `{domain}` and `{webHost}`.
|
|
426
|
+
*/
|
|
427
|
+
export declare interface UiCliAction {
|
|
428
|
+
type: 'cli';
|
|
429
|
+
label: string;
|
|
430
|
+
command: string;
|
|
431
|
+
args: readonly string[];
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** Overrides what the credentials page shows for one credential field. */
|
|
435
|
+
export declare interface UiInputSpec {
|
|
436
|
+
label?: string;
|
|
437
|
+
hint?: string;
|
|
438
|
+
placeholder?: string;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/** A button that opens `url` in a new tab; `{domain}`, `{webHost}` and `{server}` are filled in. */
|
|
442
|
+
export declare interface UiLinkAction {
|
|
443
|
+
type: 'link';
|
|
444
|
+
label: string;
|
|
445
|
+
url: string;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* What the credentials page shows. On the manifest only `texts` applies (page-wide strings); on an auth entry
|
|
450
|
+
* `inputs` (by env var name) and `actions` apply. Anything left out falls back to mcpkit's default text.
|
|
451
|
+
*/
|
|
452
|
+
export declare interface UiSpec {
|
|
453
|
+
texts?: Partial<UiTexts>;
|
|
454
|
+
inputs?: Readonly<Record<string, UiInputSpec>>;
|
|
455
|
+
actions?: readonly UiAction[];
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Every string the credentials page shows. `{server}` is filled in by mcpkit; `{key}`, `{name}`, `{label}` and
|
|
460
|
+
* `{status}` are filled in where the text is used.
|
|
461
|
+
*/
|
|
462
|
+
export declare interface UiTexts {
|
|
463
|
+
brand: string;
|
|
464
|
+
pageTitle: string;
|
|
465
|
+
title: string;
|
|
466
|
+
intro: string;
|
|
467
|
+
domainLabel: string;
|
|
468
|
+
domainHint: string;
|
|
469
|
+
domainPlaceholder: string;
|
|
470
|
+
signInLabel: string;
|
|
471
|
+
tokenDivider: string;
|
|
472
|
+
credentialLegend: string;
|
|
473
|
+
fieldHint: string;
|
|
474
|
+
tokenLabel: string;
|
|
475
|
+
usernameLabel: string;
|
|
476
|
+
passwordLabel: string;
|
|
477
|
+
headerLabel: string;
|
|
478
|
+
queryLabel: string;
|
|
479
|
+
actionsDivider: string;
|
|
480
|
+
cancel: string;
|
|
481
|
+
submit: string;
|
|
482
|
+
requiredField: string;
|
|
483
|
+
savedTitle: string;
|
|
484
|
+
savedBody: string;
|
|
485
|
+
signingInTitle: string;
|
|
486
|
+
signingInBody: string;
|
|
487
|
+
cancelledTitle: string;
|
|
488
|
+
cancelledBody: string;
|
|
489
|
+
failedTitle: string;
|
|
490
|
+
requestFailed: string;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/** The form answer comes over a local HTTP request, so it is checked against what was asked. */
|
|
494
|
+
export declare const validateCredentialResponse: (request: CredentialRequest, response: unknown) => string[];
|
|
495
|
+
|
|
496
|
+
/** Manifests can be downloaded at runtime, so they are treated as untrusted input. */
|
|
497
|
+
export declare const validateManifest: (manifest: unknown) => string[];
|
|
498
|
+
|
|
499
|
+
export { }
|