Skip to content

Commit fb5bd5a

Browse files
Consistent MCP Client() name from package
Make both clients use name from package.json for consistency and protocol clarity - web client changes `mcp-inspector` -> `inspector-client` (package.json) - cli client remains `inspector-cli` (package.json)
1 parent 9ddada1 commit fb5bd5a

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

cli/src/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@ function createTransportOptions(
8989
async function callMethod(args: Args): Promise<void> {
9090
const transportOptions = createTransportOptions(args.target, args.transport);
9191
const transport = createTransport(transportOptions);
92-
const client = new Client({
93-
name: "inspector-cli",
94-
version: packageJson.version,
95-
});
92+
93+
const [_, name = packageJson.name] = packageJson.name.split("/");
94+
const version = packageJson.version;
95+
const clientIdentity = { name, version };
96+
97+
const client = new Client(clientIdentity);
9698

9799
try {
98100
await connect(client, transport);

client/src/lib/hooks/useConnection.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -328,20 +328,23 @@ export function useConnection({
328328
};
329329

330330
const connect = async (_e?: unknown, retryCount: number = 0) => {
331-
const client = new Client<Request, Notification, Result>(
332-
{
333-
name: "mcp-inspector",
334-
version: packageJson.version,
335-
},
336-
{
337-
capabilities: {
338-
sampling: {},
339-
elicitation: {},
340-
roots: {
341-
listChanged: true,
342-
},
331+
const [, name = packageJson.name] = packageJson.name.split("/");
332+
const version = packageJson.version;
333+
const clientIdentity = { name, version };
334+
335+
const clientCapabilities = {
336+
capabilities: {
337+
sampling: {},
338+
elicitation: {},
339+
roots: {
340+
listChanged: true,
343341
},
344342
},
343+
};
344+
345+
const client = new Client<Request, Notification, Result>(
346+
clientIdentity,
347+
clientCapabilities,
345348
);
346349

347350
try {

0 commit comments

Comments
 (0)