refactor: remove resource config
This commit is contained in:
parent
b8120d9f85
commit
3b3205228f
2 changed files with 4 additions and 52 deletions
|
|
@ -66,10 +66,8 @@ export const clearClientInformationFromSessionStorage = ({
|
|||
};
|
||||
|
||||
export class InspectorOAuthClientProvider implements OAuthClientProvider {
|
||||
constructor(
|
||||
protected serverUrl: string,
|
||||
protected resource?: string,
|
||||
) {
|
||||
|
||||
constructor(protected serverUrl: string) {
|
||||
// Save the server URL to session storage
|
||||
sessionStorage.setItem(SESSION_KEYS.SERVER_URL, serverUrl);
|
||||
}
|
||||
|
|
@ -131,18 +129,6 @@ export class InspectorOAuthClientProvider implements OAuthClientProvider {
|
|||
}
|
||||
|
||||
redirectToAuthorization(authorizationUrl: URL) {
|
||||
/**
|
||||
* Note: This resource parameter is for testing purposes in Inspector.
|
||||
* Once MCP Client SDK supports resource indicators, this parameter
|
||||
* will be passed to the SDK's auth method similar to how scope is passed.
|
||||
*
|
||||
* See: https://github.com/modelcontextprotocol/typescript-sdk/pull/498
|
||||
*
|
||||
* TODO: @xiaoyijun Remove this once MCP Client SDK supports resource indicators.
|
||||
*/
|
||||
if (this.resource) {
|
||||
authorizationUrl.searchParams.set("resource", this.resource);
|
||||
}
|
||||
window.location.href = authorizationUrl.href;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ interface UseConnectionOptions {
|
|||
headerName?: string;
|
||||
oauthClientId?: string;
|
||||
oauthScope?: string;
|
||||
oauthResource?: string;
|
||||
config: InspectorConfig;
|
||||
onNotification?: (notification: Notification) => void;
|
||||
onStdErrNotification?: (notification: Notification) => void;
|
||||
|
|
@ -78,7 +77,6 @@ export function useConnection({
|
|||
headerName,
|
||||
oauthClientId,
|
||||
oauthScope,
|
||||
oauthResource,
|
||||
config,
|
||||
onNotification,
|
||||
onStdErrNotification,
|
||||
|
|
@ -301,7 +299,6 @@ export function useConnection({
|
|||
if (is401Error(error)) {
|
||||
const serverAuthProvider = new InspectorOAuthClientProvider(
|
||||
sseUrl,
|
||||
oauthResource,
|
||||
);
|
||||
|
||||
const result = await auth(serverAuthProvider, {
|
||||
|
|
@ -343,10 +340,7 @@ export function useConnection({
|
|||
const headers: HeadersInit = {};
|
||||
|
||||
// Create an auth provider with the current server URL
|
||||
const serverAuthProvider = new InspectorOAuthClientProvider(
|
||||
sseUrl,
|
||||
oauthResource,
|
||||
);
|
||||
const serverAuthProvider = new InspectorOAuthClientProvider(sseUrl);
|
||||
|
||||
// Use manually provided bearer token if available, otherwise use OAuth tokens
|
||||
const token =
|
||||
|
|
@ -566,10 +560,7 @@ export function useConnection({
|
|||
clientTransport as StreamableHTTPClientTransport
|
||||
).terminateSession();
|
||||
await mcpClient?.close();
|
||||
const authProvider = new InspectorOAuthClientProvider(
|
||||
sseUrl,
|
||||
oauthResource,
|
||||
);
|
||||
const authProvider = new InspectorOAuthClientProvider(sseUrl);
|
||||
authProvider.clear();
|
||||
setMcpClient(null);
|
||||
setClientTransport(null);
|
||||
|
|
|
|||
Loading…
Reference in a new issue