UNPKG

@civic/hub-bridge

Version:

Stdio <-> HTTP/SSE MCP bridge with Civic auth handling

39 lines 1.41 kB
/** * serviceAuthorization.ts * * Handles service authorization flows and job continuation * as described in section 4.5 of the Civic Hub Bridge spec. */ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; /** * Callback function type for continuing a job */ export type ContinueJobCallback = (jobId: string) => Promise<CallToolResult>; /** * Class to handle the service authorization process * Instantiated per request flow */ export declare class ServiceAuthorizationHandler { private continueJobCallback; private maxRetries; private initialWaitMs; private retryIntervalMs; /** * Create a new ServiceAuthorizationHandler * @param continueJobCallback Callback function to call continue_job with a jobId */ constructor(continueJobCallback: ContinueJobCallback); /** * Main method to handle service authorization - assumes auth is already detected * @param response The MCPResponse that requires authorization * @returns The final response after auth flow completion */ handleServiceAuthorization(response: CallToolResult): Promise<CallToolResult>; /** * Poll the server to check if authorization is complete * @param jobId The job ID to continue * @returns The final MCPResponse from the server */ private pollForCompletion; } //# sourceMappingURL=service-authorization.d.ts.map