Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/mcp/common/mcpGatewayService.ts
5263 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { IDisposable } from '../../../../base/common/lifecycle.js';
7
import { URI } from '../../../../base/common/uri.js';
8
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
9
10
export const IWorkbenchMcpGatewayService = createDecorator<IWorkbenchMcpGatewayService>('IWorkbenchMcpGatewayService');
11
12
/**
13
* Result of creating an MCP gateway, which is itself disposable.
14
*/
15
export interface IMcpGatewayResult extends IDisposable {
16
/**
17
* The address of the HTTP endpoint for this gateway.
18
*/
19
readonly address: URI;
20
}
21
22
/**
23
* Service that manages MCP gateway HTTP endpoints in the workbench.
24
*
25
* The gateway provides an HTTP server that external processes can connect
26
* to in order to interact with MCP servers known to the editor. The server
27
* is shared among all gateways and is automatically torn down when the
28
* last gateway is disposed.
29
*/
30
export interface IWorkbenchMcpGatewayService {
31
readonly _serviceBrand: undefined;
32
33
/**
34
* Creates a new MCP gateway endpoint.
35
*
36
* The gateway is assigned a secure random route ID to make the endpoint
37
* URL unguessable without authentication.
38
*
39
* @param inRemote Whether to create the gateway in the remote environment.
40
* If true, the gateway is created on the remote server (requires a remote connection).
41
* If false, the gateway is created locally (requires a local Node process, e.g., desktop).
42
* @returns A promise that resolves to the gateway result if successful,
43
* or `undefined` if the requested environment is not available.
44
*/
45
createGateway(inRemote: boolean): Promise<IMcpGatewayResult | undefined>;
46
}
47
48