mage-remote-run 0.14.0 → 0.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/lib/mcp.js +9 -1
- package/package.json +1 -1
package/lib/mcp.js
CHANGED
|
@@ -5,6 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import http from "http";
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
import { Command } from "commander";
|
|
8
|
+
import { readFileSync } from "fs";
|
|
8
9
|
|
|
9
10
|
// Import command registry
|
|
10
11
|
import { registerAllCommands } from './command-registry.js';
|
|
@@ -22,12 +23,16 @@ function stripAnsi(str) {
|
|
|
22
23
|
* @param {number} [options.port] Port for HTTP server
|
|
23
24
|
*/
|
|
24
25
|
export async function startMcpServer(options) {
|
|
26
|
+
const packageJson = JSON.parse(
|
|
27
|
+
readFileSync(new URL("../package.json", import.meta.url))
|
|
28
|
+
);
|
|
29
|
+
|
|
25
30
|
// 1. Setup a dynamic program to discovery commands
|
|
26
31
|
const program = setupProgram();
|
|
27
32
|
|
|
28
33
|
const server = new McpServer({
|
|
29
34
|
name: "mage-remote-run",
|
|
30
|
-
version:
|
|
35
|
+
version: packageJson.version
|
|
31
36
|
});
|
|
32
37
|
|
|
33
38
|
const toolsCount = registerTools(server, program);
|
|
@@ -113,8 +118,11 @@ function registerTools(server, program) {
|
|
|
113
118
|
}
|
|
114
119
|
});
|
|
115
120
|
|
|
121
|
+
const description = cmd.description() || `Execute mage-remote-run ${cmdName.replace(/_/g, ' ')}`;
|
|
122
|
+
|
|
116
123
|
server.tool(
|
|
117
124
|
toolName,
|
|
125
|
+
description,
|
|
118
126
|
zodShape,
|
|
119
127
|
async (args) => {
|
|
120
128
|
return await executeCommand(cmd, args, parentName);
|