import type { OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js"; import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; import type { FetchLike } from "@modelcontextprotocol/sdk/shared/transport.js"; import { type OAuthServerCloseInfo, type OAuthServerListeningInfo } from "../../auth/server"; import type { McpServerRegistration } from "./types"; export type McpSdkAuthCapableTransport = SSEClientTransport | StreamableHTTPClientTransport; export interface CreateMcpOAuthProviderContextOptions { settingsPath?: string; serverName: string; redirectUrl: string; onAuthorizationUrl?: (url: string) => void | Promise; } export interface McpOAuthProviderContext { provider: OAuthClientProvider; getLastAuthorizationUrl(): string | undefined; getLastOAuthState(): string | undefined; resetInteractiveState(): Promise; markError(errorMessage: string): Promise; clearError(): Promise; } export interface AuthorizeMcpServerOAuthOptions { serverName: string; filePath?: string; clientName?: string; clientVersion?: string; fetch?: FetchLike; openUrl?: (url: string) => void | Promise; callbackHost?: string; callbackPorts?: number[]; callbackPath?: string; timeoutMs?: number; successHtml?: string; onServerListening?: (info: OAuthServerListeningInfo) => void | Promise; onServerClose?: (info: OAuthServerCloseInfo) => void | Promise; } export interface AuthorizeMcpServerOAuthResult { serverName: string; authorized: true; message: string; } export declare function createMcpOAuthProviderContext(options: CreateMcpOAuthProviderContextOptions): McpOAuthProviderContext; export declare function createMcpSdkTransport(input: { registration: McpServerRegistration; oauthProvider?: OAuthClientProvider; fetch?: FetchLike; }): McpSdkAuthCapableTransport; export declare function authorizeMcpServerOAuth(options: AuthorizeMcpServerOAuthOptions): Promise;