@ontrails/mcp 1.0.0-beta.5 → 1.0.0-beta.50

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 (50) hide show
  1. package/CHANGELOG.md +416 -12
  2. package/README.md +69 -17
  3. package/package.json +16 -3
  4. package/src/annotations.ts +24 -1
  5. package/src/build.ts +1335 -136
  6. package/src/index.ts +32 -4
  7. package/src/progress.ts +22 -0
  8. package/src/resources.ts +336 -0
  9. package/src/stdio.ts +9 -1
  10. package/src/surface.ts +295 -0
  11. package/src/tool-name.ts +6 -7
  12. package/.turbo/turbo-build.log +0 -1
  13. package/.turbo/turbo-lint.log +0 -3
  14. package/.turbo/turbo-typecheck.log +0 -1
  15. package/dist/annotations.d.ts +0 -19
  16. package/dist/annotations.d.ts.map +0 -1
  17. package/dist/annotations.js +0 -31
  18. package/dist/annotations.js.map +0 -1
  19. package/dist/blaze.d.ts +0 -36
  20. package/dist/blaze.d.ts.map +0 -1
  21. package/dist/blaze.js +0 -96
  22. package/dist/blaze.js.map +0 -1
  23. package/dist/build.d.ts +0 -40
  24. package/dist/build.d.ts.map +0 -1
  25. package/dist/build.js +0 -227
  26. package/dist/build.js.map +0 -1
  27. package/dist/index.d.ts +0 -7
  28. package/dist/index.d.ts.map +0 -1
  29. package/dist/index.js +0 -13
  30. package/dist/index.js.map +0 -1
  31. package/dist/progress.d.ts +0 -13
  32. package/dist/progress.d.ts.map +0 -1
  33. package/dist/progress.js +0 -51
  34. package/dist/progress.js.map +0 -1
  35. package/dist/stdio.d.ts +0 -12
  36. package/dist/stdio.d.ts.map +0 -1
  37. package/dist/stdio.js +0 -15
  38. package/dist/stdio.js.map +0 -1
  39. package/dist/tool-name.d.ts +0 -15
  40. package/dist/tool-name.d.ts.map +0 -1
  41. package/dist/tool-name.js +0 -19
  42. package/dist/tool-name.js.map +0 -1
  43. package/src/__tests__/annotations.test.ts +0 -63
  44. package/src/__tests__/blaze.test.ts +0 -105
  45. package/src/__tests__/build.test.ts +0 -453
  46. package/src/__tests__/progress.test.ts +0 -136
  47. package/src/__tests__/tool-name.test.ts +0 -46
  48. package/src/blaze.ts +0 -146
  49. package/tsconfig.json +0 -9
  50. package/tsconfig.tsbuildinfo +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,409 @@
1
1
  # @ontrails/mcp
2
2
 
3
+ ## 1.0.0-beta.50
4
+
5
+ ## 1.0.0-beta.49
6
+
7
+ ## 1.0.0-beta.48
8
+
9
+ ## 1.0.0-beta.47
10
+
11
+ ## 1.0.0-beta.46
12
+
13
+ ## 1.0.0-beta.45
14
+
15
+ ## 1.0.0-beta.44
16
+
17
+ ### Patch Changes
18
+
19
+ - [`b1fbe57`](https://github.com/outfitter-dev/trails/commit/b1fbe574e6f44d1fecb5e3a000270955c0a77b7b): Publish Bun-validated package tarballs through an npm trusted-publishing adapter
20
+ binding, add exact repository metadata for each public workspace package, and
21
+ correct the native Bun release descriptor to its pack-only runtime boundary.
22
+
23
+ ## 1.0.0-beta.43
24
+
25
+ ### Minor Changes
26
+
27
+ - [`88a6a62`](https://github.com/outfitter-dev/trails/commit/88a6a62a9e9e230ca6d368fa78dc3ece6c816204): Complete the v1 classification-first cutover from projection/project vocabulary
28
+ to derive/derived for contract-owned fact production and render/rendered for
29
+ surface presentation. Public type, helper, rule, relation, and report names move
30
+ without compatibility aliases; ordinary repository/project nouns remain
31
+ explicit preserves or structured review inventory.
32
+
33
+ ## 1.0.0-beta.42
34
+
35
+ ## 1.0.0-beta.41
36
+
37
+ ## 1.0.0-beta.40
38
+
39
+ ### Minor Changes
40
+
41
+ - [`5adb995`](https://github.com/outfitter-dev/trails/commit/5adb99551c2dda6190d46cce7f60bb08d63c99aa): Complete the v1 hard cutover from the authored `blaze` field to
42
+ `implementation` across trail contracts, surface projections, tests, examples,
43
+ and public source-analysis helpers. Existing applications must rename authored
44
+ trail behavior fields and direct trail-object access before upgrading.
45
+
46
+ ## 1.0.0-beta.39
47
+
48
+ ### Patch Changes
49
+
50
+ - [`81373bc`](https://github.com/outfitter-dev/trails/commit/81373bc5e980bb06d56fb06af4f0986f72e318c7): Wave-2 MCP cutover to the app-authored `surfaces` overlay. The overlay's `mcp` bindings are now the authored, lockable default for the MCP surface: a list binding derives one grouped trailhead tool (member selection in `{ trail, input }`, member identity preserved in `{ trail, output }`, deterministic derived description), and a scalar binding derives an additional tool synonym whose MCP-safe name is published verbatim and must expand to exactly one trail. `deriveMcpTools`/`createServer` accept the new `overlays` option; `@ontrails/core` gains `expandMcpSurfaceBindings` and `deriveMcpTrailheadDescription`.
51
+
52
+ The call-site `CreateServerOptions.trailheads` map survives as permanent override-in-context design, not a compatibility bridge: when both channels are present, the call-site map wins at runtime. Warden's new `trailhead-override-divergence` rule (warn) names both sides when a call-site map's binding names or member selectors diverge from the authored overlay default.
53
+
54
+ Topographer now derives `graph.trailheads` from the overlay's `mcp` list bindings in both `deriveTopoGraph` and the store-side graph build, so trailhead facts flow from compiled locks into Wayfinder reads for the first time. The never-wired `DeriveTopoGraphOptions.trailheads` option and the `TopoGraphTrailheadDeclaration`/`TopoGraphTrailheadTrailSelector` types are removed — a beta-window hard cutover of an option no caller could reach; author the equivalent `mcp` list binding in `surfaceOverlay({ mcp })` instead.
55
+
56
+ - [`820b4ad`](https://github.com/outfitter-dev/trails/commit/820b4ad9c40ea383b3c489a05fe7e4b2328e324f): Add `surfaceOverlay` — the shared surface-naming schema (scalar binding = synonym, list binding = grouped entry, singleton list stays a group) with app-authored/adapter-derived overlay provenance enforced at collection and consumption, and the `surface-overlay-coherence` Warden rule. MCP tool-name derivation moves to `@ontrails/core` (`deriveMcpToolName`) so the surface and governance read one projection; `@ontrails/mcp`'s `deriveToolName` now delegates to it. The coherence rule activates on standard warden runs once fresh derivations collect app-module overlays through the shared compile channel (TRL-1209, next in this stack).
57
+
58
+ ## 1.0.0-beta.38
59
+
60
+ ## 1.0.0-beta.37
61
+
62
+ ## 1.0.0-beta.36
63
+
64
+ ### Patch Changes
65
+
66
+ - [`6e63e48`](https://github.com/outfitter-dev/trails/commit/6e63e483617b84cb6868d0c4d58d5b5a8d3b9ed2): Complete the v1 grouped surface-entry vocabulary cutover from facet to trailhead, including Regrade dogfood support for governed string literal renames and composed AST rewrite application.
67
+
68
+ ## 1.0.0-beta.35
69
+
70
+ ## 1.0.0-beta.34
71
+
72
+ ## 1.0.0-beta.33
73
+
74
+ ## 1.0.0-beta.32
75
+
76
+ ### Patch Changes
77
+
78
+ - Updated dependencies [3e5c0fc]
79
+ - Updated dependencies [f3c4fef]
80
+ - Updated dependencies [cb0a9d8]
81
+ - Updated dependencies [21c6dda]
82
+ - Updated dependencies [fe72b84]
83
+ - @ontrails/core@1.0.0-beta.32
84
+
85
+ ## 1.0.0-beta.31
86
+
87
+ ### Patch Changes
88
+
89
+ - ee9f3ae: Let Warden fix capabilities declare downstream scan targets and have Regrade
90
+ honor those targets for Warden-backed term-rewrite classes.
91
+
92
+ Dogfood the first safe facet-to-trailhead prose rewrite through project-local
93
+ Warden rules and Regrade.
94
+
95
+ - Updated dependencies [4cd5d4e]
96
+ - Updated dependencies [38907cc]
97
+ - @ontrails/core@1.0.0-beta.31
98
+
99
+ ## 1.0.0-beta.30
100
+
101
+ ### Patch Changes
102
+
103
+ - @ontrails/core@1.0.0-beta.30
104
+
105
+ ## 1.0.0-beta.29
106
+
107
+ ### Patch Changes
108
+
109
+ - @ontrails/core@1.0.0-beta.29
110
+
111
+ ## 1.0.0-beta.28
112
+
113
+ ### Patch Changes
114
+
115
+ - @ontrails/core@1.0.0-beta.28
116
+
117
+ ## 1.0.0-beta.27
118
+
119
+ ### Patch Changes
120
+
121
+ - @ontrails/core@1.0.0-beta.27
122
+
123
+ ## 1.0.0-beta.26
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies [1307568]
128
+ - Updated dependencies [371d19e]
129
+ - @ontrails/core@1.0.0-beta.26
130
+
131
+ ## 1.0.0-beta.25
132
+
133
+ ### Patch Changes
134
+
135
+ - a9fdbc7: Clarify surface accommodation doctrine in MCP surface facet metadata and Warden trail-fork coaching guidance.
136
+ - 2c08afe: Expose MCP trail graph fact resources and enable them for the Trails operator MCP surface.
137
+ - f1e6efa: Document the Wayfinder MCP resource surface and polish Wayfinder filter dogfood coverage for unified navigation.
138
+ - df13faf: Tighten Wayfinder navigation review findings: carry adapter filters into included adapter facts, keep live-source outline off the operator MCP surface until host-root binding exists, make unknown MCP resources protocol errors, route secondary Wayfinder graph populations through unified flags, and keep undeclared string `ctx.compose()` calls as Warden errors.
139
+ - Updated dependencies [c36aca9]
140
+ - Updated dependencies [3befcf1]
141
+ - Updated dependencies [a4f9cf6]
142
+ - Updated dependencies [9bcf34e]
143
+ - @ontrails/core@1.0.0-beta.25
144
+
145
+ ## 1.0.0-beta.24
146
+
147
+ ### Patch Changes
148
+
149
+ - @ontrails/core@1.0.0-beta.24
150
+
151
+ ## 1.0.0-beta.23
152
+
153
+ ### Patch Changes
154
+
155
+ - @ontrails/core@1.0.0-beta.23
156
+
157
+ ## 1.0.0-beta.22
158
+
159
+ ### Patch Changes
160
+
161
+ - @ontrails/core@1.0.0-beta.22
162
+
163
+ ## 1.0.0-beta.21
164
+
165
+ ### Patch Changes
166
+
167
+ - Updated dependencies [99523f2]
168
+ - @ontrails/core@1.0.0-beta.21
169
+
170
+ ## 1.0.0-beta.20
171
+
172
+ ### Minor Changes
173
+
174
+ - accb9ec: Add MCP surface facets, MCP resource projection for cold context, and deferred-loading metadata hints.
175
+
176
+ ### Patch Changes
177
+
178
+ - 9bec01c: Document MCP resource projection and deferred-loading options for cold surface context.
179
+ - Updated dependencies [851a2a3]
180
+ - @ontrails/core@1.0.0-beta.20
181
+
182
+ ## 1.0.0-beta.19
183
+
184
+ ### Patch Changes
185
+
186
+ - e41c382: Document beta-channel install guidance in package and adapter README install snippets so consumers use explicit `@beta` (or pinned `1.0.0-beta.N`) tags instead of accidental `latest` resolution during the prerelease line. Adds the policy doc at `docs/releases/beta-channel-policy.md`, prints both `latest` and `beta` dist-tags in `bun run publish:registry-check`, and aligns plugin/skill install snippets.
187
+ - 1eb5bdc: Rename first-class trail composition from the `cross` API family to the `compose` family across core contracts, testing helpers, topo projections, Warden rules, CLI scaffolds, and docs. `composes`, `ctx.compose`, `composeInput`, and `Compose*` type names are now the public authoring vocabulary; topo persistence migrates legacy composition rows and graph keys forward.
188
+ - 8638dae: Add a public API example for MCP `deriveAnnotations` annotation derivation.
189
+ - 8638dae: Add public API examples for the MCP tool metadata keys.
190
+ - 8638dae: Add a public API example for the MCP progress callback bridge.
191
+ - 84f56a5: Project live trail-version metadata on CLI, HTTP, and MCP surfaces and thread explicit surface version selection into shared trail execution.
192
+ - 5d88104: Polish Trails blaze terminology across package docs and Warden guidance.
193
+ - Updated dependencies [e41c382]
194
+ - Updated dependencies [1eb5bdc]
195
+ - Updated dependencies [f8d80b9]
196
+ - Updated dependencies [846a597]
197
+ - Updated dependencies [223aaad]
198
+ - Updated dependencies [3125f4d]
199
+ - Updated dependencies [2494dc6]
200
+ - Updated dependencies [2d53717]
201
+ - Updated dependencies [16cb740]
202
+ - Updated dependencies [8894ecb]
203
+ - Updated dependencies [fdf7ec9]
204
+ - Updated dependencies [d76be13]
205
+ - Updated dependencies [84f56a5]
206
+ - Updated dependencies [431b04c]
207
+ - Updated dependencies [5d88104]
208
+ - Updated dependencies [f04a9ef]
209
+ - @ontrails/core@1.0.0-beta.19
210
+
211
+ ## 1.0.0-beta.18
212
+
213
+ ### Patch Changes
214
+
215
+ - @ontrails/core@1.0.0-beta.18
216
+
217
+ ## 1.0.0-beta.17
218
+
219
+ ### Patch Changes
220
+
221
+ - 61497c5: Add v1-minimum public API examples for shipped surface entrypoints.
222
+ - Updated dependencies [3dc8254]
223
+ - @ontrails/core@1.0.0-beta.17
224
+
225
+ ## 1.0.0-beta.16
226
+
227
+ ### Minor Changes
228
+
229
+ - 26f9ffd: Project typed-layer `input` schemas onto MCP and HTTP surfaces. Closes Phase 7. Lifts `collectAttachedTypedLayers` and `projectLayerFieldName` (collision-rename rule) into `@ontrails/core/internal/layer-projection` so all three surfaces share one source of truth. The CLI surface refactors to consume the lifted helpers (no behavior change). MCP merges layer fields into each tool's `inputSchema` and partitions inbound args at invocation time. HTTP merges layer fields into the route's request schema (query for reads, body for writes) and exposes new optional `HttpRouteDefinition.inputSchema` + `layerInputProjections` for surface adapters / OpenAPI generators. Collision rule matches TRL-473's: deterministic rename to a layer-prefixed camelCase name with the original captured in the routing table. Side fix: MCP and HTTP handlers now forward `topoLayers: graph.layers` + `surfaceLayers: layers` so topo-scope layers actually compose at runtime (previously the handlers used the deprecated `layers` alias and never read `graph.layers`).
230
+
231
+ ### Patch Changes
232
+
233
+ - 6300f70: Refresh source comments and test labels for retired connector terminology as adapter guardrails become strict.
234
+ - 20d7a5c: Enforce the shared safe error projection policy for public error bodies, diagnostics, serialized payloads, and CLI stderr.
235
+ - 49c2e7d: Refresh published package README taxonomy to use adapter language instead of retired connector vocabulary.
236
+ - Updated dependencies [73622ae]
237
+ - Updated dependencies [6300f70]
238
+ - Updated dependencies [d172013]
239
+ - Updated dependencies [c3fc5c3]
240
+ - Updated dependencies [20d7a5c]
241
+ - Updated dependencies [be5fb46]
242
+ - Updated dependencies [e898cc4]
243
+ - Updated dependencies [3395234]
244
+ - Updated dependencies [bcdc484]
245
+ - Updated dependencies [331e3a9]
246
+ - Updated dependencies [4399fdb]
247
+ - Updated dependencies [4b8d13b]
248
+ - Updated dependencies [112b9f2]
249
+ - Updated dependencies [893025e]
250
+ - Updated dependencies [eec5e9d]
251
+ - Updated dependencies [ebd4434]
252
+ - Updated dependencies [863d473]
253
+ - Updated dependencies [344f2f7]
254
+ - Updated dependencies [26f9ffd]
255
+ - Updated dependencies [10eae9a]
256
+ - Updated dependencies [22c6c06]
257
+ - @ontrails/core@1.0.0-beta.16
258
+
259
+ ## 1.0.0-beta.15
260
+
261
+ ### Patch Changes
262
+
263
+ - Updated dependencies [4ad6b25]
264
+ - @ontrails/core@1.0.0-beta.15
265
+
266
+ ## 1.0.0-beta.14
267
+
268
+ ### Minor Changes
269
+
270
+ - 69057e9: Add hierarchical CLI command trees and structured input, enforce established-only topo exports across trailheads, move developer topo and tracker state onto shared `trails.db` with pins and maintenance flows, and ship schema-derived stores through `@ontrails/store` and its Drizzle runtime.
271
+
272
+ ### Patch Changes
273
+
274
+ - Updated dependencies [69057e9]
275
+ - @ontrails/core@1.0.0-beta.14
276
+
277
+ ## 1.0.0-beta.13
278
+
279
+ ### Minor Changes
280
+
281
+ - Trail-native vocabulary cutover. Breaking API field renames across all packages:
282
+
283
+ - Trail spec: `run:` → `blaze:`, `follow:` → `crosses:`, `services:` → `provisions:`, `metadata:` → `meta:`, `emits:` → `signals:`
284
+ - Runtime: `ctx.follow()` → `ctx.cross()`, `ctx.emit()` → `ctx.signal()`, `ctx.signal` (abort) → `ctx.abortSignal`
285
+ - Entry points: `blaze(app)` → `trailhead(app)`
286
+ - Package rename: `@ontrails/crumbs` → `@ontrails/tracker`
287
+ - Wrapper types: `Layer` → `Gate`, `layers`/`middleware` → `gates`
288
+ - Transport: `surface` → `trailhead`, `adapter` → `connector`
289
+
290
+ ### Patch Changes
291
+
292
+ - 6944147: Complete trifecta for config, permits, and tracker (formerly tracks)
293
+
294
+ - **config**: Add `configProvision`, `configGate`, `config.trail`, and `config.workspace` trails with full `defineConfig`, `resolve`, `describe`, `explain`, `doctor`, and code generation support
295
+ - **permits**: Add `authService` and `auth.verify` trail for runtime authorization checks
296
+ - **tracker**: Rename tracks to tracker; add `trackerProvision` and `tracker.status` trail for structured signal tracking
297
+ - **cli**: Fix build flag handling and improve bootstrap scaffolding
298
+ - **testing**: Expand test context helpers and example-based testing utilities
299
+ - **core/mcp/http**: Internal alignment for provision and composition updates
300
+
301
+ - Updated dependencies [6944147]
302
+ - Updated dependencies
303
+ - @ontrails/core@1.0.0-beta.13
304
+
305
+ ## 1.0.0-beta.12
306
+
307
+ ### Patch Changes
308
+
309
+ - Complete trifecta for config, permits, and tracker (formerly tracks)
310
+
311
+ - **config**: Add `configProvision`, `config.gate`, `config.trail`, and `config.workspace` trails with full `defineConfig`, `resolve`, `describe`, `explain`, `doctor`, and code generation support
312
+ - **permits**: Add `authProvision` and `auth.verify` trail for runtime authorization checks
313
+ - **tracker**: Rename tracks to tracker; add `trackerProvision` and `tracker.status` trail for structured event tracking
314
+ - **cli**: Fix build flag handling and improve bootstrap scaffolding
315
+ - **testing**: Expand test context helpers and example-based testing utilities
316
+ - **core/mcp/http**: Internal alignment for provision and composition updates
317
+
318
+ - Updated dependencies
319
+ - @ontrails/core@1.0.0-beta.12
320
+
321
+ ## 1.0.0-beta.11
322
+
323
+ ### Patch Changes
324
+
325
+ - Add provisions as a first-class primitive.
326
+
327
+ Provisions make infrastructure dependencies declarative, injectable, and governable. Define a provision with `provision()`, declare it on a trail with `provisions: [db]`, and access it with `db.from(ctx)` or `ctx.provision()`.
328
+
329
+ **Core:** `provision()` factory, `ProvisionSpec<T>`, `ProvisionContext`, singleton resolution in `executeTrail`, in-flight creation dedup, `isProvision` guard, `findDuplicateProvisionId`, topo provision discovery and validation, `provisions` field on trail specs.
330
+
331
+ **Testing:** Auto-resolution of `mock` factories in `testAll`, `testExamples`, `testContracts`, and `testCrosses`. Explicit `provisions` overrides with correct precedence (`explicit > ctx.extensions > auto-mock`). Provision mock propagation through crossing graphs.
332
+
333
+ **Warden:** `provision-declarations` rule validates `db.from(ctx)` and `ctx.provision()` usage matches declared `provisions: [...]`. `provision-exists` rule validates declared provision IDs resolve in project context. Scope-aware AST walking skips nested function boundaries.
334
+
335
+ **Trailheads:** Provision overrides thread through `run` and `trailhead` on CLI, MCP, and HTTP.
336
+
337
+ **Introspection:** Survey and trailhead map outputs include provision graph. Topo exposes `.provisions`, `.getProvision()`, `.hasProvision()`, `.listProvisions()`, `.provisionIds()`, `.provisionCount`.
338
+
339
+ **Docs:** ADR-009 accepted. Unified provisions guide, updated vocabulary, getting-started, architecture, and package READMEs.
340
+
341
+ - Updated dependencies
342
+ - @ontrails/core@1.0.0-beta.11
343
+
344
+ ## 1.0.0-beta.10
345
+
346
+ ### Patch Changes
347
+
348
+ - Cleanup and hardening pass across all packages.
349
+
350
+ **core**: Deduplicate `DispatchOptions` as type alias of `ExecuteTrailOptions`. Replace `TrailContext` index signature with typed `extensions` field for type safety. Deep-merge `extensions` in `executeTrail` context resolution. Remove unused `Trailhead` type, `connectors.ts`, `health.ts`, and `job.ts` proof-of-concept from published package.
351
+
352
+ **cli**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `trailhead()` with opt-out via `validate: false`.
353
+
354
+ **http**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `trailhead()` with opt-out.
355
+
356
+ **mcp**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `trailhead()` with opt-out.
357
+
358
+ **warden**: Project-aware rule context preserved in trail wrappers.
359
+
360
+ - Updated dependencies
361
+ - @ontrails/core@1.0.0-beta.10
362
+
363
+ ## 1.0.0-beta.9
364
+
365
+ ### Minor Changes
366
+
367
+ - Consolidated improvements across all trailhead packages.
368
+
369
+ **core**: Add `TrailResult<T>` utility type, `topo.ids()` and `topo.count` accessors, `run()` for headless trail execution, and extract shared `executeTrail` pipeline used by CLI/MCP/HTTP.
370
+
371
+ **http**: Detect route path collisions and return `Result` from `buildHttpRoutes()`, wire request `AbortSignal` through to trail context, and make write → POST mapping explicit in intent-to-method lookup.
372
+
373
+ **mcp**: Return `Result` from `buildMcpTools()` on collision instead of throwing.
374
+
375
+ **cli**: Verify exception catching via centralized `executeTrail`.
376
+
377
+ **testing**: Cross-context awareness improvements.
378
+
379
+ **warden**: Refactor rules as composable trails with examples.
380
+
381
+ **schema**: Error code and empty body fixes.
382
+
383
+ ### Patch Changes
384
+
385
+ - Updated dependencies
386
+ - @ontrails/core@1.0.0-beta.9
387
+
388
+ ## 1.0.0-beta.8
389
+
390
+ ### Patch Changes
391
+
392
+ - @ontrails/core@1.0.0-beta.8
393
+
394
+ ## 1.0.0-beta.7
395
+
396
+ ### Patch Changes
397
+
398
+ - @ontrails/core@1.0.0-beta.7
399
+
400
+ ## 1.0.0-beta.6
401
+
402
+ ### Patch Changes
403
+
404
+ - Updated dependencies
405
+ - @ontrails/core@1.0.0-beta.6
406
+
3
407
  ## 1.0.0-beta.5
4
408
 
5
409
  ### Patch Changes
@@ -15,15 +419,15 @@
15
419
 
16
420
  **BREAKING CHANGES:**
17
421
 
18
- - `hike()` removed — use `trail()` with optional `follow: [...]` field
19
- - `follows` renamed to `follow` (singular, matching `ctx.follow()`)
422
+ - `hike()` removed — use `trail()` with optional `crosses: [...]` field
423
+ - `follows` renamed to `crosses` (matching `ctx.cross()`)
20
424
  - `topo.hikes` removed — single `topo.trails` map
21
425
  - `kind: 'hike'` removed — everything is `kind: 'trail'`
22
426
  - `readOnly`/`destructive` booleans replaced by `intent: 'read' | 'write' | 'destroy'`
23
427
  - `implementation` field renamed to `run`
24
428
  - `markers` field renamed to `metadata`
25
- - `testHike` renamed to `testFollows`, `HikeScenario` to `FollowScenario`
26
- - `blaze()` now returns the surface handle (`Command` for CLI, `Server` for MCP)
429
+ - `testHike` renamed to `testCrosses`, `HikeScenario` to `CrossScenario`
430
+ - `trailhead()` now returns the trailhead handle (`Command` for CLI, `Server` for MCP)
27
431
 
28
432
  ### Patch Changes
29
433
 
@@ -34,15 +438,15 @@
34
438
 
35
439
  ### Minor Changes
36
440
 
37
- - Bug fixes across all surface packages found via parallel Codex review.
441
+ - Bug fixes across all trailhead packages found via parallel Codex review.
38
442
 
39
443
  **core**: Fix Result.toJson false circular detection on DAGs, deserializeError subclass round-trip, topo cross-kind ID collisions, validateTopo multi-node cycle detection, error example input validation bypass, and deriveFields array type collapse.
40
444
 
41
- **cli**: Switch blaze to parseAsync for proper async error handling, add boolean flag negation (--no-flag), and strict number parsing that rejects partial input.
445
+ **cli**: Switch trailhead to parseAsync for proper async error handling, add boolean flag negation (--no-flag), and strict number parsing that rejects partial input.
42
446
 
43
447
  **mcp**: Align BlobRef with core (including ReadableStream support) and detect tool-name collisions after normalization.
44
448
 
45
- **testing**: Include hikes in testContracts validation, with follow-context awareness.
449
+ **testing**: Include hikes in testContracts validation, with cross-context awareness.
46
450
 
47
451
  **warden**: Collect hike detour targets, validate detour refs in hike specs, and stop implementation-returns-result from walking into nested function bodies.
48
452
 
@@ -77,12 +481,12 @@
77
481
  - Initial v1 beta release of the Trails framework.
78
482
 
79
483
  - **@ontrails/core** — Result type, error taxonomy, trail/hike/event/topo, validateTopo, validateInput/Output, deriveFields, patterns, redaction, branded types, resilience
80
- - **@ontrails/cli** — CLI surface adapter, Commander integration, flag derivation, layers
81
- - **@ontrails/mcp** — MCP surface adapter, tool generation, annotations, progress bridge
82
- - **@ontrails/logging** — Structured logging, sinks, formatters, LogTape adapter
83
- - **@ontrails/testing** — testAll, testExamples, testTrail, testHike, testContracts, testDetours, surface harnesses
484
+ - **@ontrails/cli** — CLI trailhead connector, Commander integration, flag derivation, gates
485
+ - **@ontrails/mcp** — MCP trailhead connector, tool generation, annotations, progress bridge
486
+ - **@ontrails/logging** — Structured logging, sinks, formatters, LogTape connector
487
+ - **@ontrails/testing** — testAll, testExamples, testTrail, testHike, testContracts, testDetours, trailhead harnesses
84
488
  - **@ontrails/warden** — AST-based code convention rules via oxc-parser, drift detection, CI formatters
85
- - **@ontrails/schema** — Surface map generation, hashing, semantic diffing
489
+ - **@ontrails/schema** — Trailhead map generation, hashing, semantic diffing
86
490
 
87
491
  ### Patch Changes
88
492
 
package/README.md CHANGED
@@ -1,55 +1,69 @@
1
1
  # @ontrails/mcp
2
2
 
3
- MCP surface adapter. One `blaze()` call turns a topo into an MCP server with tool definitions, annotations, and progress bridging -- all derived from the trail contracts.
3
+ MCP surface adapter. One `surface()` call turns a topo into an MCP server with tool definitions, annotations, and progress bridging -- all derived from the trail contracts.
4
4
 
5
5
  ## Usage
6
6
 
7
7
  ```typescript
8
8
  import { trail, topo, Result } from '@ontrails/core';
9
- import { blaze } from '@ontrails/mcp';
9
+ import { surface } from '@ontrails/mcp';
10
10
  import { z } from 'zod';
11
11
 
12
12
  const greet = trail('greet', {
13
13
  input: z.object({ name: z.string().describe('Who to greet') }),
14
+ output: z.object({ greeting: z.string() }),
14
15
  intent: 'read',
15
- run: (input) => Result.ok(`Hello, ${input.name}!`),
16
+ examples: [
17
+ {
18
+ expected: { greeting: 'Hello, Ada!' },
19
+ input: { name: 'Ada' },
20
+ name: 'Ada',
21
+ },
22
+ ],
23
+ implementation: (input) => Result.ok({ greeting: `Hello, ${input.name}!` }),
16
24
  });
17
25
 
18
- const app = topo('myapp', { greet });
19
- await blaze(app);
26
+ const graph = topo('myapp', { greet });
27
+ await surface(graph);
20
28
  ```
21
29
 
22
- This starts an MCP server over stdio with a `myapp_greet` tool. The tool gets `readOnlyHint: true` and a JSON Schema input -- both derived from the trail definition.
30
+ This starts an MCP server over stdio with a `myapp_greet` tool. The tool gets `readOnlyHint: true`, JSON Schema input, JSON Schema output, and structured examples -- all derived from the trail definition.
23
31
 
24
32
  For more control, build the tools yourself:
25
33
 
26
34
  ```typescript
27
- import { buildMcpTools } from '@ontrails/mcp';
35
+ import { deriveMcpTools } from '@ontrails/mcp';
28
36
 
29
- const tools = buildMcpTools(app);
30
- for (const tool of tools) {
37
+ const result = deriveMcpTools(graph);
38
+ if (result.isErr()) throw result.error; // ValidationError on tool-name collision
39
+ for (const tool of result.value) {
31
40
  server.registerTool(tool.name, tool.handler, {
32
41
  inputSchema: tool.inputSchema,
42
+ outputSchema: tool.outputSchema,
33
43
  annotations: tool.annotations,
44
+ _meta: tool._meta,
34
45
  });
35
46
  }
36
47
  ```
37
48
 
49
+ `deriveMcpTools` returns `Result<McpToolDefinition[], Error>` rather than a bare array. It returns `Result.err(ValidationError)` if two trails derive the same MCP tool name. Each `McpToolDefinition` includes a `trailId` field that records which trail the tool was derived from.
50
+
38
51
  ## API
39
52
 
40
53
  | Export | What it does |
41
54
  | --- | --- |
42
- | `blaze(app, options?)` | Start an MCP server with all trails as tools |
43
- | `buildMcpTools(app, options?)` | Build tool definitions without starting a server |
55
+ | `surface(graph, options?)` | Start an MCP server with all trails as tools |
56
+ | `deriveMcpTools(graph, options?)` | Build tool definitions without starting a server |
57
+ | `buildMcpResources(graph, tools, config?)` | Build MCP resource listings and read handlers for cold context |
44
58
  | `deriveToolName(appName, trailId)` | Compute the MCP tool name from app and trail IDs |
45
- | `deriveAnnotations(trail)` | Extract MCP annotations from trail intent and metadata |
59
+ | `deriveAnnotations(trail)` | Extract MCP annotations from trail intent, idempotency, and description |
46
60
  | `createMcpProgressCallback(server)` | Bridge `ctx.progress` to MCP `notifications/progress` |
47
61
 
48
62
  See the [API Reference](../../docs/api-reference.md) for the full list.
49
63
 
50
64
  ## Annotations
51
65
 
52
- Trail intent and metadata map directly to MCP annotations:
66
+ Trail intent, idempotency, and description map directly to MCP annotations:
53
67
 
54
68
  | Trail field | MCP annotation |
55
69
  | --- | --- |
@@ -60,17 +74,53 @@ Trail intent and metadata map directly to MCP annotations:
60
74
 
61
75
  No manual annotation definitions. The contract is the source of truth.
62
76
 
77
+ ## Schemas and Examples
78
+
79
+ MCP tool definitions include the trail's input schema, and trails with an `output` schema also render that schema into MCP `outputSchema`. Non-object trail outputs are wrapped in a `{ data: ... }` object because MCP structured tool results are object-shaped.
80
+
81
+ Trail examples are rendered as structured metadata under `_meta["ontrails/examples"]`. Each rendered example preserves its input, expected output or error, a success/error kind, and provenance pointing back to the authored `trail.examples` field.
82
+
83
+ ## MCP resources and deferred loading
84
+
85
+ Cold context is rendered through MCP resources, not extra Trails resources. `surface(graph)` and `createServer(graph)` expose MCP resources by default:
86
+
87
+ - `trails://surface-map` lists the resolved MCP tool rendering, including ordinary tools, trailhead tools, schemas, versions, deferred hints, and member trail IDs.
88
+ - `trails://examples/<trailId>` exposes structured examples for exposed trails that define examples.
89
+ - `trails://trail/<trailId>` exposes MCP-visible graph facts for an exposed trail when graph resources are enabled.
90
+
91
+ Disable resource rendering only when the host needs a minimal MCP capability surface:
92
+
93
+ ```typescript
94
+ await surface(graph, { mcpResources: false });
95
+ ```
96
+
97
+ Or choose a narrower resource set:
98
+
99
+ ```typescript
100
+ await surface(graph, {
101
+ mcpResources: { examples: false, graph: true, surfaceMap: true },
102
+ });
103
+ ```
104
+
105
+ Graph resources are opt-in for general MCP hosts because they widen cold context for every exposed trail. The Trails operator enables them so agents can inspect high-signal graph facts without invoking another tool.
106
+
107
+ Trailhead definitions may set `mcp: { loading: 'deferred' }`. In this release, deferred loading is a compatibility hint under `_meta["ontrails/deferred"]`; the MCP tool schema remains present so clients that do not understand deferred loading continue to work.
108
+
63
109
  ## Tool naming
64
110
 
65
111
  Trail IDs become MCP tool names with the app prefix: `entity.show` in app `myapp` becomes `myapp_entity_show`. Dots and hyphens become underscores, everything lowercase.
66
112
 
113
+ ## Resource resolution
114
+
115
+ Declared resources on each trail are resolved into the context before the implementation receives input.
116
+
67
117
  ## Progress bridge
68
118
 
69
119
  Implementations report progress through `ctx.progress`. On MCP, these bridge to `notifications/progress` when the client sends a `progressToken`:
70
120
 
71
121
  ```typescript
72
122
  const importTrail = trail('data.import', {
73
- run: async (input, ctx) => {
123
+ implementation: async (input, ctx) => {
74
124
  for (let i = 0; i < items.length; i++) {
75
125
  await processItem(items[i]);
76
126
  ctx.progress?.({ type: 'progress', current: i + 1, total: items.length });
@@ -83,12 +133,14 @@ const importTrail = trail('data.import', {
83
133
  ## Filtering
84
134
 
85
135
  ```typescript
86
- await blaze(app, { includeTrails: ['entity.show', 'search'] });
87
- await blaze(app, { excludeTrails: ['internal.debug'] });
136
+ await surface(graph, { include: ['entity.**', 'search'] });
137
+ await surface(graph, { exclude: ['internal.debug'] });
88
138
  ```
89
139
 
140
+ `*` matches one dotted segment and `**` matches any depth. Trails declared with `visibility: 'internal'` stay hidden unless you include their exact trail ID.
141
+
90
142
  ## Installation
91
143
 
92
144
  ```bash
93
- bun add @ontrails/mcp
145
+ bun add @ontrails/mcp@beta
94
146
  ```
package/package.json CHANGED
@@ -1,6 +1,19 @@
1
1
  {
2
2
  "name": "@ontrails/mcp",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-beta.50",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/outfitter-dev/trails.git",
7
+ "directory": "packages/mcp"
8
+ },
9
+ "files": [
10
+ "src/**/*.ts",
11
+ "!src/**/__tests__/**",
12
+ "!src/**/*.test.ts",
13
+ "!src/**/*.test-d.ts",
14
+ "README.md",
15
+ "CHANGELOG.md"
16
+ ],
4
17
  "type": "module",
5
18
  "exports": {
6
19
  ".": "./src/index.ts",
@@ -14,10 +27,10 @@
14
27
  "clean": "rm -rf dist *.tsbuildinfo"
15
28
  },
16
29
  "dependencies": {
17
- "@ontrails/core": "^1.0.0-beta.0"
30
+ "@ontrails/core": "^1.0.0-beta.50"
18
31
  },
19
32
  "peerDependencies": {
20
- "@modelcontextprotocol/sdk": "^1.12.0",
33
+ "@modelcontextprotocol/sdk": "^1.28.0",
21
34
  "zod": "^4.3.5"
22
35
  }
23
36
  }