import { IMcpServerConfiguration } from "../../../../platform/mcp/common/mcpPlatformTypes.js"; import { McpResourceFormat } from "../../../../platform/mcp/common/mcpWorkspaceConfiguration.js"; /** * The server kinds offered by the configuration form. `Http` and `Sse` both * persist as {@link McpServerType.REMOTE}; `Sse` additionally pins `transport: 'sse'`. */ export declare enum McpServerFormKind { Stdio = "stdio", Http = "http", Sse = "sse" } export interface IMcpServerFormKeyValue { name: string; value: string; /** * Name of the entry in the configuration this row was loaded from, used to merge the row with * later changes to the file. Absent for rows the user added. */ origin?: string; } /** * Editable, string-based representation of an MCP server configuration. */ export interface IMcpServerFormState { kind: McpServerFormKind; command: string; args: string; cwd: string; envFile: string; env: IMcpServerFormKeyValue[]; url: string; headers: IMcpServerFormKeyValue[]; } /** * Validation messages keyed by form field. A field without a message is valid. * `format` reports configuration the destination file cannot represent. */ export interface IMcpServerFormValidation { command?: string; args?: string; url?: string; env?: string; headers?: string; format?: string; } /** * The parts of a configuration that a file format can store. `.mcp.json` and the * Copilot CLI's `mcp-config.json` are shared with other clients and support less than `mcp.json`. */ export interface IMcpServerFormCapabilities { readonly kinds: readonly McpServerFormKind[]; readonly envFile: boolean; readonly cwd: boolean; /** Whether VS Code `${input:...}` variables are resolved for this file. */ readonly inputVariables: boolean; } export declare function getMcpServerFormCapabilities(format: McpResourceFormat): IMcpServerFormCapabilities; /** * Explains why changing {@link previous} to {@link config} cannot be saved to a file of the given * {@link format}, if it cannot. Only the edit is checked, so properties already in the file that * the format does not support never block saving. */ export declare function getMcpServerFormatError(name: string, previous: IMcpServerConfiguration, config: IMcpServerConfiguration, format: McpResourceFormat): string | undefined; export declare function toMcpServerFormState(config: IMcpServerConfiguration): IMcpServerFormState; /** * Formats arguments as a space separated list, or as a JSON array when an * argument would not survive a round trip through {@link parseMcpServerArgs}. */ export declare function formatMcpServerArgs(args: readonly string[] | undefined): string; /** * Parses arguments entered as a space separated list or as a JSON array of strings. */ export declare function parseMcpServerArgs(value: string): { readonly args: string[]; readonly error?: string; }; export declare function validateMcpServerFormState(state: IMcpServerFormState): IMcpServerFormValidation; /** * Three-way merges name/value rows after the configuration file changed while the form had unsaved * edits. {@link base} is the configuration the edits were made against, {@link local} the rows in * the form and {@link remote} the configuration now in the file. Rows the user added, removed, * renamed or changed keep the user's edit; all other rows take the file's current entry, and entries * the file added are appended. Rows taken from the file are copies, so {@link remote} is not shared. */ export declare function mergeMcpServerFormKeyValues(base: readonly IMcpServerFormKeyValue[], local: readonly IMcpServerFormKeyValue[], remote: readonly IMcpServerFormKeyValue[]): IMcpServerFormKeyValue[]; export declare function isMcpServerFormValid(validation: IMcpServerFormValidation): boolean; /** * Builds the configuration to persist from the form state. Properties the form * does not edit (for example `gallery`, `dev`, `oauth` or `sandboxEnabled`) are * preserved from {@link original} as long as the server kind does not change, and * env values keep their original `number`/`null` types when left unchanged. * * Callers should validate the state with {@link validateMcpServerFormState} first. */ export declare function toMcpServerConfiguration(state: IMcpServerFormState, original: IMcpServerConfiguration): IMcpServerConfiguration;