@markcolabs/mcp 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +128 -205
- package/dist/index.d.ts +9 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -186
- package/dist/index.js.map +1 -1
- package/package.json +21 -12
- package/dist/disclaimers/ymyl.d.ts +0 -16
- package/dist/disclaimers/ymyl.d.ts.map +0 -1
- package/dist/disclaimers/ymyl.js +0 -20
- package/dist/disclaimers/ymyl.js.map +0 -1
- package/dist/engines/compoundInterest.d.ts +0 -75
- package/dist/engines/compoundInterest.d.ts.map +0 -1
- package/dist/engines/compoundInterest.js +0 -74
- package/dist/engines/compoundInterest.js.map +0 -1
- package/dist/engines/data/federalTax.d.ts +0 -47
- package/dist/engines/data/federalTax.d.ts.map +0 -1
- package/dist/engines/data/federalTax.js +0 -111
- package/dist/engines/data/federalTax.js.map +0 -1
- package/dist/engines/data/irs2026.d.ts +0 -30
- package/dist/engines/data/irs2026.d.ts.map +0 -1
- package/dist/engines/data/irs2026.js +0 -30
- package/dist/engines/data/irs2026.js.map +0 -1
- package/dist/engines/data/ssa.d.ts +0 -39
- package/dist/engines/data/ssa.d.ts.map +0 -1
- package/dist/engines/data/ssa.js +0 -55
- package/dist/engines/data/ssa.js.map +0 -1
- package/dist/engines/mortgage.d.ts +0 -70
- package/dist/engines/mortgage.d.ts.map +0 -1
- package/dist/engines/mortgage.js +0 -60
- package/dist/engines/mortgage.js.map +0 -1
- package/dist/engines/paycheck.d.ts +0 -93
- package/dist/engines/paycheck.d.ts.map +0 -1
- package/dist/engines/paycheck.js +0 -113
- package/dist/engines/paycheck.js.map +0 -1
- package/dist/engines/retirement401k.d.ts +0 -109
- package/dist/engines/retirement401k.d.ts.map +0 -1
- package/dist/engines/retirement401k.js +0 -130
- package/dist/engines/retirement401k.js.map +0 -1
- package/dist/engines/socialSecurity.d.ts +0 -63
- package/dist/engines/socialSecurity.d.ts.map +0 -1
- package/dist/engines/socialSecurity.js +0 -139
- package/dist/engines/socialSecurity.js.map +0 -1
- package/dist/envelope.d.ts +0 -76
- package/dist/envelope.d.ts.map +0 -1
- package/dist/envelope.js +0 -34
- package/dist/envelope.js.map +0 -1
- package/dist/shared/bounds.d.ts +0 -83
- package/dist/shared/bounds.d.ts.map +0 -1
- package/dist/shared/bounds.js +0 -121
- package/dist/shared/bounds.js.map +0 -1
- package/dist/tools/compoundInterest.d.ts +0 -48
- package/dist/tools/compoundInterest.d.ts.map +0 -1
- package/dist/tools/compoundInterest.js +0 -107
- package/dist/tools/compoundInterest.js.map +0 -1
- package/dist/tools/mortgage.d.ts +0 -51
- package/dist/tools/mortgage.d.ts.map +0 -1
- package/dist/tools/mortgage.js +0 -112
- package/dist/tools/mortgage.js.map +0 -1
- package/dist/tools/paycheck.d.ts +0 -54
- package/dist/tools/paycheck.d.ts.map +0 -1
- package/dist/tools/paycheck.js +0 -122
- package/dist/tools/paycheck.js.map +0 -1
- package/dist/tools/retirement401k.d.ts +0 -85
- package/dist/tools/retirement401k.d.ts.map +0 -1
- package/dist/tools/retirement401k.js +0 -141
- package/dist/tools/retirement401k.js.map +0 -1
- package/dist/tools/socialSecurity.d.ts +0 -51
- package/dist/tools/socialSecurity.d.ts.map +0 -1
- package/dist/tools/socialSecurity.js +0 -117
- package/dist/tools/socialSecurity.js.map +0 -1
- package/dist/util/zod-to-json-schema.d.ts +0 -28
- package/dist/util/zod-to-json-schema.d.ts.map +0 -1
- package/dist/util/zod-to-json-schema.js +0 -98
- package/dist/util/zod-to-json-schema.js.map +0 -1
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal Zod → JSON Schema converter for the MCP `tools/list` `inputSchema` field.
|
|
3
|
-
*
|
|
4
|
-
* The MCP SDK expects a JSON Schema object on each tool descriptor. Rather than
|
|
5
|
-
* pulling in the `zod-to-json-schema` npm package (extra dep, infrequent updates),
|
|
6
|
-
* this file implements the small subset we need for v1 input shapes:
|
|
7
|
-
* - z.object({...})
|
|
8
|
-
* - z.number() with .min()/.max()/.int()
|
|
9
|
-
* - z.enum([...])
|
|
10
|
-
* - .optional() / .describe() metadata
|
|
11
|
-
*
|
|
12
|
-
* If a schema feature added later isn't supported here, extend this util — or
|
|
13
|
-
* swap in the `zod-to-json-schema` package.
|
|
14
|
-
*/
|
|
15
|
-
import { z } from "zod";
|
|
16
|
-
export function zodToJsonSchema(schema) {
|
|
17
|
-
return convert(schema);
|
|
18
|
-
}
|
|
19
|
-
function convert(schema) {
|
|
20
|
-
const def = schema._def;
|
|
21
|
-
const description = def?.description;
|
|
22
|
-
// ZodOptional / ZodDefault unwrapping (we still mark the field as optional in
|
|
23
|
-
// the parent object; here we just convert the inner type).
|
|
24
|
-
if (schema instanceof z.ZodOptional) {
|
|
25
|
-
return { ...convert(def.innerType), description };
|
|
26
|
-
}
|
|
27
|
-
if (schema instanceof z.ZodDefault) {
|
|
28
|
-
return { ...convert(def.innerType), description };
|
|
29
|
-
}
|
|
30
|
-
// ZodEffects wraps schemas built with .refine() / .transform() / .preprocess().
|
|
31
|
-
// Cross-field rules can't be expressed in JSON Schema, but the runtime check
|
|
32
|
-
// still fires inside the tool's safeParse(), so unwrapping to the inner schema
|
|
33
|
-
// exposes a valid JSON Schema to MCP clients without losing validation.
|
|
34
|
-
if (schema instanceof z.ZodEffects) {
|
|
35
|
-
return { ...convert(def.schema), description };
|
|
36
|
-
}
|
|
37
|
-
if (schema instanceof z.ZodObject) {
|
|
38
|
-
const shape = schema.shape;
|
|
39
|
-
const properties = {};
|
|
40
|
-
const required = [];
|
|
41
|
-
for (const [key, child] of Object.entries(shape)) {
|
|
42
|
-
const childSchema = child;
|
|
43
|
-
properties[key] = convert(childSchema);
|
|
44
|
-
const isOptional = childSchema instanceof z.ZodOptional ||
|
|
45
|
-
childSchema instanceof z.ZodDefault;
|
|
46
|
-
if (!isOptional)
|
|
47
|
-
required.push(key);
|
|
48
|
-
}
|
|
49
|
-
const out = {
|
|
50
|
-
type: "object",
|
|
51
|
-
properties,
|
|
52
|
-
additionalProperties: false,
|
|
53
|
-
};
|
|
54
|
-
if (required.length)
|
|
55
|
-
out.required = required;
|
|
56
|
-
if (description)
|
|
57
|
-
out.description = description;
|
|
58
|
-
return out;
|
|
59
|
-
}
|
|
60
|
-
if (schema instanceof z.ZodNumber) {
|
|
61
|
-
const out = { type: "number" };
|
|
62
|
-
// Iterate Zod's check list to extract min/max/int.
|
|
63
|
-
const checks = def.checks ?? [];
|
|
64
|
-
for (const c of checks) {
|
|
65
|
-
if (c.kind === "min" && typeof c.value === "number")
|
|
66
|
-
out.minimum = c.value;
|
|
67
|
-
if (c.kind === "max" && typeof c.value === "number")
|
|
68
|
-
out.maximum = c.value;
|
|
69
|
-
if (c.kind === "int")
|
|
70
|
-
out.type = "integer";
|
|
71
|
-
}
|
|
72
|
-
if (description)
|
|
73
|
-
out.description = description;
|
|
74
|
-
return out;
|
|
75
|
-
}
|
|
76
|
-
if (schema instanceof z.ZodEnum) {
|
|
77
|
-
return {
|
|
78
|
-
type: "string",
|
|
79
|
-
enum: [...schema.options],
|
|
80
|
-
...(description ? { description } : {}),
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
if (schema instanceof z.ZodString) {
|
|
84
|
-
return {
|
|
85
|
-
type: "string",
|
|
86
|
-
...(description ? { description } : {}),
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
if (schema instanceof z.ZodBoolean) {
|
|
90
|
-
return {
|
|
91
|
-
type: "boolean",
|
|
92
|
-
...(description ? { description } : {}),
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
// Fallback — accept anything; widen as needed in future sprints.
|
|
96
|
-
return {};
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=zod-to-json-schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zod-to-json-schema.js","sourceRoot":"","sources":["../../src/util/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