@julong/mono-rele2-core 1.13.0 → 1.15.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/dist/server.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// ../common/kit/tool.ts
|
|
4
|
+
function toolDef(def) {
|
|
5
|
+
return def;
|
|
6
|
+
}
|
|
7
|
+
function defineTool(tool) {
|
|
8
|
+
return tool;
|
|
9
|
+
}
|
|
10
|
+
function text(content) {
|
|
11
|
+
return { content: [{ type: "text", text: content }] };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// ../common/kit/server.ts
|
|
15
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
17
|
+
function createMcpServer(config, tools2) {
|
|
18
|
+
const server3 = new McpServer(config);
|
|
19
|
+
for (const tool of tools2) {
|
|
20
|
+
server3.registerTool(
|
|
21
|
+
tool.name,
|
|
22
|
+
{ description: tool.description, inputSchema: tool.inputSchema },
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
tool.handler
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return server3;
|
|
28
|
+
}
|
|
29
|
+
async function startServer(server3) {
|
|
30
|
+
const transport = new StdioServerTransport();
|
|
31
|
+
await server3.connect(transport);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ../common/kit/cli.ts
|
|
35
|
+
import { z } from "zod";
|
|
36
|
+
|
|
37
|
+
// ../common/kit/skill.ts
|
|
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";
|
|
43
|
+
var tools = {
|
|
44
|
+
echoTool: toolDef({
|
|
45
|
+
name: "echo",
|
|
46
|
+
description: "Returns the message as-is",
|
|
47
|
+
inputSchema: {
|
|
48
|
+
message: z3.string().describe("Message to echo")
|
|
49
|
+
},
|
|
50
|
+
handler: async ({ message }) => text(message),
|
|
51
|
+
examples: [{ args: [`"hello world"`], result: "hello world" }]
|
|
52
|
+
}),
|
|
53
|
+
timestampTool: toolDef({
|
|
54
|
+
name: "timestamp",
|
|
55
|
+
description: "Returns the current UTC timestamp",
|
|
56
|
+
inputSchema: {
|
|
57
|
+
format: z3.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
|
|
58
|
+
},
|
|
59
|
+
handler: async ({ format }) => {
|
|
60
|
+
const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
|
|
61
|
+
return text(value);
|
|
62
|
+
},
|
|
63
|
+
examples: [
|
|
64
|
+
{ args: [], result: "2026-05-02T00:00:00.000Z" },
|
|
65
|
+
{ args: ["unix"], result: "1746144000000" }
|
|
66
|
+
]
|
|
67
|
+
}),
|
|
68
|
+
envTool: toolDef({
|
|
69
|
+
name: "env",
|
|
70
|
+
description: "Returns the value of an environment variable",
|
|
71
|
+
inputSchema: {
|
|
72
|
+
key: z3.string().describe("Environment variable name")
|
|
73
|
+
},
|
|
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" }]
|
|
87
|
+
})
|
|
88
|
+
};
|
|
89
|
+
var echoTool = defineTool(tools.echoTool);
|
|
90
|
+
var timestampTool = defineTool(tools.timestampTool);
|
|
91
|
+
var envTool = defineTool(tools.envTool);
|
|
92
|
+
var uuidTool = defineTool(tools.uuidTool);
|
|
93
|
+
|
|
94
|
+
// src/index.ts
|
|
95
|
+
function createCoreServer() {
|
|
96
|
+
return createMcpServer({ name: "mono-rele2-core", version: "1.0.0" }, [echoTool, timestampTool, envTool, uuidTool]);
|
|
97
|
+
}
|
|
98
|
+
var server = createCoreServer();
|
|
99
|
+
startServer(server).catch((err) => {
|
|
100
|
+
console.error("[core] server error:", err);
|
|
101
|
+
process.exit(1);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// src/server.ts
|
|
105
|
+
var server2 = createCoreServer();
|
|
106
|
+
startServer(server2).catch((err) => {
|
|
107
|
+
console.error("[core] server error:", err);
|
|
108
|
+
process.exit(1);
|
|
109
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: mono-rele2-core
|
|
2
|
+
name: mono-rele2-core-cli
|
|
3
3
|
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
4
|
---
|
|
5
5
|
|
|
6
|
-
# mono-rele2-core
|
|
6
|
+
# mono-rele2-core-cli
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
mono-rele2-core <skillName> [...args]
|
|
9
|
+
mono-rele2-core-cli <skillName> [...args]
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
## Skills
|
|
@@ -45,16 +45,16 @@ Generates a random UUID v4
|
|
|
45
45
|
|
|
46
46
|
## Examples
|
|
47
47
|
|
|
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
|
+
- `mono-rele2-core-cli echoTool "hello world"` => `hello world`
|
|
49
|
+
- `mono-rele2-core-cli timestampTool` => `2026-05-02T00:00:00.000Z`
|
|
50
|
+
- `mono-rele2-core-cli timestampTool unix` => `1746144000000`
|
|
51
|
+
- `mono-rele2-core-cli envTool HOME` => `/Users/julong`
|
|
52
|
+
- `mono-rele2-core-cli envTool NODE_ENV` => `development`
|
|
53
|
+
- `mono-rele2-core-cli uuidTool` => `550e8400-e29b-41d4-a716-446655440000`
|
|
54
54
|
|
|
55
55
|
## Guidelines
|
|
56
56
|
|
|
57
57
|
- Arguments are positional — pass them in the order listed in each skill's table
|
|
58
58
|
- Optional args with defaults may be omitted
|
|
59
59
|
- `envTool` returns an empty string when the variable is not set
|
|
60
|
-
- Run `mono-rele2-core` with no args to list all available skills
|
|
60
|
+
- Run `mono-rele2-core-cli` with no args to list all available skills
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@julong/mono-rele2-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
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.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"type": "module",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"bin": {
|
|
14
|
-
"mono-rele2-core": "./dist/
|
|
14
|
+
"mono-rele2-core": "./dist/server.js",
|
|
15
15
|
"mono-rele2-core-cli": "./dist/cli.js"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|