@ontrails/mcp 1.0.0-beta.1 → 1.0.0-beta.10
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/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +123 -0
- package/README.md +12 -9
- package/dist/annotations.d.ts +2 -2
- package/dist/annotations.d.ts.map +1 -1
- package/dist/annotations.js +8 -6
- package/dist/annotations.js.map +1 -1
- package/dist/blaze.d.ts +2 -0
- package/dist/blaze.d.ts.map +1 -1
- package/dist/blaze.js +12 -2
- package/dist/blaze.js.map +1 -1
- package/dist/build.d.ts +4 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +79 -62
- package/dist/build.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/annotations.test.ts +15 -22
- package/src/__tests__/blaze.test.ts +59 -14
- package/src/__tests__/build.test.ts +159 -61
- package/src/annotations.ts +11 -11
- package/src/blaze.ts +16 -2
- package/src/build.ts +119 -91
package/.turbo/turbo-lint.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,128 @@
|
|
|
1
1
|
# @ontrails/mcp
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Cleanup and hardening pass across all packages.
|
|
8
|
+
|
|
9
|
+
**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 `Surface` type, `adapters.ts`, `health.ts`, and `job.ts` proof-of-concept from published package.
|
|
10
|
+
|
|
11
|
+
**cli**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `blaze()` with opt-out via `validate: false`.
|
|
12
|
+
|
|
13
|
+
**http**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `blaze()` with opt-out.
|
|
14
|
+
|
|
15
|
+
**mcp**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `blaze()` with opt-out.
|
|
16
|
+
|
|
17
|
+
**warden**: Project-aware rule context preserved in trail wrappers.
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @ontrails/core@1.0.0-beta.10
|
|
21
|
+
|
|
22
|
+
## 1.0.0-beta.9
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- Consolidated improvements across all surface packages.
|
|
27
|
+
|
|
28
|
+
**core**: Add `TrailResult<T>` utility type, `topo.ids()` and `topo.count` accessors, `dispatch()` for headless trail execution, and extract shared `executeTrail` pipeline used by CLI/MCP/HTTP.
|
|
29
|
+
|
|
30
|
+
**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.
|
|
31
|
+
|
|
32
|
+
**mcp**: Return `Result` from `buildMcpTools()` on collision instead of throwing.
|
|
33
|
+
|
|
34
|
+
**cli**: Verify exception catching via centralized `executeTrail`.
|
|
35
|
+
|
|
36
|
+
**testing**: Follow context awareness improvements.
|
|
37
|
+
|
|
38
|
+
**warden**: Refactor rules as composable trails with examples.
|
|
39
|
+
|
|
40
|
+
**schema**: Error code and empty body fixes.
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- Updated dependencies
|
|
45
|
+
- @ontrails/core@1.0.0-beta.9
|
|
46
|
+
|
|
47
|
+
## 1.0.0-beta.8
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- @ontrails/core@1.0.0-beta.8
|
|
52
|
+
|
|
53
|
+
## 1.0.0-beta.7
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- @ontrails/core@1.0.0-beta.7
|
|
58
|
+
|
|
59
|
+
## 1.0.0-beta.6
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Updated dependencies
|
|
64
|
+
- @ontrails/core@1.0.0-beta.6
|
|
65
|
+
|
|
66
|
+
## 1.0.0-beta.5
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- Updated dependencies
|
|
71
|
+
- @ontrails/core@1.0.0-beta.5
|
|
72
|
+
|
|
73
|
+
## 1.0.0-beta.4
|
|
74
|
+
|
|
75
|
+
### Major Changes
|
|
76
|
+
|
|
77
|
+
- API simplification: unified trail model, intent enum, run, metadata.
|
|
78
|
+
|
|
79
|
+
**BREAKING CHANGES:**
|
|
80
|
+
|
|
81
|
+
- `hike()` removed — use `trail()` with optional `follow: [...]` field
|
|
82
|
+
- `follows` renamed to `follow` (singular, matching `ctx.follow()`)
|
|
83
|
+
- `topo.hikes` removed — single `topo.trails` map
|
|
84
|
+
- `kind: 'hike'` removed — everything is `kind: 'trail'`
|
|
85
|
+
- `readOnly`/`destructive` booleans replaced by `intent: 'read' | 'write' | 'destroy'`
|
|
86
|
+
- `implementation` field renamed to `run`
|
|
87
|
+
- `markers` field renamed to `metadata`
|
|
88
|
+
- `testHike` renamed to `testFollows`, `HikeScenario` to `FollowScenario`
|
|
89
|
+
- `blaze()` now returns the surface handle (`Command` for CLI, `Server` for MCP)
|
|
90
|
+
|
|
91
|
+
### Patch Changes
|
|
92
|
+
|
|
93
|
+
- Updated dependencies
|
|
94
|
+
- @ontrails/core@1.0.0-beta.4
|
|
95
|
+
|
|
96
|
+
## 1.0.0-beta.3
|
|
97
|
+
|
|
98
|
+
### Minor Changes
|
|
99
|
+
|
|
100
|
+
- Bug fixes across all surface packages found via parallel Codex review.
|
|
101
|
+
|
|
102
|
+
**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.
|
|
103
|
+
|
|
104
|
+
**cli**: Switch blaze to parseAsync for proper async error handling, add boolean flag negation (--no-flag), and strict number parsing that rejects partial input.
|
|
105
|
+
|
|
106
|
+
**mcp**: Align BlobRef with core (including ReadableStream support) and detect tool-name collisions after normalization.
|
|
107
|
+
|
|
108
|
+
**testing**: Include hikes in testContracts validation, with follow-context awareness.
|
|
109
|
+
|
|
110
|
+
**warden**: Collect hike detour targets, validate detour refs in hike specs, and stop implementation-returns-result from walking into nested function bodies.
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- Updated dependencies
|
|
115
|
+
- @ontrails/core@1.0.0-beta.3
|
|
116
|
+
|
|
117
|
+
## 1.0.0-beta.2
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- Fix workspace dependency resolution in published packages. Now using bun publish
|
|
122
|
+
which correctly replaces workspace:^ with actual version numbers.
|
|
123
|
+
- Updated dependencies
|
|
124
|
+
- @ontrails/core@1.0.0-beta.2
|
|
125
|
+
|
|
3
126
|
## 1.0.0-beta.1
|
|
4
127
|
|
|
5
128
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@ 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
|
-
|
|
15
|
-
|
|
14
|
+
intent: 'read',
|
|
15
|
+
run: (input) => Result.ok(`Hello, ${input.name}!`),
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
const app = topo('myapp', { greet });
|
|
@@ -26,8 +26,9 @@ For more control, build the tools yourself:
|
|
|
26
26
|
```typescript
|
|
27
27
|
import { buildMcpTools } from '@ontrails/mcp';
|
|
28
28
|
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const result = buildMcpTools(app);
|
|
30
|
+
if (result.isErr()) throw result.error; // ValidationError on tool-name collision
|
|
31
|
+
for (const tool of result.value) {
|
|
31
32
|
server.registerTool(tool.name, tool.handler, {
|
|
32
33
|
inputSchema: tool.inputSchema,
|
|
33
34
|
annotations: tool.annotations,
|
|
@@ -35,6 +36,8 @@ for (const tool of tools) {
|
|
|
35
36
|
}
|
|
36
37
|
```
|
|
37
38
|
|
|
39
|
+
`buildMcpTools` 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.
|
|
40
|
+
|
|
38
41
|
## API
|
|
39
42
|
|
|
40
43
|
| Export | What it does |
|
|
@@ -42,19 +45,19 @@ for (const tool of tools) {
|
|
|
42
45
|
| `blaze(app, options?)` | Start an MCP server with all trails as tools |
|
|
43
46
|
| `buildMcpTools(app, options?)` | Build tool definitions without starting a server |
|
|
44
47
|
| `deriveToolName(appName, trailId)` | Compute the MCP tool name from app and trail IDs |
|
|
45
|
-
| `deriveAnnotations(trail)` | Extract MCP annotations from trail
|
|
48
|
+
| `deriveAnnotations(trail)` | Extract MCP annotations from trail intent and metadata |
|
|
46
49
|
| `createMcpProgressCallback(server)` | Bridge `ctx.progress` to MCP `notifications/progress` |
|
|
47
50
|
|
|
48
51
|
See the [API Reference](../../docs/api-reference.md) for the full list.
|
|
49
52
|
|
|
50
53
|
## Annotations
|
|
51
54
|
|
|
52
|
-
Trail
|
|
55
|
+
Trail intent and metadata map directly to MCP annotations:
|
|
53
56
|
|
|
54
57
|
| Trail field | MCP annotation |
|
|
55
58
|
| --- | --- |
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
59
|
+
| `intent: 'read'` | `readOnlyHint: true` |
|
|
60
|
+
| `intent: 'destroy'` | `destructiveHint: true` |
|
|
58
61
|
| `idempotent: true` | `idempotentHint: true` |
|
|
59
62
|
| `description` | `title` |
|
|
60
63
|
|
|
@@ -70,7 +73,7 @@ Implementations report progress through `ctx.progress`. On MCP, these bridge to
|
|
|
70
73
|
|
|
71
74
|
```typescript
|
|
72
75
|
const importTrail = trail('data.import', {
|
|
73
|
-
|
|
76
|
+
run: async (input, ctx) => {
|
|
74
77
|
for (let i = 0; i < items.length; i++) {
|
|
75
78
|
await processItem(items[i]);
|
|
76
79
|
ctx.progress?.({ type: 'progress', current: i + 1, total: items.length });
|
package/dist/annotations.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Derive MCP tool annotations from trail spec
|
|
2
|
+
* Derive MCP tool annotations from trail spec fields.
|
|
3
3
|
*/
|
|
4
4
|
import type { Trail } from '@ontrails/core';
|
|
5
5
|
export interface McpAnnotations {
|
|
@@ -15,5 +15,5 @@ export interface McpAnnotations {
|
|
|
15
15
|
* Only sets hints that are explicitly declared on the trail.
|
|
16
16
|
* Omitted hints let the MCP SDK use its defaults.
|
|
17
17
|
*/
|
|
18
|
-
export declare const deriveAnnotations: (trail: Pick<Trail<unknown, unknown>, "
|
|
18
|
+
export declare const deriveAnnotations: (trail: Pick<Trail<unknown, unknown>, "intent" | "idempotent" | "description">) => McpAnnotations;
|
|
19
19
|
//# sourceMappingURL=annotations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../src/annotations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../src/annotations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAU,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAMpD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAMD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,aAAa,CAAC,KAC5E,cAoBF,CAAC"}
|
package/dist/annotations.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Derive MCP tool annotations from trail spec
|
|
2
|
+
* Derive MCP tool annotations from trail spec fields.
|
|
3
3
|
*/
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
5
|
// Derivation
|
|
@@ -12,11 +12,13 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export const deriveAnnotations = (trail) => {
|
|
14
14
|
const annotations = {};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const intentToHint = {
|
|
16
|
+
destroy: 'destructiveHint',
|
|
17
|
+
read: 'readOnlyHint',
|
|
18
|
+
};
|
|
19
|
+
const hint = intentToHint[trail.intent];
|
|
20
|
+
if (hint) {
|
|
21
|
+
annotations[hint] = true;
|
|
20
22
|
}
|
|
21
23
|
if (trail.idempotent === true) {
|
|
22
24
|
annotations['idempotentHint'] = true;
|
package/dist/annotations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../src/annotations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgBH,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,
|
|
1
|
+
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../src/annotations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgBH,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAA6E,EAC7D,EAAE;IAClB,MAAM,WAAW,GAA4B,EAAE,CAAC;IAEhD,MAAM,YAAY,GAAoC;QACpD,OAAO,EAAE,iBAAiB;QAC1B,IAAI,EAAE,cAAc;KACrB,CAAC;IAEF,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,IAAI,EAAE,CAAC;QACT,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3B,CAAC;IACD,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;QAC9B,WAAW,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;IACvC,CAAC;IACD,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACpC,WAAW,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;IAC3C,CAAC;IAED,OAAO,WAA6B,CAAC;AACvC,CAAC,CAAC"}
|
package/dist/blaze.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface BlazeMcpOptions {
|
|
|
21
21
|
readonly version?: string | undefined;
|
|
22
22
|
} | undefined;
|
|
23
23
|
readonly transport?: 'stdio' | undefined;
|
|
24
|
+
/** Set to `false` to skip topo validation at startup. Defaults to `true`. */
|
|
25
|
+
readonly validate?: boolean | undefined;
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* Create an MCP Server instance and register all tools.
|
package/dist/blaze.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blaze.d.ts","sourceRoot":"","sources":["../src/blaze.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAKnE,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"blaze.d.ts","sourceRoot":"","sources":["../src/blaze.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,O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
|
11
11
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
12
12
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
13
|
+
import { validateTopo } from '@ontrails/core';
|
|
13
14
|
import { buildMcpTools } from './build.js';
|
|
14
15
|
import { connectStdio } from './stdio.js';
|
|
15
16
|
// ---------------------------------------------------------------------------
|
|
@@ -81,13 +82,22 @@ export const createMcpServer = (tools, info) => {
|
|
|
81
82
|
* Build MCP tools from an App, create a server, and connect via stdio.
|
|
82
83
|
*/
|
|
83
84
|
export const blaze = async (app, options = {}) => {
|
|
84
|
-
|
|
85
|
+
if (options.validate !== false) {
|
|
86
|
+
const validated = validateTopo(app);
|
|
87
|
+
if (validated.isErr()) {
|
|
88
|
+
throw validated.error;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const toolsResult = buildMcpTools(app, {
|
|
85
92
|
createContext: options.createContext,
|
|
86
93
|
excludeTrails: options.excludeTrails,
|
|
87
94
|
includeTrails: options.includeTrails,
|
|
88
95
|
layers: options.layers,
|
|
89
96
|
});
|
|
90
|
-
|
|
97
|
+
if (toolsResult.isErr()) {
|
|
98
|
+
throw toolsResult.error;
|
|
99
|
+
}
|
|
100
|
+
const server = createMcpServer(toolsResult.value, {
|
|
91
101
|
name: options.serverInfo?.name ?? app.name,
|
|
92
102
|
version: options.serverInfo?.version ?? '0.1.0',
|
|
93
103
|
});
|
package/dist/blaze.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blaze.js","sourceRoot":"","sources":["../src/blaze.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"blaze.js","sourceRoot":"","sources":["../src/blaze.ts"],"names":[],"mappings":"AAAA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EACxB,GAAS,EACT,UAA2B,EAAE,EACd,EAAE;IACjB,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC;YACtB,MAAM,SAAS,CAAC,KAAK,CAAC;QACxB,CAAC;IACH,CAAC;IAED,MAAM,WAAW,GAAG,aAAa,CAAC,GAAG,EAAE;QACrC,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,IAAI,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC;QACxB,MAAM,WAAW,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,WAAW,CAAC,KAAK,EAAE;QAChD,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,IAAI,IAAI,GAAG,CAAC,IAAI;QAC1C,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,IAAI,OAAO;KAChD,CAAC,CAAC;IAEH,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC,CAAC"}
|
package/dist/build.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* validate input, compose layers, execute the implementation, and map
|
|
6
6
|
* Results to MCP responses.
|
|
7
7
|
*/
|
|
8
|
+
import { Result } from '@ontrails/core';
|
|
8
9
|
import type { Layer, Topo, TrailContext } from '@ontrails/core';
|
|
9
10
|
import type { McpAnnotations } from './annotations.js';
|
|
10
11
|
export interface BuildMcpToolsOptions {
|
|
@@ -19,6 +20,8 @@ export interface McpToolDefinition {
|
|
|
19
20
|
readonly handler: (args: Record<string, unknown>, extra: McpExtra) => Promise<McpToolResult>;
|
|
20
21
|
readonly inputSchema: Record<string, unknown>;
|
|
21
22
|
readonly name: string;
|
|
23
|
+
/** The trail ID this tool was derived from. */
|
|
24
|
+
readonly trailId: string;
|
|
22
25
|
}
|
|
23
26
|
export interface McpExtra {
|
|
24
27
|
readonly progressToken?: string | number | undefined;
|
|
@@ -36,5 +39,5 @@ export interface McpContent {
|
|
|
36
39
|
readonly type: 'text' | 'image' | 'resource';
|
|
37
40
|
readonly uri?: string | undefined;
|
|
38
41
|
}
|
|
39
|
-
export declare const buildMcpTools: (app: Topo, options?: BuildMcpToolsOptions) => McpToolDefinition[]
|
|
42
|
+
export declare const buildMcpTools: (app: Topo, options?: BuildMcpToolsOptions) => Result<McpToolDefinition[], Error>;
|
|
40
43
|
//# sourceMappingURL=build.d.ts.map
|
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,MAAM,EAKP,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAW,KAAK,EAAE,IAAI,EAAS,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEhF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASvD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,aAAa,CAAC,EACnB,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,GAC5C,SAAS,CAAC;IACd,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,KAAK,EAAE,GAAG,SAA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AAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAkQD,eAAO,MAAM,aAAa,GACxB,KAAK,IAAI,EACT,UAAS,oBAAyB,KACjC,MAAM,CAAC,iBAAiB,EAAE,EAAE,KAAK,CAoBnC,CAAC"}
|
package/dist/build.js
CHANGED
|
@@ -5,18 +5,44 @@
|
|
|
5
5
|
* validate input, compose layers, execute the implementation, and map
|
|
6
6
|
* Results to MCP responses.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { Result, ValidationError, executeTrail, isBlobRef, zodToJsonSchema, } from '@ontrails/core';
|
|
9
9
|
import { deriveAnnotations } from './annotations.js';
|
|
10
10
|
import { createMcpProgressCallback } from './progress.js';
|
|
11
11
|
import { deriveToolName } from './tool-name.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Internal helpers (defined before use)
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
/** Concatenate an array of Uint8Array chunks into a single Uint8Array. */
|
|
16
|
+
const concatChunks = (chunks, totalLength) => {
|
|
17
|
+
const result = new Uint8Array(totalLength);
|
|
18
|
+
let offset = 0;
|
|
19
|
+
for (const chunk of chunks) {
|
|
20
|
+
result.set(chunk, offset);
|
|
21
|
+
offset += chunk.length;
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
/** Collect a ReadableStream into a single Uint8Array. */
|
|
26
|
+
const collectStream = async (stream) => {
|
|
27
|
+
const reader = stream.getReader();
|
|
28
|
+
const chunks = [];
|
|
29
|
+
let totalLength = 0;
|
|
30
|
+
for (;;) {
|
|
31
|
+
const { done, value } = await reader.read();
|
|
32
|
+
if (done) {
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
chunks.push(value);
|
|
36
|
+
totalLength += value.length;
|
|
15
37
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
38
|
+
return concatChunks(chunks, totalLength);
|
|
39
|
+
};
|
|
40
|
+
/** Resolve BlobRef data to Uint8Array (handles ReadableStream). */
|
|
41
|
+
const resolveBlobData = (blob) => {
|
|
42
|
+
if (blob.data instanceof ReadableStream) {
|
|
43
|
+
return collectStream(blob.data);
|
|
44
|
+
}
|
|
45
|
+
return blob.data;
|
|
20
46
|
};
|
|
21
47
|
const uint8ArrayToBase64 = (bytes) => {
|
|
22
48
|
// Use btoa with manual conversion for runtime-agnostic base64
|
|
@@ -26,10 +52,11 @@ const uint8ArrayToBase64 = (bytes) => {
|
|
|
26
52
|
}
|
|
27
53
|
return btoa(binary);
|
|
28
54
|
};
|
|
29
|
-
const blobToContent = (blob) => {
|
|
55
|
+
const blobToContent = async (blob) => {
|
|
56
|
+
const bytes = await resolveBlobData(blob);
|
|
30
57
|
if (blob.mimeType.startsWith('image/')) {
|
|
31
58
|
return {
|
|
32
|
-
data: uint8ArrayToBase64(
|
|
59
|
+
data: uint8ArrayToBase64(bytes),
|
|
33
60
|
mimeType: blob.mimeType,
|
|
34
61
|
type: 'image',
|
|
35
62
|
};
|
|
@@ -37,18 +64,18 @@ const blobToContent = (blob) => {
|
|
|
37
64
|
return {
|
|
38
65
|
mimeType: blob.mimeType,
|
|
39
66
|
type: 'resource',
|
|
40
|
-
uri: `blob://${blob.name
|
|
67
|
+
uri: `blob://${blob.name}`,
|
|
41
68
|
};
|
|
42
69
|
};
|
|
43
70
|
/** Separate blob fields from non-blob fields in an object. */
|
|
44
|
-
const separateBlobFields = (obj) => {
|
|
71
|
+
const separateBlobFields = async (obj) => {
|
|
45
72
|
const blobContents = [];
|
|
46
73
|
const textFields = {};
|
|
47
74
|
let hasBlobFields = false;
|
|
48
75
|
for (const [key, val] of Object.entries(obj)) {
|
|
49
76
|
if (isBlobRef(val)) {
|
|
50
77
|
hasBlobFields = true;
|
|
51
|
-
blobContents.push(blobToContent(val));
|
|
78
|
+
blobContents.push(await blobToContent(val));
|
|
52
79
|
}
|
|
53
80
|
else {
|
|
54
81
|
textFields[key] = val;
|
|
@@ -57,8 +84,8 @@ const separateBlobFields = (obj) => {
|
|
|
57
84
|
return { blobContents, hasBlobFields, textFields };
|
|
58
85
|
};
|
|
59
86
|
/** Serialize a mixed blob/text object to MCP content. */
|
|
60
|
-
const serializeMixedObject = (obj) => {
|
|
61
|
-
const { blobContents, hasBlobFields, textFields } = separateBlobFields(obj);
|
|
87
|
+
const serializeMixedObject = async (obj) => {
|
|
88
|
+
const { blobContents, hasBlobFields, textFields } = await separateBlobFields(obj);
|
|
62
89
|
if (!hasBlobFields) {
|
|
63
90
|
return undefined;
|
|
64
91
|
}
|
|
@@ -67,12 +94,12 @@ const serializeMixedObject = (obj) => {
|
|
|
67
94
|
}
|
|
68
95
|
return blobContents;
|
|
69
96
|
};
|
|
70
|
-
const serializeOutput = (value) => {
|
|
97
|
+
const serializeOutput = async (value) => {
|
|
71
98
|
if (isBlobRef(value)) {
|
|
72
|
-
return [blobToContent(value)];
|
|
99
|
+
return [await blobToContent(value)];
|
|
73
100
|
}
|
|
74
101
|
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
75
|
-
const mixed = serializeMixedObject(value);
|
|
102
|
+
const mixed = await serializeMixedObject(value);
|
|
76
103
|
if (mixed) {
|
|
77
104
|
return mixed;
|
|
78
105
|
}
|
|
@@ -87,40 +114,18 @@ const mcpError = (message) => ({
|
|
|
87
114
|
content: [{ text: message, type: 'text' }],
|
|
88
115
|
isError: true,
|
|
89
116
|
});
|
|
90
|
-
|
|
91
|
-
const buildTrailContext = async (options, extra) => {
|
|
92
|
-
const baseContext = options.createContext !== undefined && options.createContext !== null
|
|
93
|
-
? await options.createContext()
|
|
94
|
-
: createTrailContext();
|
|
95
|
-
const signal = extra.signal ?? baseContext.signal;
|
|
117
|
+
const createHandler = (t, layers, options) => async (args, extra) => {
|
|
96
118
|
const progressCb = createMcpProgressCallback(extra);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const result = await impl(validatedInput, ctx);
|
|
108
|
-
if (result.isOk()) {
|
|
109
|
-
return { content: serializeOutput(result.value) };
|
|
110
|
-
}
|
|
111
|
-
return mcpError(result.error.message);
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
return mcpError(error instanceof Error ? error.message : String(error));
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
const createHandler = (trail, layers, options) => async (args, extra) => {
|
|
118
|
-
const validated = validateInput(trail.input, args);
|
|
119
|
-
if (validated.isErr()) {
|
|
120
|
-
return mcpError(validated.error.message);
|
|
121
|
-
}
|
|
122
|
-
const ctx = await buildTrailContext(options, extra);
|
|
123
|
-
return executeAndMap(trail, validated.value, ctx, layers);
|
|
119
|
+
const result = await executeTrail(t, args, {
|
|
120
|
+
createContext: options.createContext,
|
|
121
|
+
ctx: progressCb === undefined ? undefined : { progress: progressCb },
|
|
122
|
+
layers,
|
|
123
|
+
signal: extra.signal,
|
|
124
|
+
});
|
|
125
|
+
if (result.isOk()) {
|
|
126
|
+
return { content: await serializeOutput(result.value) };
|
|
127
|
+
}
|
|
128
|
+
return mcpError(result.error.message);
|
|
124
129
|
};
|
|
125
130
|
// ---------------------------------------------------------------------------
|
|
126
131
|
// Builder
|
|
@@ -131,12 +136,12 @@ const createHandler = (trail, layers, options) => async (args, extra) => {
|
|
|
131
136
|
* Each trail in the topo becomes an McpToolDefinition with:
|
|
132
137
|
* - A derived tool name (app-prefixed, underscore-delimited)
|
|
133
138
|
* - JSON Schema input from zodToJsonSchema
|
|
134
|
-
* - MCP annotations from trail
|
|
139
|
+
* - MCP annotations from trail metadata
|
|
135
140
|
* - A handler that validates, composes layers, executes, and maps results
|
|
136
141
|
*/
|
|
137
|
-
/** Check if a trail should be included based on
|
|
142
|
+
/** Check if a trail should be included based on metadata and filters. */
|
|
138
143
|
const shouldInclude = (trail, options) => {
|
|
139
|
-
if (trail.
|
|
144
|
+
if (trail.metadata?.['internal'] === true) {
|
|
140
145
|
return false;
|
|
141
146
|
}
|
|
142
147
|
if (options.includeTrails !== undefined && options.includeTrails.length > 0) {
|
|
@@ -171,20 +176,32 @@ const buildToolDefinition = (app, trail, layers, options) => {
|
|
|
171
176
|
handler: createHandler(trail, layers, options),
|
|
172
177
|
inputSchema: zodToJsonSchema(trail.input),
|
|
173
178
|
name: deriveToolName(app.name, trail.id),
|
|
179
|
+
trailId: trail.id,
|
|
174
180
|
};
|
|
175
181
|
};
|
|
182
|
+
/** Register a trail as an MCP tool, checking for name collisions. */
|
|
183
|
+
const registerTool = (app, trailItem, layers, options, nameToTrailId, tools) => {
|
|
184
|
+
const toolName = deriveToolName(app.name, trailItem.id);
|
|
185
|
+
const existingId = nameToTrailId.get(toolName);
|
|
186
|
+
if (existingId !== undefined) {
|
|
187
|
+
return Result.err(new ValidationError(`MCP tool-name collision: trails "${existingId}" and "${trailItem.id}" both derive the tool name "${toolName}"`));
|
|
188
|
+
}
|
|
189
|
+
nameToTrailId.set(toolName, trailItem.id);
|
|
190
|
+
tools.push(buildToolDefinition(app, trailItem, layers, options));
|
|
191
|
+
return Result.ok();
|
|
192
|
+
};
|
|
193
|
+
/** Filter topo items to eligible trails. */
|
|
194
|
+
const eligibleTrails = (app, options) => app.list().filter((trail) => shouldInclude(trail, options));
|
|
176
195
|
export const buildMcpTools = (app, options = {}) => {
|
|
177
196
|
const layers = options.layers ?? [];
|
|
178
197
|
const tools = [];
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
continue;
|
|
198
|
+
const nameToTrailId = new Map();
|
|
199
|
+
for (const trailItem of eligibleTrails(app, options)) {
|
|
200
|
+
const registered = registerTool(app, trailItem, layers, options, nameToTrailId, tools);
|
|
201
|
+
if (registered.isErr()) {
|
|
202
|
+
return registered;
|
|
185
203
|
}
|
|
186
|
-
tools.push(buildToolDefinition(app, item, layers, options));
|
|
187
204
|
}
|
|
188
|
-
return tools;
|
|
205
|
+
return Result.ok(tools);
|
|
189
206
|
};
|
|
190
207
|
//# sourceMappingURL=build.js.map
|
package/dist/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,MAAM,EACN,eAAe,EACf,YAAY,EACZ,SAAS,EACT,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAiDhD,8EAA8E;AAC9E,wCAAwC;AACxC,8EAA8E;AAE9E,0EAA0E;AAC1E,MAAM,YAAY,GAAG,CACnB,MAAoB,EACpB,WAAmB,EACP,EAAE;IACd,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3C,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;IACzB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,yDAAyD;AACzD,MAAM,aAAa,GAAG,KAAK,EACzB,MAAkC,EACb,EAAE;IACvB,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IAClC,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,IAAI,WAAW,GAAG,C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",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ontrails/core": "
|
|
17
|
+
"@ontrails/core": "^1.0.0-beta.8"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
21
|
-
"zod": "
|
|
21
|
+
"zod": "^4.3.5"
|
|
22
22
|
}
|
|
23
23
|
}
|