Skip to content

Fix hard-coded CLI inspector version #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
import { handleError } from "./error-handler.js";
import { createTransport, TransportOptions } from "./transport.js";

import packageJson from "../package.json" with { type: "json" };

type Args = {
target: string[];
method?: string;
Expand Down Expand Up @@ -61,10 +63,12 @@ function createTransportOptions(target: string[]): TransportOptions {
async function callMethod(args: Args): Promise<void> {
const transportOptions = createTransportOptions(args.target);
const transport = createTransport(transportOptions);
const client = new Client({
name: "inspector-cli",
version: "0.5.1",
});

const [_, name = packageJson.name] = packageJson.name.split("/");
const version = packageJson.version;
const clientIdentity = { name, version };

const client = new Client(clientIdentity);

try {
await connect(client, transport);
Expand Down
25 changes: 14 additions & 11 deletions client/src/lib/hooks/useConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,19 +287,22 @@
};

const connect = async (_e?: unknown, retryCount: number = 0) => {
const client = new Client<Request, Notification, Result>(
{
name: "mcp-inspector",
version: packageJson.version,
},
{
capabilities: {
sampling: {},
roots: {
listChanged: true,
},
const [_, name = packageJson.name] = packageJson.name.split("/");

Check failure on line 290 in client/src/lib/hooks/useConnection.ts

View workflow job for this annotation

GitHub Actions / build

'_' is assigned a value but never used
const version = packageJson.version;
const clientIdentity = { name, version };

const clientCapabilities = {
capabilities: {
sampling: {},
roots: {
listChanged: true,
},
},
};

const client = new Client<Request, Notification, Result>(
clientIdentity,
clientCapabilities,
);

try {
Expand Down
Loading