@sentropic/cluster-mesh 0.15.0 → 0.18.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.
Files changed (77) hide show
  1. package/README.md +53 -14
  2. package/dist/compose/mcp.d.ts +87 -0
  3. package/dist/compose/mcp.d.ts.map +1 -0
  4. package/dist/compose/mcp.js +186 -0
  5. package/dist/compose/mcp.js.map +1 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +2 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/integrations/mcp/artifacts.d.ts +19 -0
  11. package/dist/integrations/mcp/artifacts.d.ts.map +1 -0
  12. package/dist/integrations/mcp/artifacts.js +26 -0
  13. package/dist/integrations/mcp/artifacts.js.map +1 -0
  14. package/dist/loaders/mcp/artifacts.d.ts +9 -0
  15. package/dist/loaders/mcp/artifacts.d.ts.map +1 -0
  16. package/dist/loaders/mcp/artifacts.js +10 -0
  17. package/dist/loaders/mcp/artifacts.js.map +1 -0
  18. package/dist/loaders/mcp/bridge.d.ts +8 -0
  19. package/dist/loaders/mcp/bridge.d.ts.map +1 -0
  20. package/dist/loaders/mcp/bridge.js +9 -0
  21. package/dist/loaders/mcp/bridge.js.map +1 -0
  22. package/dist/loaders/mcp/entry.d.ts +8 -0
  23. package/dist/loaders/mcp/entry.d.ts.map +1 -0
  24. package/dist/loaders/mcp/entry.js +9 -0
  25. package/dist/loaders/mcp/entry.js.map +1 -0
  26. package/dist/loaders/mcp/hono.d.ts +8 -0
  27. package/dist/loaders/mcp/hono.d.ts.map +1 -0
  28. package/dist/loaders/mcp/hono.js +9 -0
  29. package/dist/loaders/mcp/hono.js.map +1 -0
  30. package/dist/loaders/mcp/index.d.ts +7 -0
  31. package/dist/loaders/mcp/index.d.ts.map +1 -0
  32. package/dist/loaders/mcp/index.js +7 -0
  33. package/dist/loaders/mcp/index.js.map +1 -0
  34. package/dist/loaders/mcp/registry.d.ts +8 -0
  35. package/dist/loaders/mcp/registry.d.ts.map +1 -0
  36. package/dist/loaders/mcp/registry.js +9 -0
  37. package/dist/loaders/mcp/registry.js.map +1 -0
  38. package/dist/loaders/mcp/stdio.d.ts +8 -0
  39. package/dist/loaders/mcp/stdio.d.ts.map +1 -0
  40. package/dist/loaders/mcp/stdio.js +9 -0
  41. package/dist/loaders/mcp/stdio.js.map +1 -0
  42. package/dist/mcp/registry.d.ts +38 -0
  43. package/dist/mcp/registry.d.ts.map +1 -0
  44. package/dist/mcp/registry.js +171 -0
  45. package/dist/mcp/registry.js.map +1 -0
  46. package/dist/mcp/stdio.d.ts +37 -0
  47. package/dist/mcp/stdio.d.ts.map +1 -0
  48. package/dist/mcp/stdio.js +47 -0
  49. package/dist/mcp/stdio.js.map +1 -0
  50. package/dist/mesh.d.ts +9 -1
  51. package/dist/mesh.d.ts.map +1 -1
  52. package/dist/mesh.js +4 -2
  53. package/dist/mesh.js.map +1 -1
  54. package/dist/modules/catalog.d.ts +11 -4
  55. package/dist/modules/catalog.d.ts.map +1 -1
  56. package/dist/modules/catalog.js +28 -4
  57. package/dist/modules/catalog.js.map +1 -1
  58. package/dist/modules/contracts.d.ts +1 -1
  59. package/dist/modules/contracts.d.ts.map +1 -1
  60. package/dist/modules/contracts.js +6 -0
  61. package/dist/modules/contracts.js.map +1 -1
  62. package/dist/modules/topology-guard-mcp.d.ts +2 -0
  63. package/dist/modules/topology-guard-mcp.d.ts.map +1 -0
  64. package/dist/modules/topology-guard-mcp.js +7 -0
  65. package/dist/modules/topology-guard-mcp.js.map +1 -0
  66. package/dist/token-exchange.d.ts +176 -0
  67. package/dist/token-exchange.d.ts.map +1 -0
  68. package/dist/token-exchange.js +377 -0
  69. package/dist/token-exchange.js.map +1 -0
  70. package/dist/trust/token-exchange-http.d.ts +93 -0
  71. package/dist/trust/token-exchange-http.d.ts.map +1 -0
  72. package/dist/trust/token-exchange-http.js +364 -0
  73. package/dist/trust/token-exchange-http.js.map +1 -0
  74. package/dist/trust.d.ts +2 -7
  75. package/dist/trust.d.ts.map +1 -1
  76. package/dist/trust.js.map +1 -1
  77. package/package.json +30 -4
package/README.md CHANGED
@@ -103,7 +103,7 @@ topology introduced in 0.1: one Sentropic server, its attached local workstation
103
103
  local signed projections, and the existing device-code lifecycle. It does not
104
104
  implement server-to-server federation.
105
105
 
106
- ## Lazy integration surface (0.12+, tuple of 0.13)
106
+ ## Lazy integration surface (0.12+, tuple of 0.14)
107
107
 
108
108
  Cluster Mesh is the single integration surface for llm-mesh and llm-gateway. Those
109
109
  providers stay independent packages and never depend on cluster-mesh. They are
@@ -112,14 +112,22 @@ providers stay independent packages and never depend on cluster-mesh. They are
112
112
 
113
113
  | Entry | Provider | Selected optional peers |
114
114
  |---|---|---|
115
- | `/llm-mesh`, `/llm-mesh/facade`, `/llm-mesh/enrollment`, `/llm-mesh/node`, `/llm-mesh/transport/cloud-code` | matching `@sentropic/llm-mesh` entry | `@sentropic/llm-mesh >=0.22.0 <0.23.0` |
116
- | `/gateway` | `@sentropic/llm-gateway` root (neither auth mode) | llm-mesh + `@sentropic/llm-gateway >=0.19.0 <0.20.0` |
115
+ | `/llm-mesh`, `/llm-mesh/facade`, `/llm-mesh/enrollment`, `/llm-mesh/node`, `/llm-mesh/transport/cloud-code` | matching `@sentropic/llm-mesh` entry | `@sentropic/llm-mesh >=0.22.0 <0.27.0` |
116
+ | `/gateway` | `@sentropic/llm-gateway` root (neither auth mode) | llm-mesh + `@sentropic/llm-gateway >=0.19.0 <0.21.0` |
117
117
  | `/gateway/auth` (service mode) | `@sentropic/llm-gateway/auth` | gateway + `@sentropic/mcp-auth >=0.2.1 <0.3.0`, `jose ^5.10.0` |
118
- | `/gateway/auth-hono` (session mode) | `@sentropic/llm-gateway/auth-hono` | gateway + `@sentropic/auth-hono ^0.15.0` |
118
+ | `/gateway/auth-hono` (session mode) | `@sentropic/llm-gateway/auth-hono` | gateway + `@sentropic/auth-hono ^0.15.0 \|\| ^0.16.0` |
119
119
  | `/loaders/<leaf>` | async typed loader (`loadLlmMesh`, `loadGateway`, `loadGatewayAuth`, ...) | as its leaf, resolved on call |
120
120
  | `/compose/llm-mesh`, `/compose/gateway` | `createLlmMeshNamespaceModule`, `createGatewayNamespaceModule` | as the loaders they call |
121
+ | `/mcp/registry`, `/mcp/stdio` | `@sentropic/mcp-platform` MCP kernel entries | `@sentropic/mcp-platform >=0.3.0 <0.4.0` (plus `@modelcontextprotocol/sdk ^1.31.0` for the stdio transport) |
122
+ | `/compose/mcp`, `/loaders/mcp` | `createMcpNamespaceModule`, `loadMcpPlatform{Registry,Stdio,Bridge,Entry,Hono}` | as its leaf, resolved on call |
123
+ | `/mcp/artifacts` | `createArtifactsBuiltin` over `@sentropic/artifacts/mcp` | `@sentropic/artifacts >=0.1.0 <0.2.0`, `@sentropic/mcp-platform >=0.3.0 <0.4.0` |
121
124
 
122
- Static leaves are `export *` re-exports of the provider namespace: same values,
125
+ The `./mcp/artifacts` export provides the `sentropic.artifacts` builtin factory;
126
+ its optional `@sentropic/artifacts >=0.1.0 <0.2.0` peer must be installed when
127
+ that leaf is imported. `loadArtifactsMcp` from `./loaders/mcp` acquires the same
128
+ provider through the module registry. The root entry remains usable without it.
129
+
130
+ Static provider re-export leaves use `export *`: same values,
123
131
  types, overloads and class identity. Importing a leaf selects that provider; a
124
132
  missing provider fails native ESM linking of the importing module. Loaders take a
125
133
  registry from `createClusterMeshModules({ disabled? })` (one per composition root) and
@@ -129,7 +137,7 @@ load_failed | source_unavailable`). Recognize it with `isClusterMeshModuleUnavai
129
137
  or by `code`, never by `instanceof` (duplicate copies have distinct constructors).
130
138
  `modules.probe()` reports metadata-only availability without evaluating providers;
131
139
  pass `modules` to `createDegenerateClusterMesh` to expose `capabilities.modules`.
132
- MCP and other catalogued capabilities are listed as `source_unavailable` until a
140
+ Other catalogued capabilities are listed as `source_unavailable` until a
133
141
  later minor delivers them.
134
142
 
135
143
  **Startup preflight (fail closed before bind).** llm-gateway imports its auth peers
@@ -151,7 +159,7 @@ the llm-mesh range; gateway entries check the llm-gateway and llm-mesh ranges. R
151
159
  are checked on the copies cluster-mesh actually resolves (llm-mesh and llm-gateway from
152
160
  its own physical location, the gateway's llm-mesh from the gateway's location), release
153
161
  versions only: a prerelease version never satisfies, and `+build` metadata is ignored
154
- as npm does (`0.22.0+build.1` satisfies `>=0.22.0 <0.23.0`). An absent
162
+ as npm does (`0.26.0+build.1` satisfies `>=0.22.0 <0.27.0`). An absent
155
163
  provider is left to the leaf import itself.
156
164
  Copies are keyed by module URL without `?query`/`#hash`: a copy loaded from another
157
165
  path (nested install, `npm link`, a `--preserve-symlinks` link path) is a duplicate,
@@ -169,7 +177,7 @@ next to it (remove that gateway copy or align its llm-mesh).
169
177
  **Consumer rules.** Every manifest that declares cluster-mesh and imports a leaf
170
178
  also declares that leaf's selected peers at the qualified versions; the installed
171
179
  tree must hold exactly one cluster-mesh and one llm-mesh shared with the gateway.
172
- 0.13.0 is qualified with **npm only** (flat project installs, `npm ci` from a lockfile,
180
+ 0.16.0 is qualified with **npm only** (flat project installs, `npm ci` from a lockfile,
173
181
  and a global consumer beside a separately installed runtime); other package managers
174
182
  are not qualified. The tested bundler is esbuild with `@sentropic/cluster-mesh` **and**
175
183
  `@sentropic/cluster-mesh/*` (and the peer packages) externalized, which keeps the
@@ -177,11 +185,20 @@ resolution anchor at the installed package; bundling the root inline (as the API
177
185
  build does) embeds no provider code. TypeScript >= 5.7 is required with
178
186
  `skipLibCheck: false` (hono's declarations); with `skipLibCheck: true`, a missing
179
187
  peer surfaces as TS2305 on the named import. Frozen tuple (committed lockfile):
180
- cluster-mesh 0.13.0, llm-mesh 0.22.0, llm-gateway 0.19.0, mcp-auth 0.2.1,
181
- oauth-verify 0.1.0, jose 5.10.0, hono 4.10.7; session mode with auth-hono 0.15.0
182
- (llm-gateway 0.19.0's declared peer range `^0.15.0`); the latest versions inside
188
+ cluster-mesh 0.18.0, llm-mesh 0.26.1, llm-gateway 0.20.1, mcp-auth 0.2.2,
189
+ oauth-verify 0.1.0, jose 5.10.0, hono 4.13.0; session mode with auth-hono 0.16.0
190
+ (llm-gateway 0.20.1's declared peer range `^0.15.0 || ^0.16.0`); the latest versions inside
183
191
  every declared range are re-qualified on each release run. The previous tuple
184
192
  (llm-mesh 0.21.x, llm-gateway 0.18.x) is refused, see "Upgrading to 0.13" below.
193
+
194
+ The current release target is **cluster-mesh 0.18.0, llm-mesh 0.26.1 and
195
+ llm-gateway 0.20.1** (cluster-mesh 0.18.0 is the unpublished branch candidate;
196
+ main carries llm-mesh 0.26.1 and llm-gateway 0.20.0 — see the Post-Rebase Gate in
197
+ BRANCH.md). Final sibling archive qualification
198
+ and the selected-lock integrity refresh remain release gates; the selected fixture
199
+ retains the baseline until that final refresh. The widened ranges retain the prior
200
+ qualified minors.
201
+
185
202
  Release-train runs qualify the unpublished llm-mesh and llm-gateway candidates from
186
203
  same-PR sibling archives validated by the CI `loadSiblings` rules (sha256, packed
187
204
  identity and manifest guard, receipts packed from the current commit, no unlisted
@@ -190,6 +207,11 @@ SIBLING_ARCHIVES_FILE=tmp/ci-manifest-guard/siblings/cluster-mesh/receipts.json`
190
207
  receipt for cluster-mesh itself replaces the local pack as the qualified candidate. The
191
208
  committed `selected` lockfile carries their registry URL and the sha512 of those bytes.
192
209
 
210
+ **Upgrading to 0.16.** Gateway 0.20.0 requires llm-mesh `^0.26.0`: upgrade both
211
+ providers in the same artifact and keep their physical llm-mesh instance shared.
212
+ Cluster-mesh 0.16.0 also accepts the prior 0.22.x / 0.19.x tuple. Prereleases
213
+ are refused.
214
+
193
215
  **Upgrading to 0.13.** Bump cluster-mesh 0.13, llm-mesh 0.22 and llm-gateway 0.19 in
194
216
  the same commit; npm may not error on a partial bump. Measured with npm 11.19: a
195
217
  consumer keeping its own `^0.21.2`/`^0.18.0` pins fails with `ERESOLVE`, while
@@ -203,6 +225,12 @@ loaders (`modules.load('gateway')`) refuse with `cluster_mesh_module_unavailable
203
225
  `incompatible_version` as well. `verifyClusterMeshTopology()` is an optional earlier
204
226
  check for hosts that mount routes before importing any leaf.
205
227
 
228
+ **Upgrading to 0.16.** Cluster-mesh 0.16.0 is a minor with no runtime change from
229
+ main's 0.15.0 (the live-storage registration export is inherited): it keeps
230
+ the `>=0.22.0 <0.27.0` / `>=0.19.0 <0.21.0` peer ceilings and qualifies the
231
+ llm-mesh 0.26.0 + llm-gateway 0.20.0 train. It supersedes main's 0.15.0 (taken by
232
+ PR #664, which merged first) strictly greater than npm (0.15.0) and main (0.15.0).
233
+
206
234
  **Namespace remap.** `createClusterMeshPlugin({ mounts })` mounts each enabled module
207
235
  once at `mounts[namespace] ?? namespace`. A standalone gateway host passes
208
236
  `mounts: { '/gw': '/' }` and serves exactly `/healthz`, `/readyz`, `/v1/messages`,
@@ -256,17 +284,28 @@ qualification and is rejected in production.
256
284
 
257
285
  ## Gated seams
258
286
 
259
- The public surface already defines the future federal ports, but the v1 runtime fails
260
- closed for all of them:
287
+ The public surface already defines the future federal ports. The v1 runtime fails
288
+ closed for all of them except RFC 8693 token exchange, which is available when a
289
+ binding plus policy is configured (see below):
261
290
 
262
291
  - inter-server discovery and member revocation;
263
- - RFC 8693 token exchange;
264
292
  - remote signed-projection resolution;
265
293
  - memory snapshot replication and purge.
266
294
 
267
295
  Invoking one of these seams throws `CapabilityGatedError`. The package exposes no broker
268
296
  HTTP route, trusted-issuer store, inter-server directory, or replication runtime.
269
297
 
298
+ ## RFC 8693 token exchange (configured)
299
+
300
+ `createDegenerateClusterMesh({ tokenExchange })` wires the exchange client when the
301
+ binding plus policy passes its local preflight; otherwise `capabilities.tokenExchange`
302
+ stays `'gated'`. The production binding (`trust/token-exchange-http.ts`) performs an
303
+ authenticated RFC 8693 form POST with `client_secret_basic`, validates the returned
304
+ token (signature, issuer, exact audience, subject, workload `client_id`, mandatory
305
+ `act`, scope subset, TTL ceilings), and caches it for at most 60 seconds with an
306
+ early-use safety margin. `tokenExchange: 'available'` proves only this trust/egress
307
+ port: it neither delivers the MCP provider registry nor qualifies any module leaf.
308
+
270
309
  ## Construction
271
310
 
272
311
  `createDegenerateClusterMesh` composes the membership, trust, wrap, device, and
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Lot 7 — mesh composition over the compiled plan
3
+ * (`@sentropic/cluster-mesh/compose/mcp`, spec-v8 §3).
4
+ *
5
+ * Preflights the platform leaves (bridge + hono mount) before anything
6
+ * binds, checks bridge/plan coherence (every bridge tool resolves by exact
7
+ * name in the compiled registry), then serves `/mcp` through per-request
8
+ * verified servers. B1: every `/mcp` request is verified through the mesh
9
+ * verified-invocation context port (401 when unverified); the per-request
10
+ * runner chain uses the verified-derived identity only — client headers are
11
+ * never authority (the bridge forwards the host mount identity only).
12
+ * Authorization chains per call: verified identity → host `contextResolver`
13
+ * → compiled-plan `policy` (`authorizeDispatch`) → host `invocation` guard
14
+ * → host `runner`. A refusal stops before any tool effect. The classic
15
+ * `/invoke` path routes through the same policy-guarded chain with the
16
+ * host-verified principal. Per-request servers are required: a shared
17
+ * server cannot bind per-request verified principals, so `stateful` mounts
18
+ * are unsupported here (the platform host-owned mount keeps its own mode).
19
+ */
20
+ import '../modules/topology-guard-mcp.js';
21
+ import type { WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
22
+ import type { ClusterMeshHonoNamespaceModule } from '../hono/plugin.js';
23
+ import type { ClusterMeshModules } from '../modules/contracts.js';
24
+ import type { CompiledMcpRegistry } from '@sentropic/mcp-platform/registry';
25
+ import type { BridgeRunner, BridgeTool, RequestIdentity } from '@sentropic/mcp-platform/transport/bridge';
26
+ import type { McpHonoOptions, McpPrincipal } from '@sentropic/mcp-platform/hono';
27
+ export interface McpInvocationGuard {
28
+ authorize(input: {
29
+ operation: 'invoke';
30
+ principal: McpPrincipal;
31
+ tool: string;
32
+ }): Promise<{
33
+ allowed: true;
34
+ } | {
35
+ allowed: false;
36
+ reason: string;
37
+ status?: 403 | 409 | 503;
38
+ }>;
39
+ }
40
+ export interface McpNamespaceOptions {
41
+ registry: CompiledMcpRegistry;
42
+ tools: readonly BridgeTool[];
43
+ runner: BridgeRunner;
44
+ auth: McpHonoOptions['auth'];
45
+ contextResolver(identity: RequestIdentity | undefined): McpPrincipal | Promise<McpPrincipal>;
46
+ invocation: McpInvocationGuard;
47
+ createTransport(): WebStandardStreamableHTTPServerTransport;
48
+ /**
49
+ * Runtime generation id bound into every verified `/mcp` invocation
50
+ * (mirrors the mesh invocation context contract; host-supplied).
51
+ */
52
+ generationId: string;
53
+ }
54
+ /**
55
+ * Compiled-plan policy hook: runs after principal resolution, before the
56
+ * host invocation guard. Reasons become stable wire error codes, so they
57
+ * must be kebab-case plan codes (see `createRegistryPolicy`).
58
+ */
59
+ export interface GuardedRunnerPolicy {
60
+ authorize(input: {
61
+ tool: string;
62
+ principal: McpPrincipal;
63
+ }): Promise<{
64
+ allowed: true;
65
+ } | {
66
+ allowed: false;
67
+ reason: string;
68
+ status?: 403 | 409 | 503;
69
+ }>;
70
+ }
71
+ export interface GuardedRunnerOptions {
72
+ contextResolver(identity: RequestIdentity | undefined): McpPrincipal | Promise<McpPrincipal>;
73
+ invocation: McpInvocationGuard;
74
+ runner: BridgeRunner;
75
+ policy?: GuardedRunnerPolicy;
76
+ }
77
+ /** Compiled-plan policy over `authorizeDispatch` (unknown tool/scope/claims). */
78
+ export declare function createRegistryPolicy(registry: CompiledMcpRegistry): GuardedRunnerPolicy;
79
+ /** Chain verified identity → context → plan policy → guard → runner; refusals stop before effects. */
80
+ export declare function createGuardedRunner(options: GuardedRunnerOptions): BridgeRunner;
81
+ /**
82
+ * Prepare the `/mcp` namespace at composition startup. Missing or
83
+ * incompatible platform leaves, and bridge tools outside the compiled plan,
84
+ * fail startup before any listener binds.
85
+ */
86
+ export declare function createMcpNamespaceModule(modules: ClusterMeshModules, options: McpNamespaceOptions): Promise<ClusterMeshHonoNamespaceModule>;
87
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.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,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,YAAY,CAAA;KAAE,GAAG,OAAO,CAClE;QAAE,OAAO,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;KAAE,CACjF,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,eAAe,CACb,QAAQ,EAAE,eAAe,GAAG,SAAS,GACpC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACxC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,mBAAmB,CAqBvF;AAQD,sGAAsG;AACtG,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,YAAY,CA2B/E;AAWD;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,8BAA8B,CAAC,CAsEzC"}
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Lot 7 — mesh composition over the compiled plan
3
+ * (`@sentropic/cluster-mesh/compose/mcp`, spec-v8 §3).
4
+ *
5
+ * Preflights the platform leaves (bridge + hono mount) before anything
6
+ * binds, checks bridge/plan coherence (every bridge tool resolves by exact
7
+ * name in the compiled registry), then serves `/mcp` through per-request
8
+ * verified servers. B1: every `/mcp` request is verified through the mesh
9
+ * verified-invocation context port (401 when unverified); the per-request
10
+ * runner chain uses the verified-derived identity only — client headers are
11
+ * never authority (the bridge forwards the host mount identity only).
12
+ * Authorization chains per call: verified identity → host `contextResolver`
13
+ * → compiled-plan `policy` (`authorizeDispatch`) → host `invocation` guard
14
+ * → host `runner`. A refusal stops before any tool effect. The classic
15
+ * `/invoke` path routes through the same policy-guarded chain with the
16
+ * host-verified principal. Per-request servers are required: a shared
17
+ * server cannot bind per-request verified principals, so `stateful` mounts
18
+ * are unsupported here (the platform host-owned mount keeps its own mode).
19
+ */
20
+ import '../modules/topology-guard-mcp.js';
21
+ import { randomUUID } from 'node:crypto';
22
+ import { Server as SdkServer } from '@modelcontextprotocol/sdk/server/index.js';
23
+ import { authorizeDispatch } from '@sentropic/mcp-platform/transport/dispatch';
24
+ import { loadMcpPlatformBridge } from '../loaders/mcp/bridge.js';
25
+ import { loadMcpPlatformHono } from '../loaders/mcp/hono.js';
26
+ /** Compiled-plan policy over `authorizeDispatch` (unknown tool/scope/claims). */
27
+ export function createRegistryPolicy(registry) {
28
+ return {
29
+ authorize: async ({ tool, principal }) => {
30
+ const decision = authorizeDispatch({
31
+ registry,
32
+ toolName: tool,
33
+ principal: {
34
+ sub: principal.sub,
35
+ clientId: principal.clientId,
36
+ scopes: [...principal.scopes],
37
+ claims: [],
38
+ },
39
+ });
40
+ if (decision.allowed)
41
+ return { allowed: true };
42
+ return {
43
+ allowed: false,
44
+ reason: decision.code,
45
+ status: (decision.code === 'unknown_tool' ? 409 : 403),
46
+ };
47
+ },
48
+ };
49
+ }
50
+ /** Chain verified identity → context → plan policy → guard → runner; refusals stop before effects. */
51
+ export function createGuardedRunner(options) {
52
+ return {
53
+ run: async (tool, args, identity) => {
54
+ const principal = await options.contextResolver(identity);
55
+ if (options.policy !== undefined) {
56
+ const policy = await options.policy.authorize({ tool, principal });
57
+ if (!policy.allowed) {
58
+ return {
59
+ ok: false,
60
+ auditId: 'namespace-guard',
61
+ redactionClass: 'low',
62
+ error: { code: policy.reason, message: policy.reason, retriable: false },
63
+ };
64
+ }
65
+ }
66
+ const decision = await options.invocation.authorize({ operation: 'invoke', principal, tool });
67
+ if (!decision.allowed) {
68
+ return {
69
+ ok: false,
70
+ auditId: 'namespace-guard',
71
+ redactionClass: 'low',
72
+ error: { code: 'invocation_refused', message: decision.reason, retriable: false },
73
+ };
74
+ }
75
+ return options.runner.run(tool, args, identity);
76
+ },
77
+ };
78
+ }
79
+ function refused(code, message) {
80
+ return {
81
+ ok: false,
82
+ auditId: 'namespace-guard',
83
+ redactionClass: 'low',
84
+ error: { code, message, retriable: false },
85
+ };
86
+ }
87
+ /**
88
+ * Prepare the `/mcp` namespace at composition startup. Missing or
89
+ * incompatible platform leaves, and bridge tools outside the compiled plan,
90
+ * fail startup before any listener binds.
91
+ */
92
+ export async function createMcpNamespaceModule(modules, options) {
93
+ const [bridge, hono] = await Promise.all([
94
+ loadMcpPlatformBridge(modules),
95
+ loadMcpPlatformHono(modules),
96
+ ]);
97
+ for (const tool of options.tools) {
98
+ const resolution = options.registry.resolveTool(tool.name);
99
+ if (resolution === undefined) {
100
+ throw new Error(`Bridge tool '${tool.name}' is not in the compiled plan`);
101
+ }
102
+ }
103
+ const policy = createRegistryPolicy(options.registry);
104
+ const guardedRunner = createGuardedRunner({
105
+ contextResolver: options.contextResolver,
106
+ invocation: options.invocation,
107
+ runner: options.runner,
108
+ policy,
109
+ });
110
+ const guardedRun = (tool, args, identity) => guardedRunner.run(tool, args, identity);
111
+ return {
112
+ namespace: '/mcp',
113
+ enabled: true,
114
+ createRouter: ({ context }) => {
115
+ const router = hono.createMcpPlatformHono({
116
+ auth: options.auth,
117
+ connector: {
118
+ invoke: async (request) => guardedRun(request.capabilityRef, request.input, toRequestIdentity(request.principal)),
119
+ readResource: async () => refused('unsupported_operation', 'Resource reads are not served by this namespace'),
120
+ },
121
+ });
122
+ router.all('/mcp', async (c) => {
123
+ const verified = await verifyMcpInvocation(context, options.generationId, c);
124
+ if (verified === null) {
125
+ return c.json({
126
+ error: {
127
+ code: 'unverified_invocation',
128
+ message: 'Invocation context could not be verified.',
129
+ },
130
+ }, 401);
131
+ }
132
+ const principal = await options.contextResolver(identityFromVerified(verified));
133
+ const requestRunner = createGuardedRunner({
134
+ contextResolver: async () => principal,
135
+ invocation: options.invocation,
136
+ runner: {
137
+ run: (tool, args) => options.runner.run(tool, args, toRequestIdentity(principal)),
138
+ },
139
+ policy,
140
+ });
141
+ const server = new SdkServer({ name: '@sentropic/cluster-mesh/mcp', version: '0.18.0' }, { capabilities: { tools: {} } });
142
+ bridge.registerBridgeTools(server, options.tools, requestRunner);
143
+ const transport = options.createTransport();
144
+ await server.connect(transport);
145
+ return transport.handleRequest(c.req.raw);
146
+ });
147
+ return router;
148
+ },
149
+ };
150
+ }
151
+ /** Derive the runner identity from the verified context (never client headers). */
152
+ function identityFromVerified(verified) {
153
+ return {
154
+ clientId: verified.principal.principalId,
155
+ tenantRef: verified.workspace.workspaceId,
156
+ scopes: [...verified.scopes],
157
+ hasBearer: true,
158
+ };
159
+ }
160
+ /** Derive the runner identity from a host-verified principal (never client headers). */
161
+ function toRequestIdentity(principal) {
162
+ return {
163
+ clientId: principal.clientId,
164
+ ...(principal.tid === null ? {} : { tenantRef: principal.tid }),
165
+ scopes: [...principal.scopes],
166
+ hasBearer: true,
167
+ };
168
+ }
169
+ async function verifyMcpInvocation(context, generationId, c) {
170
+ const invocationId = c.req.header('x-cluster-mesh-invocation-id') ?? randomUUID();
171
+ const evidence = c.req.header('x-cluster-mesh-evidence');
172
+ try {
173
+ return await context.verify({
174
+ invocationId,
175
+ correlationId: c.req.header('x-correlation-id') ?? invocationId,
176
+ generationId,
177
+ method: c.req.method,
178
+ path: c.req.path,
179
+ ...(evidence === undefined ? {} : { authorizationEvidenceRef: evidence }),
180
+ });
181
+ }
182
+ catch {
183
+ return null;
184
+ }
185
+ }
186
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/compose/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG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AAa,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,YAAY;YAC/D,YAAY;YACZ,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM;YACpB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI;YAChB,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,wBAAwB,EAAE,QAAQ,EAAE,CAAC;SAC1E,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,6 +7,8 @@ export * from './mesh.js';
7
7
  export * from './nhi.js';
8
8
  export * from './projection.js';
9
9
  export * from './trust.js';
10
+ export * from './token-exchange.js';
11
+ export * from './trust/token-exchange-http.js';
10
12
  export * from './config.js';
11
13
  export * from './hono/plugin.js';
12
14
  export * from './hono/health-router.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAA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CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,gCAAgC,GACtC,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -7,6 +7,8 @@ export * from './mesh.js';
7
7
  export * from './nhi.js';
8
8
  export * from './projection.js';
9
9
  export * from './trust.js';
10
+ export * from './token-exchange.js';
11
+ export * from './trust/token-exchange-http.js';
10
12
  export * from './config.js';
11
13
  export * from './hono/plugin.js';
12
14
  export * from './hono/health-router.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAA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,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,GAK1B,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import '../../modules/topology-guard-mcp.js';
2
+ import type { ClusterMeshModules } from '../../modules/contracts.js';
3
+ import type { McpRegistryBuiltin } from '../../mcp/registry.js';
4
+ import { type ArtifactsDefinitionOptions } from '@sentropic/artifacts/mcp';
5
+ export type { ArtifactsDefinitionOptions };
6
+ /**
7
+ * The `sentropic.artifacts` builtin descriptor (spec-v8 §3/§9): static
8
+ * metadata for the catalog plus a qualified loader. The heavy definition
9
+ * materializes only at compile time, only when selected, through the
10
+ * module registry — an absent/incompatible artifacts peer refuses the
11
+ * compilation atomically instead of falling back to a stub. All host
12
+ * customization (storage, identity, template and content bindings)
13
+ * arrives through `definition`; nothing Immo-specific lives here.
14
+ */
15
+ export declare function createArtifactsBuiltin(options: {
16
+ modules: ClusterMeshModules;
17
+ definition: ArtifactsDefinitionOptions;
18
+ }): McpRegistryBuiltin;
19
+ //# sourceMappingURL=artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../src/integrations/mcp/artifacts.ts"],"names":[],"mappings":"AACA,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAKL,KAAK,0BAA0B,EAChC,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,0BAA0B,EAAE,CAAC;AAE3C;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC9C,OAAO,EAAE,kBAAkB,CAAC;IAC5B,UAAU,EAAE,0BAA0B,CAAC;CACxC,GAAG,kBAAkB,CAWrB"}
@@ -0,0 +1,26 @@
1
+ // Static provider leaf: topology guard first, then the builtin factory.
2
+ import '../../modules/topology-guard-mcp.js';
3
+ import { loadArtifactsMcp } from '../../loaders/mcp/artifacts.js';
4
+ import { ARTIFACTS_TOOL_NAMES, ARTIFACTS_PARAMETER_SCHEMA, ARTIFACTS_PROVIDER_ID, ARTIFACTS_PROVIDER_VERSION, } from '@sentropic/artifacts/mcp';
5
+ /**
6
+ * The `sentropic.artifacts` builtin descriptor (spec-v8 §3/§9): static
7
+ * metadata for the catalog plus a qualified loader. The heavy definition
8
+ * materializes only at compile time, only when selected, through the
9
+ * module registry — an absent/incompatible artifacts peer refuses the
10
+ * compilation atomically instead of falling back to a stub. All host
11
+ * customization (storage, identity, template and content bindings)
12
+ * arrives through `definition`; nothing Immo-specific lives here.
13
+ */
14
+ export function createArtifactsBuiltin(options) {
15
+ return {
16
+ providerId: ARTIFACTS_PROVIDER_ID,
17
+ version: ARTIFACTS_PROVIDER_VERSION,
18
+ capabilities: [...ARTIFACTS_TOOL_NAMES],
19
+ parameterSchema: ARTIFACTS_PARAMETER_SCHEMA,
20
+ load: async () => {
21
+ const mcp = await loadArtifactsMcp(options.modules);
22
+ return mcp.createArtifactsRegistryDefinition(options.definition);
23
+ },
24
+ };
25
+ }
26
+ //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../src/integrations/mcp/artifacts.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,OAAO,qCAAqC,CAAC;AAG7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,0BAA0B,GAE3B,MAAM,0BAA0B,CAAC;AAIlC;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAGtC;IACC,OAAO;QACL,UAAU,EAAE,qBAAqB;QACjC,OAAO,EAAE,0BAA0B;QACnC,YAAY,EAAE,CAAC,GAAG,oBAAoB,CAAC;QACvC,eAAe,EAAE,0BAA0B;QAC3C,IAAI,EAAE,KAAK,IAAI,EAAE;YACf,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACpD,OAAO,GAAG,CAAC,iCAAiC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACnE,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import '../../modules/topology-guard-mcp.js';
2
+ import type { ClusterMeshModules } from '../../modules/contracts.js';
3
+ /**
4
+ * Acquire the artifacts MCP leaf through the registry.
5
+ * Rejects with `ClusterMeshModuleUnavailableError` (recognize by `code`)
6
+ * when the optional `@sentropic/artifacts` peer is absent or out of range.
7
+ */
8
+ export declare function loadArtifactsMcp(modules: ClusterMeshModules): Promise<typeof import('@sentropic/artifacts/mcp')>;
9
+ //# sourceMappingURL=artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../src/loaders/mcp/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,cAAc,0BAA0B,CAAC,CAAC,CAEpD"}
@@ -0,0 +1,10 @@
1
+ import '../../modules/topology-guard-mcp.js';
2
+ /**
3
+ * Acquire the artifacts MCP leaf through the registry.
4
+ * Rejects with `ClusterMeshModuleUnavailableError` (recognize by `code`)
5
+ * when the optional `@sentropic/artifacts` peer is absent or out of range.
6
+ */
7
+ export async function loadArtifactsMcp(modules) {
8
+ return (await modules.load('mcp/artifacts'));
9
+ }
10
+ //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../src/loaders/mcp/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,qCAAqC,CAAC;AAG7C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAA2B;IAE3B,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAA8C,CAAC;AAC5F,CAAC"}
@@ -0,0 +1,8 @@
1
+ import '../../modules/topology-guard-mcp.js';
2
+ import type { ClusterMeshModules } from '../../modules/contracts.js';
3
+ /**
4
+ * Acquire the mcp-platform transport bridge through the registry.
5
+ * Rejects with `ClusterMeshModuleUnavailableError` (recognize by `code`).
6
+ */
7
+ export declare function loadMcpPlatformBridge(modules: ClusterMeshModules): Promise<typeof import('@sentropic/mcp-platform/transport/bridge')>;
8
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../../src/loaders/mcp/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,cAAc,0CAA0C,CAAC,CAAC,CAEpE"}
@@ -0,0 +1,9 @@
1
+ import '../../modules/topology-guard-mcp.js';
2
+ /**
3
+ * Acquire the mcp-platform transport bridge through the registry.
4
+ * Rejects with `ClusterMeshModuleUnavailableError` (recognize by `code`).
5
+ */
6
+ export async function loadMcpPlatformBridge(modules) {
7
+ return (await modules.load('mcp-platform/bridge'));
8
+ }
9
+ //# sourceMappingURL=bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../../src/loaders/mcp/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,qCAAqC,CAAC;AAG7C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAA2B;IAE3B,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAA8D,CAAC;AAClH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import '../../modules/topology-guard-mcp.js';
2
+ import type { ClusterMeshModules } from '../../modules/contracts.js';
3
+ /**
4
+ * Acquire the mcp-platform registry entry subpath through the registry.
5
+ * Rejects with `ClusterMeshModuleUnavailableError` (recognize by `code`).
6
+ */
7
+ export declare function loadMcpPlatformEntry(modules: ClusterMeshModules): Promise<typeof import('@sentropic/mcp-platform/registry/entry')>;
8
+ //# sourceMappingURL=entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../../src/loaders/mcp/entry.ts"],"names":[],"mappings":"AAAA,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,cAAc,wCAAwC,CAAC,CAAC,CAElE"}
@@ -0,0 +1,9 @@
1
+ import '../../modules/topology-guard-mcp.js';
2
+ /**
3
+ * Acquire the mcp-platform registry entry subpath through the registry.
4
+ * Rejects with `ClusterMeshModuleUnavailableError` (recognize by `code`).
5
+ */
6
+ export async function loadMcpPlatformEntry(modules) {
7
+ return (await modules.load('mcp-platform/entry'));
8
+ }
9
+ //# sourceMappingURL=entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../src/loaders/mcp/entry.ts"],"names":[],"mappings":"AAAA,OAAO,qCAAqC,CAAC;AAG7C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAA2B;IAE3B,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAA4D,CAAC;AAC/G,CAAC"}
@@ -0,0 +1,8 @@
1
+ import '../../modules/topology-guard-mcp.js';
2
+ import type { ClusterMeshModules } from '../../modules/contracts.js';
3
+ /**
4
+ * Acquire the mcp-platform hono mount through the registry.
5
+ * Rejects with `ClusterMeshModuleUnavailableError` (recognize by `code`).
6
+ */
7
+ export declare function loadMcpPlatformHono(modules: ClusterMeshModules): Promise<typeof import('@sentropic/mcp-platform/hono')>;
8
+ //# sourceMappingURL=hono.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hono.d.ts","sourceRoot":"","sources":["../../../src/loaders/mcp/hono.ts"],"names":[],"mappings":"AAAA,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,cAAc,8BAA8B,CAAC,CAAC,CAExD"}