@julong/mono-rele2-core 1.3.1 → 1.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/README.md +7 -4
- package/dist/cli.js +23 -10
- package/dist/index.d.ts +70 -1
- package/dist/index.js +203 -11
- package/dist/server.js +23 -10
- package/dist/{mono-rele2-core → skills/mono-rele2-core}/skill.md +5 -8
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -35,6 +35,8 @@ Available skills:
|
|
|
35
35
|
|
|
36
36
|
### Skills
|
|
37
37
|
|
|
38
|
+
<!-- SKILLS:START -->
|
|
39
|
+
|
|
38
40
|
#### `echoTool`
|
|
39
41
|
|
|
40
42
|
Returns the message as-is.
|
|
@@ -61,12 +63,11 @@ mono-rele2-core timestampTool [format]
|
|
|
61
63
|
|
|
62
64
|
| arg | type | description |
|
|
63
65
|
|-----|------|-------------|
|
|
64
|
-
| `format` | `iso` \| `unix` |
|
|
66
|
+
| `format` | `iso` \| `unix` | Timestamp format (default: `iso`) |
|
|
65
67
|
|
|
66
68
|
```sh
|
|
67
|
-
mono-rele2-core timestampTool
|
|
68
|
-
mono-rele2-core timestampTool
|
|
69
|
-
mono-rele2-core timestampTool unix # 1746230400000
|
|
69
|
+
mono-rele2-core timestampTool # 2026-05-02T00:00:00.000Z
|
|
70
|
+
mono-rele2-core timestampTool unix # 1746144000000
|
|
70
71
|
```
|
|
71
72
|
|
|
72
73
|
#### `envTool`
|
|
@@ -86,6 +87,8 @@ mono-rele2-core envTool HOME # /Users/julong
|
|
|
86
87
|
mono-rele2-core envTool NODE_ENV # development
|
|
87
88
|
```
|
|
88
89
|
|
|
90
|
+
<!-- SKILLS:END -->
|
|
91
|
+
|
|
89
92
|
## MCP Server
|
|
90
93
|
|
|
91
94
|
```sh
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// ../common/
|
|
3
|
+
// ../common/kit/tool.ts
|
|
4
4
|
function toolDef(def) {
|
|
5
5
|
return def;
|
|
6
6
|
}
|
|
@@ -11,11 +11,11 @@ function text(content) {
|
|
|
11
11
|
return { content: [{ type: "text", text: content }] };
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
// ../common/
|
|
14
|
+
// ../common/kit/server.ts
|
|
15
15
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
16
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
17
17
|
|
|
18
|
-
// ../common/
|
|
18
|
+
// ../common/kit/cli.ts
|
|
19
19
|
import { z } from "zod";
|
|
20
20
|
function formatSkills(tools2) {
|
|
21
21
|
const sections = Object.entries(tools2).map(([key, tool]) => {
|
|
@@ -66,35 +66,48 @@ function handleCliError(err) {
|
|
|
66
66
|
process.exit(1);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
//
|
|
69
|
+
// ../common/kit/skill.ts
|
|
70
70
|
import { z as z2 } from "zod";
|
|
71
|
+
|
|
72
|
+
// src/tools/system.ts
|
|
73
|
+
import { z as z3 } from "zod";
|
|
71
74
|
var tools = {
|
|
72
75
|
echoTool: toolDef({
|
|
73
76
|
name: "echo",
|
|
74
77
|
description: "Returns the message as-is",
|
|
75
78
|
inputSchema: {
|
|
76
|
-
message:
|
|
79
|
+
message: z3.string().describe("Message to echo")
|
|
77
80
|
},
|
|
78
|
-
handler: async ({ message }) => text(message)
|
|
81
|
+
handler: async ({ message }) => text(message),
|
|
82
|
+
examples: [{ args: [`"hello world"`], result: "hello world" }]
|
|
79
83
|
}),
|
|
80
84
|
timestampTool: toolDef({
|
|
81
85
|
name: "timestamp",
|
|
82
86
|
description: "Returns the current UTC timestamp",
|
|
83
87
|
inputSchema: {
|
|
84
|
-
format:
|
|
88
|
+
format: z3.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
|
|
85
89
|
},
|
|
86
90
|
handler: async ({ format }) => {
|
|
87
91
|
const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
|
|
88
92
|
return text(value);
|
|
89
|
-
}
|
|
93
|
+
},
|
|
94
|
+
examples: [
|
|
95
|
+
{ args: [], result: "2026-05-02T00:00:00.000Z" },
|
|
96
|
+
{ args: ["unix"], result: "1746144000000" }
|
|
97
|
+
]
|
|
90
98
|
}),
|
|
91
99
|
envTool: toolDef({
|
|
92
100
|
name: "env",
|
|
93
101
|
description: "Returns the value of an environment variable",
|
|
94
102
|
inputSchema: {
|
|
95
|
-
key:
|
|
103
|
+
key: z3.string().describe("Environment variable name")
|
|
96
104
|
},
|
|
97
|
-
handler: async ({ key }) => text(process.env[key] ?? "")
|
|
105
|
+
handler: async ({ key }) => text(process.env[key] ?? ""),
|
|
106
|
+
examples: [
|
|
107
|
+
{ args: ["HOME"], result: "/Users/julong" },
|
|
108
|
+
{ args: ["NODE_ENV"], result: "development" }
|
|
109
|
+
],
|
|
110
|
+
guidelines: ["`envTool` returns an empty string when the variable is not set"]
|
|
98
111
|
})
|
|
99
112
|
};
|
|
100
113
|
var echoTool = defineTool(tools.echoTool);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
import * as _modelcontextprotocol_sdk_server_mcp_js from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
type ToolResult = CallToolResult;
|
|
6
|
+
type ToolExample = {
|
|
7
|
+
args: string[];
|
|
8
|
+
result: string;
|
|
9
|
+
};
|
|
10
|
+
type AnyToolDef = {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
inputSchema: z.ZodRawShape;
|
|
14
|
+
handler: (args: any) => Promise<ToolResult>;
|
|
15
|
+
examples?: ToolExample[];
|
|
16
|
+
guidelines?: string[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type SkillTools = Record<string, AnyToolDef>;
|
|
20
|
+
declare function generateSkillMarkdown(opts: {
|
|
21
|
+
binName: string;
|
|
22
|
+
description: string;
|
|
23
|
+
tools: SkillTools;
|
|
24
|
+
}): string;
|
|
25
|
+
declare function generateReadmeSkills(opts: {
|
|
26
|
+
binName: string;
|
|
27
|
+
tools: SkillTools;
|
|
28
|
+
}): string;
|
|
29
|
+
|
|
30
|
+
declare const tools: {
|
|
31
|
+
echoTool: {
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
inputSchema: {
|
|
35
|
+
readonly message: z.ZodString;
|
|
36
|
+
};
|
|
37
|
+
handler: (input: {
|
|
38
|
+
message: string;
|
|
39
|
+
}) => Promise<ToolResult>;
|
|
40
|
+
examples?: ToolExample[];
|
|
41
|
+
guidelines?: string[];
|
|
42
|
+
};
|
|
43
|
+
timestampTool: {
|
|
44
|
+
name: string;
|
|
45
|
+
description: string;
|
|
46
|
+
inputSchema: {
|
|
47
|
+
readonly format: z.ZodDefault<z.ZodEnum<{
|
|
48
|
+
iso: "iso";
|
|
49
|
+
unix: "unix";
|
|
50
|
+
}>>;
|
|
51
|
+
};
|
|
52
|
+
handler: (input: {
|
|
53
|
+
format: "iso" | "unix";
|
|
54
|
+
}) => Promise<ToolResult>;
|
|
55
|
+
examples?: ToolExample[];
|
|
56
|
+
guidelines?: string[];
|
|
57
|
+
};
|
|
58
|
+
envTool: {
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
inputSchema: {
|
|
62
|
+
readonly key: z.ZodString;
|
|
63
|
+
};
|
|
64
|
+
handler: (input: {
|
|
65
|
+
key: string;
|
|
66
|
+
}) => Promise<ToolResult>;
|
|
67
|
+
examples?: ToolExample[];
|
|
68
|
+
guidelines?: string[];
|
|
69
|
+
};
|
|
70
|
+
};
|
|
2
71
|
|
|
3
72
|
declare function createCoreServer(): _modelcontextprotocol_sdk_server_mcp_js.McpServer;
|
|
4
73
|
|
|
5
|
-
export { createCoreServer };
|
|
74
|
+
export { createCoreServer, generateReadmeSkills, generateSkillMarkdown, tools };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../common/
|
|
1
|
+
// ../common/kit/tool.ts
|
|
2
2
|
function toolDef(def) {
|
|
3
3
|
return def;
|
|
4
4
|
}
|
|
@@ -9,7 +9,7 @@ function text(content) {
|
|
|
9
9
|
return { content: [{ type: "text", text: content }] };
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
// ../common/
|
|
12
|
+
// ../common/kit/server.ts
|
|
13
13
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
14
14
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
15
15
|
function createMcpServer(config, tools2) {
|
|
@@ -25,38 +25,227 @@ function createMcpServer(config, tools2) {
|
|
|
25
25
|
return server;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
// ../common/
|
|
28
|
+
// ../common/kit/cli.ts
|
|
29
29
|
import { z } from "zod";
|
|
30
30
|
|
|
31
|
-
//
|
|
31
|
+
// ../common/kit/skill.ts
|
|
32
32
|
import { z as z2 } from "zod";
|
|
33
|
+
function generateSkillMarkdown(opts) {
|
|
34
|
+
const { binName, description, tools: tools2 } = opts;
|
|
35
|
+
return `---
|
|
36
|
+
name: ${binName}
|
|
37
|
+
description: ${description}
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
# ${binName}
|
|
41
|
+
|
|
42
|
+
\`\`\`sh
|
|
43
|
+
${binName} <skillName> [...args]
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
## Skills
|
|
47
|
+
|
|
48
|
+
${renderSkills(tools2)}
|
|
49
|
+
|
|
50
|
+
## Examples
|
|
51
|
+
|
|
52
|
+
${renderExamples(binName, tools2)}
|
|
53
|
+
|
|
54
|
+
## Guidelines
|
|
55
|
+
|
|
56
|
+
${renderGuidelines(binName, tools2)}
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
function renderSkills(tools2) {
|
|
60
|
+
return Object.entries(tools2).map(([key, tool]) => {
|
|
61
|
+
const rows = Object.entries(tool.inputSchema).map(([field, schema]) => `| \`${field}\` | ${describeField(schema)} |`).join("\n");
|
|
62
|
+
return `### ${key}
|
|
63
|
+
|
|
64
|
+
${tool.description}
|
|
65
|
+
|
|
66
|
+
| arg | description |
|
|
67
|
+
|-----|-------------|
|
|
68
|
+
${rows}`;
|
|
69
|
+
}).join("\n\n");
|
|
70
|
+
}
|
|
71
|
+
function describeField(schema) {
|
|
72
|
+
const baseDesc = schema.description ?? "";
|
|
73
|
+
let inner = schema;
|
|
74
|
+
let defaultValue;
|
|
75
|
+
let isOptional = false;
|
|
76
|
+
while (inner instanceof z2.ZodOptional || inner instanceof z2.ZodDefault) {
|
|
77
|
+
if (inner instanceof z2.ZodDefault) {
|
|
78
|
+
const raw = inner.def.defaultValue;
|
|
79
|
+
defaultValue = typeof raw === "function" ? raw() : raw;
|
|
80
|
+
}
|
|
81
|
+
if (inner instanceof z2.ZodOptional) isOptional = true;
|
|
82
|
+
inner = inner.unwrap();
|
|
83
|
+
}
|
|
84
|
+
const parts = [];
|
|
85
|
+
if (baseDesc) parts.push(baseDesc);
|
|
86
|
+
if (inner instanceof z2.ZodEnum) {
|
|
87
|
+
const values = inner.options.map((v) => `\`${v}\``).join(" \\| ");
|
|
88
|
+
parts.push(values);
|
|
89
|
+
}
|
|
90
|
+
if (defaultValue !== void 0) parts.push(`default: \`${String(defaultValue)}\``);
|
|
91
|
+
else if (isOptional) parts.push("optional");
|
|
92
|
+
return parts.join(" \u2014 ");
|
|
93
|
+
}
|
|
94
|
+
function renderExamples(binName, tools2) {
|
|
95
|
+
const lines = [];
|
|
96
|
+
for (const [key, tool] of Object.entries(tools2)) {
|
|
97
|
+
if (!tool.examples) continue;
|
|
98
|
+
for (const ex of tool.examples) {
|
|
99
|
+
const cmd = [binName, key, ...ex.args].join(" ");
|
|
100
|
+
lines.push(`- \`${cmd}\` \u2192 \`${ex.result}\``);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return lines.join("\n");
|
|
104
|
+
}
|
|
105
|
+
function renderGuidelines(binName, tools2) {
|
|
106
|
+
const items = [];
|
|
107
|
+
const seen = /* @__PURE__ */ new Set();
|
|
108
|
+
const push = (g) => {
|
|
109
|
+
if (seen.has(g)) return;
|
|
110
|
+
seen.add(g);
|
|
111
|
+
items.push(g);
|
|
112
|
+
};
|
|
113
|
+
push("Arguments are positional \u2014 pass them in the order listed in each skill's table");
|
|
114
|
+
const allSchemas = Object.values(tools2).flatMap((t) => Object.values(t.inputSchema));
|
|
115
|
+
if (allSchemas.some((s) => containsType(s, z2.ZodNumber))) {
|
|
116
|
+
push("Numeric args are auto-parsed \u2014 pass as plain numbers (e.g. `10`)");
|
|
117
|
+
}
|
|
118
|
+
if (allSchemas.some((s) => containsType(s, z2.ZodArray))) {
|
|
119
|
+
push('Array args must be valid JSON \u2014 wrap in single quotes on Unix shells (e.g. `\'["a","b"]\'`)');
|
|
120
|
+
}
|
|
121
|
+
if (allSchemas.some((s) => s instanceof z2.ZodOptional || s instanceof z2.ZodDefault)) {
|
|
122
|
+
push("Optional args with defaults may be omitted");
|
|
123
|
+
}
|
|
124
|
+
for (const tool of Object.values(tools2)) {
|
|
125
|
+
if (!tool.guidelines) continue;
|
|
126
|
+
for (const g of tool.guidelines) push(g);
|
|
127
|
+
}
|
|
128
|
+
push(`Run \`${binName}\` with no args to list all available skills`);
|
|
129
|
+
return items.map((g) => `- ${g}`).join("\n");
|
|
130
|
+
}
|
|
131
|
+
function containsType(schema, ctor) {
|
|
132
|
+
let inner = schema;
|
|
133
|
+
while (inner instanceof z2.ZodOptional || inner instanceof z2.ZodDefault) {
|
|
134
|
+
inner = inner.unwrap();
|
|
135
|
+
}
|
|
136
|
+
return inner instanceof ctor;
|
|
137
|
+
}
|
|
138
|
+
function generateReadmeSkills(opts) {
|
|
139
|
+
const { binName, tools: tools2 } = opts;
|
|
140
|
+
return Object.entries(tools2).map(([key, tool]) => renderReadmeSkill(binName, key, tool)).join("\n\n");
|
|
141
|
+
}
|
|
142
|
+
function renderReadmeSkill(binName, key, tool) {
|
|
143
|
+
const fields = Object.entries(tool.inputSchema);
|
|
144
|
+
const usageArgs = fields.map(([field, schema]) => {
|
|
145
|
+
const isOpt = schema instanceof z2.ZodOptional || schema instanceof z2.ZodDefault;
|
|
146
|
+
return isOpt ? `[${field}]` : `<${field}>`;
|
|
147
|
+
}).join(" ");
|
|
148
|
+
const usage = [binName, key, usageArgs].filter(Boolean).join(" ");
|
|
149
|
+
const rows = fields.map(([field, schema]) => {
|
|
150
|
+
const t = describeReadmeType(schema);
|
|
151
|
+
const d = describeReadmeDesc(schema);
|
|
152
|
+
return `| \`${field}\` | ${t} | ${d} |`;
|
|
153
|
+
}).join("\n");
|
|
154
|
+
const examples = tool.examples ?? [];
|
|
155
|
+
let exampleBlock = "";
|
|
156
|
+
if (examples.length > 0) {
|
|
157
|
+
const cmds = examples.map((ex) => [binName, key, ...ex.args].join(" "));
|
|
158
|
+
const width = Math.max(...cmds.map((c) => c.length));
|
|
159
|
+
const lines = examples.map((ex, i) => `${cmds[i].padEnd(width)} # ${ex.result}`);
|
|
160
|
+
exampleBlock = `
|
|
161
|
+
|
|
162
|
+
\`\`\`sh
|
|
163
|
+
${lines.join("\n")}
|
|
164
|
+
\`\`\``;
|
|
165
|
+
}
|
|
166
|
+
return `#### \`${key}\`
|
|
167
|
+
|
|
168
|
+
${tool.description}.
|
|
169
|
+
|
|
170
|
+
\`\`\`sh
|
|
171
|
+
${usage}
|
|
172
|
+
\`\`\`
|
|
173
|
+
|
|
174
|
+
| arg | type | description |
|
|
175
|
+
|-----|------|-------------|
|
|
176
|
+
${rows}${exampleBlock}`;
|
|
177
|
+
}
|
|
178
|
+
function describeReadmeType(schema) {
|
|
179
|
+
let inner = schema;
|
|
180
|
+
while (inner instanceof z2.ZodOptional || inner instanceof z2.ZodDefault) {
|
|
181
|
+
inner = inner.unwrap();
|
|
182
|
+
}
|
|
183
|
+
if (inner instanceof z2.ZodEnum) {
|
|
184
|
+
return inner.options.map((v) => `\`${v}\``).join(" \\| ");
|
|
185
|
+
}
|
|
186
|
+
if (inner instanceof z2.ZodNumber) return "number";
|
|
187
|
+
if (inner instanceof z2.ZodString) return "string";
|
|
188
|
+
if (inner instanceof z2.ZodBoolean) return "boolean";
|
|
189
|
+
if (inner instanceof z2.ZodArray) return "JSON string (array)";
|
|
190
|
+
return "unknown";
|
|
191
|
+
}
|
|
192
|
+
function describeReadmeDesc(schema) {
|
|
193
|
+
const baseDesc = schema.description ?? "";
|
|
194
|
+
let inner = schema;
|
|
195
|
+
let defaultValue;
|
|
196
|
+
let isOptional = false;
|
|
197
|
+
while (inner instanceof z2.ZodOptional || inner instanceof z2.ZodDefault) {
|
|
198
|
+
if (inner instanceof z2.ZodDefault) {
|
|
199
|
+
const raw = inner.def.defaultValue;
|
|
200
|
+
defaultValue = typeof raw === "function" ? raw() : raw;
|
|
201
|
+
}
|
|
202
|
+
if (inner instanceof z2.ZodOptional) isOptional = true;
|
|
203
|
+
inner = inner.unwrap();
|
|
204
|
+
}
|
|
205
|
+
if (defaultValue !== void 0) return `${baseDesc} (default: \`${String(defaultValue)}\`)`;
|
|
206
|
+
if (isOptional) return `${baseDesc} (optional)`;
|
|
207
|
+
return baseDesc;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// src/tools/system.ts
|
|
211
|
+
import { z as z3 } from "zod";
|
|
33
212
|
var tools = {
|
|
34
213
|
echoTool: toolDef({
|
|
35
214
|
name: "echo",
|
|
36
215
|
description: "Returns the message as-is",
|
|
37
216
|
inputSchema: {
|
|
38
|
-
message:
|
|
217
|
+
message: z3.string().describe("Message to echo")
|
|
39
218
|
},
|
|
40
|
-
handler: async ({ message }) => text(message)
|
|
219
|
+
handler: async ({ message }) => text(message),
|
|
220
|
+
examples: [{ args: [`"hello world"`], result: "hello world" }]
|
|
41
221
|
}),
|
|
42
222
|
timestampTool: toolDef({
|
|
43
223
|
name: "timestamp",
|
|
44
224
|
description: "Returns the current UTC timestamp",
|
|
45
225
|
inputSchema: {
|
|
46
|
-
format:
|
|
226
|
+
format: z3.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
|
|
47
227
|
},
|
|
48
228
|
handler: async ({ format }) => {
|
|
49
229
|
const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
|
|
50
230
|
return text(value);
|
|
51
|
-
}
|
|
231
|
+
},
|
|
232
|
+
examples: [
|
|
233
|
+
{ args: [], result: "2026-05-02T00:00:00.000Z" },
|
|
234
|
+
{ args: ["unix"], result: "1746144000000" }
|
|
235
|
+
]
|
|
52
236
|
}),
|
|
53
237
|
envTool: toolDef({
|
|
54
238
|
name: "env",
|
|
55
239
|
description: "Returns the value of an environment variable",
|
|
56
240
|
inputSchema: {
|
|
57
|
-
key:
|
|
241
|
+
key: z3.string().describe("Environment variable name")
|
|
58
242
|
},
|
|
59
|
-
handler: async ({ key }) => text(process.env[key] ?? "")
|
|
243
|
+
handler: async ({ key }) => text(process.env[key] ?? ""),
|
|
244
|
+
examples: [
|
|
245
|
+
{ args: ["HOME"], result: "/Users/julong" },
|
|
246
|
+
{ args: ["NODE_ENV"], result: "development" }
|
|
247
|
+
],
|
|
248
|
+
guidelines: ["`envTool` returns an empty string when the variable is not set"]
|
|
60
249
|
})
|
|
61
250
|
};
|
|
62
251
|
var echoTool = defineTool(tools.echoTool);
|
|
@@ -71,5 +260,8 @@ function createCoreServer() {
|
|
|
71
260
|
);
|
|
72
261
|
}
|
|
73
262
|
export {
|
|
74
|
-
createCoreServer
|
|
263
|
+
createCoreServer,
|
|
264
|
+
generateReadmeSkills,
|
|
265
|
+
generateSkillMarkdown,
|
|
266
|
+
tools
|
|
75
267
|
};
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// ../common/
|
|
3
|
+
// ../common/kit/tool.ts
|
|
4
4
|
function toolDef(def) {
|
|
5
5
|
return def;
|
|
6
6
|
}
|
|
@@ -11,7 +11,7 @@ function text(content) {
|
|
|
11
11
|
return { content: [{ type: "text", text: content }] };
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
// ../common/
|
|
14
|
+
// ../common/kit/server.ts
|
|
15
15
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
16
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
17
17
|
function createMcpServer(config, tools2) {
|
|
@@ -31,38 +31,51 @@ async function startServer(server2) {
|
|
|
31
31
|
await server2.connect(transport);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
// ../common/
|
|
34
|
+
// ../common/kit/cli.ts
|
|
35
35
|
import { z } from "zod";
|
|
36
36
|
|
|
37
|
-
//
|
|
37
|
+
// ../common/kit/skill.ts
|
|
38
38
|
import { z as z2 } from "zod";
|
|
39
|
+
|
|
40
|
+
// src/tools/system.ts
|
|
41
|
+
import { z as z3 } from "zod";
|
|
39
42
|
var tools = {
|
|
40
43
|
echoTool: toolDef({
|
|
41
44
|
name: "echo",
|
|
42
45
|
description: "Returns the message as-is",
|
|
43
46
|
inputSchema: {
|
|
44
|
-
message:
|
|
47
|
+
message: z3.string().describe("Message to echo")
|
|
45
48
|
},
|
|
46
|
-
handler: async ({ message }) => text(message)
|
|
49
|
+
handler: async ({ message }) => text(message),
|
|
50
|
+
examples: [{ args: [`"hello world"`], result: "hello world" }]
|
|
47
51
|
}),
|
|
48
52
|
timestampTool: toolDef({
|
|
49
53
|
name: "timestamp",
|
|
50
54
|
description: "Returns the current UTC timestamp",
|
|
51
55
|
inputSchema: {
|
|
52
|
-
format:
|
|
56
|
+
format: z3.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
|
|
53
57
|
},
|
|
54
58
|
handler: async ({ format }) => {
|
|
55
59
|
const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
|
|
56
60
|
return text(value);
|
|
57
|
-
}
|
|
61
|
+
},
|
|
62
|
+
examples: [
|
|
63
|
+
{ args: [], result: "2026-05-02T00:00:00.000Z" },
|
|
64
|
+
{ args: ["unix"], result: "1746144000000" }
|
|
65
|
+
]
|
|
58
66
|
}),
|
|
59
67
|
envTool: toolDef({
|
|
60
68
|
name: "env",
|
|
61
69
|
description: "Returns the value of an environment variable",
|
|
62
70
|
inputSchema: {
|
|
63
|
-
key:
|
|
71
|
+
key: z3.string().describe("Environment variable name")
|
|
64
72
|
},
|
|
65
|
-
handler: async ({ key }) => text(process.env[key] ?? "")
|
|
73
|
+
handler: async ({ key }) => text(process.env[key] ?? ""),
|
|
74
|
+
examples: [
|
|
75
|
+
{ args: ["HOME"], result: "/Users/julong" },
|
|
76
|
+
{ args: ["NODE_ENV"], result: "development" }
|
|
77
|
+
],
|
|
78
|
+
guidelines: ["`envTool` returns an empty string when the variable is not set"]
|
|
66
79
|
})
|
|
67
80
|
};
|
|
68
81
|
var echoTool = defineTool(tools.echoTool);
|
|
@@ -5,8 +5,6 @@ description: Use this skill to invoke core system utility functions via the mono
|
|
|
5
5
|
|
|
6
6
|
# mono-rele2-core
|
|
7
7
|
|
|
8
|
-
CLI for running core system utility functions from the mono-rele2 package.
|
|
9
|
-
|
|
10
8
|
```sh
|
|
11
9
|
mono-rele2-core <skillName> [...args]
|
|
12
10
|
```
|
|
@@ -15,7 +13,7 @@ mono-rele2-core <skillName> [...args]
|
|
|
15
13
|
|
|
16
14
|
### echoTool
|
|
17
15
|
|
|
18
|
-
Returns the message as-is
|
|
16
|
+
Returns the message as-is
|
|
19
17
|
|
|
20
18
|
| arg | description |
|
|
21
19
|
|-----|-------------|
|
|
@@ -23,15 +21,15 @@ Returns the message as-is.
|
|
|
23
21
|
|
|
24
22
|
### timestampTool
|
|
25
23
|
|
|
26
|
-
Returns the current UTC timestamp
|
|
24
|
+
Returns the current UTC timestamp
|
|
27
25
|
|
|
28
26
|
| arg | description |
|
|
29
27
|
|-----|-------------|
|
|
30
|
-
| `format` |
|
|
28
|
+
| `format` | Timestamp format — `iso` \| `unix` — default: `iso` |
|
|
31
29
|
|
|
32
30
|
### envTool
|
|
33
31
|
|
|
34
|
-
Returns the value of an environment variable
|
|
32
|
+
Returns the value of an environment variable
|
|
35
33
|
|
|
36
34
|
| arg | description |
|
|
37
35
|
|-----|-------------|
|
|
@@ -41,7 +39,6 @@ Returns the value of an environment variable.
|
|
|
41
39
|
|
|
42
40
|
- `mono-rele2-core echoTool "hello world"` → `hello world`
|
|
43
41
|
- `mono-rele2-core timestampTool` → `2026-05-02T00:00:00.000Z`
|
|
44
|
-
- `mono-rele2-core timestampTool iso` → `2026-05-02T00:00:00.000Z`
|
|
45
42
|
- `mono-rele2-core timestampTool unix` → `1746144000000`
|
|
46
43
|
- `mono-rele2-core envTool HOME` → `/Users/julong`
|
|
47
44
|
- `mono-rele2-core envTool NODE_ENV` → `development`
|
|
@@ -49,6 +46,6 @@ Returns the value of an environment variable.
|
|
|
49
46
|
## Guidelines
|
|
50
47
|
|
|
51
48
|
- Arguments are positional — pass them in the order listed in each skill's table
|
|
52
|
-
-
|
|
49
|
+
- Optional args with defaults may be omitted
|
|
53
50
|
- `envTool` returns an empty string when the variable is not set
|
|
54
51
|
- Run `mono-rele2-core` with no args to list all available skills
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@julong/mono-rele2-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "Use this skill to invoke core system utility functions via the mono-rele2-core CLI. Handles message echo, UTC timestamp generation, and environment variable lookup.",
|
|
4
5
|
"license": "ISC",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"exports": {
|
|
@@ -22,7 +23,8 @@
|
|
|
22
23
|
"scripts": {
|
|
23
24
|
"build": "tsup",
|
|
24
25
|
"typecheck": "tsc --noEmit",
|
|
25
|
-
"clean": "rimraf dist"
|
|
26
|
+
"clean": "rimraf dist",
|
|
27
|
+
"update-readme": "node ../common/build/update-readme.mjs"
|
|
26
28
|
},
|
|
27
29
|
"dependencies": {
|
|
28
30
|
"@modelcontextprotocol/sdk": "^1.29.0",
|