@civic/hub-bridge
Version:
Stdio <-> HTTP/SSE MCP bridge with Civic auth handling
39 lines • 1.49 kB
TypeScript
/**
* serviceAuthorization.ts
*
* Handles service authorization flows and job continuation
* as described in section 4.5 of the Civic Hub Bridge spec.
*/
import type { ToolCallResult } from "../types.js";
import type { PassthroughClient } from "@civic/passthrough-mcp-server";
import type { CLIAuthProvider } from "@civic/auth-mcp/client";
/**
* Class to handle the service authorization process
* Instantiated per request flow
*/
export declare class ServiceAuthorizationHandler {
private remoteClient;
private authProvider;
private maxRetries;
private initialWaitMs;
private retryIntervalMs;
/**
* Create a new ServiceAuthorizationHandler
* @param remoteClient The MCP client to use for communication with the remote server
* @param authProvider The auth provider to get tokens from
*/
constructor(remoteClient: PassthroughClient, authProvider: CLIAuthProvider);
/**
* 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: ToolCallResult): Promise<ToolCallResult>;
/**
* 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