export type Exposure = "codemode" | "codemode-deferred" | "deferred" | "direct" | "hidden"; export interface ClientOptions { description?: string; oauthClientId?: string; oauthScopes?: string[]; oauthCallbackPort?: number; oauthDpop?: boolean; disabled?: boolean; /** Only `hidden` changes behavior here: tools are always discovered, then activated. */ exposure?: Exposure; toolExposure?: Record; timeoutMs?: number; startupTimeoutMs?: number; toolTimeoutMs?: number; protocol?: "legacy" | "auto"; } /** * Normalized runtime configuration, derived from a server entry in `mcp.json`. The file shape * follows Pi's built-in MCP support (`enabled`, `exposure`, `toolExposure`, `timeout`, `oauth`), * so one file works with either extension; explicit transport tags are validated, then inferred. */ export interface ServerConfig extends ClientOptions { command?: string; args?: string[]; cwd?: string; env?: Record; url?: string; headers?: Record; } export type Config = Record; /** A server entry as written to `mcp.json`. */ export type FileServer = Record; export declare function object(value: unknown): value is Record; export declare function parseConfig(value: unknown, source?: string): Config; /** Like {@link parseConfig}, but skips invalid servers, as Pi's built-in MCP support does. */ export declare function parseConfigLenient(value: unknown, source: string, problems: string[]): Config; /** Project server definitions replace global definitions in full, including options. */ export declare function loadConfig(agentDir: string, cwd: string, trusted: boolean, /** Collects reasons for skipped servers. Without it, an invalid server fails the load. */ problems?: string[]): Promise; export type ConfigScope = "global" | "project"; export type ConfigMutation = { action: "toggle"; server: string; disabled: boolean; } | { action: "add"; server: string; scope: ConfigScope; definition: FileServer; replace: boolean; } | { action: "remove"; server: string; scope: ConfigScope; } | { action: "import"; scope: ConfigScope; servers: Record; expected: string; sourcePath: string; }; /** Messages from this class are safe to show without including raw configuration. */ export declare class ConfigMutationError extends Error { } /** Read both authorized scopes for an import preview; never resolve connection values. */ export declare function inspectConfigScopes(agentDir: string, cwd: string, trusted: boolean): Promise<{ global: Config; project: Config; targets: { global: string; project: string; }; expected: string; }>; /** Scoped, atomic updates; validation and read/modify/write share Pi's mutation queue. */ export declare function updateServerConfig(agentDir: string, cwd: string, trusted: boolean, mutation: ConfigMutation, validate: (config: Config) => void): Promise<{ config: Config; problems: string[]; scope: ConfigScope; }>; /** Toggle the effective definition, preserving unresolved secrets and other fields. */ export declare function setServerDisabled(agentDir: string, cwd: string, trusted: boolean, server: string, disabled: boolean, validate: (config: Config) => void): Promise<{ config: Config; problems: string[]; scope: ConfigScope; }>; export declare function interpolate(value: string, env?: NodeJS.ProcessEnv): string; export declare function resolveServer(config: ServerConfig, cwd: string): ServerConfig; /** HTTP authentication is automatic unless an Authorization header is configured. */ export declare function usesOAuth(config: ServerConfig | undefined): boolean; export declare function fingerprint(value: unknown): string; /** Exposure of one tool: an exact `toolExposure` key, else the first matching pattern, else the server's. */ export declare function toolExposure(name: string, config: ServerConfig): Exposure; export declare function allowed(name: string, config: ServerConfig): boolean;