55 *--------------------------------------------------------------------------------------------*/
66
77/**
8- * Type Definition for Visual Studio Code 1.100 Extension API
8+ * Type Definition for Visual Studio Code 1.101 Extension API
99 * See https://code.visualstudio.com/api for more information
1010 */
1111
@@ -20196,7 +20196,7 @@ declare module 'vscode' {
2019620196
2019720197 /**
2019820198 * A set of options that control the behavior of the language model. These options are specific to the language model
20199- * and need to be lookup in the respective documentation.
20199+ * and need to be looked up in the respective documentation.
2020020200 */
2020120201 modelOptions?: { [name: string]: any };
2020220202
@@ -20219,6 +20219,139 @@ declare module 'vscode' {
2021920219 toolMode?: LanguageModelChatToolMode;
2022020220 }
2022120221
20222+ /**
20223+ * McpStdioServerDefinition represents an MCP server available by running
20224+ * a local process and operating on its stdin and stdout streams. The process
20225+ * will be spawned as a child process of the extension host and by default
20226+ * will not run in a shell environment.
20227+ */
20228+ export class McpStdioServerDefinition {
20229+ /**
20230+ * The human-readable name of the server.
20231+ */
20232+ readonly label: string;
20233+
20234+ /**
20235+ * The working directory used to start the server.
20236+ */
20237+ cwd?: Uri;
20238+
20239+ /**
20240+ * The command used to start the server. Node.js-based servers may use
20241+ * `process.execPath` to use the editor's version of Node.js to run the script.
20242+ */
20243+ command: string;
20244+
20245+ /**
20246+ * Additional command-line arguments passed to the server.
20247+ */
20248+ args: string[];
20249+
20250+ /**
20251+ * Optional additional environment information for the server. Variables
20252+ * in this environment will overwrite or remove (if null) the default
20253+ * environment variables of the editor's extension host.
20254+ */
20255+ env: Record<string, string | number | null>;
20256+
20257+ /**
20258+ * Optional version identification for the server. If this changes, the
20259+ * editor will indicate that tools have changed and prompt to refresh them.
20260+ */
20261+ version?: string;
20262+
20263+ /**
20264+ * @param label The human-readable name of the server.
20265+ * @param command The command used to start the server.
20266+ * @param args Additional command-line arguments passed to the server.
20267+ * @param env Optional additional environment information for the server.
20268+ * @param version Optional version identification for the server.
20269+ */
20270+ constructor(label: string, command: string, args?: string[], env?: Record<string, string | number | null>, version?: string);
20271+ }
20272+
20273+ /**
20274+ * McpHttpServerDefinition represents an MCP server available using the
20275+ * Streamable HTTP transport.
20276+ */
20277+ export class McpHttpServerDefinition {
20278+ /**
20279+ * The human-readable name of the server.
20280+ */
20281+ readonly label: string;
20282+
20283+ /**
20284+ * The URI of the server. The editor will make a POST request to this URI
20285+ * to begin each session.
20286+ */
20287+ uri: Uri;
20288+
20289+ /**
20290+ * Optional additional heads included with each request to the server.
20291+ */
20292+ headers: Record<string, string>;
20293+
20294+ /**
20295+ * Optional version identification for the server. If this changes, the
20296+ * editor will indicate that tools have changed and prompt to refresh them.
20297+ */
20298+ version?: string;
20299+
20300+ /**
20301+ * @param label The human-readable name of the server.
20302+ * @param uri The URI of the server.
20303+ * @param headers Optional additional heads included with each request to the server.
20304+ */
20305+ constructor(label: string, uri: Uri, headers?: Record<string, string>, version?: string);
20306+ }
20307+
20308+ /**
20309+ * Definitions that describe different types of Model Context Protocol servers,
20310+ * which can be returned from the {@link McpServerDefinitionProvider}.
20311+ */
20312+ export type McpServerDefinition = McpStdioServerDefinition | McpHttpServerDefinition;
20313+
20314+ /**
20315+ * A type that can provide Model Context Protocol server definitions. This
20316+ * should be registered using {@link lm.registerMcpServerDefinitionProvider}
20317+ * during extension activation.
20318+ */
20319+ export interface McpServerDefinitionProvider<T extends McpServerDefinition = McpServerDefinition> {
20320+ /**
20321+ * Optional event fired to signal that the set of available servers has changed.
20322+ */
20323+ readonly onDidChangeMcpServerDefinitions?: Event<void>;
20324+
20325+ /**
20326+ * Provides available MCP servers. The editor will call this method eagerly
20327+ * to ensure the availability of servers for the language model, and so
20328+ * extensions should not take actions which would require user
20329+ * interaction, such as authentication.
20330+ *
20331+ * @param token A cancellation token.
20332+ * @returns An array of MCP available MCP servers
20333+ */
20334+ provideMcpServerDefinitions(token: CancellationToken): ProviderResult<T[]>;
20335+
20336+ /**
20337+ * This function will be called when the editor needs to start a MCP server.
20338+ * At this point, the extension may take any actions which may require user
20339+ * interaction, such as authentication. Any non-`readonly` property of the
20340+ * server may be modified, and the extension should return the resolved server.
20341+ *
20342+ * The extension may return undefined to indicate that the server
20343+ * should not be started, or throw an error. If there is a pending tool
20344+ * call, the editor will cancel it and return an error message to the
20345+ * language model.
20346+ *
20347+ * @param server The MCP server to resolve
20348+ * @param token A cancellation token.
20349+ * @returns The resolved server or thenable that resolves to such. This may
20350+ * be the given `server` definition with non-readonly properties filled in.
20351+ */
20352+ resolveMcpServerDefinition?(server: T, token: CancellationToken): ProviderResult<T>;
20353+ }
20354+
2022220355 /**
2022320356 * Namespace for language model related functionality.
2022420357 */
@@ -20297,6 +20430,34 @@ declare module 'vscode' {
2029720430 * @returns The result of the tool invocation.
2029820431 */
2029920432 export function invokeTool(name: string, options: LanguageModelToolInvocationOptions<object>, token?: CancellationToken): Thenable<LanguageModelToolResult>;
20433+
20434+ /**
20435+ * Registers a provider that publishes Model Context Protocol servers for the editor to
20436+ * consume. This allows MCP servers to be dynamically provided to the editor in
20437+ * addition to those the user creates in their configuration files.
20438+ *
20439+ * Before calling this method, extensions must register the `contributes.mcpServerDefinitionProviders`
20440+ * extension point with the corresponding {@link id}, for example:
20441+ *
20442+ * ```js
20443+ * "contributes": {
20444+ * "mcpServerDefinitionProviders": [
20445+ * {
20446+ * "id": "cool-cloud-registry.mcp-servers",
20447+ * "label": "Cool Cloud Registry",
20448+ * }
20449+ * ]
20450+ * }
20451+ * ```
20452+ *
20453+ * When a new McpServerDefinitionProvider is available, the editor will present a 'refresh'
20454+ * action to the user to discover new servers. To enable this flow, extensions should
20455+ * call `registerMcpServerDefinitionProvider` during activation.
20456+ * @param id The ID of the provider, which is unique to the extension.
20457+ * @param provider The provider to register
20458+ * @returns A disposable that unregisters the provider when disposed.
20459+ */
20460+ export function registerMcpServerDefinitionProvider(id: string, provider: McpServerDefinitionProvider): Disposable;
2030020461 }
2030120462
2030220463 /**
0 commit comments