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