Skip to content

Commit 3b32052

Browse files
committed
refactor: remove resource config
1 parent b8120d9 commit 3b32052

File tree

5 files changed

+4
-52
lines changed

5 files changed

+4
-52
lines changed

client/src/App.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@ const App = () => {
124124
return localStorage.getItem("lastOauthScope") || "";
125125
});
126126

127-
const [oauthResource, setOauthResource] = useState<string>(() => {
128-
return localStorage.getItem("lastOauthResource") || "";
129-
});
130-
131127
const [pendingSampleRequests, setPendingSampleRequests] = useState<
132128
Array<
133129
PendingRequest & {
@@ -198,7 +194,6 @@ const App = () => {
198194
headerName,
199195
oauthClientId,
200196
oauthScope,
201-
oauthResource,
202197
config,
203198
onNotification: (notification) => {
204199
setNotifications((prev) => [...prev, notification as ServerNotification]);
@@ -250,10 +245,6 @@ const App = () => {
250245
localStorage.setItem("lastOauthScope", oauthScope);
251246
}, [oauthScope]);
252247

253-
useEffect(() => {
254-
localStorage.setItem("lastOauthResource", oauthResource);
255-
}, [oauthResource]);
256-
257248
useEffect(() => {
258249
saveInspectorConfig(CONFIG_LOCAL_STORAGE_KEY, config);
259250
}, [config]);
@@ -681,8 +672,6 @@ const App = () => {
681672
setOauthClientId={setOauthClientId}
682673
oauthScope={oauthScope}
683674
setOauthScope={setOauthScope}
684-
oauthResource={oauthResource}
685-
setOauthResource={setOauthResource}
686675
onConnect={connectMcpServer}
687676
onDisconnect={disconnectMcpServer}
688677
stdErrNotifications={stdErrNotifications}

client/src/components/Sidebar.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ interface SidebarProps {
6060
setOauthClientId: (id: string) => void;
6161
oauthScope: string;
6262
setOauthScope: (scope: string) => void;
63-
oauthResource: string;
64-
setOauthResource: (resource: string) => void;
6563
onConnect: () => void;
6664
onDisconnect: () => void;
6765
stdErrNotifications: StdErrNotification[];
@@ -93,8 +91,6 @@ const Sidebar = ({
9391
setOauthClientId,
9492
oauthScope,
9593
setOauthScope,
96-
oauthResource,
97-
setOauthResource,
9894
onConnect,
9995
onDisconnect,
10096
stdErrNotifications,
@@ -409,14 +405,6 @@ const Sidebar = ({
409405
data-testid="oauth-scope-input"
410406
className="font-mono"
411407
/>
412-
<label className="text-sm font-medium">Resource</label>
413-
<Input
414-
placeholder="Resource"
415-
onChange={(e) => setOauthResource(e.target.value)}
416-
value={oauthResource}
417-
data-testid="oauth-resource-input"
418-
className="font-mono"
419-
/>
420408
</div>
421409
)}
422410
</div>

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ describe("Sidebar Environment Variables", () => {
4646
setOauthClientId: jest.fn(),
4747
oauthScope: "",
4848
setOauthScope: jest.fn(),
49-
oauthResource: "",
50-
setOauthResource: jest.fn(),
5149
env: {},
5250
setEnv: jest.fn(),
5351
bearerToken: "",

client/src/lib/auth.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ export const clearClientInformationFromSessionStorage = ({
6666
};
6767

6868
export class InspectorOAuthClientProvider implements OAuthClientProvider {
69-
constructor(
70-
protected serverUrl: string,
71-
protected resource?: string,
72-
) {
69+
70+
constructor(protected serverUrl: string) {
7371
// Save the server URL to session storage
7472
sessionStorage.setItem(SESSION_KEYS.SERVER_URL, serverUrl);
7573
}
@@ -131,18 +129,6 @@ export class InspectorOAuthClientProvider implements OAuthClientProvider {
131129
}
132130

133131
redirectToAuthorization(authorizationUrl: URL) {
134-
/**
135-
* Note: This resource parameter is for testing purposes in Inspector.
136-
* Once MCP Client SDK supports resource indicators, this parameter
137-
* will be passed to the SDK's auth method similar to how scope is passed.
138-
*
139-
* See: https://github.com/modelcontextprotocol/typescript-sdk/pull/498
140-
*
141-
* TODO: @xiaoyijun Remove this once MCP Client SDK supports resource indicators.
142-
*/
143-
if (this.resource) {
144-
authorizationUrl.searchParams.set("resource", this.resource);
145-
}
146132
window.location.href = authorizationUrl.href;
147133
}
148134

client/src/lib/hooks/useConnection.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ interface UseConnectionOptions {
5858
headerName?: string;
5959
oauthClientId?: string;
6060
oauthScope?: string;
61-
oauthResource?: string;
6261
config: InspectorConfig;
6362
onNotification?: (notification: Notification) => void;
6463
onStdErrNotification?: (notification: Notification) => void;
@@ -78,7 +77,6 @@ export function useConnection({
7877
headerName,
7978
oauthClientId,
8079
oauthScope,
81-
oauthResource,
8280
config,
8381
onNotification,
8482
onStdErrNotification,
@@ -301,7 +299,6 @@ export function useConnection({
301299
if (is401Error(error)) {
302300
const serverAuthProvider = new InspectorOAuthClientProvider(
303301
sseUrl,
304-
oauthResource,
305302
);
306303

307304
const result = await auth(serverAuthProvider, {
@@ -343,10 +340,7 @@ export function useConnection({
343340
const headers: HeadersInit = {};
344341

345342
// Create an auth provider with the current server URL
346-
const serverAuthProvider = new InspectorOAuthClientProvider(
347-
sseUrl,
348-
oauthResource,
349-
);
343+
const serverAuthProvider = new InspectorOAuthClientProvider(sseUrl);
350344

351345
// Use manually provided bearer token if available, otherwise use OAuth tokens
352346
const token =
@@ -566,10 +560,7 @@ export function useConnection({
566560
clientTransport as StreamableHTTPClientTransport
567561
).terminateSession();
568562
await mcpClient?.close();
569-
const authProvider = new InspectorOAuthClientProvider(
570-
sseUrl,
571-
oauthResource,
572-
);
563+
const authProvider = new InspectorOAuthClientProvider(sseUrl);
573564
authProvider.clear();
574565
setMcpClient(null);
575566
setClientTransport(null);

0 commit comments

Comments
 (0)