import type { BasicLogger } from "@cline/shared"; import type { McpManager, McpServerOAuthState, McpServerOAuthStatus, McpServerRegistration } from "./types"; export interface McpSettingsFile { mcpServers: Record>; } export interface LoadMcpSettingsOptions { filePath?: string; } export interface RegisterMcpServersFromSettingsOptions { filePath?: string; } export interface SetMcpServerDisabledOptions { filePath?: string; name: string; disabled: boolean; } export interface McpSettingsLockOptions { /** Maximum time to wait for the lock before failing. Defaults to 10 seconds. */ timeoutMs?: number; /** Optional host logger; stale-lock takeover is logged as severity=warn. */ logger?: BasicLogger; } export type McpSettingsMutator = (settings: Record) => T; export declare class McpSettingsUpdateSkippedError extends Error { constructor(message: string); } export declare class McpSettingsLockTimeoutError extends Error { constructor(message: string); } export declare class McpSettingsMutatorPurityError extends Error { constructor(message: string); } export declare function resolveDefaultMcpSettingsPath(): string; /** * Locked MCP settings read-modify-write that blocks the event loop (via * `Atomics.wait`) while acquiring the lock. * * Prefer {@link updateMcpSettingsFile}: async acquisition keeps the event loop * free and behaves identically otherwise. * * TODO: Delete once all callers migrate to {@link updateMcpSettingsFile}. * * The mutator is synchronous and may be called more than once with the same * input to verify it is pure/deterministic. Compute any I/O, logging, network, * timestamp, or random values before calling and close over them. Return a value * only for a successful update; throw McpSettingsUpdateSkippedError to skip. */ export declare function updateMcpSettingsFileSync(filePath: string, mutator: McpSettingsMutator, options?: McpSettingsLockOptions): T; /** * Locked MCP settings read-modify-write that yields the event loop while * acquiring the lock, so concurrent work on the same loop keeps running. * * The mutator is synchronous and may be called more than once with the same * input to verify it is pure/deterministic. Compute any I/O, logging, network, * timestamp, or random values before calling and close over them. The lock is * held only across the synchronous mutation, never across an `await`. Return a * value only for a successful update; throw McpSettingsUpdateSkippedError to skip. */ export declare function updateMcpSettingsFile(filePath: string, mutator: McpSettingsMutator, options?: McpSettingsLockOptions): Promise; export declare function loadMcpSettingsFile(options?: LoadMcpSettingsOptions): McpSettingsFile; export declare function normalizeMcpServerOAuthState(value: McpServerOAuthState | undefined): McpServerOAuthState | undefined; export declare function hasMcpSettingsFile(options?: LoadMcpSettingsOptions): boolean; export declare function resolveMcpServerRegistrations(options?: LoadMcpSettingsOptions): McpServerRegistration[]; export declare function setMcpServerDisabled(options: SetMcpServerDisabledOptions): void; export declare function getMcpServerOAuthState(serverName: string, options?: LoadMcpSettingsOptions): McpServerOAuthState | undefined; /** * Scoped read-modify-write of one server's `oauth` block that blocks the event * loop while acquiring the lock. * * Prefer {@link updateMcpServerOAuthStateAsync}. * * TODO: Delete once all callers migrate to {@link updateMcpServerOAuthStateAsync}. */ export declare function updateMcpServerOAuthState(serverName: string, updater: (current: McpServerOAuthState) => McpServerOAuthState, options?: LoadMcpSettingsOptions): McpServerOAuthState; /** * Scoped read-modify-write of one server's `oauth` block that yields the event * loop while acquiring the lock. The updater is synchronous and pure; it * receives the server's current OAuth state and returns the next state. */ export declare function updateMcpServerOAuthStateAsync(serverName: string, updater: (current: McpServerOAuthState) => McpServerOAuthState, options?: LoadMcpSettingsOptions): Promise; export declare function listMcpServerOAuthStatuses(options?: LoadMcpSettingsOptions): McpServerOAuthStatus[]; export declare function registerMcpServersFromSettingsFile(manager: Pick, options?: RegisterMcpServersFromSettingsOptions): Promise;