@lushly-dev/afd-server 2.4.0 → 3.0.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/README.md +239 -56
- package/dist/admission.d.ts +137 -0
- package/dist/admission.d.ts.map +1 -0
- package/dist/admission.js +144 -0
- package/dist/admission.js.map +1 -0
- package/dist/app-call-registry.d.ts +31 -0
- package/dist/app-call-registry.d.ts.map +1 -0
- package/dist/app-call-registry.js +64 -0
- package/dist/app-call-registry.js.map +1 -0
- package/dist/approval-admission.d.ts +139 -0
- package/dist/approval-admission.d.ts.map +1 -0
- package/dist/approval-admission.js +252 -0
- package/dist/approval-admission.js.map +1 -0
- package/dist/approval-crypto.d.ts +37 -17
- package/dist/approval-crypto.d.ts.map +1 -1
- package/dist/approval-crypto.js +84 -75
- package/dist/approval-crypto.js.map +1 -1
- package/dist/approval-process-state.d.ts +21 -0
- package/dist/approval-process-state.d.ts.map +1 -0
- package/dist/approval-process-state.js +29 -0
- package/dist/approval-process-state.js.map +1 -0
- package/dist/approval-relay.d.ts +192 -9
- package/dist/approval-relay.d.ts.map +1 -1
- package/dist/approval-relay.js +45 -9
- package/dist/approval-relay.js.map +1 -1
- package/dist/approval-up-front.d.ts +40 -0
- package/dist/approval-up-front.d.ts.map +1 -0
- package/dist/approval-up-front.js +409 -0
- package/dist/approval-up-front.js.map +1 -0
- package/dist/approval.d.ts +65 -12
- package/dist/approval.d.ts.map +1 -1
- package/dist/approval.js +311 -47
- package/dist/approval.js.map +1 -1
- package/dist/approver.d.ts +84 -0
- package/dist/approver.d.ts.map +1 -0
- package/dist/approver.js +107 -0
- package/dist/approver.js.map +1 -0
- package/dist/auth-middleware-check.d.ts +23 -0
- package/dist/auth-middleware-check.d.ts.map +1 -0
- package/dist/auth-middleware-check.js +48 -0
- package/dist/auth-middleware-check.js.map +1 -0
- package/dist/bootstrap/afd-context.d.ts.map +1 -1
- package/dist/bootstrap/afd-context.js +27 -3
- package/dist/bootstrap/afd-context.js.map +1 -1
- package/dist/bootstrap/afd-docs.d.ts.map +1 -1
- package/dist/bootstrap/afd-docs.js +4 -0
- package/dist/bootstrap/afd-docs.js.map +1 -1
- package/dist/bootstrap/afd-help.d.ts +4 -1
- package/dist/bootstrap/afd-help.d.ts.map +1 -1
- package/dist/bootstrap/afd-help.js +19 -4
- package/dist/bootstrap/afd-help.js.map +1 -1
- package/dist/bootstrap/described-command.d.ts +3 -1
- package/dist/bootstrap/described-command.d.ts.map +1 -1
- package/dist/bootstrap/described-command.js.map +1 -1
- package/dist/command-allow.d.ts +4 -4
- package/dist/command-allow.d.ts.map +1 -1
- package/dist/command-allow.js +10 -15
- package/dist/command-allow.js.map +1 -1
- package/dist/command-routing.d.ts +56 -8
- package/dist/command-routing.d.ts.map +1 -1
- package/dist/command-routing.js +82 -16
- package/dist/command-routing.js.map +1 -1
- package/dist/command-timeout.d.ts +17 -0
- package/dist/command-timeout.d.ts.map +1 -0
- package/dist/command-timeout.js +99 -0
- package/dist/command-timeout.js.map +1 -0
- package/dist/confirmation-gate.d.ts +7 -7
- package/dist/confirmation-gate.d.ts.map +1 -1
- package/dist/confirmation-gate.js +26 -12
- package/dist/confirmation-gate.js.map +1 -1
- package/dist/confirmations.d.ts +28 -3
- package/dist/confirmations.d.ts.map +1 -1
- package/dist/confirmations.js +6 -7
- package/dist/confirmations.js.map +1 -1
- package/dist/context-fields.d.ts +16 -1
- package/dist/context-fields.d.ts.map +1 -1
- package/dist/context-fields.js +30 -13
- package/dist/context-fields.js.map +1 -1
- package/dist/context-scope.d.ts +3 -3
- package/dist/context-scope.d.ts.map +1 -1
- package/dist/context-scope.js +7 -8
- package/dist/context-scope.js.map +1 -1
- package/dist/define-core.d.ts +63 -1
- package/dist/define-core.d.ts.map +1 -1
- package/dist/define-core.js +27 -4
- package/dist/define-core.js.map +1 -1
- package/dist/define.d.ts +4 -3
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +1 -1
- package/dist/define.js.map +1 -1
- package/dist/direct-registry.d.ts +54 -8
- package/dist/direct-registry.d.ts.map +1 -1
- package/dist/direct-registry.js +64 -8
- package/dist/direct-registry.js.map +1 -1
- package/dist/direct-tool-surface.d.ts +1 -1
- package/dist/direct-tool-surface.d.ts.map +1 -1
- package/dist/direct-tool-surface.js +28 -6
- package/dist/direct-tool-surface.js.map +1 -1
- package/dist/direct.d.ts +6 -2
- package/dist/direct.d.ts.map +1 -1
- package/dist/direct.js +4 -1
- package/dist/direct.js.map +1 -1
- package/dist/elicitation-state.d.ts +5 -1
- package/dist/elicitation-state.d.ts.map +1 -1
- package/dist/elicitation-state.js +4 -1
- package/dist/elicitation-state.js.map +1 -1
- package/dist/execution.d.ts +52 -6
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +183 -19
- package/dist/execution.js.map +1 -1
- package/dist/host-state.d.ts +81 -0
- package/dist/host-state.d.ts.map +1 -0
- package/dist/host-state.js +62 -0
- package/dist/host-state.js.map +1 -0
- package/dist/http-handler.d.ts +48 -11
- package/dist/http-handler.d.ts.map +1 -1
- package/dist/http-handler.js +207 -58
- package/dist/http-handler.js.map +1 -1
- package/dist/http-security.d.ts +14 -1
- package/dist/http-security.d.ts.map +1 -1
- package/dist/http-security.js +79 -17
- package/dist/http-security.js.map +1 -1
- package/dist/http-sessions.d.ts +45 -5
- package/dist/http-sessions.d.ts.map +1 -1
- package/dist/http-sessions.js +52 -10
- package/dist/http-sessions.js.map +1 -1
- package/dist/http-sse.d.ts +9 -0
- package/dist/http-sse.d.ts.map +1 -1
- package/dist/http-sse.js +12 -3
- package/dist/http-sse.js.map +1 -1
- package/dist/human-relay.d.ts +195 -0
- package/dist/human-relay.d.ts.map +1 -0
- package/dist/human-relay.js +670 -0
- package/dist/human-relay.js.map +1 -0
- package/dist/idempotency-step.d.ts +231 -0
- package/dist/idempotency-step.d.ts.map +1 -0
- package/dist/idempotency-step.js +389 -0
- package/dist/idempotency-step.js.map +1 -0
- package/dist/idempotency-store.d.ts +107 -0
- package/dist/idempotency-store.d.ts.map +1 -0
- package/dist/idempotency-store.js +100 -0
- package/dist/idempotency-store.js.map +1 -0
- package/dist/index.d.ts +18 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/dist/instance-state.d.ts +53 -0
- package/dist/instance-state.d.ts.map +1 -0
- package/dist/instance-state.js +94 -0
- package/dist/instance-state.js.map +1 -0
- package/dist/journal-off-tape.d.ts +52 -0
- package/dist/journal-off-tape.d.ts.map +1 -0
- package/dist/journal-off-tape.js +150 -0
- package/dist/journal-off-tape.js.map +1 -0
- package/dist/journal-replay.d.ts.map +1 -1
- package/dist/journal-replay.js +48 -3
- package/dist/journal-replay.js.map +1 -1
- package/dist/journal-view.d.ts +50 -0
- package/dist/journal-view.d.ts.map +1 -0
- package/dist/journal-view.js +214 -0
- package/dist/journal-view.js.map +1 -0
- package/dist/journal.d.ts +34 -6
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +183 -47
- package/dist/journal.js.map +1 -1
- package/dist/json-rpc.d.ts +3 -2
- package/dist/json-rpc.d.ts.map +1 -1
- package/dist/json-rpc.js +5 -3
- package/dist/json-rpc.js.map +1 -1
- package/dist/lazy-tools.d.ts +27 -2
- package/dist/lazy-tools.d.ts.map +1 -1
- package/dist/lazy-tools.js +22 -4
- package/dist/lazy-tools.js.map +1 -1
- package/dist/mcp-auth-bearer.d.ts +2 -0
- package/dist/mcp-auth-bearer.d.ts.map +1 -1
- package/dist/mcp-auth-bearer.js +1 -1
- package/dist/mcp-auth-bearer.js.map +1 -1
- package/dist/mcp-auth-dispatch.d.ts +38 -0
- package/dist/mcp-auth-dispatch.d.ts.map +1 -0
- package/dist/mcp-auth-dispatch.js +113 -0
- package/dist/mcp-auth-dispatch.js.map +1 -0
- package/dist/mcp-auth-jwt.d.ts +3 -2
- package/dist/mcp-auth-jwt.d.ts.map +1 -1
- package/dist/mcp-auth-jwt.js.map +1 -1
- package/dist/mcp-auth-resource.d.ts +6 -2
- package/dist/mcp-auth-resource.d.ts.map +1 -1
- package/dist/mcp-auth-resource.js +6 -5
- package/dist/mcp-auth-resource.js.map +1 -1
- package/dist/mcp-auth-scopes.d.ts +84 -0
- package/dist/mcp-auth-scopes.d.ts.map +1 -0
- package/dist/mcp-auth-scopes.js +125 -0
- package/dist/mcp-auth-scopes.js.map +1 -0
- package/dist/mcp-auth-view.d.ts +50 -0
- package/dist/mcp-auth-view.d.ts.map +1 -0
- package/dist/mcp-auth-view.js +179 -0
- package/dist/mcp-auth-view.js.map +1 -0
- package/dist/mcp-auth.d.ts +94 -3
- package/dist/mcp-auth.d.ts.map +1 -1
- package/dist/mcp-auth.js +241 -23
- package/dist/mcp-auth.js.map +1 -1
- package/dist/mcp-modern.d.ts +80 -6
- package/dist/mcp-modern.d.ts.map +1 -1
- package/dist/mcp-modern.js +378 -91
- package/dist/mcp-modern.js.map +1 -1
- package/dist/meta-argument.d.ts +9 -8
- package/dist/meta-argument.d.ts.map +1 -1
- package/dist/meta-argument.js +28 -10
- package/dist/meta-argument.js.map +1 -1
- package/dist/meta-tools.js +2 -2
- package/dist/meta-tools.js.map +1 -1
- package/dist/middleware.d.ts +16 -1
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +57 -10
- package/dist/middleware.js.map +1 -1
- package/dist/output-budget.d.ts +77 -0
- package/dist/output-budget.d.ts.map +1 -0
- package/dist/output-budget.js +202 -0
- package/dist/output-budget.js.map +1 -0
- package/dist/principal-binding.js +1 -1
- package/dist/principal-binding.js.map +1 -1
- package/dist/relay-evidence.d.ts +74 -0
- package/dist/relay-evidence.d.ts.map +1 -0
- package/dist/relay-evidence.js +143 -0
- package/dist/relay-evidence.js.map +1 -0
- package/dist/resources.d.ts +35 -10
- package/dist/resources.d.ts.map +1 -1
- package/dist/resources.js +59 -18
- package/dist/resources.js.map +1 -1
- package/dist/schema.d.ts +4 -3
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +3 -3
- package/dist/schema.js.map +1 -1
- package/dist/scope-view.d.ts +65 -0
- package/dist/scope-view.d.ts.map +1 -0
- package/dist/scope-view.js +45 -0
- package/dist/scope-view.js.map +1 -0
- package/dist/server-types.d.ts +182 -27
- package/dist/server-types.d.ts.map +1 -1
- package/dist/server-types.js.map +1 -1
- package/dist/server.d.ts +26 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +403 -61
- package/dist/server.js.map +1 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +99 -3
- package/dist/skills.js.map +1 -1
- package/dist/task-dispatch.d.ts +35 -0
- package/dist/task-dispatch.d.ts.map +1 -0
- package/dist/task-dispatch.js +25 -0
- package/dist/task-dispatch.js.map +1 -0
- package/dist/tasks-runtime.d.ts +115 -0
- package/dist/tasks-runtime.d.ts.map +1 -0
- package/dist/tasks-runtime.js +760 -0
- package/dist/tasks-runtime.js.map +1 -0
- package/dist/tasks.d.ts +237 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +321 -0
- package/dist/tasks.js.map +1 -0
- package/dist/tool-router.d.ts +68 -3
- package/dist/tool-router.d.ts.map +1 -1
- package/dist/tool-router.js +293 -70
- package/dist/tool-router.js.map +1 -1
- package/dist/tools.d.ts +32 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +162 -55
- package/dist/tools.js.map +1 -1
- package/dist/up-front-steps.d.ts +35 -0
- package/dist/up-front-steps.d.ts.map +1 -0
- package/dist/up-front-steps.js +159 -0
- package/dist/up-front-steps.js.map +1 -0
- package/dist/validation.d.ts +38 -3
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +118 -23
- package/dist/validation.js.map +1 -1
- package/dist/verified-credentials.d.ts +13 -5
- package/dist/verified-credentials.d.ts.map +1 -1
- package/dist/verified-credentials.js +43 -10
- package/dist/verified-credentials.js.map +1 -1
- package/package.json +15 -11
package/dist/server-types.d.ts
CHANGED
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
5
5
|
import type { Actor, Clock, CommandContext, CommandMiddleware, CommandResult, PipelineRequest, PipelineResult, RandomSource } from '@lushly-dev/afd-core';
|
|
6
|
+
import type { ApproverPredicate } from './approver.js';
|
|
6
7
|
import type { ContextField } from './context-fields.js';
|
|
7
|
-
import type {
|
|
8
|
+
import type { HumanRelay } from './human-relay.js';
|
|
9
|
+
import type { IdempotencyOptions } from './idempotency-step.js';
|
|
10
|
+
import type { McpAuthOptions, PreDispatchCheck, PreDispatchCheckOptions } from './mcp-auth.js';
|
|
8
11
|
import type { Credentials } from './mcp-auth-rules.js';
|
|
9
12
|
import type { ResourcesOption } from './resources.js';
|
|
10
13
|
import type { ZodCommandDefinition } from './schema.js';
|
|
11
14
|
import type { SkillCatalog } from './skills.js';
|
|
15
|
+
import type { TaskOptions, TaskStore } from './tasks.js';
|
|
12
16
|
/**
|
|
13
17
|
* Transport type for MCP server.
|
|
14
18
|
*
|
|
@@ -45,28 +49,34 @@ export interface McpServerOptions {
|
|
|
45
49
|
/** Host to bind to (default: localhost) */
|
|
46
50
|
host?: string;
|
|
47
51
|
/**
|
|
48
|
-
* Enable development mode
|
|
49
|
-
* When
|
|
50
|
-
* -
|
|
51
|
-
*
|
|
52
|
-
*
|
|
52
|
+
* Enable development mode: a handler exception's message and stack, and a schema callback's
|
|
53
|
+
* exception text, reach the caller. When false (the default) they are replaced by a generic
|
|
54
|
+
* message. Invalid-input errors carry their field-level issues in both modes. With the `grouped`
|
|
55
|
+
* tool strategy it also writes each grouped call's full arguments to stderr and returns them in
|
|
56
|
+
* an `INVALID_GROUPED_CALL` result's `_debug.receivedArgs`; arguments can hold secrets.
|
|
53
57
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
+
* It changes no HTTP check: Host and Origin validation and CORS headers are the same either
|
|
59
|
+
* way, so a browser page on another origin is refused in development as in production. To
|
|
60
|
+
* call the server from a browser app on another origin (such as a dev server on another
|
|
61
|
+
* port), list that origin in `allowedOrigins` and set `cors: true`.
|
|
58
62
|
*/
|
|
59
63
|
devMode?: boolean;
|
|
60
64
|
/**
|
|
61
|
-
* Send CORS response headers for accepted browser origins
|
|
62
|
-
* origins are accepted; see `allowedOrigins`.
|
|
65
|
+
* Send CORS response headers for accepted browser origins: the request's own origin is
|
|
66
|
+
* echoed, never `*`. It does not widen which origins are accepted; see `allowedOrigins`.
|
|
63
67
|
*
|
|
64
|
-
* @default
|
|
68
|
+
* @default false
|
|
65
69
|
*/
|
|
66
70
|
cors?: boolean;
|
|
67
71
|
/** Allowed HTTP Host names (without ports). Defaults to the configured host and loopback names. Set explicitly for proxies and embedded hosts. */
|
|
68
72
|
allowedHosts?: string[];
|
|
69
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Exact additional browser origins, such as `http://localhost:5173`: each a serialized http(s)
|
|
75
|
+
* origin (`scheme://host[:port]`, no path or trailing slash; `*` and `null` throw). Same-origin
|
|
76
|
+
* requests are allowed by default, and requests without an Origin unless their
|
|
77
|
+
* `Sec-Fetch-Site` is `cross-site` or `same-site`; any other browser origin is refused with
|
|
78
|
+
* HTTP 403, in `devMode` too.
|
|
79
|
+
*/
|
|
70
80
|
allowedOrigins?: string[];
|
|
71
81
|
/**
|
|
72
82
|
* Maximum request body size in bytes (default: 1048576). Also caps the UTF-8 size of the
|
|
@@ -117,7 +127,8 @@ export interface McpServerOptions {
|
|
|
117
127
|
* also runs afd-auth's middleware passes `isVerifiedCredentials` to it**
|
|
118
128
|
* (`createAuthMiddleware(adapter, { isVerifiedCredentials })`, from
|
|
119
129
|
* `@lushly-dev/afd-server/credentials`), so a token's call keeps the actor its credentials
|
|
120
|
-
* map to instead of being gated on the adapter's session.
|
|
130
|
+
* map to instead of being gated on the adapter's session. The server refuses to be built with
|
|
131
|
+
* afd-auth's middleware without it, in `middleware` directly or in `composeMiddleware`.
|
|
121
132
|
*
|
|
122
133
|
* Scopes (M6: `requiredScopes`, `resolver`, `filterToolsByScope`) are not enforced by this
|
|
123
134
|
* version; passing one throws rather than being ignored.
|
|
@@ -126,10 +137,24 @@ export interface McpServerOptions {
|
|
|
126
137
|
/** Maximum concurrent `/sse` connections; more receive HTTP 503 (default: 100). */
|
|
127
138
|
maxSseConnections?: number;
|
|
128
139
|
/**
|
|
129
|
-
* Maximum live HTTP sessions when `contexts` are configured
|
|
130
|
-
*
|
|
140
|
+
* Maximum live HTTP sessions when `contexts` are configured (default: 1000). Beyond it, an
|
|
141
|
+
* `initialize` evicts the least recently used session of its own owner (with `auth`, the
|
|
142
|
+
* verified issuer, subject and client), never another's; an owner with no session to give up
|
|
143
|
+
* is refused with HTTP 503, `Retry-After` and JSON-RPC `-32000` whose `data.code` is
|
|
144
|
+
* `SESSION_LIMIT_REACHED`. Without `auth` every caller is one owner.
|
|
131
145
|
*/
|
|
132
146
|
maxSessions?: number;
|
|
147
|
+
/**
|
|
148
|
+
* With `auth`: maximum live HTTP sessions of one subject, keyed by the verified issuer and
|
|
149
|
+
* subject so its client IDs share one quota (default: 100, or `maxSessions` when smaller;
|
|
150
|
+
* never more than `maxSessions`). At it, that subject's least recently used session is
|
|
151
|
+
* evicted, so one subject cannot fill the store; up to `maxSessions / maxSessionsPerOwner`
|
|
152
|
+
* distinct subjects still can, and a new subject is then refused until sessions expire.
|
|
153
|
+
* Sessions exist only with `contexts`: without them the value is still checked but has no
|
|
154
|
+
* effect. Without `auth` every caller is one owner whose quota is `maxSessions`, and passing
|
|
155
|
+
* this option throws.
|
|
156
|
+
*/
|
|
157
|
+
maxSessionsPerOwner?: number;
|
|
133
158
|
/** Idle time in milliseconds after which an HTTP session expires (default: 1800000, 30 minutes). */
|
|
134
159
|
sessionIdleTimeoutMs?: number;
|
|
135
160
|
/**
|
|
@@ -176,7 +201,7 @@ export interface McpServerOptions {
|
|
|
176
201
|
*/
|
|
177
202
|
advertiseOutputSchema?: boolean;
|
|
178
203
|
/**
|
|
179
|
-
* Enforce `confirmPrompt` on the MCP and HTTP surfaces (`spec/
|
|
204
|
+
* Enforce `confirmPrompt` on the MCP and HTTP surfaces (`spec/confirmations.md`,
|
|
180
205
|
* "Confirmations"). A call that reaches a command with `confirmPrompt` then runs only with a
|
|
181
206
|
* confirmation:
|
|
182
207
|
*
|
|
@@ -193,12 +218,66 @@ export interface McpServerOptions {
|
|
|
193
218
|
*/
|
|
194
219
|
confirmations?: 'off' | 'enforce' | 'require-human';
|
|
195
220
|
/**
|
|
196
|
-
* HMAC key (at least 32 bytes) that signs the
|
|
197
|
-
* elicitations, bound to the call's principal (see
|
|
198
|
-
* instance that may receive a retry needs the same key. Without it,
|
|
199
|
-
* key, which works only when one process serves every
|
|
221
|
+
* HMAC key (a string or bytes, at least 32 bytes, as approval secrets) that signs the
|
|
222
|
+
* `requestState` of confirmation and approval elicitations, bound to the call's principal (see
|
|
223
|
+
* `createContext`). Every instance that may receive a retry needs the same key. Without it,
|
|
224
|
+
* each process uses its own random key, which works only when one process serves every
|
|
225
|
+
* request (see `instances`). Keep it out of source.
|
|
226
|
+
*
|
|
227
|
+
* @throws TypeError at creation when it is shorter than 32 bytes
|
|
200
228
|
*/
|
|
201
229
|
confirmationKey?: string | Uint8Array;
|
|
230
|
+
/**
|
|
231
|
+
* How many processes serve this server's URL. Two things are per process unless the host shares
|
|
232
|
+
* them: the `confirmationKey` (a random key otherwise), used when `confirmations` is not
|
|
233
|
+
* `'off'` or an approval middleware has `relay: 'mcp-elicitation'`; and the spent single-use
|
|
234
|
+
* tokens of each `createApprovalMiddleware` without a `nonceStore`.
|
|
235
|
+
*
|
|
236
|
+
* - `'multiple'`: several processes (or engines) answer the same callers, for example behind a
|
|
237
|
+
* load balancer. Creating the server throws unless each of those defaults that is in use is
|
|
238
|
+
* supplied: a shared `confirmationKey` and, for single-use approval middleware, a shared
|
|
239
|
+
* `nonceStore`.
|
|
240
|
+
* - `'single'`: one process serves every request, so the defaults are enough. A supplied
|
|
241
|
+
* `confirmationKey` is still validated.
|
|
242
|
+
* - Left out: as `'single'`, but a server served over HTTP (`start()` with the HTTP transport,
|
|
243
|
+
* or `createMcpHandler`) logs one warning to stderr when it relies on either default, once per
|
|
244
|
+
* process. stdio logs nothing.
|
|
245
|
+
*
|
|
246
|
+
* The default key is random per server or handler, so two handlers in one process do not share
|
|
247
|
+
* it either. Approval middleware is seen in `middleware` directly or inside `composeMiddleware`,
|
|
248
|
+
* from any installed copy of this package from this version on (older copies do not mark
|
|
249
|
+
* theirs); one wrapped inside another middleware is not.
|
|
250
|
+
* `taskStore` is shared separately.
|
|
251
|
+
*/
|
|
252
|
+
instances?: 'single' | 'multiple';
|
|
253
|
+
/**
|
|
254
|
+
* Host-verified confirmation relay (`spec/confirmations.md`, "Host-verified confirmation"):
|
|
255
|
+
* required to confirm commands with `confirmationMode: 'host-verified'` over MCP 2026-07-28,
|
|
256
|
+
* regardless of `confirmations` (`'off'` included). Without one, MCP and HTTP calls to a
|
|
257
|
+
* host-verified command fail with `CONFIRMATION_REQUIRED`.
|
|
258
|
+
*/
|
|
259
|
+
humanRelay?: HumanRelay;
|
|
260
|
+
/**
|
|
261
|
+
* Which callers are approvers (`spec/approvals.md`, "Approval evidence from an approver
|
|
262
|
+
* client"): MCP clients trusted to show a person a held action and carry the person's decision
|
|
263
|
+
* back, such as an application shell that mounts this server. Called once per `tools/call`
|
|
264
|
+
* with the call's context after `createContext` (its `credentials` and `actor`); only `true`
|
|
265
|
+
* makes an approver. Read only what you verified: the credentials, or an actor you mapped from
|
|
266
|
+
* them. A throw fails the call as an internal error. None by default.
|
|
267
|
+
*
|
|
268
|
+
* For an approver, an `APPROVAL_REQUIRED` result carries `details.approvalToken` (whatever
|
|
269
|
+
* `includeToken` says) and is never turned into a form elicitation, and a retry of one command
|
|
270
|
+
* on an MCP 2026-07-28 request carries the token in `_meta["dev.afd/approval"]`
|
|
271
|
+
* (`AFD_APPROVAL_META_KEY`). Its tokens bind its principal binding (`spec/authorization.md`,
|
|
272
|
+
* M8), so only the same principal can redeem them. Without credentials that is the actor
|
|
273
|
+
* alone, so over HTTP name only callers with verified credentials. From any other caller the
|
|
274
|
+
* key is ignored. The key in tool arguments is refused from every caller.
|
|
275
|
+
*
|
|
276
|
+
* An approver promises what the server cannot check: it never gives the token to an agent or a
|
|
277
|
+
* model, and presents it only on a retry a person approved after seeing the action, shown by
|
|
278
|
+
* the display rules (`approvalDisplay` in `@lushly-dev/afd-core`).
|
|
279
|
+
*/
|
|
280
|
+
approver?: ApproverPredicate;
|
|
202
281
|
/**
|
|
203
282
|
* Transport protocol to use.
|
|
204
283
|
*
|
|
@@ -282,10 +361,12 @@ export interface McpServerOptions {
|
|
|
282
361
|
* MCP resources (`spec/mcp-resources.md`, R1 to R6): a {@link ResourceProvider}, or an array of
|
|
283
362
|
* static entries. The server then declares the `resources` capability and answers
|
|
284
363
|
* `resources/list`, `resources/read` and `resources/templates/list` on `/mcp` and stdio, in
|
|
285
|
-
* both MCP eras. A list never varies by connection, session or context
|
|
286
|
-
*
|
|
287
|
-
* `
|
|
288
|
-
*
|
|
364
|
+
* both MCP eras. A list never varies by connection, session or context; under `auth`, providers
|
|
365
|
+
* receive the request's verified {@link ResourceCaller} credentials and modern-era provider
|
|
366
|
+
* responses carry `cacheScope: "private"`. Entries are checked when the server is built, and
|
|
367
|
+
* creation throws naming the entry that breaks a rule. A `ui://` entry needs the
|
|
368
|
+
* `text/html;profile=mcp-app` MIME type; its `_meta.ui` goes on the content a read returns.
|
|
369
|
+
* The deprecated `/sse` and `/message` lane serves none of this.
|
|
289
370
|
*/
|
|
290
371
|
resources?: ResourcesOption;
|
|
291
372
|
/**
|
|
@@ -296,6 +377,55 @@ export interface McpServerOptions {
|
|
|
296
377
|
* directoryRead: true })` also serves `resources/directory/read`.
|
|
297
378
|
*/
|
|
298
379
|
skills?: SkillCatalog;
|
|
380
|
+
/**
|
|
381
|
+
* Durable store for MCP Tasks (`spec/tasks.md`). Defaults to an in-process
|
|
382
|
+
* {@link InMemoryTaskStore}. Pass a shared store when multiple server processes sit behind one
|
|
383
|
+
* URL.
|
|
384
|
+
*/
|
|
385
|
+
taskStore?: TaskStore;
|
|
386
|
+
/**
|
|
387
|
+
* MCP Tasks runtime options (`spec/tasks.md`): `ttlMs`, `pollIntervalMs`,
|
|
388
|
+
* `checkIntervalMs`, `maxResultBytes`, `maxRunning`, `tokenExpiryGraceMs` and
|
|
389
|
+
* `callersIdentifiedByHook`.
|
|
390
|
+
*/
|
|
391
|
+
taskOptions?: TaskOptions;
|
|
392
|
+
/**
|
|
393
|
+
* The engine's idempotency step (`spec/idempotency.md`, S1 to S13): answers a repeat of a call
|
|
394
|
+
* that carries an idempotency key, to a command declaring `idempotency: 'keyed'`, from a store
|
|
395
|
+
* instead of running the handler again. `{ store, ttlMs, leaseMs, callersIdentifiedByHook }`;
|
|
396
|
+
* `{}` gives the defaults (an in-memory store for this process, one day, one minute). Off when
|
|
397
|
+
* unset: keys are still validated and delivered to handlers. `ttlMs` must exceed
|
|
398
|
+
* `defaultTimeoutMs` plus `leaseMs`. Several processes behind one address share a store or
|
|
399
|
+
* leave this off (S13).
|
|
400
|
+
*/
|
|
401
|
+
idempotency?: IdempotencyOptions;
|
|
402
|
+
/**
|
|
403
|
+
* Server-level default per-command deadline in milliseconds (`spec/execution-controls.md`).
|
|
404
|
+
* Applied when a call does not specify its own `context.timeout`. Pass `0` or `null` to
|
|
405
|
+
* disable the default deadline for trusted long-running deployments.
|
|
406
|
+
*
|
|
407
|
+
* @default 30000
|
|
408
|
+
*/
|
|
409
|
+
defaultTimeoutMs?: number | null;
|
|
410
|
+
/**
|
|
411
|
+
* Maximum number of commands accepted in a single batch (`spec/execution-controls.md`).
|
|
412
|
+
*
|
|
413
|
+
* @default 500
|
|
414
|
+
*/
|
|
415
|
+
maxBatchSize?: number;
|
|
416
|
+
/**
|
|
417
|
+
* Maximum `options.parallelism` accepted in a single batch (`spec/execution-controls.md`).
|
|
418
|
+
*
|
|
419
|
+
* @default 16
|
|
420
|
+
*/
|
|
421
|
+
maxBatchParallelism?: number;
|
|
422
|
+
/**
|
|
423
|
+
* Maximum number of validation issues reported per `VALIDATION_ERROR`
|
|
424
|
+
* (`spec/execution-controls.md`).
|
|
425
|
+
*
|
|
426
|
+
* @default 100
|
|
427
|
+
*/
|
|
428
|
+
maxValidationIssues?: number;
|
|
299
429
|
}
|
|
300
430
|
/**
|
|
301
431
|
* Options for creating an embeddable Node HTTP handler without starting a server.
|
|
@@ -334,9 +464,34 @@ export type CreateRequestContext = (req: IncomingMessage, verified: {
|
|
|
334
464
|
* Embeddable Node HTTP handler returned by `createMcpHandler()`.
|
|
335
465
|
*/
|
|
336
466
|
export type McpHandler = {
|
|
337
|
-
|
|
467
|
+
/**
|
|
468
|
+
* Serve one request. `body` is its body when a host's own layer has already read it (to run
|
|
469
|
+
* {@link McpHandler.preDispatchCheck}); the handler then reads it instead of the stream.
|
|
470
|
+
*/
|
|
471
|
+
(req: IncomingMessage, res: ServerResponse, body?: Uint8Array | string): Promise<void>;
|
|
338
472
|
/** Close active SSE/stream responses when the embedding host shuts down. */
|
|
339
473
|
dispose(): void;
|
|
474
|
+
/**
|
|
475
|
+
* **Trust-bearing.** Admit `credentials` that a host's own layer vouches for, for `req` alone,
|
|
476
|
+
* instead of a bearer token (`spec/authorization.md`, M6, "A host's own layer"): only for a
|
|
477
|
+
* gateway that has itself authenticated the caller, never from anything the caller sent. They
|
|
478
|
+
* are checked as a verifier's are (shape, a numeric `expiresAt` not yet passed, the
|
|
479
|
+
* certificate binding where required), frozen, and branded for `isVerifiedCredentials` while
|
|
480
|
+
* the handler serves `req`. A request without them still needs a valid bearer token.
|
|
481
|
+
*
|
|
482
|
+
* @throws Error without the `auth` option; when `req` carries a bearer token (in the
|
|
483
|
+
* `Authorization` header or the query) or was admitted before; or when the credentials fail
|
|
484
|
+
* those checks
|
|
485
|
+
*/
|
|
486
|
+
admit(req: IncomingMessage, credentials: Credentials): void;
|
|
487
|
+
/**
|
|
488
|
+
* The decision before dispatch for a host's own layer (M6): the bearer layer's own
|
|
489
|
+
* implementation, with a 403 in the host's scheme (`challenge`) and suggestion
|
|
490
|
+
* (`scopeSource`). Run its `decide(req, body)` after `admit` and after reading the body.
|
|
491
|
+
*
|
|
492
|
+
* @throws Error without the `auth` option
|
|
493
|
+
*/
|
|
494
|
+
preDispatchCheck(options?: PreDispatchCheckOptions): PreDispatchCheck;
|
|
340
495
|
};
|
|
341
496
|
/**
|
|
342
497
|
* MCP Server instance.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-types.d.ts","sourceRoot":"","sources":["../src/server-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EACX,KAAK,EACL,KAAK,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,cAAc,EACd,YAAY,EACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"server-types.d.ts","sourceRoot":"","sources":["../src/server-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EACX,KAAK,EACL,KAAK,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,cAAc,EACd,YAAY,EACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACh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AC,aAAa,EAAE,SAAS,YAAY,EAAE,CAAC;IAEhD;;;OAGG;IACH,YAAY,IAAI,OAAO,GAAG,MAAM,CAAC;IAEjC,+CAA+C;IAC/C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAExF;;;;;;OAMG;IACH,eAAe,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC7F"}
|
package/dist/server-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-types.js","sourceRoot":"","sources":["../src/server-types.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"server-types.js","sourceRoot":"","sources":["../src/server-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAuCH;;;;;GAKG;AACH,MAAM,UAAU,YAAY;IAC3B,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;AAC7B,CAAC;AASD,wFAAwF;AACxF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -4,9 +4,35 @@
|
|
|
4
4
|
* This module provides the `createMcpServer` factory that wires together
|
|
5
5
|
* execution, tool routing, and transport layers into a single MCP server.
|
|
6
6
|
*/
|
|
7
|
+
import { type IncomingMessage } from 'node:http';
|
|
8
|
+
import type { CommandContext } from '@lushly-dev/afd-core';
|
|
9
|
+
import { type ModernMcpDeps } from './mcp-modern.js';
|
|
7
10
|
import type { McpHandler, McpHandlerOptions, McpServer, McpServerOptions } from './server-types.js';
|
|
8
11
|
export type { CommandMiddleware, ContextConfig, CreateRequestContext, McpHandler, McpHandlerOptions, McpServer, McpServerOptions, McpTransport, ToolStrategy, } from './server-types.js';
|
|
9
12
|
export { isStdinPiped, MAX_FIRST_CLASS_TOOLS } from './server-types.js';
|
|
13
|
+
/**
|
|
14
|
+
* The wiring every lane of one server shares, with its HTTP runtime built: engines, routers,
|
|
15
|
+
* admission, the HTTP handler and the stdio lane's dependencies. Exported for tests that drive
|
|
16
|
+
* several lanes of one server; not part of the package's entry points.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createSharedHttpRuntime(options: McpHandlerOptions): {
|
|
19
|
+
engine: {
|
|
20
|
+
executeCommand: (commandName: string, input: unknown, callerContext?: CommandContext) => Promise<import("@lushly-dev/afd-core").CommandResult>;
|
|
21
|
+
executeBatch: (request: import("@lushly-dev/afd-core").BatchRequest, context?: CommandContext) => Promise<import("@lushly-dev/afd-core").BatchResult>;
|
|
22
|
+
executePipeline: (request: import("@lushly-dev/afd-core").PipelineRequest, context?: CommandContext) => Promise<import("@lushly-dev/afd-core").PipelineResult>;
|
|
23
|
+
executeStream: (commandName: string, input: unknown, context?: CommandContext) => AsyncGenerator<import("@lushly-dev/afd-core").StreamChunk, void, unknown>;
|
|
24
|
+
};
|
|
25
|
+
contextFields: readonly import("./context-fields.js").ContextField<unknown>[];
|
|
26
|
+
routeToolCall: import("./tool-router.js").ToolRouter;
|
|
27
|
+
getToolsList: (context?: CommandContext) => readonly import("./meta-tools.js").McpToolDefinition[];
|
|
28
|
+
handler: (req: IncomingMessage, res: import("node:http").ServerResponse, body?: Uint8Array | string) => Promise<void>;
|
|
29
|
+
dispose: () => void;
|
|
30
|
+
modernDeps: ModernMcpDeps;
|
|
31
|
+
contextState: import("./context-scope.js").ContextState | undefined;
|
|
32
|
+
auth: import("./mcp-auth.js").AuthLayer | undefined;
|
|
33
|
+
httpWarning: string | undefined;
|
|
34
|
+
url: string;
|
|
35
|
+
};
|
|
10
36
|
/**
|
|
11
37
|
* Create an embeddable Node HTTP handler for MCP endpoints.
|
|
12
38
|
*
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA2C,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAwC3D,OAAO,EAKN,KAAK,aAAa,EAIlB,MAAM,iBAAiB,CAAC;AAWzB,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AASpG,YAAY,EACX,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AA8exE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB;IAIhE,MAAM;;;;;;IACN,aAAa;IACb,aAAa;IACb,YAAY,aAzKuB,cAAc;IA0KjD,OAAO;IACP,OAAO;IAIP,UAAU;IACV,YAAY;IACZ,IAAI;IACJ,WAAW;IACX,GAAG;EAEJ;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAiBvE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CA8JpE"}
|