@chrischall/mcp-utils 0.28.0 → 2.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 +69 -7
- package/dist/cancel/index.d.ts +64 -0
- package/dist/cancel/index.d.ts.map +1 -0
- package/dist/cancel/index.js +91 -0
- package/dist/cancel/index.js.map +1 -0
- package/dist/fetchproxy/index.d.ts +5 -16
- package/dist/fetchproxy/index.d.ts.map +1 -1
- package/dist/fetchproxy/index.js +0 -10
- package/dist/fetchproxy/index.js.map +1 -1
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +20 -3
- package/dist/http/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/server/index.d.ts +96 -13
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +129 -21
- package/dist/server/index.js.map +1 -1
- package/dist/test/index.d.ts +10 -0
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +10 -0
- package/dist/test/index.js.map +1 -1
- package/dist/zod/index.d.ts +19 -2
- package/dist/zod/index.d.ts.map +1 -1
- package/dist/zod/index.js +19 -2
- package/dist/zod/index.js.map +1 -1
- package/package.json +8 -5
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* - `@chrischall/mcp-utils/html` opt-in HTML scraping helpers
|
|
14
14
|
* - `@chrischall/mcp-utils/test` in-memory test harness
|
|
15
15
|
*/
|
|
16
|
+
export * from './cancel/index.js';
|
|
16
17
|
export * from './server/index.js';
|
|
17
18
|
export * from './response/index.js';
|
|
18
19
|
export * from './errors/index.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import type { StdioServerHandle } from '@modelcontextprotocol/server/stdio';
|
|
1
2
|
import { McpServer } from '@modelcontextprotocol/server';
|
|
2
3
|
import type { Transport } from '@modelcontextprotocol/server';
|
|
3
4
|
export * from './confirmation.js';
|
|
5
|
+
/**
|
|
6
|
+
* The handle {@link runMcp} returns — re-exported so a caller can name the
|
|
7
|
+
* type without importing the SDK's `/stdio` subpath itself.
|
|
8
|
+
*/
|
|
9
|
+
export type { StdioServerHandle } from '@modelcontextprotocol/server/stdio';
|
|
4
10
|
/**
|
|
5
11
|
* Registers one or more tools onto a fresh {@link McpServer}. `deps` is whatever
|
|
6
12
|
* the caller threaded through {@link createMcpServer} / {@link runMcp} — an API
|
|
@@ -33,8 +39,8 @@ export interface CreateMcpServerOptions<TDeps = unknown> {
|
|
|
33
39
|
banner?: string;
|
|
34
40
|
/**
|
|
35
41
|
* Transport hint. Carried for API symmetry with {@link runMcp}; this function
|
|
36
|
-
* never connects, so it only matters that the value is accepted.
|
|
37
|
-
* `'stdio'`.
|
|
42
|
+
* never connects or serves, so it only matters that the value is accepted.
|
|
43
|
+
* Defaults to `'stdio'`.
|
|
38
44
|
*/
|
|
39
45
|
transport?: TransportSpec;
|
|
40
46
|
/**
|
|
@@ -67,13 +73,29 @@ export interface CreateMcpServerOptions<TDeps = unknown> {
|
|
|
67
73
|
export declare function surfaceToolHints(server: McpServer): void;
|
|
68
74
|
/**
|
|
69
75
|
* Build an {@link McpServer}, print the optional stderr banner, and apply every
|
|
70
|
-
* tool registrar (awaiting async ones) — but do **not**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
76
|
+
* tool registrar (awaiting async ones) — but do **not** serve it. Serving is
|
|
77
|
+
* {@link runMcp}'s job (or the caller's), which keeps this usable from tests
|
|
78
|
+
* and from custom boot sequences.
|
|
79
|
+
*
|
|
80
|
+
* This is the **factory body**, and that is how to hand it to a serving entry:
|
|
81
|
+
* `serveStdio(() => createMcpServer({…}))` over stdio,
|
|
82
|
+
* `createMcpHandler(() => createMcpServer({…}))` over HTTP. Do NOT
|
|
83
|
+
* `server.connect(new StdioServerTransport())` the result — an instance no
|
|
84
|
+
* entry constructed stays 2025-era and answers `server/discover` with
|
|
85
|
+
* `-32601 Method not found` (see this module's header). {@link runMcp} is that
|
|
86
|
+
* wiring for the stdio case.
|
|
73
87
|
*/
|
|
74
88
|
export declare function createMcpServer<TDeps = unknown>(opts: CreateMcpServerOptions<TDeps>): Promise<McpServer>;
|
|
75
89
|
/** Signals {@link withGracefulShutdown} listens for. */
|
|
76
90
|
export type ShutdownSignal = 'SIGINT' | 'SIGTERM';
|
|
91
|
+
/**
|
|
92
|
+
* Anything {@link withGracefulShutdown} can tear down. Both shapes it is handed
|
|
93
|
+
* in practice satisfy it identically: an {@link McpServer}, and the
|
|
94
|
+
* {@link StdioServerHandle} {@link runMcp} returns.
|
|
95
|
+
*/
|
|
96
|
+
export interface Closeable {
|
|
97
|
+
close(): Promise<void>;
|
|
98
|
+
}
|
|
77
99
|
/** Options for {@link withGracefulShutdown}. */
|
|
78
100
|
export interface GracefulShutdownOptions {
|
|
79
101
|
/**
|
|
@@ -91,29 +113,90 @@ export interface GracefulShutdownOptions {
|
|
|
91
113
|
}
|
|
92
114
|
/**
|
|
93
115
|
* Wire SIGINT/SIGTERM to a one-shot graceful shutdown: run `onSignal` (e.g.
|
|
94
|
-
* close the client/transport), close
|
|
116
|
+
* close the client/transport), close `target`, then `process.exit(0)` (unless
|
|
95
117
|
* `exit: false`). Idempotent — a second signal mid-shutdown is ignored, and a
|
|
96
118
|
* throwing `onSignal`/`close` is logged but still exits cleanly so a wedged
|
|
97
119
|
* cleanup can't hang the host.
|
|
120
|
+
*
|
|
121
|
+
* `target` is the {@link StdioServerHandle} when called from {@link runMcp} —
|
|
122
|
+
* closing the handle closes whichever instance the connection pinned *and* the
|
|
123
|
+
* transport under it, which is strictly more than closing a server was. A bare
|
|
124
|
+
* {@link McpServer} is still accepted and behaves as before.
|
|
98
125
|
*/
|
|
99
|
-
export declare function withGracefulShutdown(
|
|
126
|
+
export declare function withGracefulShutdown(target: Closeable, opts?: GracefulShutdownOptions): void;
|
|
100
127
|
/** Options for {@link runMcp} — {@link createMcpServer}'s plus lifecycle wiring. */
|
|
101
128
|
export interface RunMcpOptions<TDeps = unknown> extends CreateMcpServerOptions<TDeps> {
|
|
102
129
|
/**
|
|
103
130
|
* Graceful-shutdown wiring. `true` (default) installs SIGINT/SIGTERM handlers
|
|
104
|
-
* that close the
|
|
105
|
-
* {@link withGracefulShutdown}
|
|
131
|
+
* that close the {@link StdioServerHandle}. `false` skips them. An object is
|
|
132
|
+
* passed straight to {@link withGracefulShutdown}
|
|
133
|
+
* (e.g. `{ onSignal: () => client.close() }`).
|
|
106
134
|
*/
|
|
107
135
|
shutdown?: boolean | GracefulShutdownOptions;
|
|
136
|
+
/**
|
|
137
|
+
* How a 2025-era opening (a claim-less `initialize`, or any claim-less
|
|
138
|
+
* message) is handled. Defaults to `'serve'` — the connection is pinned to a
|
|
139
|
+
* 2025-era instance from the same factory and served exactly as a hand-wired
|
|
140
|
+
* stdio server served it.
|
|
141
|
+
*
|
|
142
|
+
* The default is deliberate and should stay: `'reject'` answers such an
|
|
143
|
+
* opening with the unsupported-protocol-version error, which silently drops
|
|
144
|
+
* every host that has not moved to the 2026 revision. A fleet MCP is reached
|
|
145
|
+
* by hosts we do not control, so the cost of serving an old client is a
|
|
146
|
+
* second instance and the cost of rejecting one is an MCP that looks broken.
|
|
147
|
+
*/
|
|
148
|
+
legacy?: 'serve' | 'reject';
|
|
149
|
+
/**
|
|
150
|
+
* Out-of-band errors from the stdio entry — a factory that threw, a wire
|
|
151
|
+
* failure, a malformed opening. Defaults to a one-line stderr log.
|
|
152
|
+
*
|
|
153
|
+
* There is a reason this has a default rather than being optional-and-silent:
|
|
154
|
+
* with the factory model a registrar no longer throws out of `runMcp` (there
|
|
155
|
+
* is no instance until a client connects), so without a sink a boot-time
|
|
156
|
+
* misconfiguration would be invisible on both channels.
|
|
157
|
+
*
|
|
158
|
+
* IT ALSO CHANGES WHAT A BOOT FAILURE LOOKS LIKE, and an operator needs to
|
|
159
|
+
* know which signal to watch. Under the old `await runMcp(...)` a throwing
|
|
160
|
+
* registrar rejected and the process exited non-zero — the host saw "server
|
|
161
|
+
* failed to start". Now the entry catches it, reports here, and KEEPS THE
|
|
162
|
+
* CONNECTION OPEN answering `-32603 Internal server error`, re-running the
|
|
163
|
+
* factory on every request. So a misconfigured server presents as connected
|
|
164
|
+
* and broken rather than as dead, and stderr is the only place that says so.
|
|
165
|
+
* The fleet's deferred-config-error pattern means registrars are not supposed
|
|
166
|
+
* to throw at boot, which is why this is a documented consequence and not a
|
|
167
|
+
* defect — but it is the failure mode to recognise.
|
|
168
|
+
*/
|
|
169
|
+
onerror?: (error: Error) => void;
|
|
108
170
|
}
|
|
109
171
|
/**
|
|
110
|
-
* The whole boot in one call:
|
|
111
|
-
*
|
|
112
|
-
*
|
|
172
|
+
* The whole boot in one call: print the banner, serve stdio through
|
|
173
|
+
* {@link serveStdio} with {@link createMcpServer} as the factory, and install
|
|
174
|
+
* graceful-shutdown handlers. Returns the {@link StdioServerHandle}.
|
|
113
175
|
*
|
|
114
176
|
* Pattern-A and Pattern-B MCPs both build their client/transport in `deps` and
|
|
115
177
|
* pass `onSignal: () => client.close()` via `shutdown`, so this stays agnostic
|
|
116
178
|
* to how creds are resolved.
|
|
179
|
+
*
|
|
180
|
+
* ## What callers must know about the factory
|
|
181
|
+
*
|
|
182
|
+
* The serving entry owns the era decision, so **the registrars run per served
|
|
183
|
+
* instance, not once at boot**: once for a connection, and a second time when
|
|
184
|
+
* a client probes with `server/discover` and then falls back to the 2025-era
|
|
185
|
+
* `initialize` (the probe instance is discarded). Anything expensive or
|
|
186
|
+
* credential-bearing therefore belongs in `deps`, built ONCE before this call,
|
|
187
|
+
* exactly as the deferred-config-error pattern already asks — a lazy
|
|
188
|
+
* `getClient` built outside and threaded through `deps` keeps resolving
|
|
189
|
+
* credentials once, while a client constructed inside a registrar would be
|
|
190
|
+
* rebuilt per instance. Registrars must also be side-effect-free beyond
|
|
191
|
+
* registering (no port binds, no `process.on`).
|
|
192
|
+
*
|
|
193
|
+
* `banner` is printed HERE, once, before anything is served — not inside the
|
|
194
|
+
* factory — so a two-instance connection still logs one line.
|
|
195
|
+
*
|
|
196
|
+
* Returns synchronously: there is no server instance yet to return, which is
|
|
197
|
+
* why the old `Promise<McpServer>` could not be kept honest. `await runMcp(…)`
|
|
198
|
+
* still compiles and still means "boot the server", which is what every fleet
|
|
199
|
+
* consumer writes.
|
|
117
200
|
*/
|
|
118
|
-
export declare function runMcp<TDeps = unknown>(opts: RunMcpOptions<TDeps>):
|
|
201
|
+
export declare function runMcp<TDeps = unknown>(opts: RunMcpOptions<TDeps>): StdioServerHandle;
|
|
119
202
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,SAAS,EAA+B,MAAM,8BAA8B,CAAC;AACtF,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,8BAA8B,CAAC;AAI9E,cAAc,mBAAmB,CAAC;AAGlC;;;GAGG;AACH,YAAY,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAE5E;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,OAAO,IAAI,CAC3C,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,KAAK,KACR,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB,mBAGnC,CAAC;AAEH,+EAA+E;AAC/E,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhD,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB,CAAC,KAAK,GAAG,OAAO;IACrD,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;IAC9B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,mGAAmG;IACnG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAwCD;;;;;;;;;;;;;;;;;;;GAmBG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|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* This module collapses that 30–120 lines/MCP into three calls:
|
|
10
10
|
* - {@link createMcpServer} — build the server and apply the registrars.
|
|
11
11
|
* - {@link withGracefulShutdown} — SIGINT/SIGTERM → cleanup → exit.
|
|
12
|
-
* - {@link runMcp} — bootstrap + banner +
|
|
12
|
+
* - {@link runMcp} — bootstrap + banner + serve + shutdown, the whole boot.
|
|
13
13
|
*
|
|
14
14
|
* It is deliberately transport- and domain-agnostic. The
|
|
15
15
|
* deferred-config-error pattern (server boots before creds exist, so the host's
|
|
@@ -17,12 +17,28 @@
|
|
|
17
17
|
* error) is preserved by keeping client/transport construction in the caller's
|
|
18
18
|
* `deps`: both Pattern-A (fetchproxy bridge) and Pattern-B (direct/bearer) MCPs
|
|
19
19
|
* build their client themselves and pass it through, so neither is coupled in.
|
|
20
|
+
*
|
|
21
|
+
* ## Why {@link runMcp} SERVES rather than connects
|
|
22
|
+
*
|
|
23
|
+
* Under the v2 SDK the protocol era is *instance state*, and only a serving
|
|
24
|
+
* ENTRY — `serveStdio` here, `createMcpHandler` over HTTP — marks an instance
|
|
25
|
+
* modern at construction. A hand-wired
|
|
26
|
+
* `server.connect(new StdioServerTransport())` never marks one, so the
|
|
27
|
+
* instance stays 2025-era and the 2026-era `server/discover` is answered
|
|
28
|
+
* `-32601 Method not found`. That was true of every fleet MCP at once, since
|
|
29
|
+
* all of them boot through here; found by @bschrib in
|
|
30
|
+
* chrischall/skylight-mcp#182 and fixed here rather than in the 60 repos
|
|
31
|
+
* that call `runMcp`.
|
|
32
|
+
* `stdio.test.ts` pins it over a real pipe to a real child process, because an
|
|
33
|
+
* in-memory transport cannot see this class of bug — the broken server answers
|
|
34
|
+
* an `InMemoryTransport` perfectly.
|
|
20
35
|
*/
|
|
21
|
-
import {
|
|
36
|
+
import { serveStdio } from '@modelcontextprotocol/server/stdio';
|
|
22
37
|
import { McpServer, SUPPORTED_PROTOCOL_VERSIONS } from '@modelcontextprotocol/server';
|
|
23
|
-
import { McpToolError } from '../errors/index.js';
|
|
38
|
+
import { McpToolError, redactSecrets } from '../errors/index.js';
|
|
24
39
|
import { errorResult } from '../response/index.js';
|
|
25
40
|
export * from './confirmation.js';
|
|
41
|
+
import { withCallSignal } from '../cancel/index.js';
|
|
26
42
|
/** Protocol revisions supported by servers and the shared test harness. */
|
|
27
43
|
export const SERVER_PROTOCOL_VERSIONS = Object.freeze([
|
|
28
44
|
'2026-07-28',
|
|
@@ -42,6 +58,30 @@ function hintResultOrRethrow(err) {
|
|
|
42
58
|
}
|
|
43
59
|
throw err;
|
|
44
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* The caller's `AbortSignal`, dug out of whatever the SDK passed.
|
|
63
|
+
*
|
|
64
|
+
* The context is the LAST argument on both shapes the SDK uses — `(args,
|
|
65
|
+
* ctx)` for a tool with an `inputSchema` and `(ctx)` for one without — and
|
|
66
|
+
* the signal hangs off `mcpReq`, not off the context itself. That level is
|
|
67
|
+
* worth stating because the obvious guess is wrong: `ctx.signal` is
|
|
68
|
+
* undefined in 2.0.0, and a probe that looked there concluded the SDK
|
|
69
|
+
* delivered no cancellation at all.
|
|
70
|
+
*
|
|
71
|
+
* Every step is checked rather than asserted. This runs on the tool path for
|
|
72
|
+
* every call, and a wrapper that throws while reaching for an optional field
|
|
73
|
+
* would break every tool in the fleet to add a feature none of them had.
|
|
74
|
+
*/
|
|
75
|
+
function callSignalFrom(args) {
|
|
76
|
+
const ctx = args.at(-1);
|
|
77
|
+
if (typeof ctx !== 'object' || ctx === null)
|
|
78
|
+
return undefined;
|
|
79
|
+
const req = ctx.mcpReq;
|
|
80
|
+
if (typeof req !== 'object' || req === null)
|
|
81
|
+
return undefined;
|
|
82
|
+
const signal = req.signal;
|
|
83
|
+
return signal instanceof AbortSignal ? signal : undefined;
|
|
84
|
+
}
|
|
45
85
|
/**
|
|
46
86
|
* Wrap `server.registerTool` so every tool handler surfaces its error `hint`.
|
|
47
87
|
*
|
|
@@ -67,7 +107,20 @@ export function surfaceToolHints(server) {
|
|
|
67
107
|
// The SDK's `registerTool` is heavily generic over the input/output schemas.
|
|
68
108
|
// Re-expressing those generics here would buy nothing — the wrapper is
|
|
69
109
|
// transparent — so the seam is cast once, here, and nowhere else.
|
|
70
|
-
server.registerTool = (name, config, cb) => register(name, config, (...args) =>
|
|
110
|
+
server.registerTool = (name, config, cb) => register(name, config, (...args) =>
|
|
111
|
+
// THE CALLER'S CANCELLATION, made ambient for the whole handler
|
|
112
|
+
// (`cancel/index.ts`). The SDK delivers it and the fleet ignored it:
|
|
113
|
+
// measured against @modelcontextprotocol/server 2.0.0, a cancelled
|
|
114
|
+
// call aborts `ctx.mcpReq.signal` with the caller's reason and the
|
|
115
|
+
// handler runs to completion regardless — so the HTTP request stays
|
|
116
|
+
// in flight, the child keeps burning metered CPU, and the upstream
|
|
117
|
+
// keeps being hit for somebody who has gone. claude.ai sent 101
|
|
118
|
+
// cancellations in the week to 2026-09-20.
|
|
119
|
+
//
|
|
120
|
+
// Here because this is the one wrapper every tool already passes
|
|
121
|
+
// through: threading the signal by hand would mean editing several
|
|
122
|
+
// hundred handlers and missing exactly the ones nobody edits.
|
|
123
|
+
withCallSignal(callSignalFrom(args), () => {
|
|
71
124
|
let result;
|
|
72
125
|
try {
|
|
73
126
|
result = cb(...args);
|
|
@@ -76,13 +129,21 @@ export function surfaceToolHints(server) {
|
|
|
76
129
|
return hintResultOrRethrow(err);
|
|
77
130
|
}
|
|
78
131
|
return result instanceof Promise ? result.catch(hintResultOrRethrow) : result;
|
|
79
|
-
});
|
|
132
|
+
}));
|
|
80
133
|
}
|
|
81
134
|
/**
|
|
82
135
|
* Build an {@link McpServer}, print the optional stderr banner, and apply every
|
|
83
|
-
* tool registrar (awaiting async ones) — but do **not**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
136
|
+
* tool registrar (awaiting async ones) — but do **not** serve it. Serving is
|
|
137
|
+
* {@link runMcp}'s job (or the caller's), which keeps this usable from tests
|
|
138
|
+
* and from custom boot sequences.
|
|
139
|
+
*
|
|
140
|
+
* This is the **factory body**, and that is how to hand it to a serving entry:
|
|
141
|
+
* `serveStdio(() => createMcpServer({…}))` over stdio,
|
|
142
|
+
* `createMcpHandler(() => createMcpServer({…}))` over HTTP. Do NOT
|
|
143
|
+
* `server.connect(new StdioServerTransport())` the result — an instance no
|
|
144
|
+
* entry constructed stays 2025-era and answers `server/discover` with
|
|
145
|
+
* `-32601 Method not found` (see this module's header). {@link runMcp} is that
|
|
146
|
+
* wiring for the stdio case.
|
|
86
147
|
*/
|
|
87
148
|
export async function createMcpServer(opts) {
|
|
88
149
|
const server = new McpServer({ name: opts.name, version: opts.version }, { supportedProtocolVersions: [...SERVER_PROTOCOL_VERSIONS] });
|
|
@@ -103,12 +164,17 @@ export async function createMcpServer(opts) {
|
|
|
103
164
|
}
|
|
104
165
|
/**
|
|
105
166
|
* Wire SIGINT/SIGTERM to a one-shot graceful shutdown: run `onSignal` (e.g.
|
|
106
|
-
* close the client/transport), close
|
|
167
|
+
* close the client/transport), close `target`, then `process.exit(0)` (unless
|
|
107
168
|
* `exit: false`). Idempotent — a second signal mid-shutdown is ignored, and a
|
|
108
169
|
* throwing `onSignal`/`close` is logged but still exits cleanly so a wedged
|
|
109
170
|
* cleanup can't hang the host.
|
|
171
|
+
*
|
|
172
|
+
* `target` is the {@link StdioServerHandle} when called from {@link runMcp} —
|
|
173
|
+
* closing the handle closes whichever instance the connection pinned *and* the
|
|
174
|
+
* transport under it, which is strictly more than closing a server was. A bare
|
|
175
|
+
* {@link McpServer} is still accepted and behaves as before.
|
|
110
176
|
*/
|
|
111
|
-
export function withGracefulShutdown(
|
|
177
|
+
export function withGracefulShutdown(target, opts = {}) {
|
|
112
178
|
const shouldExit = opts.exit ?? true;
|
|
113
179
|
let shuttingDown = false;
|
|
114
180
|
const handler = (signal) => {
|
|
@@ -119,7 +185,7 @@ export function withGracefulShutdown(server, opts = {}) {
|
|
|
119
185
|
try {
|
|
120
186
|
if (opts.onSignal)
|
|
121
187
|
await opts.onSignal(signal);
|
|
122
|
-
await
|
|
188
|
+
await target.close();
|
|
123
189
|
}
|
|
124
190
|
catch (err) {
|
|
125
191
|
console.error(`[mcp-utils] error during graceful shutdown on ${signal}: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -134,23 +200,65 @@ export function withGracefulShutdown(server, opts = {}) {
|
|
|
134
200
|
process.on('SIGTERM', () => handler('SIGTERM'));
|
|
135
201
|
}
|
|
136
202
|
/**
|
|
137
|
-
* The whole boot in one call:
|
|
138
|
-
*
|
|
139
|
-
*
|
|
203
|
+
* The whole boot in one call: print the banner, serve stdio through
|
|
204
|
+
* {@link serveStdio} with {@link createMcpServer} as the factory, and install
|
|
205
|
+
* graceful-shutdown handlers. Returns the {@link StdioServerHandle}.
|
|
140
206
|
*
|
|
141
207
|
* Pattern-A and Pattern-B MCPs both build their client/transport in `deps` and
|
|
142
208
|
* pass `onSignal: () => client.close()` via `shutdown`, so this stays agnostic
|
|
143
209
|
* to how creds are resolved.
|
|
210
|
+
*
|
|
211
|
+
* ## What callers must know about the factory
|
|
212
|
+
*
|
|
213
|
+
* The serving entry owns the era decision, so **the registrars run per served
|
|
214
|
+
* instance, not once at boot**: once for a connection, and a second time when
|
|
215
|
+
* a client probes with `server/discover` and then falls back to the 2025-era
|
|
216
|
+
* `initialize` (the probe instance is discarded). Anything expensive or
|
|
217
|
+
* credential-bearing therefore belongs in `deps`, built ONCE before this call,
|
|
218
|
+
* exactly as the deferred-config-error pattern already asks — a lazy
|
|
219
|
+
* `getClient` built outside and threaded through `deps` keeps resolving
|
|
220
|
+
* credentials once, while a client constructed inside a registrar would be
|
|
221
|
+
* rebuilt per instance. Registrars must also be side-effect-free beyond
|
|
222
|
+
* registering (no port binds, no `process.on`).
|
|
223
|
+
*
|
|
224
|
+
* `banner` is printed HERE, once, before anything is served — not inside the
|
|
225
|
+
* factory — so a two-instance connection still logs one line.
|
|
226
|
+
*
|
|
227
|
+
* Returns synchronously: there is no server instance yet to return, which is
|
|
228
|
+
* why the old `Promise<McpServer>` could not be kept honest. `await runMcp(…)`
|
|
229
|
+
* still compiles and still means "boot the server", which is what every fleet
|
|
230
|
+
* consumer writes.
|
|
144
231
|
*/
|
|
145
|
-
export
|
|
146
|
-
|
|
232
|
+
export function runMcp(opts) {
|
|
233
|
+
// Hoisted out of the factory: one boot, one banner, however many instances
|
|
234
|
+
// the connection's opening exchange ends up constructing.
|
|
235
|
+
if (opts.banner !== undefined) {
|
|
236
|
+
// stderr only: stdout carries the JSON-RPC frames over stdio transport.
|
|
237
|
+
console.error(opts.banner);
|
|
238
|
+
}
|
|
239
|
+
const spec = opts.transport ?? 'stdio';
|
|
240
|
+
const handle = serveStdio(() => createMcpServer({ ...opts, banner: undefined }), {
|
|
241
|
+
legacy: opts.legacy ?? 'serve',
|
|
242
|
+
onerror: opts.onerror ??
|
|
243
|
+
((error) => {
|
|
244
|
+
// Through `redactSecrets` like every other error this package formats.
|
|
245
|
+
// It matters more here than most: this sink is the only channel a
|
|
246
|
+
// boot-time failure has left (the entry no longer lets a throwing
|
|
247
|
+
// registrar exit the process), and the things that throw at boot are
|
|
248
|
+
// exactly the credential-shaped ones — a bad token, a malformed
|
|
249
|
+
// connection string — so the unredacted message is the likeliest to
|
|
250
|
+
// carry a secret into a log an operator then pastes somewhere.
|
|
251
|
+
console.error(`[mcp-utils] stdio server error: ${redactSecrets(error.message)}`);
|
|
252
|
+
}),
|
|
253
|
+
// `'stdio'` means "let the entry make its own StdioServerTransport over
|
|
254
|
+
// this process"; anything else is the caller's transport, which the entry
|
|
255
|
+
// then owns (it starts it, pumps it, and closes it with the handle).
|
|
256
|
+
...(spec === 'stdio' ? {} : { transport: spec }),
|
|
257
|
+
});
|
|
147
258
|
const shutdown = opts.shutdown ?? true;
|
|
148
259
|
if (shutdown !== false) {
|
|
149
|
-
withGracefulShutdown(
|
|
260
|
+
withGracefulShutdown(handle, shutdown === true ? {} : shutdown);
|
|
150
261
|
}
|
|
151
|
-
|
|
152
|
-
const transport = spec === 'stdio' ? new StdioServerTransport() : spec;
|
|
153
|
-
await server.connect(transport);
|
|
154
|
-
return server;
|
|
262
|
+
return handle;
|
|
155
263
|
}
|
|
156
264
|
//# sourceMappingURL=index.js.map
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAqBpD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC;IACpD,YAAY;IACZ,GAAG,2BAA2B;CAC/B,CAAC,CAAC;AAoCH;;;;;;;GAOG;AACH,SAAS,mBAAmB,CAAC,GAAY;IACvC,IAAI,GAAG,YAAY,YAAY,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QAC5C,OAAO,WAAW,CAAC,GAAG,GAAG,CAAC,OAAO,aAAa,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,MAAM,GAAG,CAAC;AACZ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,cAAc,CAAC,IAAwB;IAC9C,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC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E;gBAClE,kEAAkE;gBAClE,qEAAqE;gBACrE,gEAAgE;gBAChE,oEAAoE;gBACpE,+DAA+D;gBAC/D,OAAO,CAAC,KAAK,CAAC,mCAAmC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACnF,CAAC,CAAC;QACJ,wEAAwE;QACxE,0EAA0E;QAC1E,qEAAqE;QACrE,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;KACjD,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC;IACvC,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;QACvB,oBAAoB,CAAC,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/test/index.d.ts
CHANGED
|
@@ -36,6 +36,16 @@ export interface TestHarnessOptions {
|
|
|
36
36
|
*
|
|
37
37
|
* Applies the same error-hint surfacing `createMcpServer` does, so a tool's
|
|
38
38
|
* failure text under test is the text production returns.
|
|
39
|
+
*
|
|
40
|
+
* What it deliberately does NOT reproduce is the protocol ERA. This pair is
|
|
41
|
+
* hand-wired, so the instance is 2025-era and the 2026-era `server/discover`
|
|
42
|
+
* is not installed on it — which is exactly the shape that hid
|
|
43
|
+
* chrischall/skylight-mcp#182, where every fleet MCP answered
|
|
44
|
+
* `server/discover` with `-32601 Method not found` in production while every
|
|
45
|
+
* harness test stayed green. Tool behaviour belongs here; anything about the
|
|
46
|
+
* era or the boot path has to go through the real serving entry, the way
|
|
47
|
+
* `mcp-utils`' own `src/server/stdio.test.ts` spawns a process and speaks over
|
|
48
|
+
* a pipe.
|
|
39
49
|
*/
|
|
40
50
|
export declare function createTestHarness(registerFn: RegisterFn, options?: TestHarnessOptions): Promise<TestHarness>;
|
|
41
51
|
/**
|
package/dist/test/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAqB,MAAM,8BAA8B,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAGnC,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAErE,wEAAwE;AACxE,MAAM,WAAW,WAAW;IAC1B,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,MAAM,EAAE,SAAS,CAAC;IAClB,iEAAiE;IACjE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACpF,wDAAwD;IACxD,SAAS,EAAE,MAAM,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAC;IACnE,yEAAyE;IACzE,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,0EAA0E;AAC1E,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAChF;AAED
|
|
1
|
+
{"version":3,"file":"index.d.ts","s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uBAAuB,CAazB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAC/C,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,GAClD,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAUtB"}
|
package/dist/test/index.js
CHANGED
|
@@ -25,6 +25,16 @@ import { SERVER_PROTOCOL_VERSIONS, surfaceToolHints } from '../server/index.js';
|
|
|
25
25
|
*
|
|
26
26
|
* Applies the same error-hint surfacing `createMcpServer` does, so a tool's
|
|
27
27
|
* failure text under test is the text production returns.
|
|
28
|
+
*
|
|
29
|
+
* What it deliberately does NOT reproduce is the protocol ERA. This pair is
|
|
30
|
+
* hand-wired, so the instance is 2025-era and the 2026-era `server/discover`
|
|
31
|
+
* is not installed on it — which is exactly the shape that hid
|
|
32
|
+
* chrischall/skylight-mcp#182, where every fleet MCP answered
|
|
33
|
+
* `server/discover` with `-32601 Method not found` in production while every
|
|
34
|
+
* harness test stayed green. Tool behaviour belongs here; anything about the
|
|
35
|
+
* era or the boot path has to go through the real serving entry, the way
|
|
36
|
+
* `mcp-utils`' own `src/server/stdio.test.ts` spawns a process and speaks over
|
|
37
|
+
* a pipe.
|
|
28
38
|
*/
|
|
29
39
|
export async function createTestHarness(registerFn, options = {}) {
|
|
30
40
|
const server = new McpServer({ name: 'test', version: '0.0.0' }, { supportedProtocolVersions: [...SERVER_PROTOCOL_VERSIONS] });
|
package/dist/test/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,W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.ts
CHANGED
|
@@ -63,8 +63,25 @@ export declare const schemaOrigin: z.ZodOptional<z.ZodString>;
|
|
|
63
63
|
* `confirm: true` the tool returns a preview instead of performing the action.
|
|
64
64
|
* (honeybook pay_invoice / sign_contract)
|
|
65
65
|
*
|
|
66
|
-
* @deprecated
|
|
67
|
-
*
|
|
66
|
+
* @deprecated Prefer `requireConfirmation` where the client supports it — the
|
|
67
|
+
* confirmation is then a protocol exchange rather than a tool argument, so a
|
|
68
|
+
* model cannot satisfy the gate itself by setting a boolean. The description
|
|
69
|
+
* below is the weakness made literal: it tells an attacker-controlled model
|
|
70
|
+
* how to proceed.
|
|
71
|
+
*
|
|
72
|
+
* NOT scheduled for removal, and do not migrate a fleet to
|
|
73
|
+
* `requireConfirmation` without checking the surfaces it is called from.
|
|
74
|
+
* Measured 2026-09-19 against real clients: claude.ai declares no
|
|
75
|
+
* `elicitation` capability at all — its envelope is UI-extension only — so a
|
|
76
|
+
* gated tool answers `-32021` and is INERT there; Claude Desktop does not
|
|
77
|
+
* support elicitation; and Cowork declares the capability then never services
|
|
78
|
+
* it, hanging the call for 180s and attributing the failure to the server
|
|
79
|
+
* (anthropics/claude-ai-mcp#1046). A conformant server cannot detect that
|
|
80
|
+
* case, because the declaration is its only signal. Claude Code is the one
|
|
81
|
+
* surface measured working.
|
|
82
|
+
*
|
|
83
|
+
* This parameter has no such dependency: it is an argument, so it works on
|
|
84
|
+
* every client. That is the whole trade — weaker gate, universal reach.
|
|
68
85
|
*/
|
|
69
86
|
export declare const schemaConfirm: z.ZodOptional<z.ZodBoolean>;
|
|
70
87
|
/**
|
package/dist/zod/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zod/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,2CAA2C;AAC3C,eAAO,MAAM,WAAW,aAA8B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;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAIlE;AAMD,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,2CAA2C;AAC3C,MAAM,WAAW,oBAAoB;IACnC,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,oBAAyB,GAAG,eAAe,CAOhF;AAMD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAOpE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAuBlF;AAED,cAAc,oBAAoB,CAAC"}
|
package/dist/zod/index.js
CHANGED
|
@@ -79,8 +79,25 @@ export const schemaOrigin = z
|
|
|
79
79
|
* `confirm: true` the tool returns a preview instead of performing the action.
|
|
80
80
|
* (honeybook pay_invoice / sign_contract)
|
|
81
81
|
*
|
|
82
|
-
* @deprecated
|
|
83
|
-
*
|
|
82
|
+
* @deprecated Prefer `requireConfirmation` where the client supports it — the
|
|
83
|
+
* confirmation is then a protocol exchange rather than a tool argument, so a
|
|
84
|
+
* model cannot satisfy the gate itself by setting a boolean. The description
|
|
85
|
+
* below is the weakness made literal: it tells an attacker-controlled model
|
|
86
|
+
* how to proceed.
|
|
87
|
+
*
|
|
88
|
+
* NOT scheduled for removal, and do not migrate a fleet to
|
|
89
|
+
* `requireConfirmation` without checking the surfaces it is called from.
|
|
90
|
+
* Measured 2026-09-19 against real clients: claude.ai declares no
|
|
91
|
+
* `elicitation` capability at all — its envelope is UI-extension only — so a
|
|
92
|
+
* gated tool answers `-32021` and is INERT there; Claude Desktop does not
|
|
93
|
+
* support elicitation; and Cowork declares the capability then never services
|
|
94
|
+
* it, hanging the call for 180s and attributing the failure to the server
|
|
95
|
+
* (anthropics/claude-ai-mcp#1046). A conformant server cannot detect that
|
|
96
|
+
* case, because the declaration is its only signal. Claude Code is the one
|
|
97
|
+
* surface measured working.
|
|
98
|
+
*
|
|
99
|
+
* This parameter has no such dependency: it is an argument, so it works on
|
|
100
|
+
* every client. That is the whole trade — weaker gate, universal reach.
|
|
84
101
|
*/
|
|
85
102
|
export const schemaConfirm = z
|
|
86
103
|
.boolean()
|
package/dist/zod/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/zod/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8EAA8E;AAC9E,QAAQ;AACR,8EAA8E;AAE9E,2CAA2C;AAC3C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;AAEvD,uCAAuC;AACvC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;AAExD,uEAAuE;AACvE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GA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