format
This commit is contained in:
parent
85ae0ede85
commit
2f6a9fca11
2 changed files with 9 additions and 9 deletions
|
|
@ -252,8 +252,8 @@ export function useConnection({
|
||||||
const handleAuthError = async (error: unknown) => {
|
const handleAuthError = async (error: unknown) => {
|
||||||
const is401Error =
|
const is401Error =
|
||||||
(error instanceof SseError && error.code === 401) ||
|
(error instanceof SseError && error.code === 401) ||
|
||||||
(error instanceof Error && error.message.includes('401')) ||
|
(error instanceof Error && error.message.includes("401")) ||
|
||||||
(error instanceof Error && error.message.includes('Unauthorized'));
|
(error instanceof Error && error.message.includes("Unauthorized"));
|
||||||
|
|
||||||
if (is401Error) {
|
if (is401Error) {
|
||||||
const serverAuthProvider = new InspectorOAuthClientProvider(sseUrl);
|
const serverAuthProvider = new InspectorOAuthClientProvider(sseUrl);
|
||||||
|
|
@ -377,9 +377,9 @@ export function useConnection({
|
||||||
const clientTransport =
|
const clientTransport =
|
||||||
transportType === "streamable-http"
|
transportType === "streamable-http"
|
||||||
? new StreamableHTTPClientTransport(mcpProxyServerUrl as URL, {
|
? new StreamableHTTPClientTransport(mcpProxyServerUrl as URL, {
|
||||||
sessionId: undefined,
|
sessionId: undefined,
|
||||||
...transportOptions,
|
...transportOptions,
|
||||||
})
|
})
|
||||||
: new SSEClientTransport(mcpProxyServerUrl as URL, transportOptions);
|
: new SSEClientTransport(mcpProxyServerUrl as URL, transportOptions);
|
||||||
|
|
||||||
if (onNotification) {
|
if (onNotification) {
|
||||||
|
|
@ -434,8 +434,8 @@ export function useConnection({
|
||||||
}
|
}
|
||||||
const is401Error =
|
const is401Error =
|
||||||
(error instanceof SseError && error.code === 401) ||
|
(error instanceof SseError && error.code === 401) ||
|
||||||
(error instanceof Error && error.message.includes('401')) ||
|
(error instanceof Error && error.message.includes("401")) ||
|
||||||
(error instanceof Error && error.message.includes('Unauthorized'));
|
(error instanceof Error && error.message.includes("Unauthorized"));
|
||||||
|
|
||||||
if (is401Error) {
|
if (is401Error) {
|
||||||
// Don't set error state if we're about to redirect for auth
|
// Don't set error state if we're about to redirect for auth
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ export default function mcpProxy({
|
||||||
error: {
|
error: {
|
||||||
code: -32001,
|
code: -32001,
|
||||||
message: error.message,
|
message: error.message,
|
||||||
data: error
|
data: error,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
transportToClient.send(errorResponse).catch(onClientError);
|
transportToClient.send(errorResponse).catch(onClientError);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue