Skip to content

Commit 5bc0eed

Browse files
Merge pull request #504 from modelcontextprotocol/jerome/fix/linting
Fixing linting issues from previous bug fix
2 parents 50df0e1 + b08827d commit 5bc0eed

File tree

7 files changed

+304
-257
lines changed

7 files changed

+304
-257
lines changed

.git-blame-ignore-revs

Whitespace-only changes.

client/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,9 @@ const App = () => {
349349
const headers: HeadersInit = {};
350350
const proxyAuthToken = getMCPProxyAuthToken(config);
351351
if (proxyAuthToken) {
352-
headers['Authorization'] = `Bearer ${proxyAuthToken}`;
352+
headers["Authorization"] = `Bearer ${proxyAuthToken}`;
353353
}
354-
354+
355355
fetch(`${getMCPProxyAddress(config)}/config`, { headers })
356356
.then((response) => response.json())
357357
.then((data) => {

client/src/components/__tests__/AuthDebugger.test.tsx

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ Object.defineProperty(window, "sessionStorage", {
8484
value: sessionStorageMock,
8585
});
8686

87-
Object.defineProperty(window, "location", {
88-
value: {
89-
origin: "http://localhost:3000",
90-
},
91-
});
92-
9387
describe("AuthDebugger", () => {
9488
const defaultAuthState = EMPTY_DEBUGGER_STATE;
9589

@@ -104,7 +98,7 @@ describe("AuthDebugger", () => {
10498
jest.clearAllMocks();
10599
sessionStorageMock.getItem.mockReturnValue(null);
106100

107-
// Supress
101+
// Suppress console errors in tests to avoid JSDOM navigation noise
108102
jest.spyOn(console, "error").mockImplementation(() => {});
109103

110104
mockDiscoverOAuthMetadata.mockResolvedValue(mockOAuthMetadata);
@@ -447,18 +441,6 @@ describe("AuthDebugger", () => {
447441
it("should store auth state to sessionStorage before redirect in Quick OAuth Flow", async () => {
448442
const updateAuthState = jest.fn();
449443

450-
// Mock window.location.href setter
451-
const originalLocation = window.location;
452-
const locationMock = {
453-
...originalLocation,
454-
href: "",
455-
origin: "http://localhost:3000",
456-
};
457-
Object.defineProperty(window, "location", {
458-
writable: true,
459-
value: locationMock,
460-
});
461-
462444
// Setup mocks for OAuth flow
463445
mockStartAuthorization.mockResolvedValue({
464446
authorizationUrl: new URL(

client/src/components/__tests__/Sidebar.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ describe("Sidebar Environment Variables", () => {
519519
label: "Request Timeout",
520520
description: "Timeout for requests to the MCP server (ms)",
521521
value: 5000,
522+
is_session_item: false,
522523
},
523524
}),
524525
);
@@ -544,6 +545,7 @@ describe("Sidebar Environment Variables", () => {
544545
description:
545546
"Set this if you are running the MCP Inspector Proxy on a non-default address. Example: http://10.1.1.22:5577",
546547
value: "http://localhost:8080",
548+
is_session_item: false,
547549
},
548550
}),
549551
);
@@ -569,6 +571,7 @@ describe("Sidebar Environment Variables", () => {
569571
description:
570572
"Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications)",
571573
value: 10000,
574+
is_session_item: false,
572575
},
573576
}),
574577
);
@@ -591,6 +594,7 @@ describe("Sidebar Environment Variables", () => {
591594
label: "Request Timeout",
592595
description: "Timeout for requests to the MCP server (ms)",
593596
value: 0,
597+
is_session_item: false,
594598
},
595599
}),
596600
);
@@ -637,6 +641,7 @@ describe("Sidebar Environment Variables", () => {
637641
label: "Request Timeout",
638642
description: "Timeout for requests to the MCP server (ms)",
639643
value: 3000,
644+
is_session_item: false,
640645
},
641646
}),
642647
);

client/src/lib/hooks/useConnection.ts

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export function useConnection({
246246
const proxyAuthToken = getMCPProxyAuthToken(config);
247247
const headers: HeadersInit = {};
248248
if (proxyAuthToken) {
249-
headers['Authorization'] = `Bearer ${proxyAuthToken}`;
249+
headers["Authorization"] = `Bearer ${proxyAuthToken}`;
250250
}
251251
const proxyHealthResponse = await fetch(proxyHealthUrl, { headers });
252252
const proxyHealth = await proxyHealthResponse.json();
@@ -269,7 +269,7 @@ export function useConnection({
269269

270270
const isProxyAuthError = (error: unknown): boolean => {
271271
return (
272-
error instanceof Error &&
272+
error instanceof Error &&
273273
error.message.includes("Authentication required. Use the session token")
274274
);
275275
};
@@ -335,7 +335,7 @@ export function useConnection({
335335
const proxyAuthToken = getMCPProxyAuthToken(config);
336336
const proxyHeaders: HeadersInit = {};
337337
if (proxyAuthToken) {
338-
proxyHeaders['Authorization'] = `Bearer ${proxyAuthToken}`;
338+
proxyHeaders["Authorization"] = `Bearer ${proxyAuthToken}`;
339339
}
340340

341341
// Create appropriate transport
@@ -356,7 +356,11 @@ export function useConnection({
356356
fetch: (
357357
url: string | URL | globalThis.Request,
358358
init: RequestInit | undefined,
359-
) => fetch(url, { ...init, headers: { ...headers, ...proxyHeaders } }),
359+
) =>
360+
fetch(url, {
361+
...init,
362+
headers: { ...headers, ...proxyHeaders },
363+
}),
360364
},
361365
requestInit: {
362366
headers: { ...headers, ...proxyHeaders },
@@ -372,7 +376,11 @@ export function useConnection({
372376
fetch: (
373377
url: string | URL | globalThis.Request,
374378
init: RequestInit | undefined,
375-
) => fetch(url, { ...init, headers: { ...headers, ...proxyHeaders } }),
379+
) =>
380+
fetch(url, {
381+
...init,
382+
headers: { ...headers, ...proxyHeaders },
383+
}),
376384
},
377385
requestInit: {
378386
headers: { ...headers, ...proxyHeaders },
@@ -388,7 +396,11 @@ export function useConnection({
388396
fetch: (
389397
url: string | URL | globalThis.Request,
390398
init: RequestInit | undefined,
391-
) => fetch(url, { ...init, headers: { ...headers, ...proxyHeaders } }),
399+
) =>
400+
fetch(url, {
401+
...init,
402+
headers: { ...headers, ...proxyHeaders },
403+
}),
392404
},
393405
requestInit: {
394406
headers: { ...headers, ...proxyHeaders },
@@ -471,7 +483,8 @@ export function useConnection({
471483
if (isProxyAuthError(error)) {
472484
toast({
473485
title: "Proxy Authentication Required",
474-
description: "Please enter the session token from the proxy server console in the Configuration settings.",
486+
description:
487+
"Please enter the session token from the proxy server console in the Configuration settings.",
475488
variant: "destructive",
476489
});
477490
setConnectionStatus("error");

package-lock.json

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

0 commit comments

Comments
 (0)