33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6+ // version: 1
7+
68declare module 'vscode' {
79
810 // https://github.com/microsoft/vscode/issues/288777 @DonJayamanne
911
1012 /**
11- * Represents an MCP gateway that exposes MCP servers via HTTP.
12- * The gateway provides an HTTP endpoint that external processes can connect
13- * to in order to interact with MCP servers known to the editor.
13+ * Represents a single MCP server exposed by the gateway via its own HTTP endpoint.
1414 */
15- export interface McpGateway extends Disposable {
15+ export interface McpGatewayServer {
16+ /**
17+ * The human-readable label of the MCP server.
18+ */
19+ readonly label : string ;
20+
1621 /**
1722 * The address of the HTTP MCP server endpoint.
18- * External processes can connect to this URI to interact with MCP servers .
23+ * External processes can connect to this URI to interact with this MCP server .
1924 */
2025 readonly address : Uri ;
2126 }
2227
28+ /**
29+ * Represents an MCP gateway that exposes MCP servers via HTTP.
30+ * Each known MCP server gets its own HTTP endpoint. The gateway
31+ * dynamically tracks server additions and removals.
32+ */
33+ export interface McpGateway extends Disposable {
34+ /**
35+ * The MCP servers currently exposed by the gateway.
36+ * Each server has its own HTTP endpoint address.
37+ */
38+ readonly servers : readonly McpGatewayServer [ ] ;
39+
40+ /**
41+ * Event that fires when the set of gateway servers changes.
42+ * This can be due to MCP servers being added, removed, or restarted.
43+ */
44+ readonly onDidChangeServers : Event < readonly McpGatewayServer [ ] > ;
45+ }
46+
2347 /**
2448 * Namespace for language model related functionality.
2549 */
@@ -42,14 +66,16 @@ declare module 'vscode' {
4266 export const onDidChangeMcpServerDefinitions : Event < void > ;
4367
4468 /**
45- * Starts an MCP gateway that exposes MCP servers via an HTTP endpoint .
69+ * Starts an MCP gateway that exposes MCP servers via HTTP endpoints .
4670 *
47- * The gateway creates a localhost HTTP server that external processes (such as
48- * CLI-based agent loops) can connect to in order to interact with MCP servers
49- * that the editor knows about.
71+ * The gateway creates a localhost HTTP server where each MCP server known
72+ * to the editor gets its own endpoint. External processes (such as CLI-based
73+ * agent loops) can connect to these endpoints to interact with individual
74+ * MCP servers.
5075 *
5176 * The HTTP server is shared among all gateways and is automatically torn down
52- * when the last gateway is disposed.
77+ * when the last gateway is disposed. The gateway dynamically tracks server
78+ * additions and removals via {@link McpGateway.onDidChangeServers}.
5379 *
5480 * @returns A promise that resolves to an {@link McpGateway} if successful,
5581 * or `undefined` if no Node process is available (e.g., in serverless web environments).
0 commit comments