Skip to content

Commit c2610b6

Browse files
authored
Merge branch 'main' into pcarleton/naming
2 parents df9ea1e + b07f738 commit c2610b6

File tree

8 files changed

+104
-45
lines changed

8 files changed

+104
-45
lines changed

cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector-cli",
3-
"version": "0.12.0",
3+
"version": "0.13.0",
44
"description": "CLI for the Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",
@@ -21,7 +21,7 @@
2121
},
2222
"devDependencies": {},
2323
"dependencies": {
24-
"@modelcontextprotocol/sdk": "^1.11.0",
24+
"@modelcontextprotocol/sdk": "^1.11.5",
2525
"commander": "^13.1.0",
2626
"spawn-rx": "^5.1.2"
2727
}

client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector-client",
3-
"version": "0.12.0",
3+
"version": "0.13.0",
44
"description": "Client-side application for the Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",
@@ -23,7 +23,7 @@
2323
"test:watch": "jest --config jest.config.cjs --watch"
2424
},
2525
"dependencies": {
26-
"@modelcontextprotocol/sdk": "^1.11.0",
26+
"@modelcontextprotocol/sdk": "^1.11.5",
2727
"@radix-ui/react-checkbox": "^1.1.4",
2828
"@radix-ui/react-dialog": "^1.1.3",
2929
"@radix-ui/react-icons": "^1.3.0",

client/src/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ const App = () => {
234234
const onOAuthConnect = useCallback(
235235
(serverUrl: string) => {
236236
setSseUrl(serverUrl);
237-
setTransportType("sse");
238237
setIsAuthDebuggerVisible(false);
239238
void connectMcpServer();
240239
},

client/src/lib/hooks/useConnection.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,16 @@ export function useConnection({
249249
}
250250
};
251251

252+
const is401Error = (error: unknown): boolean => {
253+
return (
254+
(error instanceof SseError && error.code === 401) ||
255+
(error instanceof Error && error.message.includes("401")) ||
256+
(error instanceof Error && error.message.includes("Unauthorized"))
257+
);
258+
};
259+
252260
const handleAuthError = async (error: unknown) => {
253-
if (error instanceof SseError && error.code === 401) {
254-
// Create a new auth provider with the current server URL
261+
if (is401Error(error)) {
255262
const serverAuthProvider = new InspectorOAuthClientProvider(sseUrl);
256263

257264
const result = await auth(serverAuthProvider, { serverUrl: sseUrl });
@@ -330,7 +337,6 @@ export function useConnection({
330337
mcpProxyServerUrl = new URL(`${getMCPProxyAddress(config)}/sse`);
331338
mcpProxyServerUrl.searchParams.append("url", sseUrl);
332339
transportOptions = {
333-
authProvider: serverAuthProvider,
334340
eventSourceInit: {
335341
fetch: (
336342
url: string | URL | globalThis.Request,
@@ -347,7 +353,6 @@ export function useConnection({
347353
mcpProxyServerUrl = new URL(`${getMCPProxyAddress(config)}/mcp`);
348354
mcpProxyServerUrl.searchParams.append("url", sseUrl);
349355
transportOptions = {
350-
authProvider: serverAuthProvider,
351356
eventSourceInit: {
352357
fetch: (
353358
url: string | URL | globalThis.Request,
@@ -425,13 +430,14 @@ export function useConnection({
425430
`Failed to connect to MCP Server via the MCP Inspector Proxy: ${mcpProxyServerUrl}:`,
426431
error,
427432
);
433+
428434
const shouldRetry = await handleAuthError(error);
429435
if (shouldRetry) {
430436
return connect(undefined, retryCount + 1);
431437
}
432-
433-
if (error instanceof SseError && error.code === 401) {
438+
if (is401Error(error)) {
434439
// Don't set error state if we're about to redirect for auth
440+
435441
return;
436442
}
437443
throw error;

package-lock.json

Lines changed: 65 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector",
3-
"version": "0.12.0",
3+
"version": "0.13.0",
44
"description": "Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",
@@ -40,10 +40,10 @@
4040
"publish-all": "npm publish --workspaces --access public && npm publish --access public"
4141
},
4242
"dependencies": {
43-
"@modelcontextprotocol/inspector-cli": "^0.12.0",
44-
"@modelcontextprotocol/inspector-client": "^0.12.0",
45-
"@modelcontextprotocol/inspector-server": "^0.12.0",
46-
"@modelcontextprotocol/sdk": "^1.11.2",
43+
"@modelcontextprotocol/inspector-cli": "^0.13.0",
44+
"@modelcontextprotocol/inspector-client": "^0.13.0",
45+
"@modelcontextprotocol/inspector-server": "^0.13.0",
46+
"@modelcontextprotocol/sdk": "^1.11.5",
4747
"concurrently": "^9.0.1",
4848
"open": "^10.1.0",
4949
"shell-quote": "^1.8.2",

server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/inspector-server",
3-
"version": "0.12.0",
3+
"version": "0.13.0",
44
"description": "Server-side application for the Model Context Protocol inspector",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",
@@ -27,7 +27,7 @@
2727
"typescript": "^5.6.2"
2828
},
2929
"dependencies": {
30-
"@modelcontextprotocol/sdk": "^1.11.0",
30+
"@modelcontextprotocol/sdk": "^1.11.5",
3131
"cors": "^2.8.5",
3232
"express": "^5.1.0",
3333
"ws": "^8.18.0",

server/src/mcpProxy.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
2+
import { isJSONRPCRequest } from "@modelcontextprotocol/sdk/types.js";
23

34
function onClientError(error: Error) {
45
console.error("Error from inspector client:", error);
@@ -19,7 +20,21 @@ export default function mcpProxy({
1920
let transportToServerClosed = false;
2021

2122
transportToClient.onmessage = (message) => {
22-
transportToServer.send(message).catch(onServerError);
23+
transportToServer.send(message).catch((error) => {
24+
// Send error response back to client if it was a request (has id) and connection is still open
25+
if (isJSONRPCRequest(message) && !transportToClientClosed) {
26+
const errorResponse = {
27+
jsonrpc: "2.0" as const,
28+
id: message.id,
29+
error: {
30+
code: -32001,
31+
message: error.message,
32+
data: error,
33+
},
34+
};
35+
transportToClient.send(errorResponse).catch(onClientError);
36+
}
37+
});
2338
};
2439

2540
transportToServer.onmessage = (message) => {

0 commit comments

Comments
 (0)