@julong/mono-rele2-core 1.1.2 → 1.1.4

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/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
- export { echoTool, envTool, timestampTool } from './tools/index.js';
2
- export declare function createCoreServer(): import("@modelcontextprotocol/sdk/server/mcp").McpServer;
3
- //# sourceMappingURL=index.d.ts.map
1
+ import * as _modelcontextprotocol_sdk_server_mcp from '@modelcontextprotocol/sdk/server/mcp';
2
+
3
+ declare function createCoreServer(): _modelcontextprotocol_sdk_server_mcp.McpServer;
4
+
5
+ export { createCoreServer };
package/dist/index.js CHANGED
@@ -1,7 +1,64 @@
1
- import { createMcpServer } from '@julong/mono-rele2-common';
2
- import { echoTool, envTool, timestampTool } from './tools/index.js';
3
- export { echoTool, envTool, timestampTool } from './tools/index.js';
4
- export function createCoreServer() {
5
- return createMcpServer({ name: 'mono-rele2-core', version: '1.0.0' }, [echoTool, timestampTool, envTool]);
1
+ // ../common/mcp/tool.ts
2
+ function defineTool(tool) {
3
+ return tool;
6
4
  }
7
- //# sourceMappingURL=index.js.map
5
+ function text(content) {
6
+ return { content: [{ type: "text", text: content }] };
7
+ }
8
+
9
+ // ../common/mcp/server.ts
10
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
12
+ function createMcpServer(config, tools) {
13
+ const server = new McpServer(config);
14
+ for (const tool of tools) {
15
+ server.registerTool(
16
+ tool.name,
17
+ { description: tool.description, inputSchema: tool.inputSchema },
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ tool.handler
20
+ );
21
+ }
22
+ return server;
23
+ }
24
+
25
+ // src/tools/system.ts
26
+ import { z } from "zod";
27
+ var echoTool = defineTool({
28
+ name: "echo",
29
+ description: "Returns the message as-is",
30
+ inputSchema: {
31
+ message: z.string().describe("Message to echo")
32
+ },
33
+ handler: async ({ message }) => text(message)
34
+ });
35
+ var timestampTool = defineTool({
36
+ name: "timestamp",
37
+ description: "Returns the current UTC timestamp",
38
+ inputSchema: {
39
+ format: z.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
40
+ },
41
+ handler: async ({ format }) => {
42
+ const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
43
+ return text(value);
44
+ }
45
+ });
46
+ var envTool = defineTool({
47
+ name: "env",
48
+ description: "Returns the value of an environment variable",
49
+ inputSchema: {
50
+ key: z.string().describe("Environment variable name")
51
+ },
52
+ handler: async ({ key }) => text(process.env[key] ?? "")
53
+ });
54
+
55
+ // src/index.ts
56
+ function createCoreServer() {
57
+ return createMcpServer(
58
+ { name: "mono-rele2-core", version: "1.0.0" },
59
+ [echoTool, timestampTool, envTool]
60
+ );
61
+ }
62
+ export {
63
+ createCoreServer
64
+ };
package/dist/server.js CHANGED
@@ -1,9 +1,74 @@
1
1
  #!/usr/bin/env node
2
- import { startServer } from '@julong/mono-rele2-common';
3
- import { createCoreServer } from './index.js';
4
- const server = createCoreServer();
2
+
3
+ // ../common/mcp/tool.ts
4
+ function defineTool(tool) {
5
+ return tool;
6
+ }
7
+ function text(content) {
8
+ return { content: [{ type: "text", text: content }] };
9
+ }
10
+
11
+ // ../common/mcp/server.ts
12
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
13
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
14
+ function createMcpServer(config, tools) {
15
+ const server2 = new McpServer(config);
16
+ for (const tool of tools) {
17
+ server2.registerTool(
18
+ tool.name,
19
+ { description: tool.description, inputSchema: tool.inputSchema },
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ tool.handler
22
+ );
23
+ }
24
+ return server2;
25
+ }
26
+ async function startServer(server2) {
27
+ const transport = new StdioServerTransport();
28
+ await server2.connect(transport);
29
+ }
30
+
31
+ // src/tools/system.ts
32
+ import { z } from "zod";
33
+ var echoTool = defineTool({
34
+ name: "echo",
35
+ description: "Returns the message as-is",
36
+ inputSchema: {
37
+ message: z.string().describe("Message to echo")
38
+ },
39
+ handler: async ({ message }) => text(message)
40
+ });
41
+ var timestampTool = defineTool({
42
+ name: "timestamp",
43
+ description: "Returns the current UTC timestamp",
44
+ inputSchema: {
45
+ format: z.enum(["iso", "unix"]).default("iso").describe("Timestamp format")
46
+ },
47
+ handler: async ({ format }) => {
48
+ const value = format === "unix" ? String(Date.now()) : (/* @__PURE__ */ new Date()).toISOString();
49
+ return text(value);
50
+ }
51
+ });
52
+ var envTool = defineTool({
53
+ name: "env",
54
+ description: "Returns the value of an environment variable",
55
+ inputSchema: {
56
+ key: z.string().describe("Environment variable name")
57
+ },
58
+ handler: async ({ key }) => text(process.env[key] ?? "")
59
+ });
60
+
61
+ // src/index.ts
62
+ function createCoreServer() {
63
+ return createMcpServer(
64
+ { name: "mono-rele2-core", version: "1.0.0" },
65
+ [echoTool, timestampTool, envTool]
66
+ );
67
+ }
68
+
69
+ // src/server.ts
70
+ var server = createCoreServer();
5
71
  startServer(server).catch((err) => {
6
- console.error('[core] server error:', err);
7
- process.exit(1);
72
+ console.error("[core] server error:", err);
73
+ process.exit(1);
8
74
  });
9
- //# sourceMappingURL=server.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@julong/mono-rele2-core",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,18 +19,8 @@
19
19
  "access": "public"
20
20
  },
21
21
  "scripts": {
22
- "build": "tsc --build && chmod 755 dist/server.js",
22
+ "build": "tsup",
23
23
  "typecheck": "tsc --noEmit",
24
- "clean": "rimraf dist tsconfig.tsbuildinfo"
25
- },
26
- "dependencies": {
27
- "@julong/mono-rele2-common": "1.1.1",
28
- "@modelcontextprotocol/sdk": "^1.29.0",
29
- "@types/node": "^25.6.0",
30
- "zod": "^3.24.0"
31
- },
32
- "devDependencies": {
33
- "rimraf": "^6.0.1",
34
- "typescript": "^5.6.3"
24
+ "clean": "rimraf dist"
35
25
  }
36
26
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEnE,wBAAgB,gBAAgB,6DAK/B"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEnE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEnE,MAAM,UAAU,gBAAgB;IAC9B,OAAO,eAAe,CACpB,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,EAAE,EAC7C,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,CACnC,CAAA;AACH,CAAC"}
package/dist/server.d.ts DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAA;AAEjC,WAAW,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAChC,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAA;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export { echoTool, timestampTool, envTool } from './system.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA"}
@@ -1,2 +0,0 @@
1
- export { echoTool, timestampTool, envTool } from './system.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA"}
@@ -1,4 +0,0 @@
1
- export declare const echoTool: import("@julong/mono-rele2-common").AnyToolDef;
2
- export declare const timestampTool: import("@julong/mono-rele2-common").AnyToolDef;
3
- export declare const envTool: import("@julong/mono-rele2-common").AnyToolDef;
4
- //# sourceMappingURL=system.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/tools/system.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,gDAOnB,CAAA;AAEF,eAAO,MAAM,aAAa,gDAUxB,CAAA;AAEF,eAAO,MAAM,OAAO,gDAOlB,CAAA"}
@@ -1,30 +0,0 @@
1
- import { defineTool, text } from '@julong/mono-rele2-common';
2
- import { z } from 'zod';
3
- export const echoTool = defineTool({
4
- name: 'echo',
5
- description: 'Returns the message as-is',
6
- inputSchema: {
7
- message: z.string().describe('Message to echo'),
8
- },
9
- handler: async ({ message }) => text(message),
10
- });
11
- export const timestampTool = defineTool({
12
- name: 'timestamp',
13
- description: 'Returns the current UTC timestamp',
14
- inputSchema: {
15
- format: z.enum(['iso', 'unix']).default('iso').describe('Timestamp format'),
16
- },
17
- handler: async ({ format }) => {
18
- const value = format === 'unix' ? String(Date.now()) : new Date().toISOString();
19
- return text(value);
20
- },
21
- });
22
- export const envTool = defineTool({
23
- name: 'env',
24
- description: 'Returns the value of an environment variable',
25
- inputSchema: {
26
- key: z.string().describe('Environment variable name'),
27
- },
28
- handler: async ({ key }) => text(process.env[key] ?? ''),
29
- });
30
- //# sourceMappingURL=system.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/tools/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;IACjC,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE;QACX,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;KAChD;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;CAC9C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,mCAAmC;IAChD,WAAW,EAAE;QACX,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;KAC5E;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAC5B,MAAM,KAAK,GAAG,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;QAC/E,OAAO,IAAI,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;IAChC,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,8CAA8C;IAC3D,WAAW,EAAE;QACX,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;KACtD;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;CACzD,CAAC,CAAA"}