mage-remote-run 0.23.0 → 0.23.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.
@@ -10,6 +10,7 @@ const pkg = require('../package.json');
10
10
 
11
11
  const program = new Command();
12
12
 
13
+
13
14
  program
14
15
  .name('mage-remote-run')
15
16
  .description('The remote swiss army knife for Magento Open Source, Mage-OS, Adobe Commerce')
@@ -48,12 +49,18 @@ import { startMcpServer } from '../lib/mcp.js';
48
49
  // But we need them registered early if we want them to show up in help even if config fails?
49
50
  // Actually registerCommands handles null profile by registering connection commands only.
50
51
 
51
- program.command('mcp')
52
+ program.command('mcp [args...]')
52
53
  .description('Run as MCP server')
53
54
  .option('--transport <type>', 'Transport type (stdio, http)', 'stdio')
54
55
  .option('--host <host>', 'HTTP Host', '127.0.0.1')
55
56
  .option('--port <port>', 'HTTP Port', '18098')
56
- .action(async (options) => {
57
+ .allowExcessArguments(true)
58
+ .allowUnknownOption(true)
59
+ .action(async (args, options) => {
60
+ // We ignore extra arguments but log them for debugging purposes
61
+ if (args && args.length > 0) {
62
+ // console.error(chalk.yellow(`[mage-remote-run] Warning: Received extra arguments for mcp command: ${args.join(' ')}`));
63
+ }
57
64
  await startMcpServer(options);
58
65
  });
59
66
 
@@ -68,7 +75,8 @@ program.hook('preAction', async (thisCommand, actionCommand) => {
68
75
  const config = await loadConfig();
69
76
  if (config.showActiveConnectionHeader !== false) {
70
77
  const opts = actionCommand.opts();
71
- if (opts.format !== 'json' && opts.format !== 'xml') {
78
+ // Standard output corruption check: Don't print header if output is json/xml OR if running mcp command (which uses stdio)
79
+ if (opts.format !== 'json' && opts.format !== 'xml' && actionCommand.name() !== 'mcp') {
72
80
  console.log(chalk.cyan(`Active Connection: ${chalk.bold(profile.name)} (${profile.type})`));
73
81
  console.log(chalk.gray('━'.repeat(60)) + '\n');
74
82
  }
package/lib/mcp.js CHANGED
@@ -62,8 +62,8 @@ export async function startMcpServer(options) {
62
62
 
63
63
  } else {
64
64
  // STDIO
65
- console.error(`Protocol: stdio`);
66
- console.error(`Registered Tools: ${toolsCount}`);
65
+ console.error(`Protocol: stdio`);
66
+ console.error(`Registered Tools: ${toolsCount}`);
67
67
  const transport = new StdioServerTransport();
68
68
  await server.connect(transport);
69
69
  }
@@ -82,7 +82,7 @@ function registerTools(server, program) {
82
82
  }
83
83
 
84
84
  // It's a leaf command, register as tool
85
- // Tool name: Replace spaces/colons with underscores.
85
+ // Tool name: Replace spaces/colons with underscores.
86
86
  // Example: website list -> website_list
87
87
  const toolName = cmdName.replace(/[^a-zA-Z0-9_]/g, '_');
88
88
 
@@ -105,7 +105,7 @@ function registerTools(server, program) {
105
105
 
106
106
  cmd.options.forEach(opt => {
107
107
  const name = opt.name(); // e.g. "format" for --format
108
- // Check flags to guess type.
108
+ // Check flags to guess type.
109
109
  // -f, --format <type> -> string
110
110
  // -v, --verbose -> boolean
111
111
 
@@ -186,9 +186,9 @@ async function executeCommand(cmdDefinition, args, parentName) {
186
186
  // Wait, registerTools calls: `executeCommand(cmd, args, parentName)`
187
187
  // If parentName is "website", and cmd is "list", we need "website list"
188
188
 
189
- // NOTE: parentName in processCommand is built recursively with underscores?
190
- // In processCommand(subCmd, cmdName), cmdName is "parent_sub".
191
- // So if we have website -> list.
189
+ // NOTE: parentName in processCommand is built recursively with underscores?
190
+ // In processCommand(subCmd, cmdName), cmdName is "parent_sub".
191
+ // So if we have website -> list.
192
192
  // processCommand(website) -> processCommand(list, "website")
193
193
  // parentName in executeCommand is "website".
194
194
  // cmd.name() is "list".
@@ -212,7 +212,7 @@ async function executeCommand(cmdDefinition, args, parentName) {
212
212
  // `cmdName` = `parentName_cmd.name()`.
213
213
  // So for `website list`:
214
214
  // `processCommand(website, '')` -> `cmdName="website"`.
215
- // -> `processCommand(list, "website")`.
215
+ // -> `processCommand(list, "website")`.
216
216
  // -> register tool "website_list". `parentName` passed to execute is "website".
217
217
 
218
218
  // So `parentName` is the accumulated prefix with underscores.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mage-remote-run",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "The remote swiss army knife for Magento Open Source, Mage-OS, Adobe Commerce",
5
5
  "main": "index.js",
6
6
  "scripts": {