import { McpClient } from "./mcp-client.js";
import type { McpServerConfig, McpToolResult } from "./mcp-types.js";
import type { ProjectConfigReader } from "../agent/config-directories.js";
/** Status of an MCP server */
export interface McpServerStatus {
    name: string;
    status: "connected" | "disconnected" | "error";
    toolCount: number;
    error?: string;
    config?: McpServerConfig;
}
/** Bobbit-compatible tool info produced from MCP tool defs */
export interface McpToolInfo {
    name: string;
    description: string;
    group: string;
    docs?: string;
    summary?: string;
    serverName: string;
    mcpToolName: string;
    inputSchema: Record<string, unknown>;
}
export declare class McpManager {
    private cwd;
    private clients;
    private toolDefs;
    private configs;
    private errors;
    /** Maps truncated Bobbit tool names back to original MCP tool names. */
    private _toolNameMap;
    /** In-memory cache: serverName → toolName → summary */
    private _summaryCache;
    private projectConfigStore;
    private additionalProjects;
    private stateDir;
    /** Override-able for tests via constructor opts. */
    private listToolsTimeoutMs;
    private callToolTimeoutMs;
    constructor(cwd: string, projectConfigStore?: ProjectConfigReader, stateDir?: string, opts?: {
        listToolsTimeoutMs?: number;
        callToolTimeoutMs?: number;
    });
    /**
     * Construct a new MCP client. Test seam: subclasses / tests can override this
     * to return a stub without spawning a real subprocess.
     */
    protected _createClient(name: string): McpClient;
    /**
     * Race a promise against a timeout. On timeout, rejects with
     * `<label> timed out after <ms> ms`. Used for per-call failure isolation.
     */
    private _withTimeout;
    /** Register additional project directories for MCP server discovery. */
    setAdditionalProjects(projects: Array<{
        cwd: string;
        configStore: ProjectConfigReader;
    }>): void;
    /**
     * Discover MCP servers from config files.
     * Priority order (later overrides earlier):
     *   0. Custom directories (lowest priority)
     *   1. ~/.claude.json → mcpServers (global)
     *   1b. ~/.claude.json → projects[cwd] → mcpServers (per-project)
     *   2. ~/.claude/.mcp.json → mcpServers
     *   3. ~/.bobbit/.mcp.json → mcpServers
     *   4. .mcp.json in cwd
     *   5. .bobbit/config/mcp.json → mcpServers
     */
    discoverServers(): Record<string, McpServerConfig>;
    /** Read a JSON config file and merge its servers into the target. */
    private _mergeConfigFile;
    /**
     * Read ~/.claude.json → projects → <matching-path> → mcpServers.
     * Claude Code stores per-project MCP config under a "projects" map keyed by
     * the project's absolute path. We match the current cwd against those keys
     * (case-insensitive on Windows, normalized separators).
     */
    private _mergeProjectConfigFromClaudeJson;
    /**
     * Connect to a specific MCP server.
     * Creates a client, performs the initialize handshake, and caches tool definitions.
     */
    connectServer(name: string, config: McpServerConfig): Promise<void>;
    /**
     * Discover all MCP servers and connect to them.
     * Partial failure is tolerated — failed servers are logged and skipped.
     */
    connectAll(): Promise<void>;
    /** Disconnect a specific server and remove its cached state. */
    disconnectServer(name: string): Promise<void>;
    /** Disconnect all connected servers. */
    disconnectAll(): Promise<void>;
    /**
     * Get all MCP tools as Bobbit-compatible tool info objects.
     * Tool names use double-underscore separator: mcp__<server>__<tool>
     */
    getToolInfos(): McpToolInfo[];
    /** Return a compact comma-separated list of parameter names, or empty string. */
    private _getParamNames;
    /** Generate a parameter table from a tool's inputSchema. */
    private _generateToolParamDocs;
    /** Generate a deterministic one-line summary from a tool description. */
    private _generateSummary;
    /**
     * Update the doc cache and MD file for an MCP server's tools.
     * Uses content hashing to skip regeneration when nothing changed.
     */
    private _updateDocCache;
    /** Get status for all known servers (discovered + connected + errored). */
    getServerStatuses(): McpServerStatus[];
    /**
     * Call an MCP tool by its prefixed Bobbit name.
     * Parses the server and tool name from the mcp__<server>__<tool> format.
     */
    callTool(bobbitToolName: string, args: Record<string, unknown>): Promise<McpToolResult>;
    /**
     * Build a Bobbit tool name from server + MCP tool name, truncating if needed.
     * Registers the mapping so _parseToolName can reverse it.
     */
    private _makeBobbitToolName;
    /**
     * Parse a Bobbit MCP tool name back to server + MCP tool name.
     * Uses the lookup map first (handles truncated names), falls back to parsing.
     */
    private _parseToolName;
}
//# sourceMappingURL=mcp-manager.d.ts.map