@venturekit/mcp 0.0.30 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/json-schema.d.ts +17 -11
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/json-schema.js +128 -98
- package/dist/json-schema.js.map +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -12,7 +12,8 @@ audit logging, per-call context — are injected through hooks, so any app can
|
|
|
12
12
|
expose an MCP endpoint (and issue/verify tokens for it) without re-implementing
|
|
13
13
|
the generic parts.
|
|
14
14
|
|
|
15
|
-
It stays dependency-light: `zod` is a **type-only peer dependency
|
|
15
|
+
It stays dependency-light: `zod` is a **type-only peer dependency** (Zod 4 — the
|
|
16
|
+
`tools/list` serializer reads Zod 4's `_zod.def` internals), token hashing
|
|
16
17
|
uses `node:crypto` scrypt (no third-party crypto dep), and the store talks to your
|
|
17
18
|
database through a structural `Querier` (pass `@venturekit/data`'s `query` — no DB
|
|
18
19
|
driver dependency). The dispatcher core itself remains entirely storage-free.
|
package/dist/json-schema.d.ts
CHANGED
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
* Minimal Zod -> JSON-Schema serializer for MCP `tools/list` output.
|
|
3
3
|
*
|
|
4
4
|
* Implements the subset MCP tool inputs realistically use: `z.object`
|
|
5
|
-
* with primitives, `optional`, `nullable`, `default`, `enum`,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* (
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* with primitives, `optional`, `nullable`, `default`, `enum`, `array`,
|
|
6
|
+
* `record`, `union`, `literal`, plus the wrappers Zod inserts for
|
|
7
|
+
* `.transform()` / `.pipe()` / `z.preprocess()` (all `pipe` in Zod 4),
|
|
8
|
+
* `.readonly()`, `.catch()` and `.nonoptional()` — these are unwrapped
|
|
9
|
+
* to the schema they decorate so a wrapped object still advertises its
|
|
10
|
+
* real properties. (`.refine()` / `.superRefine()` need no unwrapping in
|
|
11
|
+
* Zod 4: they append a check to the schema itself rather than wrapping
|
|
12
|
+
* it.)
|
|
11
13
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* Targets Zod 4, whose introspection surface is `schema._zod.def` with
|
|
15
|
+
* lowercase type tags (`'object'`, `'string'`, …) and `checks` carrying
|
|
16
|
+
* their own `_zod.def`. `zod` is imported type-only; this function reads
|
|
17
|
+
* those internals structurally and never constructs a schema, so the
|
|
18
|
+
* package carries no runtime zod dependency.
|
|
15
19
|
*/
|
|
16
|
-
import type {
|
|
20
|
+
import type { ZodType } from 'zod';
|
|
17
21
|
export interface JsonSchema {
|
|
18
22
|
type?: string | string[];
|
|
19
23
|
description?: string;
|
|
@@ -29,7 +33,9 @@ export interface JsonSchema {
|
|
|
29
33
|
maxLength?: number;
|
|
30
34
|
minimum?: number;
|
|
31
35
|
maximum?: number;
|
|
36
|
+
exclusiveMinimum?: number;
|
|
37
|
+
exclusiveMaximum?: number;
|
|
32
38
|
pattern?: string;
|
|
33
39
|
}
|
|
34
|
-
export declare function zodToJsonSchema(schema:
|
|
40
|
+
export declare function zodToJsonSchema(schema: ZodType): JsonSchema;
|
|
35
41
|
//# sourceMappingURL=json-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AA4DnC,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,oBAAoB,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgBD,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,UAAU,CAU3D"}
|
package/dist/json-schema.js
CHANGED
|
@@ -2,27 +2,51 @@
|
|
|
2
2
|
* Minimal Zod -> JSON-Schema serializer for MCP `tools/list` output.
|
|
3
3
|
*
|
|
4
4
|
* Implements the subset MCP tool inputs realistically use: `z.object`
|
|
5
|
-
* with primitives, `optional`, `nullable`, `default`, `enum`,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* (
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* with primitives, `optional`, `nullable`, `default`, `enum`, `array`,
|
|
6
|
+
* `record`, `union`, `literal`, plus the wrappers Zod inserts for
|
|
7
|
+
* `.transform()` / `.pipe()` / `z.preprocess()` (all `pipe` in Zod 4),
|
|
8
|
+
* `.readonly()`, `.catch()` and `.nonoptional()` — these are unwrapped
|
|
9
|
+
* to the schema they decorate so a wrapped object still advertises its
|
|
10
|
+
* real properties. (`.refine()` / `.superRefine()` need no unwrapping in
|
|
11
|
+
* Zod 4: they append a check to the schema itself rather than wrapping
|
|
12
|
+
* it.)
|
|
11
13
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* Targets Zod 4, whose introspection surface is `schema._zod.def` with
|
|
15
|
+
* lowercase type tags (`'object'`, `'string'`, …) and `checks` carrying
|
|
16
|
+
* their own `_zod.def`. `zod` is imported type-only; this function reads
|
|
17
|
+
* those internals structurally and never constructs a schema, so the
|
|
18
|
+
* package carries no runtime zod dependency.
|
|
15
19
|
*/
|
|
20
|
+
/** Zod 4 `string_format` check -> JSON-Schema `format`. */
|
|
21
|
+
const STRING_FORMATS = {
|
|
22
|
+
uuid: 'uuid',
|
|
23
|
+
guid: 'uuid',
|
|
24
|
+
email: 'email',
|
|
25
|
+
url: 'uri',
|
|
26
|
+
datetime: 'date-time',
|
|
27
|
+
date: 'date',
|
|
28
|
+
time: 'time',
|
|
29
|
+
duration: 'duration',
|
|
30
|
+
ipv4: 'ipv4',
|
|
31
|
+
ipv6: 'ipv6',
|
|
32
|
+
};
|
|
16
33
|
export function zodToJsonSchema(schema) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
const node = schema;
|
|
35
|
+
if (!node?._zod?.def) {
|
|
36
|
+
// A Zod 3 schema (`._def.typeName`) would otherwise walk into
|
|
37
|
+
// `undefined` and report an empty input schema for every tool.
|
|
38
|
+
throw new TypeError('@venturekit/mcp requires a Zod 4 schema (missing `_zod.def`); upgrade the host app to zod ^4.');
|
|
39
|
+
}
|
|
40
|
+
return toJsonSchema(node);
|
|
41
|
+
}
|
|
42
|
+
function toJsonSchema(schema) {
|
|
43
|
+
const def = schema._zod.def;
|
|
44
|
+
switch (def.type) {
|
|
45
|
+
case 'object': {
|
|
22
46
|
const properties = {};
|
|
23
47
|
const required = [];
|
|
24
|
-
for (const [k, v] of Object.entries(shape)) {
|
|
25
|
-
properties[k] =
|
|
48
|
+
for (const [k, v] of Object.entries(def.shape ?? {})) {
|
|
49
|
+
properties[k] = toJsonSchema(v);
|
|
26
50
|
if (!isOptional(v))
|
|
27
51
|
required.push(k);
|
|
28
52
|
}
|
|
@@ -33,107 +57,113 @@ export function zodToJsonSchema(schema) {
|
|
|
33
57
|
additionalProperties: false,
|
|
34
58
|
};
|
|
35
59
|
}
|
|
36
|
-
case '
|
|
60
|
+
case 'string': {
|
|
37
61
|
const out = { type: 'string' };
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (c.kind === 'regex' && c.regex)
|
|
53
|
-
out.pattern = c.regex.source;
|
|
62
|
+
for (const c of constraintsOf(def)) {
|
|
63
|
+
if (c.check === 'min_length' && typeof c.minimum === 'number')
|
|
64
|
+
out.minLength = c.minimum;
|
|
65
|
+
if (c.check === 'max_length' && typeof c.maximum === 'number')
|
|
66
|
+
out.maxLength = c.maximum;
|
|
67
|
+
if (c.check === 'string_format') {
|
|
68
|
+
if (c.format === 'regex') {
|
|
69
|
+
if (c.pattern)
|
|
70
|
+
out.pattern = c.pattern.source;
|
|
71
|
+
}
|
|
72
|
+
else if (c.format && STRING_FORMATS[c.format]) {
|
|
73
|
+
out.format = STRING_FORMATS[c.format];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
54
76
|
}
|
|
55
77
|
return out;
|
|
56
78
|
}
|
|
57
|
-
case '
|
|
79
|
+
case 'number': {
|
|
58
80
|
const out = { type: 'number' };
|
|
59
|
-
const
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (c.
|
|
81
|
+
for (const c of constraintsOf(def)) {
|
|
82
|
+
if (c.check === 'greater_than' && typeof c.value === 'number') {
|
|
83
|
+
if (c.inclusive)
|
|
84
|
+
out.minimum = c.value;
|
|
85
|
+
else
|
|
86
|
+
out.exclusiveMinimum = c.value;
|
|
87
|
+
}
|
|
88
|
+
if (c.check === 'less_than' && typeof c.value === 'number') {
|
|
89
|
+
if (c.inclusive)
|
|
90
|
+
out.maximum = c.value;
|
|
91
|
+
else
|
|
92
|
+
out.exclusiveMaximum = c.value;
|
|
93
|
+
}
|
|
94
|
+
// `.int()` / `.int32()` / `z.int()` all surface as a numeric format.
|
|
95
|
+
if (c.check === 'number_format' && c.format?.includes('int'))
|
|
67
96
|
out.type = 'integer';
|
|
68
97
|
}
|
|
69
98
|
return out;
|
|
70
99
|
}
|
|
71
|
-
case '
|
|
100
|
+
case 'boolean':
|
|
72
101
|
return { type: 'boolean' };
|
|
73
|
-
case '
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const inner = schema._def.type;
|
|
79
|
-
return { type: 'array', items: zodToJsonSchema(inner) };
|
|
102
|
+
case 'enum': {
|
|
103
|
+
// `z.enum` and `z.nativeEnum` share this node; a native enum may
|
|
104
|
+
// carry number members, so derive the type from the values.
|
|
105
|
+
const values = Object.values(def.entries ?? {});
|
|
106
|
+
return { type: jsonTypeOf(values[0]), enum: values };
|
|
80
107
|
}
|
|
81
|
-
case '
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
case '
|
|
86
|
-
case '
|
|
87
|
-
case '
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
108
|
+
case 'array':
|
|
109
|
+
return { type: 'array', items: toJsonSchema(def.element) };
|
|
110
|
+
case 'record':
|
|
111
|
+
return { type: 'object', additionalProperties: toJsonSchema(def.valueType) };
|
|
112
|
+
case 'optional':
|
|
113
|
+
case 'nullable':
|
|
114
|
+
case 'readonly':
|
|
115
|
+
case 'catch':
|
|
116
|
+
case 'nonoptional':
|
|
117
|
+
return toJsonSchema(def.innerType);
|
|
118
|
+
case 'default':
|
|
119
|
+
case 'prefault': {
|
|
120
|
+
const out = toJsonSchema(def.innerType);
|
|
121
|
+
const dv = def.defaultValue;
|
|
122
|
+
out.default = typeof dv === 'function' ? dv() : dv;
|
|
95
123
|
return out;
|
|
96
124
|
}
|
|
97
|
-
case '
|
|
98
|
-
// `.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// `
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return { oneOf: opts.map((o) => zodToJsonSchema(o)) };
|
|
125
|
+
case 'pipe': {
|
|
126
|
+
// `.pipe()`, `.transform()` and `z.preprocess()` all land here.
|
|
127
|
+
// Describe the output side, which is the validated schema for
|
|
128
|
+
// `.pipe()` / `z.preprocess()`; when it is an opaque `transform`
|
|
129
|
+
// (as in `schema.transform(fn)`) fall back to the input side so
|
|
130
|
+
// the tool still advertises the shape callers must send.
|
|
131
|
+
const out = toJsonSchema(def.out);
|
|
132
|
+
if (Object.keys(out).length)
|
|
133
|
+
return out;
|
|
134
|
+
return toJsonSchema(def.in);
|
|
108
135
|
}
|
|
109
|
-
case '
|
|
110
|
-
|
|
111
|
-
|
|
136
|
+
case 'union':
|
|
137
|
+
return { oneOf: (def.options ?? []).map(toJsonSchema) };
|
|
138
|
+
case 'literal': {
|
|
139
|
+
const values = def.values ?? [];
|
|
140
|
+
return { type: jsonTypeOf(values[0]), enum: [...values] };
|
|
112
141
|
}
|
|
113
|
-
case 'ZodAny':
|
|
114
|
-
case 'ZodUnknown':
|
|
115
|
-
return {};
|
|
116
142
|
default:
|
|
143
|
+
// `any` / `unknown` and anything unmodelled (date, tuple, …).
|
|
117
144
|
return {};
|
|
118
145
|
}
|
|
119
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Every constraint on a primitive: the schema's own def first (a format
|
|
149
|
+
* schema such as `z.uuid()` / `z.int()` carries its constraint there),
|
|
150
|
+
* then the appended `.min()` / `.regex()` / … checks.
|
|
151
|
+
*/
|
|
152
|
+
function constraintsOf(def) {
|
|
153
|
+
return [def, ...(def.checks ?? []).map((c) => c._zod.def)];
|
|
154
|
+
}
|
|
155
|
+
function jsonTypeOf(value) {
|
|
156
|
+
return typeof value === 'number' ? 'number' : typeof value === 'boolean' ? 'boolean' : 'string';
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Whether an object key may be omitted from the *input*. Zod 4 computes
|
|
160
|
+
* this itself as `optin` (`'optional'` for `.optional()` / `.catch()`,
|
|
161
|
+
* `'defaulted'` for `.default()` / `.prefault()`, and propagated through
|
|
162
|
+
* wrappers like `.readonly()` / `.pipe()`), so wrappers need no manual
|
|
163
|
+
* unwrapping here. `.nullable()` leaves it unset — nullable but still
|
|
164
|
+
* required.
|
|
165
|
+
*/
|
|
120
166
|
function isOptional(schema) {
|
|
121
|
-
|
|
122
|
-
if (def.typeName === 'ZodOptional' || def.typeName === 'ZodDefault')
|
|
123
|
-
return true;
|
|
124
|
-
if (def.typeName === 'ZodNullable')
|
|
125
|
-
return false; // nullable but still required
|
|
126
|
-
// Unwrap refinement / pipeline / readonly wrappers so an optional
|
|
127
|
-
// field that's been `.refine()`d still reads as optional.
|
|
128
|
-
if ((def.typeName === 'ZodEffects' || def.typeName === 'ZodReadonly') &&
|
|
129
|
-
def.innerType) {
|
|
130
|
-
return isOptional(def.innerType);
|
|
131
|
-
}
|
|
132
|
-
if (def.typeName === 'ZodEffects') {
|
|
133
|
-
const inner = schema._def.schema;
|
|
134
|
-
if (inner)
|
|
135
|
-
return isOptional(inner);
|
|
136
|
-
}
|
|
137
|
-
return false;
|
|
167
|
+
return schema._zod.optin !== undefined;
|
|
138
168
|
}
|
|
139
169
|
//# sourceMappingURL=json-schema.js.map
|
package/dist/json-schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAkFH,2DAA2D;AAC3D,MAAM,cAAc,GAA2B;IAC7C,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,WAAW;IACrB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,MAAe;IAC7C,MAAM,IAAI,GAAG,MAAqC,CAAC;IACnD,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QACrB,8DAA8D;QAC9D,+DAA+D;QAC/D,MAAM,IAAI,SAAS,CACjB,+FAA+F,CAChG,CAAC;IACJ,CAAC;IACD,OAAO,YAAY,CAAC,IAAe,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,YAAY,CAAC,MAAe;IACnC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;IAE5B,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,UAAU,GAA+B,EAAE,CAAC;YAClD,MAAM,QAAQ,GAAa,EAAE,CAAC;YAC9B,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;gBACrD,UAAU,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBAChC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;oBAAE,QAAQ,CAA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,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC;QAC5D,CAAC;QACD;YACE,8DAA8D;YAC9D,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,GAA2B;IAChD,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClG,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,UAAU,CAAC,MAAe;IACjC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;AACzC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The package is intentionally dependency-light: `zod` is a *type-only*
|
|
5
5
|
* peer dependency (the dispatcher only ever calls `.safeParse` on a
|
|
6
6
|
* schema the host supplies, and the JSON-Schema serializer reads
|
|
7
|
-
* `.
|
|
7
|
+
* `._zod.def` structurally), so nothing here pulls zod in at runtime.
|
|
8
8
|
*
|
|
9
9
|
* The two generic parameters thread two host-owned shapes through the
|
|
10
10
|
* dispatcher:
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* `wrapToolCall` / `createContext`. The CMS uses the
|
|
16
16
|
* `{ token, tenant }` pair from its bearer-token check.
|
|
17
17
|
*/
|
|
18
|
-
import type { ZodType
|
|
18
|
+
import type { ZodType } from 'zod';
|
|
19
19
|
export interface JsonRpcRequest {
|
|
20
20
|
jsonrpc: '2.0';
|
|
21
21
|
id: number | string | null;
|
|
@@ -35,13 +35,13 @@ export interface JsonRpcResponse {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* A single callable tool. `inputSchema` is any Zod schema; the `unknown`
|
|
38
|
-
* Input
|
|
38
|
+
* Input parameter lets schemas using `.default()` (where Zod splits the
|
|
39
39
|
* Input/Output types so Input becomes optional) satisfy this type.
|
|
40
40
|
*/
|
|
41
41
|
export interface McpTool<TInput = unknown, TContext = unknown, TOutput = unknown> {
|
|
42
42
|
name: string;
|
|
43
43
|
description: string;
|
|
44
|
-
inputSchema: ZodType<TInput,
|
|
44
|
+
inputSchema: ZodType<TInput, unknown>;
|
|
45
45
|
run(args: TInput, ctx: TContext): Promise<TOutput>;
|
|
46
46
|
}
|
|
47
47
|
/** A keyed bag of tools sharing one `TContext`. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAInC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,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CAAC,QAAQ,CAAC,CAAC;IACjC,kCAAkC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5E,2EAA2E;IAC3E,aAAa,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrF,qFAAqF;IACrF,SAAS,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,gFAAgF;IAChF,YAAY,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACxF;AAID,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,wCAAwC;IACxC,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,QAAQ,EAAE,eAAe,CAAC;CAC3B"}
|
package/dist/types.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The package is intentionally dependency-light: `zod` is a *type-only*
|
|
5
5
|
* peer dependency (the dispatcher only ever calls `.safeParse` on a
|
|
6
6
|
* schema the host supplies, and the JSON-Schema serializer reads
|
|
7
|
-
* `.
|
|
7
|
+
* `._zod.def` structurally), so nothing here pulls zod in at runtime.
|
|
8
8
|
*
|
|
9
9
|
* The two generic parameters thread two host-owned shapes through the
|
|
10
10
|
* dispatcher:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venturekit/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "Transport-agnostic Model Context Protocol (MCP) server primitives for VentureKit: JSON-RPC dispatch, a typed tool registry, and a Zod→JSON-Schema serializer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"agents"
|
|
42
42
|
],
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"zod": "^
|
|
44
|
+
"zod": "^4.5.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "^26.1.2",
|
|
48
48
|
"typescript": "^5.3.0",
|
|
49
|
-
"zod": "^
|
|
49
|
+
"zod": "^4.5.4"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsc && node -e \"require('fs').cpSync('src/migrations','dist/migrations',{recursive:true})\"",
|