@modelcontextprotocol/inspector-cli 0.16.1 → 0.16.2
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/build/cli.js +12 -2
- package/build/index.js +2 -0
- package/build/transport.js +7 -16
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -32,8 +32,18 @@ async function runWebClient(args) {
|
|
|
32
32
|
cancelled = true;
|
|
33
33
|
abort.abort();
|
|
34
34
|
});
|
|
35
|
+
// Build arguments to pass to start.js
|
|
36
|
+
const startArgs = [];
|
|
37
|
+
// Pass environment variables
|
|
38
|
+
for (const [key, value] of Object.entries(args.envArgs)) {
|
|
39
|
+
startArgs.push("-e", `${key}=${value}`);
|
|
40
|
+
}
|
|
41
|
+
// Pass command and args (using -- to separate them)
|
|
42
|
+
if (args.command) {
|
|
43
|
+
startArgs.push("--", args.command, ...args.args);
|
|
44
|
+
}
|
|
35
45
|
try {
|
|
36
|
-
await spawnPromise("node", [inspectorClientPath], {
|
|
46
|
+
await spawnPromise("node", [inspectorClientPath, ...startArgs], {
|
|
37
47
|
signal: abort.signal,
|
|
38
48
|
echoOutput: true,
|
|
39
49
|
});
|
|
@@ -155,7 +165,7 @@ async function main() {
|
|
|
155
165
|
try {
|
|
156
166
|
const args = parseArgs();
|
|
157
167
|
if (args.cli) {
|
|
158
|
-
runCli(args);
|
|
168
|
+
await runCli(args);
|
|
159
169
|
}
|
|
160
170
|
else {
|
|
161
171
|
await runWebClient(args);
|
package/build/index.js
CHANGED
package/build/transport.js
CHANGED
|
@@ -2,20 +2,6 @@ import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
|
2
2
|
import { getDefaultEnvironment, StdioClientTransport, } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
3
3
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
4
4
|
import { findActualExecutable } from "spawn-rx";
|
|
5
|
-
function createSSETransport(options) {
|
|
6
|
-
const baseUrl = new URL(options.url ?? "");
|
|
7
|
-
const sseUrl = baseUrl.pathname.endsWith("/sse")
|
|
8
|
-
? baseUrl
|
|
9
|
-
: new URL("/sse", baseUrl);
|
|
10
|
-
return new SSEClientTransport(sseUrl);
|
|
11
|
-
}
|
|
12
|
-
function createHTTPTransport(options) {
|
|
13
|
-
const baseUrl = new URL(options.url ?? "");
|
|
14
|
-
const mcpUrl = baseUrl.pathname.endsWith("/mcp")
|
|
15
|
-
? baseUrl
|
|
16
|
-
: new URL("/mcp", baseUrl);
|
|
17
|
-
return new StreamableHTTPClientTransport(mcpUrl);
|
|
18
|
-
}
|
|
19
5
|
function createStdioTransport(options) {
|
|
20
6
|
let args = [];
|
|
21
7
|
if (options.args !== undefined) {
|
|
@@ -46,11 +32,16 @@ export function createTransport(options) {
|
|
|
46
32
|
if (transportType === "stdio") {
|
|
47
33
|
return createStdioTransport(options);
|
|
48
34
|
}
|
|
35
|
+
// If not STDIO, then it must be either SSE or HTTP.
|
|
36
|
+
if (!options.url) {
|
|
37
|
+
throw new Error("URL must be provided for SSE or HTTP transport types.");
|
|
38
|
+
}
|
|
39
|
+
const url = new URL(options.url);
|
|
49
40
|
if (transportType === "sse") {
|
|
50
|
-
return
|
|
41
|
+
return new SSEClientTransport(url);
|
|
51
42
|
}
|
|
52
43
|
if (transportType === "http") {
|
|
53
|
-
return
|
|
44
|
+
return new StreamableHTTPClientTransport(url);
|
|
54
45
|
}
|
|
55
46
|
throw new Error(`Unsupported transport type: ${transportType}`);
|
|
56
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modelcontextprotocol/inspector-cli",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"description": "CLI for the Model Context Protocol inspector",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Anthropic, PBC (https://anthropic.com)",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
24
|
+
"@modelcontextprotocol/sdk": "^1.17.0",
|
|
25
25
|
"commander": "^13.1.0",
|
|
26
26
|
"spawn-rx": "^5.1.2"
|
|
27
27
|
}
|