Skip to content

Commit be65a8d

Browse files
Merge branch 'main' into fixWrongRoleValue
2 parents 1b0d235 + b025bff commit be65a8d

27 files changed

+2275
-712
lines changed

cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector-cli",
3-
"version": "0.16.7",
3+
"version": "0.17.0",
44
"description": "CLI for the Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",

cli/src/index.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env node
22

3+
import * as fs from "fs";
34
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
45
import { Command } from "commander";
56
import {
@@ -99,16 +100,27 @@ function createTransportOptions(
99100
}
100101

101102
async 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+
102112
const transportOptions = createTransportOptions(
103113
args.target,
104114
args.transport,
105115
args.headers,
106116
);
107117
const transport = createTransport(transportOptions);
108-
const client = new Client({
109-
name: "inspector-cli",
110-
version: "0.5.1",
111-
});
118+
119+
const [, name = packageJson.name] = packageJson.name.split("/");
120+
const version = packageJson.version;
121+
const clientIdentity = { name, version };
122+
123+
const client = new Client(clientIdentity);
112124

113125
try {
114126
await connect(client, transport);

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector-client",
3-
"version": "0.16.7",
3+
"version": "0.17.0",
44
"description": "Client-side application for the Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",

client/src/App.tsx

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import { SESSION_KEYS, getServerSpecificKey } from "./lib/constants";
2222
import { AuthDebuggerState, EMPTY_DEBUGGER_STATE } from "./lib/auth-types";
2323
import { OAuthStateMachine } from "./lib/oauth-state-machine";
2424
import { cacheToolOutputSchemas } from "./utils/schemaUtils";
25+
import { cleanParams } from "./utils/paramUtils";
26+
import type { JsonSchemaType } from "./utils/jsonUtils";
2527
import React, {
2628
Suspense,
2729
useCallback,
@@ -107,6 +109,14 @@ const App = () => {
107109
const [transportType, setTransportType] = useState<
108110
"stdio" | "sse" | "streamable-http"
109111
>(getInitialTransportType);
112+
const [connectionType, setConnectionType] = useState<"direct" | "proxy">(
113+
() => {
114+
return (
115+
(localStorage.getItem("lastConnectionType") as "direct" | "proxy") ||
116+
"proxy"
117+
);
118+
},
119+
);
110120
const [logLevel, setLogLevel] = useState<LoggingLevel>("debug");
111121
const [notifications, setNotifications] = useState<ServerNotification[]>([]);
112122
const [roots, setRoots] = useState<Root[]>([]);
@@ -154,12 +164,12 @@ const App = () => {
154164
return migrateFromLegacyAuth(legacyToken, legacyHeaderName);
155165
}
156166

157-
// Default to Authorization: Bearer as the most common case
167+
// Default to empty array
158168
return [
159169
{
160170
name: "Authorization",
161171
value: "Bearer ",
162-
enabled: true,
172+
enabled: false,
163173
},
164174
];
165175
});
@@ -254,6 +264,7 @@ const App = () => {
254264
oauthClientId,
255265
oauthScope,
256266
config,
267+
connectionType,
257268
onNotification: (notification) => {
258269
setNotifications((prev) => [...prev, notification as ServerNotification]);
259270
},
@@ -338,6 +349,10 @@ const App = () => {
338349
localStorage.setItem("lastTransportType", transportType);
339350
}, [transportType]);
340351

352+
useEffect(() => {
353+
localStorage.setItem("lastConnectionType", connectionType);
354+
}, [connectionType]);
355+
341356
useEffect(() => {
342357
if (bearerToken) {
343358
localStorage.setItem("lastBearerToken", bearerToken);
@@ -764,12 +779,18 @@ const App = () => {
764779
lastToolCallOriginTabRef.current = currentTabRef.current;
765780

766781
try {
782+
// Find the tool schema to clean parameters properly
783+
const tool = tools.find((t) => t.name === name);
784+
const cleanedParams = tool?.inputSchema
785+
? cleanParams(params, tool.inputSchema as JsonSchemaType)
786+
: params;
787+
767788
const response = await sendMCPRequest(
768789
{
769790
method: "tools/call" as const,
770791
params: {
771792
name,
772-
arguments: params,
793+
arguments: cleanedParams,
773794
_meta: {
774795
progressToken: progressTokenRef.current++,
775796
},
@@ -780,6 +801,8 @@ const App = () => {
780801
);
781802

782803
setToolResult(response);
804+
// Clear any validation errors since tool execution completed
805+
setErrors((prev) => ({ ...prev, tools: null }));
783806
} catch (e) {
784807
const toolResult: CompatibilityCallToolResult = {
785808
content: [
@@ -791,6 +814,8 @@ const App = () => {
791814
isError: true,
792815
};
793816
setToolResult(toolResult);
817+
// Clear validation errors - tool execution errors are shown in ToolResults
818+
setErrors((prev) => ({ ...prev, tools: null }));
794819
}
795820
};
796821

@@ -882,6 +907,8 @@ const App = () => {
882907
logLevel={logLevel}
883908
sendLogLevelRequest={sendLogLevelRequest}
884909
loggingSupported={!!serverCapabilities?.logging || false}
910+
connectionType={connectionType}
911+
setConnectionType={setConnectionType}
885912
/>
886913
<div
887914
onMouseDown={handleSidebarDragStart}

0 commit comments

Comments
 (0)