import { type OAuthFlowOptions, type StoredOAuthToken } from '@jterrats/oauth-pkce'; import { Hono } from 'hono'; export declare function cleanupOAuthFlows(): void; export type StartPkceOAuthFlowOptions = { clientId?: string; port?: number; redirectPath?: string; scope?: string; resource?: string; /** Injectable for tests — defaults to the real network-calling implementation. */ runFlow?: (url: string, options: OAuthFlowOptions) => Promise; }; /** * Starts a PKCE OAuth flow for `serverUrl` and returns immediately with a * promise for the authorization URL (resolved as soon as the flow knows it, * well before the user completes login) and a promise for the final token. */ export declare function startPkceOAuthFlow(serverUrl: string, options?: StartPkceOAuthFlowOptions): { authUrlPromise: Promise; tokenPromise: Promise; }; /** * Extract the authorization URL emitted by the `mcp____authenticate` tool * from a chunk of the CLI's stream-json stdout. The tool result carries a * structured `{ status: "auth_url", authUrl }` payload; we scan each NDJSON line * for that shape and fall back to the first OAuth `authorize` URL we find. * * Pure + tolerant of partial buffers: unparsable lines are skipped. */ export declare function parseAuthUrlFromStreamJson(buffer: string): string | null; /** * Parse the Status line from `claude mcp get ` output. The CLI reports * `Status: ! Needs authentication` for HTTP servers awaiting OAuth and a * connected/healthy status once the token exchange succeeds. Returns true only * when the server is authenticated (i.e. NOT awaiting authentication). * * Pure + tolerant: missing/unknown output is treated as not-authenticated. */ export declare function parseAuthenticatedFromMcpGet(output: string): boolean; export declare function isClaudePluginInstalled(output: string, pluginId: string): boolean; export declare function parseOpenCodeAuthenticated(output: string, id: string): boolean; export declare function mcpRoute(cwd: string): Hono;