@modelcontextprotocol/inspector-cli 0.17.0 → 0.17.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.
Files changed (2) hide show
  1. package/build/index.js +9 -1
  2. package/package.json +2 -2
package/build/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ import * as fs from "fs";
2
3
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
3
4
  import { Command } from "commander";
4
5
  import { callTool, connect, disconnect, getPrompt, listPrompts, listResources, listResourceTemplates, listTools, readResource, setLoggingLevel, validLogLevels, } from "./client/index.js";
5
6
  import { handleError } from "./error-handler.js";
6
7
  import { createTransport } from "./transport.js";
7
8
  import { awaitableLog } from "./utils/awaitable-log.js";
8
- import packageJson from "../package.json" with { type: "json" };
9
9
  function createTransportOptions(target, transport, headers) {
10
10
  if (target.length === 0) {
11
11
  throw new Error("Target is required. Specify a URL or a command to execute.");
@@ -52,6 +52,14 @@ function createTransportOptions(target, transport, headers) {
52
52
  };
53
53
  }
54
54
  async function callMethod(args) {
55
+ // Read package.json to get name and version for client identity
56
+ const pathA = "../package.json"; // We're in package @modelcontextprotocol/inspector-cli
57
+ const pathB = "../../package.json"; // We're in package @modelcontextprotocol/inspector
58
+ let packageJson;
59
+ let packageJsonData = await import(fs.existsSync(pathA) ? pathA : pathB, {
60
+ with: { type: "json" },
61
+ });
62
+ packageJson = packageJsonData.default;
55
63
  const transportOptions = createTransportOptions(args.target, args.transport, args.headers);
56
64
  const transport = createTransport(transportOptions);
57
65
  const [, name = packageJson.name] = packageJson.name.split("/");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelcontextprotocol/inspector-cli",
3
- "version": "0.17.0",
3
+ "version": "0.17.2",
4
4
  "description": "CLI for the Model Context Protocol inspector",
5
5
  "license": "MIT",
6
6
  "author": "Anthropic, PBC (https://anthropic.com)",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "devDependencies": {},
26
26
  "dependencies": {
27
- "@modelcontextprotocol/sdk": "^1.18.0",
27
+ "@modelcontextprotocol/sdk": "^1.20.1",
28
28
  "commander": "^13.1.0",
29
29
  "spawn-rx": "^5.1.2"
30
30
  }