@julong/mono-rele2-core 1.2.0 → 1.3.1
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 +93 -0
- package/dist/cli.js +105 -0
- package/dist/index.js +41 -30
- package/dist/mono-rele2-core/skill.md +54 -0
- package/dist/server.js +41 -30
- package/package.json +7 -2
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# @julong/mono-rele2-core
|
|
2
|
+
|
|
3
|
+
Core system utility tools for the mono-rele2 monorepo. Available as an MCP server and a standalone CLI.
|
|
4
|
+
|
|
5
|
+
## CLI
|
|
6
|
+
|
|
7
|
+
### Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install -g @julong/mono-rele2-core
|
|
11
|
+
# or
|
|
12
|
+
npx @julong/mono-rele2-core <skillName> [...args]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Usage
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
mono-rele2-core <skillName> [...args]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Run without arguments to list all available skills:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
mono-rele2-core
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Available skills:
|
|
29
|
+
|
|
30
|
+
echoTool
|
|
31
|
+
Returns the message as-is
|
|
32
|
+
message Message to echo
|
|
33
|
+
...
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Skills
|
|
37
|
+
|
|
38
|
+
#### `echoTool`
|
|
39
|
+
|
|
40
|
+
Returns the message as-is.
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
mono-rele2-core echoTool <message>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
| arg | type | description |
|
|
47
|
+
|-----|------|-------------|
|
|
48
|
+
| `message` | string | Message to echo |
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
mono-rele2-core echoTool "hello world" # hello world
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### `timestampTool`
|
|
55
|
+
|
|
56
|
+
Returns the current UTC timestamp.
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
mono-rele2-core timestampTool [format]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
| arg | type | description |
|
|
63
|
+
|-----|------|-------------|
|
|
64
|
+
| `format` | `iso` \| `unix` | Output format (default: `iso`) |
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
mono-rele2-core timestampTool # 2026-05-03T00:00:00.000Z
|
|
68
|
+
mono-rele2-core timestampTool iso # 2026-05-03T00:00:00.000Z
|
|
69
|
+
mono-rele2-core timestampTool unix # 1746230400000
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### `envTool`
|
|
73
|
+
|
|
74
|
+
Returns the value of an environment variable.
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
mono-rele2-core envTool <key>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
| arg | type | description |
|
|
81
|
+
|-----|------|-------------|
|
|
82
|
+
| `key` | string | Environment variable name |
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
mono-rele2-core envTool HOME # /Users/julong
|
|
86
|
+
mono-rele2-core envTool NODE_ENV # development
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## MCP Server
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
mcp-core
|
|
93
|
+
```
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// ../common/mcp/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/mcp/server.ts
|
|
15
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
17
|
+
|
|
18
|
+
// ../common/mcp/cli.ts
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
function formatSkills(tools2) {
|
|
21
|
+
const sections = Object.entries(tools2).map(([key, tool]) => {
|
|
22
|
+
const params = Object.entries(tool.inputSchema);
|
|
23
|
+
const maxLen = Math.max(...params.map(([f]) => f.length));
|
|
24
|
+
const paramLines = params.map(([field, schema]) => {
|
|
25
|
+
const desc = schema.description ?? "";
|
|
26
|
+
return ` ${field.padEnd(maxLen + 2)}${desc}`;
|
|
27
|
+
}).join("\n");
|
|
28
|
+
return ` ${key}
|
|
29
|
+
${tool.description}
|
|
30
|
+
${paramLines}`;
|
|
31
|
+
});
|
|
32
|
+
return "Available skills:\n\n" + sections.join("\n\n");
|
|
33
|
+
}
|
|
34
|
+
async function runCli(tools2) {
|
|
35
|
+
const [, , toolName, ...rawArgs] = process.argv;
|
|
36
|
+
if (!toolName || !(toolName in tools2)) {
|
|
37
|
+
if (toolName) console.error(`Unknown skill: "${toolName}"
|
|
38
|
+
`);
|
|
39
|
+
console.log(formatSkills(tools2));
|
|
40
|
+
process.exit(toolName ? 1 : 0);
|
|
41
|
+
}
|
|
42
|
+
const tool = tools2[toolName];
|
|
43
|
+
const fieldNames = Object.keys(tool.inputSchema);
|
|
44
|
+
const rawInput = {};
|
|
45
|
+
for (let i = 0; i < fieldNames.length; i++) {
|
|
46
|
+
const raw = rawArgs[i];
|
|
47
|
+
if (raw === void 0) continue;
|
|
48
|
+
try {
|
|
49
|
+
rawInput[fieldNames[i]] = JSON.parse(raw);
|
|
50
|
+
} catch {
|
|
51
|
+
rawInput[fieldNames[i]] = raw;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const parsed = z.object(tool.inputSchema).parse(rawInput);
|
|
55
|
+
const result = await tool.handler(parsed);
|
|
56
|
+
for (const part of result.content) {
|
|
57
|
+
if (part.type === "text") console.log(part.text);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function handleCliError(err) {
|
|
61
|
+
if (err instanceof z.ZodError) {
|
|
62
|
+
console.error("Validation error:", err.issues.map((e) => `${e.path.join(".")}: ${e.message}`).join(", "));
|
|
63
|
+
} else {
|
|
64
|
+
console.error("Error:", err instanceof Error ? err.message : String(err));
|
|
65
|
+
}
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// src/tools/system.ts
|
|
70
|
+
import { z as z2 } from "zod";
|
|
71
|
+
var tools = {
|
|
72
|
+
echoTool: toolDef({
|
|
73
|
+
name: "echo",
|
|
74
|
+
description: "Returns the message as-is",
|
|
75
|
+
inputSchema: {
|
|
76
|
+
message: z2.string().describe("Message to echo")
|
|
77
|
+
},
|
|
78
|
+
handler: async ({ message }) => text(message)
|
|
79
|
+
}),
|
|
80
|
+
timestampTool: toolDef({
|
|
81
|
+
name: "timestamp",
|
|
82
|
+
description: "Returns the current UTC timestamp",
|
|
83
|
+
inputSchema: {
|
|
84
|
+
format: z2.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
|
|
85
|
+
},
|
|
86
|
+
handler: async ({ format }) => {
|
|
87
|
+
const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
|
|
88
|
+
return text(value);
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
envTool: toolDef({
|
|
92
|
+
name: "env",
|
|
93
|
+
description: "Returns the value of an environment variable",
|
|
94
|
+
inputSchema: {
|
|
95
|
+
key: z2.string().describe("Environment variable name")
|
|
96
|
+
},
|
|
97
|
+
handler: async ({ key }) => text(process.env[key] ?? "")
|
|
98
|
+
})
|
|
99
|
+
};
|
|
100
|
+
var echoTool = defineTool(tools.echoTool);
|
|
101
|
+
var timestampTool = defineTool(tools.timestampTool);
|
|
102
|
+
var envTool = defineTool(tools.envTool);
|
|
103
|
+
|
|
104
|
+
// src/cli.ts
|
|
105
|
+
runCli(tools).catch(handleCliError);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// ../common/mcp/tool.ts
|
|
2
|
+
function toolDef(def) {
|
|
3
|
+
return def;
|
|
4
|
+
}
|
|
2
5
|
function defineTool(tool) {
|
|
3
6
|
return tool;
|
|
4
7
|
}
|
|
@@ -9,9 +12,9 @@ function text(content) {
|
|
|
9
12
|
// ../common/mcp/server.ts
|
|
10
13
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
14
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
12
|
-
function createMcpServer(config,
|
|
15
|
+
function createMcpServer(config, tools2) {
|
|
13
16
|
const server = new McpServer(config);
|
|
14
|
-
for (const tool of
|
|
17
|
+
for (const tool of tools2) {
|
|
15
18
|
server.registerTool(
|
|
16
19
|
tool.name,
|
|
17
20
|
{ description: tool.description, inputSchema: tool.inputSchema },
|
|
@@ -22,35 +25,43 @@ function createMcpServer(config, tools) {
|
|
|
22
25
|
return server;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
//
|
|
28
|
+
// ../common/mcp/cli.ts
|
|
26
29
|
import { z } from "zod";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
30
|
+
|
|
31
|
+
// src/tools/system.ts
|
|
32
|
+
import { z as z2 } from "zod";
|
|
33
|
+
var tools = {
|
|
34
|
+
echoTool: toolDef({
|
|
35
|
+
name: "echo",
|
|
36
|
+
description: "Returns the message as-is",
|
|
37
|
+
inputSchema: {
|
|
38
|
+
message: z2.string().describe("Message to echo")
|
|
39
|
+
},
|
|
40
|
+
handler: async ({ message }) => text(message)
|
|
41
|
+
}),
|
|
42
|
+
timestampTool: toolDef({
|
|
43
|
+
name: "timestamp",
|
|
44
|
+
description: "Returns the current UTC timestamp",
|
|
45
|
+
inputSchema: {
|
|
46
|
+
format: z2.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
|
|
47
|
+
},
|
|
48
|
+
handler: async ({ format }) => {
|
|
49
|
+
const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
|
|
50
|
+
return text(value);
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
envTool: toolDef({
|
|
54
|
+
name: "env",
|
|
55
|
+
description: "Returns the value of an environment variable",
|
|
56
|
+
inputSchema: {
|
|
57
|
+
key: z2.string().describe("Environment variable name")
|
|
58
|
+
},
|
|
59
|
+
handler: async ({ key }) => text(process.env[key] ?? "")
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
var echoTool = defineTool(tools.echoTool);
|
|
63
|
+
var timestampTool = defineTool(tools.timestampTool);
|
|
64
|
+
var envTool = defineTool(tools.envTool);
|
|
54
65
|
|
|
55
66
|
// src/index.ts
|
|
56
67
|
function createCoreServer() {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mono-rele2-core
|
|
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
|
+
---
|
|
5
|
+
|
|
6
|
+
# mono-rele2-core
|
|
7
|
+
|
|
8
|
+
CLI for running core system utility functions from the mono-rele2 package.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
mono-rele2-core <skillName> [...args]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Skills
|
|
15
|
+
|
|
16
|
+
### echoTool
|
|
17
|
+
|
|
18
|
+
Returns the message as-is.
|
|
19
|
+
|
|
20
|
+
| arg | description |
|
|
21
|
+
|-----|-------------|
|
|
22
|
+
| `message` | Message to echo |
|
|
23
|
+
|
|
24
|
+
### timestampTool
|
|
25
|
+
|
|
26
|
+
Returns the current UTC timestamp.
|
|
27
|
+
|
|
28
|
+
| arg | description |
|
|
29
|
+
|-----|-------------|
|
|
30
|
+
| `format` | Output format: `iso` (default) \| `unix` |
|
|
31
|
+
|
|
32
|
+
### envTool
|
|
33
|
+
|
|
34
|
+
Returns the value of an environment variable.
|
|
35
|
+
|
|
36
|
+
| arg | description |
|
|
37
|
+
|-----|-------------|
|
|
38
|
+
| `key` | Environment variable name |
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
- `mono-rele2-core echoTool "hello world"` → `hello world`
|
|
43
|
+
- `mono-rele2-core timestampTool` → `2026-05-02T00:00:00.000Z`
|
|
44
|
+
- `mono-rele2-core timestampTool iso` → `2026-05-02T00:00:00.000Z`
|
|
45
|
+
- `mono-rele2-core timestampTool unix` → `1746144000000`
|
|
46
|
+
- `mono-rele2-core envTool HOME` → `/Users/julong`
|
|
47
|
+
- `mono-rele2-core envTool NODE_ENV` → `development`
|
|
48
|
+
|
|
49
|
+
## Guidelines
|
|
50
|
+
|
|
51
|
+
- Arguments are positional — pass them in the order listed in each skill's table
|
|
52
|
+
- `format` in `timestampTool` defaults to `iso` if omitted
|
|
53
|
+
- `envTool` returns an empty string when the variable is not set
|
|
54
|
+
- Run `mono-rele2-core` with no args to list all available skills
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// ../common/mcp/tool.ts
|
|
4
|
+
function toolDef(def) {
|
|
5
|
+
return def;
|
|
6
|
+
}
|
|
4
7
|
function defineTool(tool) {
|
|
5
8
|
return tool;
|
|
6
9
|
}
|
|
@@ -11,9 +14,9 @@ function text(content) {
|
|
|
11
14
|
// ../common/mcp/server.ts
|
|
12
15
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
16
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
14
|
-
function createMcpServer(config,
|
|
17
|
+
function createMcpServer(config, tools2) {
|
|
15
18
|
const server2 = new McpServer(config);
|
|
16
|
-
for (const tool of
|
|
19
|
+
for (const tool of tools2) {
|
|
17
20
|
server2.registerTool(
|
|
18
21
|
tool.name,
|
|
19
22
|
{ description: tool.description, inputSchema: tool.inputSchema },
|
|
@@ -28,35 +31,43 @@ async function startServer(server2) {
|
|
|
28
31
|
await server2.connect(transport);
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
//
|
|
34
|
+
// ../common/mcp/cli.ts
|
|
32
35
|
import { z } from "zod";
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
|
|
37
|
+
// src/tools/system.ts
|
|
38
|
+
import { z as z2 } from "zod";
|
|
39
|
+
var tools = {
|
|
40
|
+
echoTool: toolDef({
|
|
41
|
+
name: "echo",
|
|
42
|
+
description: "Returns the message as-is",
|
|
43
|
+
inputSchema: {
|
|
44
|
+
message: z2.string().describe("Message to echo")
|
|
45
|
+
},
|
|
46
|
+
handler: async ({ message }) => text(message)
|
|
47
|
+
}),
|
|
48
|
+
timestampTool: toolDef({
|
|
49
|
+
name: "timestamp",
|
|
50
|
+
description: "Returns the current UTC timestamp",
|
|
51
|
+
inputSchema: {
|
|
52
|
+
format: z2.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
|
|
53
|
+
},
|
|
54
|
+
handler: async ({ format }) => {
|
|
55
|
+
const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
|
|
56
|
+
return text(value);
|
|
57
|
+
}
|
|
58
|
+
}),
|
|
59
|
+
envTool: toolDef({
|
|
60
|
+
name: "env",
|
|
61
|
+
description: "Returns the value of an environment variable",
|
|
62
|
+
inputSchema: {
|
|
63
|
+
key: z2.string().describe("Environment variable name")
|
|
64
|
+
},
|
|
65
|
+
handler: async ({ key }) => text(process.env[key] ?? "")
|
|
66
|
+
})
|
|
67
|
+
};
|
|
68
|
+
var echoTool = defineTool(tools.echoTool);
|
|
69
|
+
var timestampTool = defineTool(tools.timestampTool);
|
|
70
|
+
var envTool = defineTool(tools.envTool);
|
|
60
71
|
|
|
61
72
|
// src/index.ts
|
|
62
73
|
function createCoreServer() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@julong/mono-rele2-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"bin": {
|
|
13
|
-
"mcp-core": "./dist/server.js"
|
|
13
|
+
"mcp-core": "./dist/server.js",
|
|
14
|
+
"mono-rele2-core": "./dist/cli.js"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
17
|
"dist"
|
|
@@ -22,5 +23,9 @@
|
|
|
22
23
|
"build": "tsup",
|
|
23
24
|
"typecheck": "tsc --noEmit",
|
|
24
25
|
"clean": "rimraf dist"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
29
|
+
"zod": "^4.4.2"
|
|
25
30
|
}
|
|
26
31
|
}
|