File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3+ import * as fs from "fs" ;
34import { Client } from "@modelcontextprotocol/sdk/client/index.js" ;
45import { Command } from "commander" ;
56import {
@@ -31,8 +32,6 @@ type JsonValue =
3132 | JsonValue [ ]
3233 | { [ key : string ] : JsonValue } ;
3334
34- import packageJson from "../package.json" with { type : "json" } ;
35-
3635type Args = {
3736 target : string [ ] ;
3837 method ?: string ;
@@ -101,6 +100,15 @@ function createTransportOptions(
101100}
102101
103102async function callMethod ( args : Args ) : Promise < void > {
103+ // Read package.json to get name and version for client identity
104+ const pathA = "../package.json" ; // We're in package @modelcontextprotocol/inspector-cli
105+ const pathB = "../../package.json" ; // We're in package @modelcontextprotocol/inspector
106+ let packageJson : { name: string ; version: string } ;
107+ let packageJsonData = await import ( fs . existsSync ( pathA ) ? pathA : pathB , {
108+ with : { type : "json" } ,
109+ } ) ;
110+ packageJson = packageJsonData . default ;
111+
104112 const transportOptions = createTransportOptions (
105113 args . target ,
106114 args . transport ,
You can’t perform that action at this time.
0 commit comments