@nest-mcp/manager 0.0.0-stage → 2.0.0-alpha.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/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @nest-mcp/manager
2
+
3
+ ## 2.0.0-alpha.0
4
+
5
+ ### Major Changes
6
+
7
+ - First prerelease of the 2.x line, built on the official MCP TypeScript SDK v2 and NestJS 12.
package/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, btwld
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,3 +1,256 @@
1
- # Temporary Holding Version
1
+ # `@nest-mcp/manager`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A framework-neutral, process-local lifecycle manager for dynamic MCP client generations.
4
+
5
+ It accepts only an opaque generation key and a host-owned resolver that returns already-admitted
6
+ transport material. Connection records, endpoints, credentials, tenancy, approval policy, and
7
+ persistence remain in the host application.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ pnpm add @nest-mcp/manager @nest-mcp/client @modelcontextprotocol/client
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ import { McpRuntimeManager } from "@nest-mcp/manager";
19
+
20
+ const manager = new McpRuntimeManager({
21
+ generationResolver: {
22
+ async resolve(generationKey, signal) {
23
+ const admitted = await resolveAdmittedTransport(generationKey, signal);
24
+ return {
25
+ transport: admitted.transport,
26
+ close: () => admitted.close(),
27
+ };
28
+ },
29
+ },
30
+ maxConnections: 16,
31
+ maxStateEntries: 1_000,
32
+ shutdownTimeoutMs: 30_000,
33
+ });
34
+
35
+ await manager.ensureOnline("opaque-generation-capability");
36
+ const catalog = await manager.refreshCatalog("opaque-generation-capability");
37
+ await manager.close();
38
+ ```
39
+
40
+ ## Shared and exclusive operation leases
41
+
42
+ The ordinary manager path is generation-shared. `ensureOnline(key)` retains a keeper, and calls for
43
+ that key reuse its connected runtime until `setOffline()` or `retire()` drains it. This is suitable
44
+ only when the admitted transport and every attached collaborator are safe to pool.
45
+
46
+ Use `leaseMode: "exclusive"` when one operation must own a fresh runtime and close it before the
47
+ operation promise settles:
48
+
49
+ ```ts
50
+ const result = await manager.callTool(
51
+ "opaque-generation-capability",
52
+ "search",
53
+ { query: "lease fencing" },
54
+ {
55
+ leaseMode: "exclusive",
56
+ toolDefinition: approvedDefinition,
57
+ },
58
+ );
59
+ ```
60
+
61
+ An exclusive operation does not require `ensureOnline()`. It receives a unique internal lease
62
+ identity, never joins another acquisition, and holds its global `maxConnections` slot through
63
+ runtime and admitted-material cleanup. Shared or second exclusive work for the same generation
64
+ fails with `MCP_LEASE_MODE_CONFLICT`; the manager does not hide contention behind an unbounded
65
+ queue. Retirement and shutdown still abort the operation and wait for its lease cleanup. A cleanup
66
+ failure remains quarantined and capacity-charging.
67
+
68
+ For concurrent callers that must each use a fresh transport, opt into bounded FIFO waiting:
69
+
70
+ ```ts
71
+ const result = await manager.callTool(
72
+ generationKey,
73
+ "search",
74
+ { query },
75
+ {
76
+ leaseMode: "exclusive",
77
+ exclusiveContention: "queue",
78
+ signal,
79
+ },
80
+ );
81
+ ```
82
+
83
+ Queued callers wait only behind exclusive operations of the same generation. Each caller resolves
84
+ fresh admitted material after the prior operation's runtime and material have fully closed; no
85
+ request or result is reused or retried. `requestTimeoutMs` includes queue waiting, admission, and
86
+ execution. Caller cancellation removes just that waiter. `setOffline`, `retire`, and `close` reject
87
+ pending waiters before they can start; uncertain cleanup rejects them as quarantined. Shared work
88
+ or an online keeper remains a lease-mode conflict even when waiting is requested.
89
+
90
+ `maxQueuedOperations` bounds waiting callers across all generations (default 100). Excess callers
91
+ receive `MCP_CAPACITY_EXCEEDED`. Waiting does not consume a connection slot, while active transports
92
+ remain bounded by `maxConnections` through cleanup. `snapshot().queuedOperationCount` reports
93
+ waiting callers without exposing generation identities. The ordinary exclusive default remains
94
+ fail-fast.
95
+
96
+ This is the manager-side close-on-release primitive for a credential-bound transport that cannot
97
+ provide request-correlated OAuth refresh fencing. Do not also retain that generation with
98
+ `ensureOnline()`. A host that supplies request-correlated refresh and exact revision fencing may
99
+ use the ordinary shared mode instead. Generation keys stay opaque and non-secret in either mode.
100
+
101
+ `probe`, `refreshCatalog`, `withClientRuntime`, `callTool`, `readResource`, and `getPrompt` accept the
102
+ same operation options (or the existing positional `AbortSignal`). `withClientRuntime` remains the
103
+ generic route to other protocol methods under an exclusive lease; its callback must not start
104
+ parallel credentialed requests when it relies on the minimal OAuth provider's no-concurrency
105
+ alternative. The manager-owned exclusive catalog refresh runs its list requests sequentially for
106
+ that reason.
107
+
108
+ ## Catalog freshness and change detection
109
+
110
+ An admitted generation may provide `onConnected(snapshot, signal)`. The manager awaits it once
111
+ after successful negotiation and before handing the runtime to an operation. The frozen snapshot
112
+ contains the negotiated protocol version, era, capabilities, and connection timestamp. Hosts can
113
+ persist a last observation there without keeping a runtime online or making a second probe.
114
+ Connection records, timestamp ordering, configuration invalidation, and persistence remain host
115
+ policy. This callback is part of acquisition: rejection closes the runtime and admitted material;
116
+ best-effort persistence must catch its own errors. Honor the generation signal and keep work bounded.
117
+ Ordinary operation cleanup still transitions the current state to offline and removes its active
118
+ connection metadata. The hook does not change that lifecycle or the key-free metrics event contract.
119
+
120
+ `refreshCatalog(key, options)` is the reusable freshness seam. It performs protocol liveness first,
121
+ forces every supported list delegate through `cacheMode: "refresh"`, applies the configured page and
122
+ item bounds, and only then releases the generation lease. Shared mode runs the list wave in parallel
123
+ but waits for every request to settle before release; exclusive mode runs it sequentially so one
124
+ minimal OAuth bridge never has concurrent credentialed requests. The frozen `discoveredAt` timestamp
125
+ is recorded after the complete successful wave.
126
+
127
+ The manager deliberately does not persist a baseline or turn list-change notifications into product
128
+ state. Compare snapshots with `digestMcpRuntimeCatalog` from `@nest-mcp/conformance`; that canonical,
129
+ domain-separated digest is the change seam for approval, persistence, or scheduling owned by the
130
+ host. Credential-bound refreshes can combine both guarantees:
131
+
132
+ ```ts
133
+ const catalog = await manager.refreshCatalog("opaque-generation-capability", {
134
+ leaseMode: "exclusive",
135
+ });
136
+ const digest = digestMcpRuntimeCatalog(catalog, {
137
+ domain: "example/mcp/catalog/v1",
138
+ toolSchemaDomain: "example/mcp/tool-schema/v1",
139
+ });
140
+ ```
141
+
142
+ ## Shared runtime ownership
143
+
144
+ Use `McpRuntimeOwnership` when several host projections can retain the same opaque manager
145
+ generation. It composes the manager's existing `retire()` port without taking over product records,
146
+ key construction, admission, tenancy, or persistence:
147
+
148
+ ```ts
149
+ import { McpRuntimeManager, McpRuntimeOwnership } from "@nest-mcp/manager";
150
+
151
+ const manager = new McpRuntimeManager({
152
+ generationResolver,
153
+ maxConnections: 16,
154
+ });
155
+ const ownership = new McpRuntimeOwnership({
156
+ manager,
157
+ maxOwners: 1_000,
158
+ maxGenerations: 1_000,
159
+ maxReferences: 10_000,
160
+ });
161
+
162
+ const workspaceProjection = ownership.createOwner();
163
+ await workspaceProjection.retain("opaque-generation-capability");
164
+
165
+ // The final cooperative owner release retires the manager generation.
166
+ await workspaceProjection.release();
167
+ ```
168
+
169
+ An owner-to-generation retention is idempotent. Concurrent calls for the same owner and key share
170
+ one task. If an older retirement is unsettled, `retain()` waits for that barrier and rechecks the
171
+ owner and generation before it acquires, so consumers do not implement a retry race. Releasing an
172
+ owner is terminal and repeated calls share one settlement. If several final retirements fail,
173
+ `release()` rejects with an `AggregateError` containing only fixed, generation-key-free ownership
174
+ errors; failed cleanup remains fenced and charged against `maxGenerations`.
175
+
176
+ `forceRetire(key)` immediately revokes every current reference and fences every owner that existed
177
+ when the force began. An owner created after that boundary may reuse an equal `Map` key only after
178
+ the manager retirement fully settles; old retirement work can therefore never overlap its
179
+ replacement. A manager-closed result counts as settled because manager shutdown already owns every
180
+ runtime generation.
181
+
182
+ Reversible desired-state transitions stay separate: call `manager.setOffline(key)` without
183
+ releasing the owner, then call `manager.ensureOnline(key)` when the host wants that retained
184
+ generation online again. Ownership finalization and `forceRetire()` call only `manager.retire()`.
185
+ `snapshot()` reports bounded aggregate counts and never emits generation keys or manager failures.
186
+
187
+ `subscribe(listener)` emits key-free, bounded state transitions. Pass an optional
188
+ `McpLifecycleObserver` as `observer` to observe operations performed by each managed
189
+ `McpClientRuntime`. Runtime server names are random and never derived from the generation key;
190
+ telemetry exporters should omit operation targets when aggregating across dynamic generations.
191
+
192
+ `callTool(generationKey, name, arguments, options)` accepts either a positional `AbortSignal` or an
193
+ `McpRuntimeToolCallOptions` object. Pinning `toolDefinition` keeps the managed client runtime's
194
+ structured output validation bound to that exact definition instead of its cached `tools/list`
195
+ view, so a host that already holds an approved definition never validates a result against a
196
+ drifted schema.
197
+
198
+ Retained state is bounded by `maxStateEntries` (1,000 by default and always at least
199
+ `maxConnections`). Live and quarantined projections are protected; older offline or failed
200
+ diagnostics are evicted first. State listeners still receive each bounded transition event even
201
+ when its projection cannot be retained.
202
+
203
+ `MCP_RUNTIME_PHASES` and `MCP_RUNTIME_PROTOCOL_ERAS` publish every lifecycle phase and negotiated
204
+ protocol era as frozen tuples for hosts that persist state projections. The matching
205
+ `mcpRuntimeStateSnapshotSchema`, `mcpRuntimeProbeSnapshotSchema`, and
206
+ `mcpRuntimeCapabilitiesSnapshotSchema` validators implement [Standard
207
+ Schema](https://standardschema.dev) v1 with no added runtime dependency: they accept exactly what
208
+ the manager emits, reject unknown properties, and return a frozen normalized snapshot.
209
+
210
+ Cleanup failures quarantine and continue charging the affected generation against the configured
211
+ capacity. Runtime cleanup runs before admitted-material cleanup, and both are bounded by
212
+ `shutdownTimeoutMs`; a timed-out host `close()` remains quarantined. The manager is in memory only
213
+ and implements both `close()` and `AsyncDisposable`.
214
+
215
+ ## Concurrent isolated operations
216
+
217
+ Use `leaseMode: "concurrent"` with an opaque `admissionKey` for host-authorized independent
218
+ operations. Each admitted call creates its own client and closes it before settlement; no online
219
+ keeper or shared session is retained. The default `maxConcurrentOperationsPerAdmissionKey` is four;
220
+ set it to `null` to use only process capacity. A call's `maxConcurrentOperations` can override this
221
+ with a positive integer or `null`. Across related active calls, the strictest supplied ceiling
222
+ applies, including calls from older configuration generations.
223
+
224
+ Opt into `concurrentContention: "queue"` to wait for both connector and process capacity before
225
+ allocating a transport. Without this option, saturation returns `MCP_CAPACITY_EXCEEDED` immediately.
226
+ One transport ledger charges acquisition, execution, cleanup, and failed cleanup against
227
+ `maxConnections`. Waiting neither restarts the operation deadline nor redispatches an operation.
228
+
229
+ Queued calls rotate fairly across connector keys and remain FIFO within each key. A blocked
230
+ connector does not block eligible work for another connector. The queue is bounded by
231
+ `maxQueuedOperations` (100 by default). Queue overflow returns `MCP_QUEUE_FULL`; expiry before
232
+ admission returns `MCP_ADMISSION_TIMEOUT`. Cancellation removes the waiter immediately. The
233
+ optional per-call `onAdmission` observer receives outcome, elapsed admission time, queued count,
234
+ and occupied connection count, without keys, credentials, or provider payloads. Observer errors
235
+ cannot affect admission. Hosts retain responsibility for authorization and configuration checks
236
+ inside the protected operation callback, after admission and before dispatch.
237
+
238
+ Supply the same stable `admissionKey` to **every isolated operation for that connector**, including
239
+ exclusive discovery, probes, OAuth, and tool calls, across actors and configuration generations.
240
+ The host owns this identity and the eligibility policy; tool annotations are not authorization.
241
+ Keys are bounded to 1–1024 characters and are never emitted in manager diagnostics. Shared/retained
242
+ runtimes cannot use keyed admission and must not be mixed into a keyed connector's lifecycle.
243
+
244
+ An exclusive call with `exclusiveContention: "queue"` waits for related concurrent calls to drain
245
+ and blocks new concurrent arrivals until it settles or is cancelled. Waiting remains bounded by
246
+ `maxQueuedOperations` and the call deadline. Retirement cancels that generation's calls and waiting
247
+ operations, without retiring sibling generations. Uncertain cleanup quarantines its generation
248
+ and admission identity until manager replacement, retaining the failed transport's capacity charge.
249
+ A successful sibling cleanup cannot clear quarantine.
250
+
251
+ Limits are local to one manager/process. Hosts operating several processes must allocate their
252
+ provider budget across them; this is not a fleet-wide semaphore.
253
+
254
+ For concurrent runtimes, generation `state()` is the latest lifecycle observation, not an aggregate
255
+ connection count. Use `snapshot()` for bounded aggregate pending, active, closing, and quarantined
256
+ transport counts. Quarantine is sticky even when a sibling reports another lifecycle transition.
@@ -0,0 +1,350 @@
1
+ import { CallToolResult, GetPromptResult, McpClientConnectionSnapshot, McpClientRuntime, McpClientRuntimeOptions, McpClientTransportDefinition, ReadResourceResult } from "@nest-mcp/client";
2
+ import { Prompt, Resource, ResourceTemplateType, StandardSchemaV1Sync, Tool } from "@modelcontextprotocol/client";
3
+ import { MaybePromise, McpLifecycleObserver } from "@nest-mcp/core";
4
+ //#region src/errors.d.ts
5
+ declare const MCP_RUNTIME_QUEUE_FULL: "MCP_QUEUE_FULL";
6
+ declare const MCP_RUNTIME_ADMISSION_TIMEOUT: "MCP_ADMISSION_TIMEOUT";
7
+ declare const MCP_RUNTIME_CAPACITY_EXCEEDED: "MCP_CAPACITY_EXCEEDED";
8
+ declare const MCP_RUNTIME_DISCOVERY_LIMIT_EXCEEDED: "MCP_DISCOVERY_LIMIT_EXCEEDED";
9
+ declare const MCP_RUNTIME_GENERATION_RETIRED: "MCP_GENERATION_RETIRED";
10
+ declare const MCP_RUNTIME_LEASE_MODE_CONFLICT: "MCP_LEASE_MODE_CONFLICT";
11
+ declare const MCP_RUNTIME_NOT_READY: "MCP_NOT_READY";
12
+ declare const MCP_RUNTIME_QUARANTINED: "MCP_QUARANTINED";
13
+ declare const MCP_RUNTIME_MANAGER_CLOSED: "MCP_RUNTIME_CLOSED";
14
+ declare const MCP_RUNTIME_UPSTREAM_FAILED: "MCP_UPSTREAM_FAILED";
15
+ declare const MCP_RUNTIME_CLEANUP_FAILED: "MCP_CLEANUP_FAILED";
16
+ declare const MCP_RUNTIME_CONNECTION_LOST: "MCP_CONNECTION_LOST";
17
+ type McpRuntimeManagerErrorCode = typeof MCP_RUNTIME_CAPACITY_EXCEEDED | typeof MCP_RUNTIME_QUEUE_FULL | typeof MCP_RUNTIME_ADMISSION_TIMEOUT | typeof MCP_RUNTIME_DISCOVERY_LIMIT_EXCEEDED | typeof MCP_RUNTIME_GENERATION_RETIRED | typeof MCP_RUNTIME_LEASE_MODE_CONFLICT | typeof MCP_RUNTIME_NOT_READY | typeof MCP_RUNTIME_QUARANTINED | typeof MCP_RUNTIME_MANAGER_CLOSED | typeof MCP_RUNTIME_UPSTREAM_FAILED;
18
+ type McpRuntimeStateErrorCode = McpRuntimeManagerErrorCode | typeof MCP_RUNTIME_CLEANUP_FAILED | typeof MCP_RUNTIME_CONNECTION_LOST | "UNKNOWN";
19
+ /** Framework-neutral, key-free failure raised by the managed runtime lifecycle. */
20
+ declare class McpRuntimeManagerError extends Error {
21
+ readonly code: McpRuntimeManagerErrorCode;
22
+ constructor(code: McpRuntimeManagerErrorCode, message: string, options?: ErrorOptions);
23
+ }
24
+ //#endregion
25
+ //#region src/types.d.ts
26
+ type McpRuntimePhase = "offline" | "queued" | "connecting" | "online" | "degraded" | "draining" | "failed" | "quarantined";
27
+ /** Protocol era negotiated by a connected managed runtime generation. */
28
+ type McpRuntimeProtocolEra = NonNullable<McpClientConnectionSnapshot["protocolEra"]>;
29
+ interface McpRuntimeCapabilitiesSnapshot {
30
+ readonly tools: boolean;
31
+ readonly resources: boolean;
32
+ readonly prompts: boolean;
33
+ readonly completion: boolean;
34
+ readonly subscriptions: boolean;
35
+ }
36
+ /**
37
+ * Normalized immutable projection of one managed runtime's lifecycle state.
38
+ *
39
+ * Optional properties are absent rather than present with an `undefined` value.
40
+ * The snapshot and its nested capability projection are frozen.
41
+ */
42
+ interface McpRuntimeStateSnapshot {
43
+ readonly phase: McpRuntimePhase;
44
+ readonly lastTransitionAt: string;
45
+ readonly protocolVersion?: string;
46
+ readonly protocolEra?: McpRuntimeProtocolEra;
47
+ readonly connectedAt?: string;
48
+ readonly errorCode?: McpRuntimeStateErrorCode;
49
+ readonly capabilities?: McpRuntimeCapabilitiesSnapshot;
50
+ }
51
+ /** Aggregate diagnostics deliberately omit opaque generation keys and runtime names. */
52
+ interface McpRuntimeManagerSnapshot {
53
+ readonly closed: boolean;
54
+ readonly maxConnections: number;
55
+ readonly maxQueuedOperations: number;
56
+ readonly queuedOperationCount: number;
57
+ readonly connectionCount: number;
58
+ readonly pendingConnectionCount: number;
59
+ readonly activeConnectionCount: number;
60
+ readonly closingConnectionCount: number;
61
+ readonly quarantinedConnectionCount: number;
62
+ readonly operationReferenceCount: number;
63
+ readonly onlineKeeperCount: number;
64
+ }
65
+ interface McpRuntimeCatalogSnapshot {
66
+ readonly discoveredAt: string;
67
+ readonly tools: readonly Tool[];
68
+ readonly resources: readonly Resource[];
69
+ readonly resourceTemplates: readonly ResourceTemplateType[];
70
+ readonly prompts: readonly Prompt[];
71
+ }
72
+ interface McpRuntimeProbeSnapshot {
73
+ readonly reachable: true;
74
+ readonly observedAt: string;
75
+ readonly protocolVersion?: string;
76
+ readonly protocolEra?: McpRuntimeProtocolEra;
77
+ readonly capabilities?: McpRuntimeCapabilitiesSnapshot;
78
+ readonly runtime: McpRuntimeStateSnapshot;
79
+ }
80
+ /**
81
+ * Selects whether an operation may reuse the generation-keyed runtime.
82
+ *
83
+ * `"concurrent"` admits an isolated transport per operation. `concurrentContention: "queue"`
84
+ * opts into bounded waiting for connector and process capacity; the default rejects contention.
85
+ * `"shared"` preserves the manager's ordinary retained-generation behavior. `"exclusive"`
86
+ * creates one unshared runtime for the operation and closes it before settlement. Exclusive
87
+ * work is fail-fast unless `exclusiveContention: "queue"` opts into bounded waiting behind
88
+ * another exclusive operation. Shared work and retained keepers still conflict. A custom
89
+ * `withClientRuntime` callback remains responsible for not starting parallel protocol requests.
90
+ */
91
+ type McpRuntimeOperationLeaseMode = "shared" | "exclusive" | "concurrent";
92
+ interface McpRuntimeAdmissionEvent {
93
+ readonly outcome: "admitted" | "queue-full" | "timeout" | "cancelled" | "refused";
94
+ readonly durationMs: number;
95
+ readonly queuedOperationCount: number;
96
+ readonly activeConnectionCount: number;
97
+ }
98
+ interface McpRuntimeOperationOptions {
99
+ readonly signal?: AbortSignal;
100
+ /** Defaults to `"shared"`; use `"exclusive"` for a non-pooled close-before-settlement runtime. */
101
+ readonly leaseMode?: McpRuntimeOperationLeaseMode;
102
+ /** Stable opaque connector identity across generations. Required for concurrent calls;
103
+ * supply the same identity to exclusive calls for mutual exclusion. Never logged. */
104
+ readonly admissionKey?: string;
105
+ /** Defaults to `"reject"`. `"queue"` waits FIFO behind exclusive work within the request deadline. */
106
+ readonly exclusiveContention?: "reject" | "queue";
107
+ /** Opt into bounded waiting for isolated concurrent calls, including process capacity. */
108
+ readonly concurrentContention?: "reject" | "queue";
109
+ /** Host-owned connector limit; null removes the per-key ceiling, undefined uses the manager default. */
110
+ readonly maxConcurrentOperations?: number | null;
111
+ /** Bounded, key-free admission timing. Observer failures never alter execution. */
112
+ readonly onAdmission?: (event: McpRuntimeAdmissionEvent) => void;
113
+ }
114
+ /**
115
+ * Narrow client-runtime surface available while the manager owns a generation lease.
116
+ * Registry mutation, transport admission, shutdown, and credential material stay private.
117
+ */
118
+ type McpManagedClientRuntime = Pick<McpClientRuntime, "callTool" | "complete" | "getPrompt" | "listPrompts" | "listResources" | "listResourceTemplates" | "listTools" | "readResource" | "request" | "requestWithInputRequired" | "snapshot">;
119
+ interface McpManagedClientRuntimeContext {
120
+ readonly runtime: McpManagedClientRuntime;
121
+ readonly serverName: string;
122
+ readonly signal: AbortSignal;
123
+ }
124
+ type McpManagedClientRuntimeOperation<Result> = (context: McpManagedClientRuntimeContext) => Promise<Result>;
125
+ /**
126
+ * Host-authorized transport material for one opaque runtime generation.
127
+ *
128
+ * The close callback is wrapped by the manager, but hosts should still make it
129
+ * idempotent because process-level cleanup can be retried after failures.
130
+ */
131
+ interface McpAdmittedRuntimeGeneration {
132
+ readonly transport: McpClientTransportDefinition;
133
+ /**
134
+ * Called once after successful negotiation, before the runtime is handed to an operation.
135
+ * The host may retain this immutable observation independently of transient runtime state.
136
+ * Awaited as part of acquisition; rejection fails acquisition and closes admitted material.
137
+ * Hosts that need best-effort persistence must handle their own persistence errors.
138
+ */
139
+ onConnected?(snapshot: McpRuntimeStateSnapshot, signal: AbortSignal): MaybePromise<void>;
140
+ close(): Promise<void>;
141
+ }
142
+ /**
143
+ * Resolves an opaque, non-secret generation key into already-admitted runtime
144
+ * material. Product records, credentials, endpoint policy, and tenancy remain
145
+ * behind this interface.
146
+ */
147
+ interface McpRuntimeGenerationResolver<GenerationKey = string> {
148
+ resolve(generationKey: GenerationKey, signal: AbortSignal): Promise<McpAdmittedRuntimeGeneration>;
149
+ }
150
+ /**
151
+ * A key-free, bounded state transition suitable for metrics and diagnostics.
152
+ * It intentionally omits endpoints, server names, generation keys, payloads,
153
+ * error messages, and credentials.
154
+ */
155
+ interface McpRuntimeStateTransitionEvent {
156
+ readonly type: "runtime.state.changed";
157
+ readonly timestamp: number;
158
+ readonly phase: McpRuntimePhase;
159
+ readonly previousPhase?: McpRuntimePhase;
160
+ readonly errorCode?: McpRuntimeStateErrorCode;
161
+ readonly protocolEra?: McpRuntimeProtocolEra;
162
+ readonly capabilities?: McpRuntimeCapabilitiesSnapshot;
163
+ }
164
+ type McpRuntimeStateListener = (event: McpRuntimeStateTransitionEvent) => MaybePromise<void>;
165
+ interface McpRuntimeManagerOptions<GenerationKey = string> {
166
+ readonly generationResolver: McpRuntimeGenerationResolver<GenerationKey>;
167
+ readonly maxConnections?: number;
168
+ /** Global bound on operations waiting behind exclusive work; defaults to 100. */
169
+ readonly maxQueuedOperations?: number;
170
+ /** Concurrent isolated operations per admissionKey, including cleanup. Defaults to four. */
171
+ readonly maxConcurrentOperationsPerAdmissionKey?: number | null;
172
+ /** Maximum retained generation state projections; must be at least maxConnections. */
173
+ readonly maxStateEntries?: number;
174
+ readonly requestTimeoutMs?: number;
175
+ readonly shutdownTimeoutMs?: number;
176
+ readonly maxDiscoveryPages?: number;
177
+ readonly maxDiscoveryItems?: number;
178
+ /** Identity advertised by every short-lived managed MCP client runtime. */
179
+ readonly clientInfo?: NonNullable<McpClientRuntimeOptions["clientInfo"]>;
180
+ /** Receives operation lifecycle events from every managed client runtime. */
181
+ readonly observer?: McpLifecycleObserver;
182
+ /** Unix epoch milliseconds, injectable for deterministic state and runtime snapshots. */
183
+ readonly now?: () => number;
184
+ /** Listener failures never alter runtime lifecycle; this hook receives them best-effort. */
185
+ readonly onListenerError?: (error: unknown, event: McpRuntimeStateTransitionEvent) => MaybePromise<void>;
186
+ }
187
+ /**
188
+ * Per-call controls for the manager's convenience tool invocation.
189
+ *
190
+ * Pinning `toolDefinition` keeps the managed client runtime's structured output
191
+ * validation bound to that exact definition instead of a cached `tools/list`
192
+ * view, so a host that already holds an approved definition never validates a
193
+ * result against a drifted schema.
194
+ */
195
+ interface McpRuntimeToolCallOptions {
196
+ readonly signal?: AbortSignal;
197
+ /** Defaults to `"shared"`; exclusive calls do not require an online keeper. */
198
+ readonly leaseMode?: McpRuntimeOperationLeaseMode;
199
+ /** Stable opaque connector identity across generations. Required for concurrent calls;
200
+ * supply the same identity to exclusive calls for mutual exclusion. Never logged. */
201
+ readonly admissionKey?: string;
202
+ /** Defaults to `"reject"`; requires `leaseMode: "exclusive"` when set to `"queue"`. */
203
+ readonly exclusiveContention?: "reject" | "queue";
204
+ /** Opt into bounded waiting for isolated concurrent calls, including process capacity. */
205
+ readonly concurrentContention?: "reject" | "queue";
206
+ /** Host-owned connector limit; null removes the per-key ceiling, undefined uses the manager default. */
207
+ readonly maxConcurrentOperations?: number | null;
208
+ /** Bounded, key-free admission timing. Observer failures never alter execution. */
209
+ readonly onAdmission?: (event: McpRuntimeAdmissionEvent) => void;
210
+ readonly toolDefinition?: Tool;
211
+ }
212
+ interface McpRuntimeManagerPort<GenerationKey = string> {
213
+ ensureOnline(generationKey: GenerationKey, signal?: AbortSignal): Promise<McpRuntimeStateSnapshot>;
214
+ setOffline(generationKey: GenerationKey): Promise<McpRuntimeStateSnapshot>;
215
+ retire(generationKey: GenerationKey): Promise<void>;
216
+ probe(generationKey: GenerationKey, options?: AbortSignal | McpRuntimeOperationOptions): Promise<McpRuntimeProbeSnapshot>;
217
+ refreshCatalog(generationKey: GenerationKey, options?: AbortSignal | McpRuntimeOperationOptions): Promise<McpRuntimeCatalogSnapshot>;
218
+ /** Execute a protocol-aware integration operation under the generation's managed lease. */
219
+ withClientRuntime<Result>(generationKey: GenerationKey, operation: McpManagedClientRuntimeOperation<Result>, options?: AbortSignal | McpRuntimeOperationOptions): Promise<Result>;
220
+ /** A positional `AbortSignal` stays accepted as the cancellation-only form of the options. */
221
+ callTool(generationKey: GenerationKey, name: string, arguments_: Readonly<Record<string, unknown>>, options?: AbortSignal | McpRuntimeToolCallOptions): Promise<CallToolResult>;
222
+ readResource(generationKey: GenerationKey, uri: string, options?: AbortSignal | McpRuntimeOperationOptions): Promise<ReadResourceResult>;
223
+ getPrompt(generationKey: GenerationKey, name: string, arguments_: Readonly<Record<string, string>> | undefined, options?: AbortSignal | McpRuntimeOperationOptions): Promise<GetPromptResult>;
224
+ state(generationKey: GenerationKey): McpRuntimeStateSnapshot;
225
+ snapshot(): McpRuntimeManagerSnapshot;
226
+ subscribe(listener: McpRuntimeStateListener): () => void;
227
+ close(): Promise<void>;
228
+ [Symbol.asyncDispose](): Promise<void>;
229
+ }
230
+ //#endregion
231
+ //#region src/runtime-manager.d.ts
232
+ declare const MCP_RUNTIME_MANAGER_DEFAULTS: Readonly<{
233
+ maxConnections: 100;
234
+ maxQueuedOperations: 100;
235
+ maxConcurrentOperationsPerAdmissionKey: 4;
236
+ maxStateEntries: 1000;
237
+ requestTimeoutMs: 10000;
238
+ shutdownTimeoutMs: 30000;
239
+ maxDiscoveryPages: 16;
240
+ maxDiscoveryItems: 1000;
241
+ }>;
242
+ declare class McpRuntimeManager<GenerationKey = string> implements McpRuntimeManagerPort<GenerationKey>, AsyncDisposable {
243
+ #private;
244
+ constructor(options: McpRuntimeManagerOptions<GenerationKey>);
245
+ ensureOnline(generationKey: GenerationKey, signal?: AbortSignal): Promise<McpRuntimeStateSnapshot>;
246
+ setOffline(generationKey: GenerationKey): Promise<McpRuntimeStateSnapshot>;
247
+ retire(generationKey: GenerationKey): Promise<void>;
248
+ probe(generationKey: GenerationKey, options?: AbortSignal | McpRuntimeOperationOptions): Promise<McpRuntimeProbeSnapshot>;
249
+ refreshCatalog(generationKey: GenerationKey, options?: AbortSignal | McpRuntimeOperationOptions): Promise<McpRuntimeCatalogSnapshot>;
250
+ withClientRuntime<Result>(generationKey: GenerationKey, operation: McpManagedClientRuntimeOperation<Result>, options?: AbortSignal | McpRuntimeOperationOptions): Promise<Result>;
251
+ callTool(generationKey: GenerationKey, name: string, arguments_: Readonly<Record<string, unknown>>, options?: AbortSignal | McpRuntimeToolCallOptions): Promise<CallToolResult>;
252
+ readResource(generationKey: GenerationKey, uri: string, options?: AbortSignal | McpRuntimeOperationOptions): Promise<ReadResourceResult>;
253
+ getPrompt(generationKey: GenerationKey, name: string, arguments_: Readonly<Record<string, string>> | undefined, options?: AbortSignal | McpRuntimeOperationOptions): Promise<GetPromptResult>;
254
+ state(generationKey: GenerationKey): McpRuntimeStateSnapshot;
255
+ snapshot(): McpRuntimeManagerSnapshot;
256
+ subscribe(listener: McpRuntimeStateListener): () => void;
257
+ close(): Promise<void>;
258
+ [Symbol.asyncDispose](): Promise<void>;
259
+ }
260
+ //#endregion
261
+ //#region src/runtime-ownership.d.ts
262
+ declare const MCP_RUNTIME_OWNERSHIP_DEFAULTS: Readonly<{
263
+ maxOwners: 1000;
264
+ maxGenerations: 1000;
265
+ maxReferences: 10000;
266
+ }>;
267
+ declare const MCP_RUNTIME_OWNERSHIP_INVALID_OPTIONS: "MCP_RUNTIME_OWNERSHIP_INVALID_OPTIONS";
268
+ declare const MCP_RUNTIME_OWNERSHIP_CAPACITY_EXCEEDED: "MCP_RUNTIME_OWNERSHIP_CAPACITY_EXCEEDED";
269
+ declare const MCP_RUNTIME_OWNER_RELEASED: "MCP_RUNTIME_OWNER_RELEASED";
270
+ declare const MCP_RUNTIME_GENERATION_FENCED: "MCP_RUNTIME_GENERATION_FENCED";
271
+ declare const MCP_RUNTIME_RETIREMENT_FAILED: "MCP_RUNTIME_RETIREMENT_FAILED";
272
+ type McpRuntimeOwnershipErrorCode = typeof MCP_RUNTIME_OWNERSHIP_INVALID_OPTIONS | typeof MCP_RUNTIME_OWNERSHIP_CAPACITY_EXCEEDED | typeof MCP_RUNTIME_OWNER_RELEASED | typeof MCP_RUNTIME_GENERATION_FENCED | typeof MCP_RUNTIME_RETIREMENT_FAILED;
273
+ /** Stable ownership failure that never retains a generation key or caught manager error. */
274
+ declare class McpRuntimeOwnershipError extends Error {
275
+ readonly code: McpRuntimeOwnershipErrorCode;
276
+ constructor(code: McpRuntimeOwnershipErrorCode, message: string);
277
+ }
278
+ /** The only manager operation taken into ownership by this coordinator. */
279
+ type McpRuntimeRetirementPort<GenerationKey> = Pick<McpRuntimeManagerPort<GenerationKey>, "retire">;
280
+ interface McpRuntimeOwnershipOptions<GenerationKey> {
281
+ readonly manager: McpRuntimeRetirementPort<GenerationKey>;
282
+ /** Hard bound over live owner capabilities. */
283
+ readonly maxOwners?: number;
284
+ /** Hard bound over active generations and retained retirement fences. */
285
+ readonly maxGenerations?: number;
286
+ /** Hard bound over distinct owner-to-generation references. */
287
+ readonly maxReferences?: number;
288
+ }
289
+ interface McpRuntimeOwner<GenerationKey> extends AsyncDisposable {
290
+ readonly released: boolean;
291
+ /** Retains after any older retirement barrier settles; concurrent duplicates share one task. */
292
+ retain(generationKey: GenerationKey): Promise<void>;
293
+ /** Releases every retained generation. Repeated calls share one settlement. */
294
+ release(): Promise<void>;
295
+ }
296
+ /** Aggregate diagnostics deliberately omit generation keys and manager failures. */
297
+ interface McpRuntimeOwnershipSnapshot {
298
+ readonly maxOwners: number;
299
+ readonly maxGenerations: number;
300
+ readonly maxReferences: number;
301
+ readonly ownerCount: number;
302
+ readonly generationCount: number;
303
+ readonly referenceCount: number;
304
+ readonly pendingReferenceCount: number;
305
+ readonly retiringGenerationCount: number;
306
+ readonly fencedGenerationCount: number;
307
+ }
308
+ /**
309
+ * Bounded, framework-neutral cooperative ownership for opaque runtime generations.
310
+ *
311
+ * Equal keys use `Map` identity. The final cooperative release retires the manager generation.
312
+ * `forceRetire` immediately revokes every current reference and permanently fences every owner
313
+ * that existed when the force began. No retain can cross an unsettled retirement barrier.
314
+ */
315
+ declare class McpRuntimeOwnership<GenerationKey> {
316
+ #private;
317
+ constructor(options: McpRuntimeOwnershipOptions<GenerationKey>);
318
+ createOwner(): McpRuntimeOwner<GenerationKey>;
319
+ /**
320
+ * Retires a generation regardless of cooperative references.
321
+ * Repeated calls against the same generation barrier share one settlement.
322
+ */
323
+ forceRetire(generationKey: GenerationKey): Promise<void>;
324
+ snapshot(): McpRuntimeOwnershipSnapshot;
325
+ }
326
+ //#endregion
327
+ //#region src/runtime-snapshots.d.ts
328
+ /** Every `McpRuntimePhase`, in lifecycle order, for hosts that persist state projections. */
329
+ declare const MCP_RUNTIME_PHASES: readonly ["offline", "queued", "connecting", "online", "degraded", "draining", "failed", "quarantined"];
330
+ /** Every `McpRuntimeProtocolEra` a connected managed generation can report. */
331
+ declare const MCP_RUNTIME_PROTOCOL_ERAS: readonly ["legacy", "modern"];
332
+ /**
333
+ * Standard Schema v1 validator for one snapshot shape produced by the manager.
334
+ *
335
+ * Validation is synchronous and dependency-free. It accepts exactly what the
336
+ * manager itself emits, rejects unknown properties, and returns a frozen
337
+ * normalized snapshot so persisting a validated value round-trips unchanged.
338
+ *
339
+ * @see https://standardschema.dev
340
+ */
341
+ type McpRuntimeSnapshotSchema<Snapshot> = StandardSchemaV1Sync<unknown, Snapshot>;
342
+ /** Validates a persisted `McpRuntimeCapabilitiesSnapshot`. */
343
+ declare const mcpRuntimeCapabilitiesSnapshotSchema: McpRuntimeSnapshotSchema<McpRuntimeCapabilitiesSnapshot>;
344
+ /** Validates a persisted `McpRuntimeStateSnapshot`, including an optional capability projection. */
345
+ declare const mcpRuntimeStateSnapshotSchema: McpRuntimeSnapshotSchema<McpRuntimeStateSnapshot>;
346
+ /** Validates a persisted `McpRuntimeProbeSnapshot`, including its nested state projection. */
347
+ declare const mcpRuntimeProbeSnapshotSchema: McpRuntimeSnapshotSchema<McpRuntimeProbeSnapshot>;
348
+ //#endregion
349
+ export { MCP_RUNTIME_ADMISSION_TIMEOUT, MCP_RUNTIME_CAPACITY_EXCEEDED, MCP_RUNTIME_CLEANUP_FAILED, MCP_RUNTIME_CONNECTION_LOST, MCP_RUNTIME_DISCOVERY_LIMIT_EXCEEDED, MCP_RUNTIME_GENERATION_FENCED, MCP_RUNTIME_GENERATION_RETIRED, MCP_RUNTIME_LEASE_MODE_CONFLICT, MCP_RUNTIME_MANAGER_CLOSED, MCP_RUNTIME_MANAGER_DEFAULTS, MCP_RUNTIME_NOT_READY, MCP_RUNTIME_OWNERSHIP_CAPACITY_EXCEEDED, MCP_RUNTIME_OWNERSHIP_DEFAULTS, MCP_RUNTIME_OWNERSHIP_INVALID_OPTIONS, MCP_RUNTIME_OWNER_RELEASED, MCP_RUNTIME_PHASES, MCP_RUNTIME_PROTOCOL_ERAS, MCP_RUNTIME_QUARANTINED, MCP_RUNTIME_QUEUE_FULL, MCP_RUNTIME_RETIREMENT_FAILED, MCP_RUNTIME_UPSTREAM_FAILED, type McpAdmittedRuntimeGeneration, type McpManagedClientRuntime, type McpManagedClientRuntimeContext, type McpManagedClientRuntimeOperation, type McpRuntimeAdmissionEvent, type McpRuntimeCapabilitiesSnapshot, type McpRuntimeCatalogSnapshot, type McpRuntimeGenerationResolver, McpRuntimeManager, McpRuntimeManagerError, type McpRuntimeManagerErrorCode, type McpRuntimeManagerOptions, type McpRuntimeManagerPort, type McpRuntimeManagerSnapshot, type McpRuntimeOperationLeaseMode, type McpRuntimeOperationOptions, type McpRuntimeOwner, McpRuntimeOwnership, McpRuntimeOwnershipError, type McpRuntimeOwnershipErrorCode, type McpRuntimeOwnershipOptions, type McpRuntimeOwnershipSnapshot, type McpRuntimePhase, type McpRuntimeProbeSnapshot, type McpRuntimeProtocolEra, type McpRuntimeRetirementPort, type McpRuntimeSnapshotSchema, type McpRuntimeStateErrorCode, type McpRuntimeStateListener, type McpRuntimeStateSnapshot, type McpRuntimeStateTransitionEvent, type McpRuntimeToolCallOptions, mcpRuntimeCapabilitiesSnapshotSchema, mcpRuntimeProbeSnapshotSchema, mcpRuntimeStateSnapshotSchema };
350
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors.ts","../src/types.ts","../src/runtime-manager.ts","../src/runtime-ownership.ts","../src/runtime-snapshots.ts"],"mappings":"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"}