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