run-mcp 1.3.2 → 1.3.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.
Files changed (3) hide show
  1. package/README.md +25 -30
  2. package/dist/index.js +56 -56
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -4,10 +4,10 @@ A smart proxy, interactive REPL, and live test harness for [Model Context Protoc
4
4
 
5
5
  `run-mcp` operates in two modes:
6
6
 
7
- 1. **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. **Server Mode** (`run-mcp server`) — 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.
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.).
9
9
 
10
- ### Interception Rules (Server Mode & REPL)
10
+ ### Interception Rules (Agent Server & REPL)
11
11
 
12
12
  To protect the CLI and parent agents from large payloads, `run-mcp` automatically applies the following rules:
13
13
 
@@ -55,47 +55,42 @@ You'll see an interactive prompt:
55
55
 
56
56
  ## Usage
57
57
 
58
- ```
59
- run-mcp <command> [options]
60
-
61
- Commands:
62
- repl <target_command...> Start an interactive REPL session
63
- server Start as an MCP server for agents
58
+ run-mcp [options] [target_command...]
64
59
 
65
60
  Options:
66
61
  -V, --version Show version number
67
- -h, --help Show help
68
- ```
62
+ -o, --out-dir <path> Directory to save intercepted images and audio
63
+ -t, --timeout <ms> Default tool call timeout in milliseconds (default: 300000) (Agent Mode only)
64
+ --max-text <chars> Max text response length before truncation (default: 50000) (Agent Mode only)
65
+ -s, --script <file> Read commands from a file instead of stdin (REPL Mode only)
66
+ -h, --help Display help for command
69
67
 
70
- ### REPL Command
68
+ Examples:
69
+ $ run-mcp # Test harness (agent mode)
70
+ $ run-mcp node my-server.js # Interactive testing (human REPL mode)
71
+ $ run-mcp node my-server.js -s test.txt # Run a script in REPL mode
72
+ $ run-mcp npx -y some-mcp-server # Test an npx server
73
+ $ run-mcp --out-dir ./test-output # Agent mode with options
74
+ $ run-mcp --out-dir ./screenshots node srv.js # REPL mode with options
71
75
 
72
- ```
73
- run-mcp repl <target_command...> [options]
74
76
 
75
- Options:
76
- -s, --script <file> Read commands from a file instead of stdin
77
- -o, --out-dir <path> Directory to save intercepted images (default: $TMPDIR/run-mcp)
78
- ```
79
77
 
80
- ### Server Command
78
+ ## Agent Use Cases
81
79
 
82
- ```
83
- run-mcp server [options]
80
+ ### Dynamic Testing
84
81
 
85
- Options:
86
- -o, --out-dir <path> Directory to save intercepted images and audio (default: $TMPDIR/run-mcp)
87
- -t, --timeout <ms> Default tool call timeout in milliseconds (default: 60000)
88
- --max-text <chars> Max text response length before truncation (default: 50000)
89
- ```
82
+ When an AI agent is actively *developing* an MCP server, it needs to test it. Standard MCP clients require updating a configuration file (`mcp.json`) and restarting the agent session entirely.
90
83
 
91
- Add to your MCP client configuration:
84
+ `run-mcp` solves this by giving the agent a suite of tools to dynamically spawn, inspect, and test local MCP servers on the fly.
92
85
 
86
+ **How to use:**
87
+ Add `run-mcp` to your agent's MCP configuration using `npx`:
93
88
  ```json
94
89
  {
95
90
  "mcpServers": {
96
91
  "run-mcp": {
97
92
  "command": "npx",
98
- "args": ["-y", "run-mcp", "server"]
93
+ "args": ["-y", "run-mcp"]
99
94
  }
100
95
  }
101
96
  }
@@ -116,9 +111,9 @@ Then use these tools from your agent:
116
111
  | `get_mcp_prompt` | Get a prompt by name |
117
112
  | `get_mcp_server_stderr` | View target server stderr output |
118
113
 
119
- ## REPL Commands
114
+ ## REPL Mode Commands
120
115
 
121
- Once in the REPL, these commands are available:
116
+ Once connected via `run-mcp <command>`, the following shorthand commands are available:
122
117
 
123
118
  | Command | Description |
124
119
  |---------|-------------|
package/dist/index.js CHANGED
@@ -318,7 +318,11 @@ var TargetManager = class _TargetManager extends EventEmitter {
318
318
  async callTool(name, args = {}, _timeoutMs) {
319
319
  this._assertConnected();
320
320
  const requestOptions = { timeout: 36e5 * 10 };
321
- const result = await this.client.callTool({ name, arguments: args }, void 0, requestOptions);
321
+ const result = await this.client.callTool(
322
+ { name, arguments: args },
323
+ void 0,
324
+ requestOptions
325
+ );
322
326
  this.recordResponse();
323
327
  return result;
324
328
  }
@@ -1029,7 +1033,10 @@ Check that the command is correct and the server starts without errors. You can
1029
1033
  if (!target?.connected) {
1030
1034
  return {
1031
1035
  content: [
1032
- { type: "text", text: "No target server connected. Use connect_to_mcp first." }
1036
+ {
1037
+ type: "text",
1038
+ text: "No target server connected. Use connect_to_mcp first."
1039
+ }
1033
1040
  ],
1034
1041
  isError: true
1035
1042
  };
@@ -1041,16 +1048,17 @@ Check that the command is correct and the server starts without errors. You can
1041
1048
  const available = result.tools.map((t) => t.name).join(", ");
1042
1049
  return {
1043
1050
  content: [
1044
- { type: "text", text: `Tool "${name}" not found.
1045
- Available tools: ${available}` }
1051
+ {
1052
+ type: "text",
1053
+ text: `Tool "${name}" not found.
1054
+ Available tools: ${available}`
1055
+ }
1046
1056
  ],
1047
1057
  isError: true
1048
1058
  };
1049
1059
  }
1050
1060
  return {
1051
- content: [
1052
- { type: "text", text: JSON.stringify(tool, null, 2) }
1053
- ]
1061
+ content: [{ type: "text", text: JSON.stringify(tool, null, 2) }]
1054
1062
  };
1055
1063
  } catch (err) {
1056
1064
  return {
@@ -1277,68 +1285,60 @@ Available tools: ${available}` }
1277
1285
  }
1278
1286
 
1279
1287
  // src/index.ts
1280
- program.name("run-mcp").enablePositionalOptions().description(
1281
- "A smart interactive REPL and live test harness for MCP servers.\n\nOperates in two modes:\n repl - Human-friendly CLI for testing MCP servers interactively\n server - MCP server that lets AI agents dynamically test local MCP servers"
1282
- ).version("1.3.1").addHelpText(
1283
- "after",
1284
- `
1285
- Examples:
1286
- $ run-mcp repl node my-server.js # Interactive testing (human)
1287
- $ run-mcp repl node my-server.js -s test.txt # Run a script
1288
- $ run-mcp server # Test harness (agent)
1289
- $ run-mcp repl npx -y some-mcp-server # Test an npx server
1290
-
1291
- Run 'run-mcp <command> --help' for detailed options.`
1292
- );
1293
- if (process.argv.length <= 2) {
1294
- program.outputHelp();
1295
- process.exit(0);
1296
- }
1297
- program.command("repl").description("Start an interactive REPL session with a target MCP server").passThroughOptions().allowUnknownOption().argument("<target_command...>", "Command to spawn the target MCP server").option("-s, --script <file>", "Read commands from a file instead of stdin").option("-o, --out-dir <path>", "Directory to save intercepted images").addHelpText(
1288
+ program.name("run-mcp").description("A smart interactive REPL and live test harness for MCP servers").version("1.3.4").passThroughOptions().allowUnknownOption().argument(
1289
+ "[target_command...]",
1290
+ "Command to spawn the target MCP server (starts REPL if provided, Agent server otherwise)"
1291
+ ).option("-o, --out-dir <path>", "Directory to save intercepted images and audio").option(
1292
+ "-t, --timeout <ms>",
1293
+ "Default tool call timeout in milliseconds (default: 300000) (Agent Mode only)"
1294
+ ).option(
1295
+ "--max-text <chars>",
1296
+ "Max text response length before truncation (default: 50000) (Agent Mode only)"
1297
+ ).option("-s, --script <file>", "Read commands from a file instead of stdin (REPL Mode only)").addHelpText(
1298
1298
  "after",
1299
1299
  `
1300
1300
  Examples:
1301
- $ run-mcp repl node my-server.js
1302
- $ run-mcp repl node my-server.js --script verify.txt
1303
- $ run-mcp repl node my-server.js --out-dir ./screenshots
1301
+ $ run-mcp # Test harness (agent mode)
1302
+ $ run-mcp node my-server.js # Interactive testing (human REPL mode)
1303
+ $ run-mcp node my-server.js -s test.txt # Run a script in REPL mode
1304
+ $ run-mcp npx -y some-mcp-server # Test an npx server
1305
+ $ run-mcp --out-dir ./test-output # Agent mode with options
1306
+ $ run-mcp --out-dir ./screenshots node srv.js # REPL mode with options
1304
1307
 
1305
- REPL Commands (once connected):
1306
- tools/list List all available tools
1307
- tools/describe <name> Show a tool's input schema
1308
- tools/call <name> <json> [opts] Call a tool with JSON arguments
1309
- status Show target server status
1310
- help Show all commands`
1311
- ).action(async (targetCommand, opts) => {
1312
- await startRepl(targetCommand, opts);
1313
- });
1314
- program.command("server").description("Start as an MCP server that lets AI agents dynamically test local MCP servers").option("-o, --out-dir <path>", "Directory to save intercepted images and audio").option("-t, --timeout <ms>", "Default tool call timeout in milliseconds (default: 300000)").option("--max-text <chars>", "Max text response length before truncation (default: 50000)").addHelpText(
1315
- "after",
1316
- `
1317
- Examples:
1318
- $ run-mcp server
1319
- $ run-mcp server --out-dir ./test-output
1320
- $ run-mcp server --timeout 120000
1321
-
1322
- Add to your MCP client configuration:
1308
+ Agent Mode Configuration (mcp.json):
1323
1309
  {
1324
1310
  "mcpServers": {
1325
1311
  "run-mcp": {
1326
1312
  "command": "npx",
1327
- "args": ["-y", "run-mcp", "server"]
1313
+ "args": ["-y", "run-mcp"]
1328
1314
  }
1329
1315
  }
1330
1316
  }
1331
1317
 
1332
- Then use these tools from your agent:
1318
+ Agent Mode Tools:
1333
1319
  connect_to_mcp \u2192 Spawn and connect to a local MCP server
1334
1320
  list_mcp_tools \u2192 List tools on the connected server
1321
+ describe_mcp_tool \u2192 Show a tool's input schema
1335
1322
  call_mcp_tool \u2192 Call a tool (with interception)
1336
- disconnect_from_mcp \u2192 Tear down and reconnect after changes`
1337
- ).action(async (opts) => {
1338
- await startServer({
1339
- outDir: opts.outDir,
1340
- timeoutMs: opts.timeout ? Number.parseInt(opts.timeout, 10) : void 0,
1341
- maxTextLength: opts.maxText ? Number.parseInt(opts.maxText, 10) : void 0
1342
- });
1343
- });
1323
+ disconnect_from_mcp \u2192 Tear down and reconnect after changes
1324
+
1325
+ REPL Mode Commands (once connected):
1326
+ tools/list List all available tools
1327
+ tools/describe <name> Show a tool's input schema
1328
+ tools/call <name> <json> [opts] Call a tool with JSON arguments
1329
+ status Show target server status
1330
+ help Show all commands`
1331
+ ).action(
1332
+ async (targetCommand, opts) => {
1333
+ if (targetCommand && targetCommand.length > 0) {
1334
+ await startRepl(targetCommand, { script: opts.script, outDir: opts.outDir });
1335
+ } else {
1336
+ await startServer({
1337
+ outDir: opts.outDir,
1338
+ timeoutMs: opts.timeout ? Number.parseInt(opts.timeout, 10) : void 0,
1339
+ maxTextLength: opts.maxText ? Number.parseInt(opts.maxText, 10) : void 0
1340
+ });
1341
+ }
1342
+ }
1343
+ );
1344
1344
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run-mcp",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
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": {