mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-17 22:24:29 +00:00
chore: generate
This commit is contained in:
@@ -401,7 +401,8 @@ export namespace MCP {
|
|||||||
// but may also throw plain Errors when auth() fails internally
|
// but may also throw plain Errors when auth() fails internally
|
||||||
// (e.g. during discovery, registration, or state generation).
|
// (e.g. during discovery, registration, or state generation).
|
||||||
// When an authProvider is attached, treat both cases as auth-related.
|
// When an authProvider is attached, treat both cases as auth-related.
|
||||||
const isAuthError = error instanceof UnauthorizedError || (authProvider && lastError.message.includes("OAuth"))
|
const isAuthError =
|
||||||
|
error instanceof UnauthorizedError || (authProvider && lastError.message.includes("OAuth"))
|
||||||
if (isAuthError) {
|
if (isAuthError) {
|
||||||
log.info("mcp server requires authentication", { key, transport: name })
|
log.info("mcp server requires authentication", { key, transport: name })
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,13 @@ let simulateAuthFlow = true
|
|||||||
// Mock the transport constructors to simulate OAuth auto-auth on 401
|
// Mock the transport constructors to simulate OAuth auto-auth on 401
|
||||||
mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
mock.module("@modelcontextprotocol/sdk/client/streamableHttp.js", () => ({
|
||||||
StreamableHTTPClientTransport: class MockStreamableHTTP {
|
StreamableHTTPClientTransport: class MockStreamableHTTP {
|
||||||
authProvider: {
|
authProvider:
|
||||||
state?: () => Promise<string>
|
| {
|
||||||
redirectToAuthorization?: (url: URL) => Promise<void>
|
state?: () => Promise<string>
|
||||||
saveCodeVerifier?: (v: string) => Promise<void>
|
redirectToAuthorization?: (url: URL) => Promise<void>
|
||||||
} | undefined
|
saveCodeVerifier?: (v: string) => Promise<void>
|
||||||
|
}
|
||||||
|
| undefined
|
||||||
constructor(url: URL, options?: { authProvider?: unknown }) {
|
constructor(url: URL, options?: { authProvider?: unknown }) {
|
||||||
this.authProvider = options?.authProvider as typeof this.authProvider
|
this.authProvider = options?.authProvider as typeof this.authProvider
|
||||||
transportCalls.push({
|
transportCalls.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user