/**
 * MCP Client Manager for dot-ai MCP Server Integration
 *
 * Connects to external MCP servers running in the cluster, discovers their tools,
 * and makes them available to dot-ai operations (remediate, operate, query) via
 * the attachTo routing mechanism.
 *
 * PRD #358: MCP Server Integration
 * PRD #414: MCP Client Outbound Authentication
 */
import type { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
import type { OAuthClientProvider, OAuthDiscoveryState } from '@modelcontextprotocol/sdk/client/auth.js';
import type { OAuthTokens, OAuthClientMetadata } from '@modelcontextprotocol/sdk/shared/auth.js';
import { McpServerConfig, McpServerAuthConfig, DiscoveredMcpServer, McpServerStats, McpAttachableOperation } from './mcp-client-types';
import { Logger } from './error-handling';
import { AITool, ToolExecutor } from './ai-provider.interface';
/**
 * Minimal OAuthClientProvider that returns a static bearer token.
 *
 * Used when the MCP server expects MCP-spec-compliant auth (authProvider)
 * but the token is a pre-provisioned service account JWT or API key
 * rather than an interactive OAuth flow.
 *
 * PRD #414: MCP Client Outbound Authentication (M1)
 */
export declare class StaticTokenAuthProvider implements OAuthClientProvider {
    private readonly token;
    constructor(token: string);
    get redirectUrl(): undefined;
    get clientMetadata(): OAuthClientMetadata;
    clientInformation(): undefined;
    tokens(): Promise<OAuthTokens>;
    saveTokens(): Promise<void>;
    redirectToAuthorization(): Promise<void>;
    saveCodeVerifier(): Promise<void>;
    codeVerifier(): Promise<string>;
    invalidateCredentials(_scope: 'all' | 'client' | 'tokens' | 'verifier' | 'discovery'): Promise<void>;
    saveDiscoveryState(_state: OAuthDiscoveryState): Promise<void>;
    discoveryState(): Promise<OAuthDiscoveryState | undefined>;
}
/**
 * Resolve transport options (authProvider and/or requestInit) from auth config.
 *
 * Reads token/header values from environment variables (sourced from K8s Secrets).
 * Returns partial options to merge into StreamableHTTPClientTransportOptions.
 *
 * PRD #414: MCP Client Outbound Authentication (M1 + M2 + M4)
 */
export declare function resolveTransportAuth(auth: McpServerAuthConfig | undefined, serverName: string, logger: Logger): Pick<StreamableHTTPClientTransportOptions, 'authProvider' | 'requestInit'>;
/**
 * Manages MCP server connections, tool discovery, and tool routing.
 *
 * Follows the same structural patterns as PluginManager but uses
 * the MCP SDK (Client + StreamableHTTPClientTransport) instead of HTTP REST.
 */
export declare class McpClientManager {
    private readonly logger;
    /** MCP SDK Client instances keyed by server name */
    private readonly clients;
    /** Transport instances keyed by server name (needed for cleanup) */
    private readonly transports;
    /** Discovered server metadata keyed by server name */
    private readonly discoveredServers;
    /** Maps namespaced tool name → server name for routing */
    private readonly toolToServer;
    constructor(logger: Logger);
    /**
     * Parse MCP server configuration from file.
     *
     * Reads from /etc/dot-ai-mcp/mcp-servers.json (mounted from ConfigMap in K8s).
     * Returns empty array if file doesn't exist (MCP servers only work in-cluster).
     * Throws on invalid JSON or malformed configuration.
     */
    static parseMcpServerConfig(): McpServerConfig[];
    /**
     * Discover all configured MCP servers.
     *
     * Connects to each server, performs MCP handshake, and discovers available tools.
     * All servers must connect successfully — any failure throws McpDiscoveryError.
     */
    discoverMcpServers(configs: McpServerConfig[]): Promise<void>;
    /**
     * Connect to a single MCP server and discover its tools.
     */
    private connectAndDiscover;
    /**
     * Get tools available for a specific dot-ai operation, filtered by attachTo.
     *
     * Returns tools as AITool[] with namespaced names ({serverName}__{toolName}).
     */
    getToolsForOperation(operation: McpAttachableOperation): AITool[];
    /**
     * Get all discovered tools across all servers.
     */
    getAllDiscoveredTools(): AITool[];
    /**
     * Check if a tool name belongs to an MCP server (is namespaced).
     */
    isMcpTool(toolName: string): boolean;
    /**
     * Create a ToolExecutor that routes MCP tools to their servers.
     *
     * Returns a function compatible with toolLoop's toolExecutor parameter.
     * MCP tools (namespaced) are routed to their MCP servers; non-MCP tools
     * are routed to the optional fallback executor.
     */
    createToolExecutor(fallbackExecutor?: ToolExecutor): ToolExecutor;
    /**
     * Get statistics about MCP server connections.
     */
    getStats(): McpServerStats;
    /**
     * Get discovered server metadata.
     */
    getDiscoveredServers(): DiscoveredMcpServer[];
    /**
     * Close all MCP server connections.
     */
    close(): Promise<void>;
    /**
     * Convert an MCP tool definition to AITool format with namespaced name.
     */
    private convertToAITool;
}
//# sourceMappingURL=mcp-client-manager.d.ts.map