@civic/hub-bridge
Version:
Stdio <-> HTTP/SSE MCP bridge with Civic auth handling
34 lines • 1.65 kB
TypeScript
import { AbstractHook, type CallToolRequestWithContext, type RequestExtra } from "@civic/hook-common";
import { type ContinueJobCallback } from "../auth/service-authorization.js";
import type { CLIAuthProvider } from "@civic/auth-mcp/client";
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
import type { CallToolResponseHookResult } from "@civic/hook-common";
/**
* AuthenticationHook listens for special authentication messages and triggers
* authentication flows when needed.
*
* This hook processes incoming tool calls and responses to detect when
* authentication is required and handles the authentication flow.
*/
export declare class AuthenticationHook extends AbstractHook {
private readonly authProvider;
private continueJobCallback;
constructor(authProvider: CLIAuthProvider);
/**
* Set the callback for continuing jobs. This should be called after the proxy
* is created but before any authentication flows are triggered.
* @param callback The callback function to use for continuing jobs
*/
setContinueJobCallback(callback: ContinueJobCallback): void;
get name(): string;
/**
* Check if a response is an authorization required response
*/
private isAuthorizationRequiredResponse;
/**
* Detect if a response contains service authorization flow information
*/
private detectServiceAuthorizationFlow;
processCallToolResult(result: CallToolResult, _originalCallToolRequest: CallToolRequestWithContext, _originalRequestExtra: RequestExtra): Promise<CallToolResponseHookResult>;
}
//# sourceMappingURL=authentication-hook.d.ts.map