run-mcp 1.6.1 → 1.6.3

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.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/dist/index.js +74 -28
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -5,7 +5,7 @@ A smart proxy, interactive REPL, and live test harness for [Model Context Protoc
5
5
  `run-mcp` operates in two modes:
6
6
 
7
7
  1. **Agent MCP Server** (`run-mcp`) — An MCP server that exposes tools (`connect_to_mcp`, `call_mcp_tool`) so AI agents can dynamically connect to and test local MCP projects without hardcoding them in configuration files. This is the **default mode** when you run `npx -y run-mcp`.
8
- 2. **Interactive REPL** (`run-mcp repl`) — A headless CLI for human developers to manually test and explore MCP servers using short, memorable commands (`tools/call`, `status`, etc.).
8
+ 2. **Interactive REPL** (Interactive mode) — A headless CLI for human developers to manually test and explore MCP servers using short, memorable commands (`tools/call`, `status`, etc.).
9
9
 
10
10
  ### Interception Rules (Agent Server & REPL)
11
11
 
@@ -234,7 +234,7 @@ tools/call screenshot {"save_path": "/tmp/test.png"}
234
234
  ```
235
235
 
236
236
  ```bash
237
- run-mcp repl node my-server.js --script commands.txt
237
+ run-mcp -s commands.txt -- node my-server.js
238
238
  ```
239
239
 
240
240
  - Lines starting with `#` are treated as comments
@@ -330,7 +330,7 @@ npm run build
330
330
  npm run dev
331
331
 
332
332
  # Run directly
333
- node dist/index.js repl <target_command...>
333
+ node dist/index.js -- <target_command...>
334
334
  ```
335
335
 
336
336
  ## License
package/dist/index.js CHANGED
@@ -921,7 +921,7 @@ var TargetManager = class _TargetManager extends EventEmitter {
921
921
  this.transport = stdioTransport;
922
922
  }
923
923
  this.client = new Client(
924
- { name: "run-mcp", version: "1.6.1" },
924
+ { name: "run-mcp", version: "1.6.3" },
925
925
  {
926
926
  capabilities: {
927
927
  roots: { listChanged: true },
@@ -1620,6 +1620,7 @@ import { createInterface } from "readline";
1620
1620
  import { checkbox, confirm, input as input2, search } from "@inquirer/prompts";
1621
1621
  import pc2 from "picocolors";
1622
1622
  var KNOWN_COMMANDS = [
1623
+ "menu",
1623
1624
  "explore",
1624
1625
  "interactive",
1625
1626
  "tools/list",
@@ -2078,7 +2079,7 @@ async function startRepl(targetCommand, opts) {
2078
2079
  await target.close();
2079
2080
  process.exit(0);
2080
2081
  } else {
2081
- startReadlineLoop(target, interceptor);
2082
+ mainMenuLoop(target, interceptor);
2082
2083
  }
2083
2084
  }
2084
2085
  function startReadlineLoop(target, interceptor) {
@@ -2174,11 +2175,16 @@ async function handleCommand(input3, target, interceptor) {
2174
2175
  case "?":
2175
2176
  printShortHelp();
2176
2177
  return;
2178
+ case "menu":
2177
2179
  case "explore":
2178
2180
  case "interactive":
2179
- await withSuspendedReadline(target, interceptor, async () => {
2180
- await cmdExplore(target, interceptor);
2181
- });
2181
+ if (activeRl) {
2182
+ globalPauseReadlineClose = true;
2183
+ activeRl.close();
2184
+ activeRl = null;
2185
+ globalPauseReadlineClose = false;
2186
+ }
2187
+ mainMenuLoop(target, interceptor);
2182
2188
  return;
2183
2189
  case "tools/list":
2184
2190
  await cmdToolsList(target);
@@ -3299,7 +3305,7 @@ async function pickInteractive(items, message) {
3299
3305
  throw err;
3300
3306
  }
3301
3307
  }
3302
- async function cmdExplore(target, interceptor) {
3308
+ async function showMainMenu(target, interceptor) {
3303
3309
  const choices = [];
3304
3310
  const caps = target.getServerCapabilities() ?? {};
3305
3311
  try {
@@ -3339,26 +3345,30 @@ async function cmdExplore(target, interceptor) {
3339
3345
  } catch {
3340
3346
  }
3341
3347
  }
3342
- if (choices.length === 0) {
3343
- console.log(pc2.yellow("No tools, resources, or prompts found."));
3344
- return;
3345
- }
3346
- if (!process.stdin.isTTY) {
3347
- console.log(pc2.bold("\n Server Capabilities\n"));
3348
- for (let i = 0; i < choices.length; i++) {
3349
- console.log(
3350
- ` ${pc2.cyan(String(i + 1).padStart(2))}. ${choices[i].name} ${pc2.dim(choices[i].description)}`
3351
- );
3352
- }
3353
- console.log();
3354
- console.log(
3355
- pc2.dim(" Non-interactive mode \u2014 use specific commands instead (e.g., tools/call <name>).")
3356
- );
3357
- return;
3358
- }
3348
+ choices.push({
3349
+ name: "\u2699\uFE0F Check Server Status",
3350
+ value: { type: "command", name: "status" },
3351
+ description: "View connection status and server info"
3352
+ });
3353
+ choices.push({
3354
+ name: "\u{1F504} Reconnect Server",
3355
+ value: { type: "command", name: "reconnect" },
3356
+ description: "Restart the target MCP server"
3357
+ });
3358
+ choices.push({
3359
+ name: "\u2328\uFE0F Type a raw command",
3360
+ value: { type: "raw" },
3361
+ description: "Drop to the traditional REPL prompt (use 'menu' to return)"
3362
+ });
3363
+ choices.push({
3364
+ name: "\u{1F6AA} Exit",
3365
+ value: { type: "command", name: "exit" },
3366
+ description: "Close connection and exit"
3367
+ });
3368
+ if (!process.stdin.isTTY) return false;
3359
3369
  try {
3360
3370
  const answer = await search({
3361
- message: "Explore server capabilities:",
3371
+ message: "Select an action (start typing to search):",
3362
3372
  source: async (term) => {
3363
3373
  if (!term) return choices;
3364
3374
  const lower = term.toLowerCase();
@@ -3373,10 +3383,46 @@ async function cmdExplore(target, interceptor) {
3373
3383
  await cmdResourcesRead(target, answer.uri);
3374
3384
  } else if (answer.type === "prompt") {
3375
3385
  await cmdPromptsGet(target, answer.name);
3386
+ } else if (answer.type === "command") {
3387
+ if (answer.name === "status") {
3388
+ cmdStatus(target);
3389
+ } else if (answer.name === "reconnect") {
3390
+ await cmdReconnect(target);
3391
+ } else if (answer.name === "exit") {
3392
+ console.log(pc2.dim("\nShutting down..."));
3393
+ await target.close();
3394
+ process.exit(0);
3395
+ }
3396
+ } else if (answer.type === "raw") {
3397
+ return true;
3376
3398
  }
3399
+ return false;
3377
3400
  } catch (err) {
3378
- if (!isAbortError(err)) {
3379
- throw err;
3401
+ if (isAbortError(err)) {
3402
+ console.log(pc2.dim("\nShutting down..."));
3403
+ await target.close();
3404
+ process.exit(0);
3405
+ }
3406
+ throw err;
3407
+ }
3408
+ }
3409
+ async function mainMenuLoop(target, interceptor) {
3410
+ if (isScriptMode || !process.stdin.isTTY) {
3411
+ startReadlineLoop(target, interceptor);
3412
+ return;
3413
+ }
3414
+ while (true) {
3415
+ try {
3416
+ const dropToRaw = await showMainMenu(target, interceptor);
3417
+ if (dropToRaw) {
3418
+ console.log(pc2.dim(" Entering raw command mode. Type 'menu' to return."));
3419
+ startReadlineLoop(target, interceptor);
3420
+ break;
3421
+ }
3422
+ } catch (err) {
3423
+ console.error(pc2.red(`Error in menu: ${err.message}`));
3424
+ startReadlineLoop(target, interceptor);
3425
+ break;
3380
3426
  }
3381
3427
  }
3382
3428
  }
@@ -3444,7 +3490,7 @@ async function startServer(opts) {
3444
3490
  mediaThresholdKb: opts.mediaThresholdKb
3445
3491
  });
3446
3492
  const mcpServer = new McpServer(
3447
- { name: "run-mcp", version: "1.6.1" },
3493
+ { name: "run-mcp", version: "1.6.3" },
3448
3494
  {
3449
3495
  capabilities: {
3450
3496
  tools: {},
@@ -4732,7 +4778,7 @@ program.command("close-session").argument("<session_name>", "Session name").desc
4732
4778
  }
4733
4779
  }
4734
4780
  });
4735
- program.name("run-mcp").description("A smart interactive REPL and live test harness for MCP servers").version("1.6.1").passThroughOptions().allowUnknownOption().argument(
4781
+ program.name("run-mcp").description("A smart interactive REPL and live test harness for MCP servers").version("1.6.3").passThroughOptions().allowUnknownOption().argument(
4736
4782
  "[target_command...]",
4737
4783
  "Command to spawn the target MCP server (starts REPL if provided, Agent server otherwise)"
4738
4784
  ).option("-o, --out-dir <path>", "Directory to save intercepted images and audio").option(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run-mcp",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "A smart proxy and interactive REPL for Model Context Protocol (MCP) servers",
5
5
  "homepage": "https://github.com/funkyfunc/run-mcp#readme",
6
6
  "bugs": {