/**
 * MCP HTTP Server — exposes Jait's tool registry as MCP-compatible endpoints.
 *
 * Modern clients such as recent Codex builds expect Streamable HTTP at a
 * single `/mcp` endpoint. Older clients may still use the deprecated split
 * HTTP+SSE transport (`/mcp/sse` + `/mcp/messages`), so we keep both.
 */
import type { FastifyInstance } from "fastify";
import type { AppConfig } from "../config.js";
import type { SessionService } from "../services/sessions.js";
import type { SessionStateService } from "../services/session-state.js";
import type { UserService } from "../services/users.js";
import type { ToolRegistry } from "../tools/registry.js";
import type { ToolContext, ToolDefinition, ToolResult } from "../tools/contracts.js";
import type { ThreadService } from "../services/threads.js";
import type { WsControlPlane } from "../ws.js";
interface McpDeps {
    toolRegistry: ToolRegistry;
    config: AppConfig;
    sessionService?: SessionService;
    userService?: UserService;
    sessionState?: SessionStateService;
    threadService?: ThreadService;
    ws?: WsControlPlane;
}
interface McpRequest {
    jsonrpc: "2.0";
    id?: number | string;
    method: string;
    params?: Record<string, unknown>;
}
interface McpResponse {
    jsonrpc: "2.0";
    id: number | string | null;
    result?: unknown;
    error?: {
        code: number;
        message: string;
        data?: unknown;
    };
}
interface McpToolContextOverrides {
    sessionId?: string;
    projectRoot?: string;
    userId?: string;
    providerId?: string;
    model?: string;
    runtimeMode?: string;
}
interface McpBaseUrlRequestLike {
    headers: Record<string, unknown>;
    protocol?: string;
    hostname?: string;
}
export declare function resolveMcpBaseUrl(request: McpBaseUrlRequestLike, config: Pick<AppConfig, "host" | "port">): string;
export declare function listToolsForMcp(toolRegistry: ToolRegistry): ToolDefinition[];
export declare function registerMcpRoutes(app: FastifyInstance, deps: McpDeps): void;
export type McpToolExecutedCallback = (toolName: string, result: ToolResult, context: ToolContext) => void;
export declare function handleMcpRequest(request: McpRequest, toolRegistry: ToolRegistry, protocolVersion?: string, contextOverrides?: McpToolContextOverrides, onToolExecuted?: McpToolExecutedCallback): Promise<McpResponse>;
export {};
//# sourceMappingURL=mcp-server.d.ts.map