@hop-top/kit 0.5.0-alpha.7 → 0.5.0-alpha.9
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/CHANGELOG.md +38 -0
- package/dist/alias-D9_qFlyP.d.ts +174 -0
- package/dist/alias.d.ts +1 -1
- package/dist/alias.js +8 -2
- package/dist/{chunk-263IZ6Z6.js → chunk-B4ULGCCN.js} +43 -154
- package/dist/{chunk-DIDN4X5C.js → chunk-BLS2OBIQ.js} +99 -20
- package/dist/{chunk-JTMPNXVQ.js → chunk-P6GRX4RV.js} +486 -83
- package/dist/chunk-UZ65A27P.js +147 -0
- package/dist/{completion-sDKVXPUL.d.ts → completion-csVun6SP.d.ts} +4 -1
- package/dist/completion.d.ts +1 -1
- package/dist/{index-B-pqGHhU.d.ts → index-CaOXdl38.d.ts} +337 -24
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -4
- package/dist/mcp/index.d.ts +2 -1
- package/dist/mcp/index.js +31 -2
- package/dist/{toolspec-UrWnoJ3Y.d.ts → toolspec-96rkLfsh.d.ts} +7 -2
- package/dist/toolspec.d.ts +1 -1
- package/dist/toolspec.js +3 -2
- package/package.json +1 -1
- package/src/alias.conformance.test.ts +250 -0
- package/src/alias.test.ts +96 -1
- package/src/alias.ts +179 -19
- package/src/completion.ts +4 -1
- package/src/mcp/README.md +6 -0
- package/src/mcp/args-separator.test.ts +164 -0
- package/src/mcp/args.test.ts +223 -0
- package/src/mcp/args.ts +160 -0
- package/src/mcp/audit.test.ts +520 -0
- package/src/mcp/audit.ts +70 -0
- package/src/mcp/bridge.test.ts +72 -0
- package/src/mcp/bridge.ts +50 -5
- package/src/mcp/conformance.test.ts +1 -1
- package/src/mcp/dispatch.ts +48 -2
- package/src/mcp/index.ts +33 -1
- package/src/mcp/legacy-notify.test.ts +59 -0
- package/src/mcp/legacy.ts +55 -15
- package/src/mcp/modern-confirm.ts +42 -10
- package/src/mcp/modern.ts +99 -35
- package/src/mcp/stdio.test.ts +313 -0
- package/src/mcp/stdio.ts +254 -0
- package/src/mcp/toolname.test.ts +147 -0
- package/src/mcp/types.ts +125 -18
- package/src/toolspec-internal.ts +24 -0
- package/src/toolspec-manifest.test.ts +25 -0
- package/src/toolspec-manifest.ts +5 -1
- package/src/toolspec.from-command.test.ts +51 -0
- package/src/toolspec.ts +29 -15
- package/dist/alias-BsJ2jGqQ.d.ts +0 -96
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProtocolErrorCode } from '@modelcontextprotocol/server';
|
|
2
|
+
import { Readable, Writable } from 'node:stream';
|
|
2
3
|
import { Command } from 'commander';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -58,6 +59,8 @@ type McpCacheScope = 'public' | 'private';
|
|
|
58
59
|
declare const DEFAULT_MCP_SERVER_NAME = "cmdsurface";
|
|
59
60
|
declare const DEFAULT_MCP_SERVER_VERSION = "0.0.0";
|
|
60
61
|
declare const DEFAULT_MCP_PATH = "/mcp";
|
|
62
|
+
/** Default string joining a leaf path into its MCP tool name. */
|
|
63
|
+
declare const DEFAULT_TOOL_NAME_SEPARATOR = ".";
|
|
61
64
|
/**
|
|
62
65
|
* Surfaces a leaf may be invoked through. Mirrors Go's Surface type;
|
|
63
66
|
* both MCP spec revisions share the single "mcp" surface — one
|
|
@@ -134,7 +137,20 @@ interface FlagSchema {
|
|
|
134
137
|
description: string;
|
|
135
138
|
items?: {
|
|
136
139
|
type: string;
|
|
140
|
+
enum?: string[];
|
|
137
141
|
};
|
|
142
|
+
/** Allowed values, when the flag declares choices. */
|
|
143
|
+
enum?: string[];
|
|
144
|
+
/** The flag's default, when it is a value of `type`. */
|
|
145
|
+
default?: unknown;
|
|
146
|
+
/** Least array length; set on the positional "args" property. */
|
|
147
|
+
minItems?: number;
|
|
148
|
+
}
|
|
149
|
+
/** One declared positional argument of a leaf, in declared order. */
|
|
150
|
+
interface LeafArg {
|
|
151
|
+
name: string;
|
|
152
|
+
/** False/absent for an optional argument. */
|
|
153
|
+
required?: boolean;
|
|
138
154
|
}
|
|
139
155
|
/**
|
|
140
156
|
* One invocable leaf command exposed as an MCP tool. `path` is the
|
|
@@ -149,6 +165,12 @@ interface Leaf {
|
|
|
149
165
|
properties: Record<string, FlagSchema>;
|
|
150
166
|
/** Names of required flags, in declaration order. */
|
|
151
167
|
required?: string[];
|
|
168
|
+
/**
|
|
169
|
+
* Declared positional arguments, in order. Published as one "args"
|
|
170
|
+
* string-array property and split back out of tools/call arguments
|
|
171
|
+
* into `Invocation.args` (see mcp/args).
|
|
172
|
+
*/
|
|
173
|
+
args?: LeafArg[];
|
|
152
174
|
/** Safety annotations consulted by the policy gate. */
|
|
153
175
|
class?: SafetyClass;
|
|
154
176
|
/** Surfaces this leaf is exposed on. */
|
|
@@ -184,6 +206,8 @@ interface InvocationMeta {
|
|
|
184
206
|
/** One leaf invocation. */
|
|
185
207
|
interface Invocation {
|
|
186
208
|
path: string[];
|
|
209
|
+
/** Positional arguments in declared order, from the "args" property. */
|
|
210
|
+
args?: string[];
|
|
187
211
|
flags?: Record<string, unknown>;
|
|
188
212
|
meta: InvocationMeta;
|
|
189
213
|
}
|
|
@@ -237,6 +261,39 @@ interface McpIdentity {
|
|
|
237
261
|
type McpVerifier = (req: McpHttpRequest) => McpIdentity | null | undefined | Promise<McpIdentity | null | undefined>;
|
|
238
262
|
/** The challenge a 401 carries in WWW-Authenticate, as Go's api.DefaultAuthChallenge. */
|
|
239
263
|
declare const MCP_AUTH_CHALLENGE = "Bearer";
|
|
264
|
+
/**
|
|
265
|
+
* One refusal the surface decided before adopter code ran: the record
|
|
266
|
+
* Go's bridge sinks receive from the MCP surface, reduced to the
|
|
267
|
+
* fields the surface has (a `cmdsurface.Invocation` subset plus the
|
|
268
|
+
* error). No caller, arguments or flags travel on it, so there is
|
|
269
|
+
* nothing to redact.
|
|
270
|
+
*/
|
|
271
|
+
interface McpAuditRecord {
|
|
272
|
+
/** The resolved leaf path, e.g. `["widget","delete"]`. */
|
|
273
|
+
path: string[];
|
|
274
|
+
surface: 'mcp';
|
|
275
|
+
/** When the refusal was decided. */
|
|
276
|
+
requestedAt: Date;
|
|
277
|
+
/** The protocol revision serving the request. */
|
|
278
|
+
specVersion: string;
|
|
279
|
+
/**
|
|
280
|
+
* Go's sentinel error message for the event, verbatim (see the
|
|
281
|
+
* `MCP_AUDIT_*` constants in `mcp/audit`).
|
|
282
|
+
*/
|
|
283
|
+
error: string;
|
|
284
|
+
/**
|
|
285
|
+
* Always `mcp_spec_version`; `mcp_confirm_rejection` on a rejected
|
|
286
|
+
* `requestState`. Keys are the Go snake_case strings so the records
|
|
287
|
+
* forward to the same audit backends.
|
|
288
|
+
*/
|
|
289
|
+
extra: Record<string, string>;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* The mount-level audit hook. Called synchronously once per refusal,
|
|
293
|
+
* after the refusal is decided and before the response is returned.
|
|
294
|
+
* Best-effort: a throwing hook never changes the wire response.
|
|
295
|
+
*/
|
|
296
|
+
type McpAuditHook = (record: McpAuditRecord) => void;
|
|
240
297
|
/**
|
|
241
298
|
* Mount options, mirroring Go's MountMCP option set. Defaults match
|
|
242
299
|
* Go exactly: both eras, path "/mcp", empty origin allowlist, cache
|
|
@@ -271,6 +328,23 @@ interface McpMountOptions {
|
|
|
271
328
|
* is established, so every `kit/auth-required` leaf is refused.
|
|
272
329
|
*/
|
|
273
330
|
verifier?: McpVerifier;
|
|
331
|
+
/**
|
|
332
|
+
* Joins a leaf path into its tool name, and splits a called name
|
|
333
|
+
* back. Default ".". `"_"` names the leaf `widget add` `widget_add`,
|
|
334
|
+
* for hosts that admit only `^[A-Za-z0-9_-]{1,64}$`. Empty is a
|
|
335
|
+
* mount-time error, and so is any separator but the default that a
|
|
336
|
+
* command name contains: the name would not map back to one leaf.
|
|
337
|
+
*/
|
|
338
|
+
toolNameSeparator?: string;
|
|
339
|
+
/**
|
|
340
|
+
* Receives one {@link McpAuditRecord} per refusal the surface
|
|
341
|
+
* decides: auth refused, confirmation required / declined / state
|
|
342
|
+
* rejected, destructive ceiling. The counterpart of Go's bridge
|
|
343
|
+
* sinks for the MCP surface. Best-effort: it runs after the refusal
|
|
344
|
+
* is decided, before the response is returned, and a throw is
|
|
345
|
+
* swallowed.
|
|
346
|
+
*/
|
|
347
|
+
audit?: McpAuditHook;
|
|
274
348
|
}
|
|
275
349
|
/** Resolved, validated mount configuration. */
|
|
276
350
|
interface ResolvedMcpConfig {
|
|
@@ -285,6 +359,8 @@ interface ResolvedMcpConfig {
|
|
|
285
359
|
confirmationKey?: Uint8Array;
|
|
286
360
|
policy: Policy;
|
|
287
361
|
verifier?: McpVerifier;
|
|
362
|
+
toolNameSeparator: string;
|
|
363
|
+
audit?: McpAuditHook;
|
|
288
364
|
}
|
|
289
365
|
/**
|
|
290
366
|
* Validates and resolves mount options. Reproduces Go's two
|
|
@@ -292,12 +368,12 @@ interface ResolvedMcpConfig {
|
|
|
292
368
|
* empty spec-version set, and a negative ttl or unrecognized scope.
|
|
293
369
|
*/
|
|
294
370
|
declare function resolveMcpConfig(opts?: McpMountOptions): ResolvedMcpConfig;
|
|
295
|
-
/** Renders a leaf path as
|
|
296
|
-
declare function toolName(path: string[]): string;
|
|
297
|
-
/** Splits
|
|
298
|
-
declare function pathFromToolName(name: string): string[];
|
|
371
|
+
/** Renders a leaf path as an MCP tool name, joined with `separator`. */
|
|
372
|
+
declare function toolName(path: string[], separator?: string): string;
|
|
373
|
+
/** Splits an MCP tool name back into a leaf path on `separator`. */
|
|
374
|
+
declare function pathFromToolName(name: string, separator?: string): string[];
|
|
299
375
|
/** Renders one leaf as an MCP tool descriptor (shared by both eras). */
|
|
300
|
-
declare function buildToolEnvelope(leaf: Leaf): Record<string, unknown>;
|
|
376
|
+
declare function buildToolEnvelope(leaf: Leaf, separator?: string): Record<string, unknown>;
|
|
301
377
|
/**
|
|
302
378
|
* Renders a bridge result as the tools/call content block list.
|
|
303
379
|
* Shared verbatim by both eras so content layout cannot drift:
|
|
@@ -410,6 +486,12 @@ interface JsonRpcRequest {
|
|
|
410
486
|
}
|
|
411
487
|
/** Which handler a request routes to. */
|
|
412
488
|
type McpEra = 'legacy' | 'modern';
|
|
489
|
+
/**
|
|
490
|
+
* The binding a dispatcher serves. `http` (Streamable HTTP) validates
|
|
491
|
+
* the 2026-07-28 routing headers against the body; `stdio` has no
|
|
492
|
+
* header layer, so the body is the only source of truth.
|
|
493
|
+
*/
|
|
494
|
+
type McpTransport = 'http' | 'stdio';
|
|
413
495
|
/**
|
|
414
496
|
* Implements per-request era detection, precedence D1-D4.
|
|
415
497
|
* Never fails — it only classifies an already-parsed request; D1
|
|
@@ -465,8 +547,14 @@ declare class McpDispatcher {
|
|
|
465
547
|
private readonly cfg;
|
|
466
548
|
private readonly legacy;
|
|
467
549
|
private readonly modern;
|
|
468
|
-
constructor(bridge: McpBridge, cfg: ResolvedMcpConfig);
|
|
550
|
+
constructor(bridge: McpBridge, cfg: ResolvedMcpConfig, transport?: McpTransport);
|
|
469
551
|
handle(req: McpHttpRequest): Promise<McpHttpResponse>;
|
|
552
|
+
/**
|
|
553
|
+
* Routes one already-parsed request to its era's handler (D2-D4).
|
|
554
|
+
* The transport-neutral core behind `handle`; stdio calls it directly
|
|
555
|
+
* after doing its own framing and parsing.
|
|
556
|
+
*/
|
|
557
|
+
dispatch(req: McpHttpRequest, rpc: JsonRpcRequest): Promise<McpHttpResponse>;
|
|
470
558
|
}
|
|
471
559
|
/** The 405 GET/DELETE answer at the mount path. */
|
|
472
560
|
declare function methodNotAllowedResponse(): McpHttpResponse;
|
|
@@ -480,16 +568,18 @@ declare function parseJsonRpcRequest(body: string): JsonRpcRequest;
|
|
|
480
568
|
* @module mcp/legacy
|
|
481
569
|
* @package @hop-top/kit
|
|
482
570
|
*
|
|
483
|
-
* The 2024-11-05 MCP handler: `initialize`, `tools/list`,
|
|
571
|
+
* The 2024-11-05 MCP handler: `initialize`, `ping`, `tools/list`,
|
|
484
572
|
* `tools/call`, plain JSON-RPC over one POST path, no sessions, no
|
|
485
573
|
* SSE.
|
|
486
574
|
*
|
|
487
|
-
* This module is byte-for-byte frozen. The dual-spec hard
|
|
488
|
-
* "2024-11-05 behavior is preserved byte-for-byte;
|
|
489
|
-
* deprecation", and the three-way module split
|
|
490
|
-
* dispatch) exists precisely so a reviewer can
|
|
491
|
-
* change did not touch this file. Modern-era
|
|
492
|
-
* modern.ts — never here.
|
|
575
|
+
* This module's wire output is byte-for-byte frozen. The dual-spec hard
|
|
576
|
+
* invariant is "2024-11-05 behavior is preserved byte-for-byte;
|
|
577
|
+
* additive only; no deprecation", and the three-way module split
|
|
578
|
+
* (legacy / modern / dispatch) exists precisely so a reviewer can
|
|
579
|
+
* confirm a modern-era change did not touch this file. Modern-era
|
|
580
|
+
* behavior belongs in modern.ts — never here. The refusal audit hook
|
|
581
|
+
* (mcp/audit) is the one deliberate addition: it observes the
|
|
582
|
+
* refusals this handler already makes and changes no byte of them.
|
|
493
583
|
*/
|
|
494
584
|
|
|
495
585
|
/**
|
|
@@ -519,7 +609,118 @@ declare class LegacyMcpHandler {
|
|
|
519
609
|
* destructive blocks, non-zero exit codes) is an isError result.
|
|
520
610
|
*/
|
|
521
611
|
private handleToolsCall;
|
|
612
|
+
/** Emits one 2024-11-05 refusal record to the mount's audit hook. */
|
|
613
|
+
private audit;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* @module mcp/audit
|
|
618
|
+
* @package @hop-top/kit
|
|
619
|
+
*
|
|
620
|
+
* The refusal audit hook: the counterpart, for the MCP surface, of the
|
|
621
|
+
* bridge sinks Go's `cmdsurface` fans every refusal out to. Go audits
|
|
622
|
+
* each refusal the surface makes before adopter code runs (`Bridge.Audit`
|
|
623
|
+
* from `mcpsdk`'s gates and the bridge's own `refuse`); this port has no
|
|
624
|
+
* sink registry, so one mount-level hook receives the same record.
|
|
625
|
+
*
|
|
626
|
+
* Contract, shared by every kit SDK: the hook is called synchronously
|
|
627
|
+
* after the refusal is decided and before the response is returned (Go's
|
|
628
|
+
* order: audit, then respond); it is best-effort, so a throw is swallowed
|
|
629
|
+
* and the wire response is never affected; and the `error` field carries
|
|
630
|
+
* Go's sentinel message verbatim, so adopters forwarding to a backend
|
|
631
|
+
* that already receives Go's sinks see one vocabulary.
|
|
632
|
+
*/
|
|
633
|
+
|
|
634
|
+
/** `cmdsurface.ErrAuthRefused`: a `kit/auth-required` leaf, no established caller. */
|
|
635
|
+
declare const MCP_AUDIT_AUTH_REFUSED = "cmdsurface: authentication refused";
|
|
636
|
+
/** `mcpsdk.ErrConfirmationRequired`: nothing satisfied the confirmation gate. */
|
|
637
|
+
declare const MCP_AUDIT_CONFIRMATION_REQUIRED = "mcpsdk: confirmation required";
|
|
638
|
+
/** `mcpsdk.ErrConfirmationDeclined`: the client's user declined or dismissed the question. */
|
|
639
|
+
declare const MCP_AUDIT_CONFIRMATION_DECLINED = "mcpsdk: confirmation declined";
|
|
640
|
+
/** `mcpsdk.ErrConfirmationStateRejected`: a presented `requestState` failed verification. */
|
|
641
|
+
declare const MCP_AUDIT_CONFIRMATION_STATE_REJECTED = "mcpsdk: confirmation requestState failed verification";
|
|
642
|
+
/** `cmdsurface.ErrDestructiveBlocked`: the leaf's destructiveness exceeds the policy ceiling. */
|
|
643
|
+
declare const MCP_AUDIT_DESTRUCTIVE_BLOCKED = "cmdsurface: destructive command blocked on this surface";
|
|
644
|
+
/** The `mcp_confirm_rejection` value a rejected `requestState` carries, as in Go. */
|
|
645
|
+
declare const MCP_CONFIRM_REJECTION_STATE = "request_state_verification_failed";
|
|
646
|
+
/**
|
|
647
|
+
* Emits one refusal record to `hook`, when there is one. Builds the
|
|
648
|
+
* record here so every call site carries the same shape: the surface
|
|
649
|
+
* pinned to `mcp`, the time the refusal was decided, and `extra`
|
|
650
|
+
* always carrying `mcp_spec_version` ahead of any event-specific key.
|
|
651
|
+
* A throwing hook is swallowed: audit must never turn a refusal into
|
|
652
|
+
* a different refusal.
|
|
653
|
+
*/
|
|
654
|
+
declare function auditRefusal(hook: McpAuditHook | undefined, path: string[], specVersion: string, error: string, extra?: Record<string, string>): void;
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* @module mcp/stdio
|
|
658
|
+
* @package @hop-top/kit
|
|
659
|
+
*
|
|
660
|
+
* The stdio binding for the dual-spec MCP surface: newline-delimited
|
|
661
|
+
* JSON-RPC over a pair of byte streams (by default the process's
|
|
662
|
+
* stdin/stdout), driving the same era dispatch the HTTP handler uses.
|
|
663
|
+
*
|
|
664
|
+
* Wire rules (stdio binding, 2024-11-05 and 2026-07-28):
|
|
665
|
+
* - one JSON-RPC message per line; output lines carry no embedded
|
|
666
|
+
* newline, and the output stream carries nothing but protocol
|
|
667
|
+
* messages — diagnostics go to the log stream (stderr);
|
|
668
|
+
* - a notification (no `id` member) is never answered;
|
|
669
|
+
* - each message is a single request: a JSON array (a batch) is
|
|
670
|
+
* refused with -32600 and `id: null`;
|
|
671
|
+
* - a line that is not JSON is answered -32700 with `id: null`;
|
|
672
|
+
* - requests run concurrently, so replies may arrive out of order —
|
|
673
|
+
* each carries its request's id.
|
|
674
|
+
*
|
|
675
|
+
* stdio has no header layer: era detection uses the body markers only
|
|
676
|
+
* (`params._meta` protocolVersion, `server/discover`), and the
|
|
677
|
+
* 2026-07-28 header checks (V4, V6, V7) do not apply. Gates that read
|
|
678
|
+
* headers see none — see the MCP guide for what that means for
|
|
679
|
+
* auth-required and confirmation-gated tools.
|
|
680
|
+
*/
|
|
681
|
+
|
|
682
|
+
/** Options for {@link serveStdio}. */
|
|
683
|
+
interface McpStdioOptions {
|
|
684
|
+
/** Where requests are read from. Default: `process.stdin`. */
|
|
685
|
+
input?: Readable;
|
|
686
|
+
/** Where replies are written. Default: `process.stdout`. */
|
|
687
|
+
output?: Writable;
|
|
688
|
+
/** Where diagnostics are written. Default: `process.stderr`. */
|
|
689
|
+
log?: Writable;
|
|
690
|
+
/**
|
|
691
|
+
* Mount options, when serving a bridge. A handler from
|
|
692
|
+
* createMcpHandler already carries its own; passing both throws.
|
|
693
|
+
*/
|
|
694
|
+
mount?: McpMountOptions;
|
|
695
|
+
}
|
|
696
|
+
/** A running stdio session. */
|
|
697
|
+
interface McpStdioServer {
|
|
698
|
+
/**
|
|
699
|
+
* Resolves once input has ended (or {@link close} was called) and
|
|
700
|
+
* every in-flight request has been answered.
|
|
701
|
+
*/
|
|
702
|
+
readonly done: Promise<void>;
|
|
703
|
+
/** Stops reading input; resolves like {@link done}. */
|
|
704
|
+
close(): Promise<void>;
|
|
522
705
|
}
|
|
706
|
+
/**
|
|
707
|
+
* Serves MCP over stdio for a bridge, or for a handler built by
|
|
708
|
+
* createMcpHandler (its bridge and mount options are reused).
|
|
709
|
+
*
|
|
710
|
+
* A handler built some other way is called with an HTTP-shaped POST
|
|
711
|
+
* per message; that serves the 2024-11-05 era, but such a handler
|
|
712
|
+
* cannot know the request came over stdio, so 2026-07-28 requests fail
|
|
713
|
+
* its header checks. Pass the bridge or a createMcpHandler handler to
|
|
714
|
+
* serve both eras.
|
|
715
|
+
*
|
|
716
|
+
* ```ts
|
|
717
|
+
* import { serveStdio } from '@hop-top/kit/mcp';
|
|
718
|
+
*
|
|
719
|
+
* const server = serveStdio(bridge);
|
|
720
|
+
* await server.done; // the host closed stdin
|
|
721
|
+
* ```
|
|
722
|
+
*/
|
|
723
|
+
declare function serveStdio(target: McpBridge | McpHandler, opts?: McpStdioOptions): McpStdioServer;
|
|
523
724
|
|
|
524
725
|
/**
|
|
525
726
|
* @module mcp/modern-confirm
|
|
@@ -625,13 +826,21 @@ type McpConfirmDecision = {
|
|
|
625
826
|
* a missing elicitation capability is never -32021 here.
|
|
626
827
|
*/
|
|
627
828
|
declare class ElicitationConfirmGate {
|
|
829
|
+
private readonly toolNameSeparator?;
|
|
830
|
+
private readonly audit?;
|
|
628
831
|
private readonly key;
|
|
629
832
|
/**
|
|
630
|
-
*
|
|
631
|
-
*
|
|
833
|
+
* In-memory records of rejected states, kept beside the mount's
|
|
834
|
+
* `audit` hook for callers holding the gate directly.
|
|
632
835
|
*/
|
|
633
836
|
readonly rejections: McpConfirmRejection[];
|
|
634
|
-
|
|
837
|
+
/**
|
|
838
|
+
* `toolNameSeparator` names the tool in the confirmation prompt, as
|
|
839
|
+
* the mount's `toolNameSeparator` option does in tools/list. `audit`
|
|
840
|
+
* is the mount's refusal hook: it receives the gate's three refusals
|
|
841
|
+
* (confirmation required, declined, state rejected).
|
|
842
|
+
*/
|
|
843
|
+
constructor(key: Uint8Array, toolNameSeparator?: string | undefined, audit?: McpAuditHook | undefined);
|
|
635
844
|
/**
|
|
636
845
|
* Runs the gate for one `tools/call`. Returns `undefined` to proceed
|
|
637
846
|
* with the invocation, or the refusal / interim result plus its HTTP
|
|
@@ -652,12 +861,14 @@ declare class ElicitationConfirmGate {
|
|
|
652
861
|
inputRequired(leaf: Leaf, binding: McpConfirmBinding): Record<string, unknown>;
|
|
653
862
|
/**
|
|
654
863
|
* Records a failed `requestState` verification as a
|
|
655
|
-
* security-relevant audit event
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
864
|
+
* security-relevant audit event: in memory on `rejections`, and on
|
|
865
|
+
* the mount's audit hook with the `mcp_confirm_rejection` extra Go's
|
|
866
|
+
* surfaces attach. Best-effort by the same contract: recording never
|
|
867
|
+
* affects the response.
|
|
659
868
|
*/
|
|
660
869
|
private auditRejection;
|
|
870
|
+
/** Emits one 2026-07-28 refusal record to the mount's audit hook. */
|
|
871
|
+
private emit;
|
|
661
872
|
}
|
|
662
873
|
/**
|
|
663
874
|
* The default gate: a `requiresConfirmation` leaf needs the
|
|
@@ -766,6 +977,7 @@ interface ModernRequestMeta {
|
|
|
766
977
|
declare class ModernMcpHandler {
|
|
767
978
|
private readonly bridge;
|
|
768
979
|
private readonly cfg;
|
|
980
|
+
private readonly transport;
|
|
769
981
|
/**
|
|
770
982
|
* The MRTR confirmation strategy, installed only when the mount was
|
|
771
983
|
* given key material. Without a key there is nothing to MAC state
|
|
@@ -773,7 +985,14 @@ declare class ModernMcpHandler {
|
|
|
773
985
|
* `X-Confirm-Token` header gate.
|
|
774
986
|
*/
|
|
775
987
|
readonly confirmGate?: ElicitationConfirmGate;
|
|
776
|
-
|
|
988
|
+
/**
|
|
989
|
+
* `transport` selects the binding. Streamable HTTP mirrors the method,
|
|
990
|
+
* tool name and protocol version into headers and requires them to
|
|
991
|
+
* agree with the body (V4, V6, V7). stdio has no header layer — the
|
|
992
|
+
* body is the only source of truth — so those three checks do not
|
|
993
|
+
* apply there; every other check runs unchanged.
|
|
994
|
+
*/
|
|
995
|
+
constructor(bridge: McpBridge, cfg: ResolvedMcpConfig, transport?: McpTransport);
|
|
777
996
|
/**
|
|
778
997
|
* The modern entry point. The validation chain runs in the guide's
|
|
779
998
|
* order V1-V9; the first failure responds and stops. HTTP status is
|
|
@@ -781,6 +1000,8 @@ declare class ModernMcpHandler {
|
|
|
781
1000
|
* JSON-RPC errors ride HTTP 200, matching legacy's convention.
|
|
782
1001
|
*/
|
|
783
1002
|
serve(req: McpHttpRequest, rpc: JsonRpcRequest): Promise<McpHttpResponse>;
|
|
1003
|
+
/** V4: MCP-Protocol-Version header present and equal to _meta's. */
|
|
1004
|
+
private validateVersionHeader;
|
|
784
1005
|
/**
|
|
785
1006
|
* server/discover — the mandatory modern discovery method. Carries
|
|
786
1007
|
* no listChanged flag (notifications unimplemented), no extensions
|
|
@@ -802,6 +1023,8 @@ declare class ModernMcpHandler {
|
|
|
802
1023
|
* the legacy path would have blocked. Results carry no cache hints.
|
|
803
1024
|
*/
|
|
804
1025
|
private handleToolsCall;
|
|
1026
|
+
/** Emits one 2026-07-28 refusal record to the mount's audit hook. */
|
|
1027
|
+
private audit;
|
|
805
1028
|
/**
|
|
806
1029
|
* Selects and runs the confirmation strategy for one `tools/call`.
|
|
807
1030
|
* Returns `undefined` to proceed with the invocation.
|
|
@@ -1022,6 +1245,73 @@ interface CommanderBridgeOptions {
|
|
|
1022
1245
|
*/
|
|
1023
1246
|
declare function commanderBridge(root: Command, opts: CommanderBridgeOptions): McpBridge;
|
|
1024
1247
|
|
|
1248
|
+
/**
|
|
1249
|
+
* @module mcp/args
|
|
1250
|
+
* @package @hop-top/kit
|
|
1251
|
+
*
|
|
1252
|
+
* Positional arguments over MCP, ported from Go's
|
|
1253
|
+
* go/transport/cmdsurface/surface_mcp_args.go.
|
|
1254
|
+
*
|
|
1255
|
+
* An MCP tool takes one JSON object of named arguments; a leaf takes
|
|
1256
|
+
* flags by name and positional arguments by position. A leaf that
|
|
1257
|
+
* declares its positionals (`Leaf.args`) publishes them as ONE extra
|
|
1258
|
+
* property, "args": an array of strings in declared order — the key
|
|
1259
|
+
* and shape every kit surface uses for positionals. One property per
|
|
1260
|
+
* argument would share a namespace with the leaf's flags, so a flag
|
|
1261
|
+
* added later could silently take an argument's name; the array
|
|
1262
|
+
* reserves exactly one name, and a trailing variadic argument needs
|
|
1263
|
+
* no extra syntax.
|
|
1264
|
+
*
|
|
1265
|
+
* The property is required, with minItems set to the number of
|
|
1266
|
+
* required arguments, when any argument is; optional arguments only
|
|
1267
|
+
* lengthen what the array may hold. No maxItems is published, as in
|
|
1268
|
+
* Go: the command's own parser refuses a count it does not accept.
|
|
1269
|
+
*
|
|
1270
|
+
* A leaf whose "args" name is taken by a flag publishes no such
|
|
1271
|
+
* property and says so in its description: the flag was part of the
|
|
1272
|
+
* tool's schema first, and taking the name would change what an
|
|
1273
|
+
* existing caller's "args" means.
|
|
1274
|
+
*/
|
|
1275
|
+
|
|
1276
|
+
/** The inputSchema property carrying a leaf's declared positionals. */
|
|
1277
|
+
declare const MCP_ARGS_PROPERTY = "args";
|
|
1278
|
+
/**
|
|
1279
|
+
* Reports whether leaf's inputSchema carries the "args" property: it
|
|
1280
|
+
* declares positional arguments and no flag already holds the name.
|
|
1281
|
+
*/
|
|
1282
|
+
declare function mcpArgsPublished(leaf: Leaf): boolean;
|
|
1283
|
+
/**
|
|
1284
|
+
* The description leaf's MCP tool publishes: its own description,
|
|
1285
|
+
* followed by a note when it takes positionals the tool cannot pass.
|
|
1286
|
+
*/
|
|
1287
|
+
declare function mcpToolDescription(leaf: Leaf): string;
|
|
1288
|
+
/**
|
|
1289
|
+
* leaf's MCP tool inputSchema: one property per flag, the leaf's
|
|
1290
|
+
* required flags listed as required, plus the "args" property when
|
|
1291
|
+
* {@link mcpArgsPublished}.
|
|
1292
|
+
*/
|
|
1293
|
+
declare function mcpInputSchema(leaf: Leaf): Record<string, unknown>;
|
|
1294
|
+
/** The outcome of {@link mcpSplitArguments}. */
|
|
1295
|
+
type McpSplitResult = {
|
|
1296
|
+
flags?: Record<string, unknown>;
|
|
1297
|
+
args?: string[];
|
|
1298
|
+
error?: undefined;
|
|
1299
|
+
} | {
|
|
1300
|
+
error: string;
|
|
1301
|
+
};
|
|
1302
|
+
/**
|
|
1303
|
+
* Splits a tools/call arguments object into an invocation's flags
|
|
1304
|
+
* and positional args. When leaf publishes "args" that key is taken
|
|
1305
|
+
* out of the flags: it must hold an array of strings, at least as
|
|
1306
|
+
* many as the leaf declares required, and becomes `args` in order.
|
|
1307
|
+
* Every other key is a flag, forwarded as-is. A leaf that publishes
|
|
1308
|
+
* no "args" property gets every key as a flag.
|
|
1309
|
+
*
|
|
1310
|
+
* `error` names the problem for the caller to correct; the handlers
|
|
1311
|
+
* return it as an isError tool result, before the confirmation gate.
|
|
1312
|
+
*/
|
|
1313
|
+
declare function mcpSplitArguments(leaf: Leaf, args: Record<string, unknown> | undefined): McpSplitResult;
|
|
1314
|
+
|
|
1025
1315
|
/**
|
|
1026
1316
|
* @module mcp
|
|
1027
1317
|
* @package @hop-top/kit
|
|
@@ -1045,13 +1335,16 @@ declare function commanderBridge(root: Command, opts: CommanderBridgeOptions): M
|
|
|
1045
1335
|
* ```
|
|
1046
1336
|
*
|
|
1047
1337
|
* The handler is framework-free: binding it to node:http, hono,
|
|
1048
|
-
* express, fastify, or a Worker is the adopter's job.
|
|
1338
|
+
* express, fastify, or a Worker is the adopter's job. For a host that
|
|
1339
|
+
* spawns the tool, `serveStdio(bridge)` (or `serveStdio(handler)`)
|
|
1340
|
+
* serves the same surface over newline-delimited stdin/stdout.
|
|
1049
1341
|
*/
|
|
1050
1342
|
|
|
1051
1343
|
type index_CommanderBridgeOptions = CommanderBridgeOptions;
|
|
1052
1344
|
declare const index_DEFAULT_MCP_PATH: typeof DEFAULT_MCP_PATH;
|
|
1053
1345
|
declare const index_DEFAULT_MCP_SERVER_NAME: typeof DEFAULT_MCP_SERVER_NAME;
|
|
1054
1346
|
declare const index_DEFAULT_MCP_SERVER_VERSION: typeof DEFAULT_MCP_SERVER_VERSION;
|
|
1347
|
+
declare const index_DEFAULT_TOOL_NAME_SEPARATOR: typeof DEFAULT_TOOL_NAME_SEPARATOR;
|
|
1055
1348
|
type index_DestructiveBlockedError = DestructiveBlockedError;
|
|
1056
1349
|
declare const index_DestructiveBlockedError: typeof DestructiveBlockedError;
|
|
1057
1350
|
type index_ElicitationConfirmGate = ElicitationConfirmGate;
|
|
@@ -1066,10 +1359,18 @@ type index_InvokeResult = InvokeResult;
|
|
|
1066
1359
|
type index_JsonRpcErrorObject = JsonRpcErrorObject;
|
|
1067
1360
|
type index_JsonRpcRequest = JsonRpcRequest;
|
|
1068
1361
|
type index_Leaf = Leaf;
|
|
1362
|
+
type index_LeafArg = LeafArg;
|
|
1069
1363
|
type index_LegacyMcpHandler = LegacyMcpHandler;
|
|
1070
1364
|
declare const index_LegacyMcpHandler: typeof LegacyMcpHandler;
|
|
1365
|
+
declare const index_MCP_ARGS_PROPERTY: typeof MCP_ARGS_PROPERTY;
|
|
1366
|
+
declare const index_MCP_AUDIT_AUTH_REFUSED: typeof MCP_AUDIT_AUTH_REFUSED;
|
|
1367
|
+
declare const index_MCP_AUDIT_CONFIRMATION_DECLINED: typeof MCP_AUDIT_CONFIRMATION_DECLINED;
|
|
1368
|
+
declare const index_MCP_AUDIT_CONFIRMATION_REQUIRED: typeof MCP_AUDIT_CONFIRMATION_REQUIRED;
|
|
1369
|
+
declare const index_MCP_AUDIT_CONFIRMATION_STATE_REJECTED: typeof MCP_AUDIT_CONFIRMATION_STATE_REJECTED;
|
|
1370
|
+
declare const index_MCP_AUDIT_DESTRUCTIVE_BLOCKED: typeof MCP_AUDIT_DESTRUCTIVE_BLOCKED;
|
|
1071
1371
|
declare const index_MCP_AUTH_CHALLENGE: typeof MCP_AUTH_CHALLENGE;
|
|
1072
1372
|
declare const index_MCP_CONFIRM_KEY: typeof MCP_CONFIRM_KEY;
|
|
1373
|
+
declare const index_MCP_CONFIRM_REJECTION_STATE: typeof MCP_CONFIRM_REJECTION_STATE;
|
|
1073
1374
|
declare const index_MCP_CONFIRM_STATE_TTL_SECONDS: typeof MCP_CONFIRM_STATE_TTL_SECONDS;
|
|
1074
1375
|
declare const index_MCP_CONFIRM_STATE_VERSION: typeof MCP_CONFIRM_STATE_VERSION;
|
|
1075
1376
|
declare const index_MCP_ERR_HEADER_MISMATCH: typeof MCP_ERR_HEADER_MISMATCH;
|
|
@@ -1086,6 +1387,8 @@ declare const index_META_KEY_CLIENT_CAPABILITIES: typeof META_KEY_CLIENT_CAPABIL
|
|
|
1086
1387
|
declare const index_META_KEY_CLIENT_INFO: typeof META_KEY_CLIENT_INFO;
|
|
1087
1388
|
declare const index_META_KEY_PROTOCOL_VERSION: typeof META_KEY_PROTOCOL_VERSION;
|
|
1088
1389
|
declare const index_META_KEY_SERVER_INFO: typeof META_KEY_SERVER_INFO;
|
|
1390
|
+
type index_McpAuditHook = McpAuditHook;
|
|
1391
|
+
type index_McpAuditRecord = McpAuditRecord;
|
|
1089
1392
|
type index_McpBridge = McpBridge;
|
|
1090
1393
|
type index_McpCacheScope = McpCacheScope;
|
|
1091
1394
|
type index_McpConfirmBinding = McpConfirmBinding;
|
|
@@ -1102,6 +1405,10 @@ type index_McpHttpResponse = McpHttpResponse;
|
|
|
1102
1405
|
type index_McpIdentity = McpIdentity;
|
|
1103
1406
|
type index_McpMountOptions = McpMountOptions;
|
|
1104
1407
|
type index_McpSpecVersion = McpSpecVersion;
|
|
1408
|
+
type index_McpSplitResult = McpSplitResult;
|
|
1409
|
+
type index_McpStdioOptions = McpStdioOptions;
|
|
1410
|
+
type index_McpStdioServer = McpStdioServer;
|
|
1411
|
+
type index_McpTransport = McpTransport;
|
|
1105
1412
|
type index_McpVerifier = McpVerifier;
|
|
1106
1413
|
type index_ModernMcpHandler = ModernMcpHandler;
|
|
1107
1414
|
declare const index_ModernMcpHandler: typeof ModernMcpHandler;
|
|
@@ -1126,6 +1433,7 @@ declare const index_TASK_METHODS: typeof TASK_METHODS;
|
|
|
1126
1433
|
type index_TaskMethod = TaskMethod;
|
|
1127
1434
|
type index_UnknownCommandError = UnknownCommandError;
|
|
1128
1435
|
declare const index_UnknownCommandError: typeof UnknownCommandError;
|
|
1436
|
+
declare const index_auditRefusal: typeof auditRefusal;
|
|
1129
1437
|
declare const index_buildToolEnvelope: typeof buildToolEnvelope;
|
|
1130
1438
|
declare const index_canonicalJSONStringify: typeof canonicalJSONStringify;
|
|
1131
1439
|
declare const index_clientSupportsFormElicitation: typeof clientSupportsFormElicitation;
|
|
@@ -1142,9 +1450,13 @@ declare const index_hasModernMetaMarker: typeof hasModernMetaMarker;
|
|
|
1142
1450
|
declare const index_headerConfirmationGate: typeof headerConfirmationGate;
|
|
1143
1451
|
declare const index_invocationMeta: typeof invocationMeta;
|
|
1144
1452
|
declare const index_isTaskMethod: typeof isTaskMethod;
|
|
1453
|
+
declare const index_mcpArgsPublished: typeof mcpArgsPublished;
|
|
1145
1454
|
declare const index_mcpConfirmArgsDigest: typeof mcpConfirmArgsDigest;
|
|
1146
1455
|
declare const index_mcpConfirmPrincipal: typeof mcpConfirmPrincipal;
|
|
1456
|
+
declare const index_mcpInputSchema: typeof mcpInputSchema;
|
|
1147
1457
|
declare const index_mcpMountConfig: typeof mcpMountConfig;
|
|
1458
|
+
declare const index_mcpSplitArguments: typeof mcpSplitArguments;
|
|
1459
|
+
declare const index_mcpToolDescription: typeof mcpToolDescription;
|
|
1148
1460
|
declare const index_methodNotAllowedResponse: typeof methodNotAllowedResponse;
|
|
1149
1461
|
declare const index_mintMcpConfirmState: typeof mintMcpConfirmState;
|
|
1150
1462
|
declare const index_modernInvocationExtra: typeof modernInvocationExtra;
|
|
@@ -1156,12 +1468,13 @@ declare const index_policyAllowed: typeof policyAllowed;
|
|
|
1156
1468
|
declare const index_rawToolCallName: typeof rawToolCallName;
|
|
1157
1469
|
declare const index_renderCallResult: typeof renderCallResult;
|
|
1158
1470
|
declare const index_resolveMcpConfig: typeof resolveMcpConfig;
|
|
1471
|
+
declare const index_serveStdio: typeof serveStdio;
|
|
1159
1472
|
declare const index_singleHeaderValue: typeof singleHeaderValue;
|
|
1160
1473
|
declare const index_toolName: typeof toolName;
|
|
1161
1474
|
declare const index_validModernRequestId: typeof validModernRequestId;
|
|
1162
1475
|
declare const index_verifyMcpConfirmState: typeof verifyMcpConfirmState;
|
|
1163
1476
|
declare namespace index {
|
|
1164
|
-
export { type index_CommanderBridgeOptions as CommanderBridgeOptions, index_DEFAULT_MCP_PATH as DEFAULT_MCP_PATH, index_DEFAULT_MCP_SERVER_NAME as DEFAULT_MCP_SERVER_NAME, index_DEFAULT_MCP_SERVER_VERSION as DEFAULT_MCP_SERVER_VERSION, index_DestructiveBlockedError as DestructiveBlockedError, index_ElicitationConfirmGate as ElicitationConfirmGate, type index_FlagSchema as FlagSchema, index_HEADER_MCP_METHOD as HEADER_MCP_METHOD, index_HEADER_MCP_NAME as HEADER_MCP_NAME, index_HEADER_MCP_PROTOCOL_VERSION as HEADER_MCP_PROTOCOL_VERSION, type index_Invocation as Invocation, type index_InvocationMeta as InvocationMeta, type index_InvokeResult as InvokeResult, type index_JsonRpcErrorObject as JsonRpcErrorObject, type index_JsonRpcRequest as JsonRpcRequest, type index_Leaf as Leaf, index_LegacyMcpHandler as LegacyMcpHandler, index_MCP_AUTH_CHALLENGE as MCP_AUTH_CHALLENGE, index_MCP_CONFIRM_KEY as MCP_CONFIRM_KEY, index_MCP_CONFIRM_STATE_TTL_SECONDS as MCP_CONFIRM_STATE_TTL_SECONDS, index_MCP_CONFIRM_STATE_VERSION as MCP_CONFIRM_STATE_VERSION, index_MCP_ERR_HEADER_MISMATCH as MCP_ERR_HEADER_MISMATCH, index_MCP_ERR_INTERNAL as MCP_ERR_INTERNAL, index_MCP_ERR_INVALID_PARAMS as MCP_ERR_INVALID_PARAMS, index_MCP_ERR_INVALID_REQUEST as MCP_ERR_INVALID_REQUEST, index_MCP_ERR_METHOD_NOT_FOUND as MCP_ERR_METHOD_NOT_FOUND, index_MCP_ERR_MISSING_CLIENT_CAPABILITY as MCP_ERR_MISSING_CLIENT_CAPABILITY, index_MCP_ERR_PARSE as MCP_ERR_PARSE, index_MCP_ERR_UNSUPPORTED_VERSION as MCP_ERR_UNSUPPORTED_VERSION, index_MCP_SPEC_2024_11_05 as MCP_SPEC_2024_11_05, index_MCP_SPEC_2026_07_28 as MCP_SPEC_2026_07_28, index_META_KEY_CLIENT_CAPABILITIES as META_KEY_CLIENT_CAPABILITIES, index_META_KEY_CLIENT_INFO as META_KEY_CLIENT_INFO, index_META_KEY_PROTOCOL_VERSION as META_KEY_PROTOCOL_VERSION, index_META_KEY_SERVER_INFO as META_KEY_SERVER_INFO, type index_McpBridge as McpBridge, type index_McpCacheScope as McpCacheScope, type index_McpConfirmBinding as McpConfirmBinding, type index_McpConfirmDecision as McpConfirmDecision, type index_McpConfirmRejection as McpConfirmRejection, type index_McpConfirmStateStatus as McpConfirmStateStatus, index_McpDispatcher as McpDispatcher, type index_McpEra as McpEra, type index_McpEstablishment as McpEstablishment, type index_McpHandler as McpHandler, type index_McpHttpRequest as McpHttpRequest, type index_McpHttpResponse as McpHttpResponse, type index_McpIdentity as McpIdentity, type index_McpMountOptions as McpMountOptions, type index_McpSpecVersion as McpSpecVersion, type index_McpVerifier as McpVerifier, index_ModernMcpHandler as ModernMcpHandler, type index_ModernRequestMeta as ModernRequestMeta, type index_Policy as Policy, index_RESULT_TYPE_COMPLETE as RESULT_TYPE_COMPLETE, index_RESULT_TYPE_INPUT_REQUIRED as RESULT_TYPE_INPUT_REQUIRED, index_RawJSON as RawJSON, type index_ResolvedMcpConfig as ResolvedMcpConfig, index_SCOPES_EXTRA_KEY as SCOPES_EXTRA_KEY, index_SURFACE_CLI as SURFACE_CLI, index_SURFACE_LIB as SURFACE_LIB, index_SURFACE_MCP as SURFACE_MCP, type index_SafetyClass as SafetyClass, type index_Surface as Surface, index_SurfaceNotEnabledError as SurfaceNotEnabledError, index_TASKS_EXTENSION as TASKS_EXTENSION, index_TASKS_SUPPORTED as TASKS_SUPPORTED, index_TASK_METHODS as TASK_METHODS, type index_TaskMethod as TaskMethod, index_UnknownCommandError as UnknownCommandError, index_buildToolEnvelope as buildToolEnvelope, index_canonicalJSONStringify as canonicalJSONStringify, index_clientSupportsFormElicitation as clientSupportsFormElicitation, index_commanderBridge as commanderBridge, index_createMcpHandler as createMcpHandler, index_decodeMcpSentinel as decodeMcpSentinel, index_defaultPolicy as defaultPolicy, index_detectMcpEra as detectMcpEra, index_discoverCapabilities as discoverCapabilities, index_encodeEnvelope as encodeEnvelope, index_errorResultBlock as errorResultBlock, index_establishCaller as establishCaller, index_hasModernMetaMarker as hasModernMetaMarker, index_headerConfirmationGate as headerConfirmationGate, index_invocationMeta as invocationMeta, index_isTaskMethod as isTaskMethod, index_mcpConfirmArgsDigest as mcpConfirmArgsDigest, index_mcpConfirmPrincipal as mcpConfirmPrincipal, index_mcpMountConfig as mcpMountConfig, index_methodNotAllowedResponse as methodNotAllowedResponse, index_mintMcpConfirmState as mintMcpConfirmState, index_modernInvocationExtra as modernInvocationExtra, index_parseJsonRpcRequest as parseJsonRpcRequest, index_parseMcpConfirmRetry as parseMcpConfirmRetry, index_parseModernMeta as parseModernMeta, index_pathFromToolName as pathFromToolName, index_policyAllowed as policyAllowed, index_rawToolCallName as rawToolCallName, index_renderCallResult as renderCallResult, index_resolveMcpConfig as resolveMcpConfig, index_singleHeaderValue as singleHeaderValue, index_toolName as toolName, index_validModernRequestId as validModernRequestId, index_verifyMcpConfirmState as verifyMcpConfirmState };
|
|
1477
|
+
export { type index_CommanderBridgeOptions as CommanderBridgeOptions, index_DEFAULT_MCP_PATH as DEFAULT_MCP_PATH, index_DEFAULT_MCP_SERVER_NAME as DEFAULT_MCP_SERVER_NAME, index_DEFAULT_MCP_SERVER_VERSION as DEFAULT_MCP_SERVER_VERSION, index_DEFAULT_TOOL_NAME_SEPARATOR as DEFAULT_TOOL_NAME_SEPARATOR, index_DestructiveBlockedError as DestructiveBlockedError, index_ElicitationConfirmGate as ElicitationConfirmGate, type index_FlagSchema as FlagSchema, index_HEADER_MCP_METHOD as HEADER_MCP_METHOD, index_HEADER_MCP_NAME as HEADER_MCP_NAME, index_HEADER_MCP_PROTOCOL_VERSION as HEADER_MCP_PROTOCOL_VERSION, type index_Invocation as Invocation, type index_InvocationMeta as InvocationMeta, type index_InvokeResult as InvokeResult, type index_JsonRpcErrorObject as JsonRpcErrorObject, type index_JsonRpcRequest as JsonRpcRequest, type index_Leaf as Leaf, type index_LeafArg as LeafArg, index_LegacyMcpHandler as LegacyMcpHandler, index_MCP_ARGS_PROPERTY as MCP_ARGS_PROPERTY, index_MCP_AUDIT_AUTH_REFUSED as MCP_AUDIT_AUTH_REFUSED, index_MCP_AUDIT_CONFIRMATION_DECLINED as MCP_AUDIT_CONFIRMATION_DECLINED, index_MCP_AUDIT_CONFIRMATION_REQUIRED as MCP_AUDIT_CONFIRMATION_REQUIRED, index_MCP_AUDIT_CONFIRMATION_STATE_REJECTED as MCP_AUDIT_CONFIRMATION_STATE_REJECTED, index_MCP_AUDIT_DESTRUCTIVE_BLOCKED as MCP_AUDIT_DESTRUCTIVE_BLOCKED, index_MCP_AUTH_CHALLENGE as MCP_AUTH_CHALLENGE, index_MCP_CONFIRM_KEY as MCP_CONFIRM_KEY, index_MCP_CONFIRM_REJECTION_STATE as MCP_CONFIRM_REJECTION_STATE, index_MCP_CONFIRM_STATE_TTL_SECONDS as MCP_CONFIRM_STATE_TTL_SECONDS, index_MCP_CONFIRM_STATE_VERSION as MCP_CONFIRM_STATE_VERSION, index_MCP_ERR_HEADER_MISMATCH as MCP_ERR_HEADER_MISMATCH, index_MCP_ERR_INTERNAL as MCP_ERR_INTERNAL, index_MCP_ERR_INVALID_PARAMS as MCP_ERR_INVALID_PARAMS, index_MCP_ERR_INVALID_REQUEST as MCP_ERR_INVALID_REQUEST, index_MCP_ERR_METHOD_NOT_FOUND as MCP_ERR_METHOD_NOT_FOUND, index_MCP_ERR_MISSING_CLIENT_CAPABILITY as MCP_ERR_MISSING_CLIENT_CAPABILITY, index_MCP_ERR_PARSE as MCP_ERR_PARSE, index_MCP_ERR_UNSUPPORTED_VERSION as MCP_ERR_UNSUPPORTED_VERSION, index_MCP_SPEC_2024_11_05 as MCP_SPEC_2024_11_05, index_MCP_SPEC_2026_07_28 as MCP_SPEC_2026_07_28, index_META_KEY_CLIENT_CAPABILITIES as META_KEY_CLIENT_CAPABILITIES, index_META_KEY_CLIENT_INFO as META_KEY_CLIENT_INFO, index_META_KEY_PROTOCOL_VERSION as META_KEY_PROTOCOL_VERSION, index_META_KEY_SERVER_INFO as META_KEY_SERVER_INFO, type index_McpAuditHook as McpAuditHook, type index_McpAuditRecord as McpAuditRecord, type index_McpBridge as McpBridge, type index_McpCacheScope as McpCacheScope, type index_McpConfirmBinding as McpConfirmBinding, type index_McpConfirmDecision as McpConfirmDecision, type index_McpConfirmRejection as McpConfirmRejection, type index_McpConfirmStateStatus as McpConfirmStateStatus, index_McpDispatcher as McpDispatcher, type index_McpEra as McpEra, type index_McpEstablishment as McpEstablishment, type index_McpHandler as McpHandler, type index_McpHttpRequest as McpHttpRequest, type index_McpHttpResponse as McpHttpResponse, type index_McpIdentity as McpIdentity, type index_McpMountOptions as McpMountOptions, type index_McpSpecVersion as McpSpecVersion, type index_McpSplitResult as McpSplitResult, type index_McpStdioOptions as McpStdioOptions, type index_McpStdioServer as McpStdioServer, type index_McpTransport as McpTransport, type index_McpVerifier as McpVerifier, index_ModernMcpHandler as ModernMcpHandler, type index_ModernRequestMeta as ModernRequestMeta, type index_Policy as Policy, index_RESULT_TYPE_COMPLETE as RESULT_TYPE_COMPLETE, index_RESULT_TYPE_INPUT_REQUIRED as RESULT_TYPE_INPUT_REQUIRED, index_RawJSON as RawJSON, type index_ResolvedMcpConfig as ResolvedMcpConfig, index_SCOPES_EXTRA_KEY as SCOPES_EXTRA_KEY, index_SURFACE_CLI as SURFACE_CLI, index_SURFACE_LIB as SURFACE_LIB, index_SURFACE_MCP as SURFACE_MCP, type index_SafetyClass as SafetyClass, type index_Surface as Surface, index_SurfaceNotEnabledError as SurfaceNotEnabledError, index_TASKS_EXTENSION as TASKS_EXTENSION, index_TASKS_SUPPORTED as TASKS_SUPPORTED, index_TASK_METHODS as TASK_METHODS, type index_TaskMethod as TaskMethod, index_UnknownCommandError as UnknownCommandError, index_auditRefusal as auditRefusal, index_buildToolEnvelope as buildToolEnvelope, index_canonicalJSONStringify as canonicalJSONStringify, index_clientSupportsFormElicitation as clientSupportsFormElicitation, index_commanderBridge as commanderBridge, index_createMcpHandler as createMcpHandler, index_decodeMcpSentinel as decodeMcpSentinel, index_defaultPolicy as defaultPolicy, index_detectMcpEra as detectMcpEra, index_discoverCapabilities as discoverCapabilities, index_encodeEnvelope as encodeEnvelope, index_errorResultBlock as errorResultBlock, index_establishCaller as establishCaller, index_hasModernMetaMarker as hasModernMetaMarker, index_headerConfirmationGate as headerConfirmationGate, index_invocationMeta as invocationMeta, index_isTaskMethod as isTaskMethod, index_mcpArgsPublished as mcpArgsPublished, index_mcpConfirmArgsDigest as mcpConfirmArgsDigest, index_mcpConfirmPrincipal as mcpConfirmPrincipal, index_mcpInputSchema as mcpInputSchema, index_mcpMountConfig as mcpMountConfig, index_mcpSplitArguments as mcpSplitArguments, index_mcpToolDescription as mcpToolDescription, index_methodNotAllowedResponse as methodNotAllowedResponse, index_mintMcpConfirmState as mintMcpConfirmState, index_modernInvocationExtra as modernInvocationExtra, index_parseJsonRpcRequest as parseJsonRpcRequest, index_parseMcpConfirmRetry as parseMcpConfirmRetry, index_parseModernMeta as parseModernMeta, index_pathFromToolName as pathFromToolName, index_policyAllowed as policyAllowed, index_rawToolCallName as rawToolCallName, index_renderCallResult as renderCallResult, index_resolveMcpConfig as resolveMcpConfig, index_serveStdio as serveStdio, index_singleHeaderValue as singleHeaderValue, index_toolName as toolName, index_validModernRequestId as validModernRequestId, index_verifyMcpConfirmState as verifyMcpConfirmState };
|
|
1165
1478
|
}
|
|
1166
1479
|
|
|
1167
|
-
export {
|
|
1480
|
+
export { McpDispatcher as $, MCP_ERR_METHOD_NOT_FOUND as A, MCP_ERR_MISSING_CLIENT_CAPABILITY as B, type CommanderBridgeOptions as C, DEFAULT_MCP_PATH as D, ElicitationConfirmGate as E, type FlagSchema as F, MCP_ERR_PARSE as G, HEADER_MCP_METHOD as H, type Invocation as I, type JsonRpcErrorObject as J, MCP_ERR_UNSUPPORTED_VERSION as K, type Leaf as L, MCP_ARGS_PROPERTY as M, MCP_SPEC_2024_11_05 as N, MCP_SPEC_2026_07_28 as O, META_KEY_CLIENT_CAPABILITIES as P, META_KEY_CLIENT_INFO as Q, META_KEY_PROTOCOL_VERSION as R, META_KEY_SERVER_INFO as S, type McpAuditHook as T, type McpAuditRecord as U, type McpBridge as V, type McpCacheScope as W, type McpConfirmBinding as X, type McpConfirmDecision as Y, type McpConfirmRejection as Z, type McpConfirmStateStatus as _, DEFAULT_MCP_SERVER_NAME as a, policyAllowed as a$, type McpEra as a0, type McpEstablishment as a1, type McpHandler as a2, type McpHttpRequest as a3, type McpHttpResponse as a4, type McpIdentity as a5, type McpMountOptions as a6, type McpSpecVersion as a7, type McpSplitResult as a8, type McpStdioOptions as a9, commanderBridge as aA, createMcpHandler as aB, decodeMcpSentinel as aC, defaultPolicy as aD, detectMcpEra as aE, discoverCapabilities as aF, encodeEnvelope as aG, errorResultBlock as aH, establishCaller as aI, hasModernMetaMarker as aJ, headerConfirmationGate as aK, invocationMeta as aL, isTaskMethod as aM, mcpArgsPublished as aN, mcpConfirmArgsDigest as aO, mcpConfirmPrincipal as aP, mcpInputSchema as aQ, mcpMountConfig as aR, mcpSplitArguments as aS, mcpToolDescription as aT, methodNotAllowedResponse as aU, mintMcpConfirmState as aV, modernInvocationExtra as aW, parseJsonRpcRequest as aX, parseMcpConfirmRetry as aY, parseModernMeta as aZ, pathFromToolName as a_, type McpStdioServer as aa, type McpTransport as ab, type McpVerifier as ac, ModernMcpHandler as ad, type ModernRequestMeta as ae, type Policy as af, RESULT_TYPE_COMPLETE as ag, RESULT_TYPE_INPUT_REQUIRED as ah, RawJSON as ai, type ResolvedMcpConfig as aj, SCOPES_EXTRA_KEY as ak, SURFACE_CLI as al, SURFACE_LIB as am, SURFACE_MCP as an, type SafetyClass as ao, type Surface as ap, SurfaceNotEnabledError as aq, TASKS_EXTENSION as ar, TASKS_SUPPORTED as as, TASK_METHODS as at, type TaskMethod as au, UnknownCommandError as av, auditRefusal as aw, buildToolEnvelope as ax, canonicalJSONStringify as ay, clientSupportsFormElicitation as az, DEFAULT_MCP_SERVER_VERSION as b, rawToolCallName as b0, renderCallResult as b1, resolveMcpConfig as b2, serveStdio as b3, singleHeaderValue as b4, toolName as b5, validModernRequestId as b6, verifyMcpConfirmState as b7, DEFAULT_TOOL_NAME_SEPARATOR as c, DestructiveBlockedError as d, HEADER_MCP_NAME as e, HEADER_MCP_PROTOCOL_VERSION as f, type InvocationMeta as g, type InvokeResult as h, index as i, type JsonRpcRequest as j, type LeafArg as k, LegacyMcpHandler as l, MCP_AUDIT_AUTH_REFUSED as m, MCP_AUDIT_CONFIRMATION_DECLINED as n, MCP_AUDIT_CONFIRMATION_REQUIRED as o, MCP_AUDIT_CONFIRMATION_STATE_REJECTED as p, MCP_AUDIT_DESTRUCTIVE_BLOCKED as q, MCP_AUTH_CHALLENGE as r, MCP_CONFIRM_KEY as s, MCP_CONFIRM_REJECTION_STATE as t, MCP_CONFIRM_STATE_TTL_SECONDS as u, MCP_CONFIRM_STATE_VERSION as v, MCP_ERR_HEADER_MISMATCH as w, MCP_ERR_INTERNAL as x, MCP_ERR_INVALID_PARAMS as y, MCP_ERR_INVALID_REQUEST as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { a as aim } from './aim-DZHwwiIc.js';
|
|
2
|
-
export { a as alias } from './alias-
|
|
2
|
+
export { a as alias } from './alias-D9_qFlyP.js';
|
|
3
3
|
export { l as anthropic } from './llm-anthropic-Cd_I2xXB.js';
|
|
4
4
|
export { a as api } from './api-DAexsu2H.js';
|
|
5
5
|
export { a as auth } from './auth-2-jfgiHn.js';
|
|
6
6
|
export { c as cli } from './cli-C5B5tnpA.js';
|
|
7
|
-
export { c as completion } from './completion-
|
|
7
|
+
export { c as completion } from './completion-csVun6SP.js';
|
|
8
8
|
export { c as completionValues } from './completion-values-By-mnjNt.js';
|
|
9
9
|
export { c as compliance } from './compliance-AxFf-uMy.js';
|
|
10
10
|
export { c as config } from './config-CaK60ByQ.js';
|
|
@@ -12,7 +12,7 @@ export { e as errcorrect } from './errcorrect-BcX1Ft0K.js';
|
|
|
12
12
|
export { i as id } from './index-VLDcI5NF.js';
|
|
13
13
|
export { l as llm } from './llm-DYuR7_uX.js';
|
|
14
14
|
export { l as log } from './log-CkaxMX3U.js';
|
|
15
|
-
export { i as mcp } from './index-
|
|
15
|
+
export { i as mcp } from './index-CaOXdl38.js';
|
|
16
16
|
export { n as netpolicy } from './netpolicy-Brx5XZUB.js';
|
|
17
17
|
export { l as openai } from './llm-openai-DyFrucmV.js';
|
|
18
18
|
export { o as output } from './output-CjZWmL8s.js';
|
|
@@ -25,7 +25,7 @@ export { s as scope } from './scope-BrhYB4ij.js';
|
|
|
25
25
|
export { s as serve } from './serve-D8yWMrTc.js';
|
|
26
26
|
export { s as stream } from './stream-CrjeCp0M.js';
|
|
27
27
|
export { i as telemetry } from './index-C3Zw4wDJ.js';
|
|
28
|
-
export { t as toolspec } from './toolspec-
|
|
28
|
+
export { t as toolspec } from './toolspec-96rkLfsh.js';
|
|
29
29
|
export { i as tui } from './index-DCe1boBz.js';
|
|
30
30
|
export { u as upgrade } from './upgrade-p_zh3pvV.js';
|
|
31
31
|
export { x as xdg } from './xdg-DB7Shoib.js';
|