|
| 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 { CancellationToken } from '../../../base/common/cancellation.js'; |
| 7 | +import { IMarkdownString } from '../../../base/common/htmlContent.js'; |
| 8 | +import { createDecorator } from '../../instantiation/common/instantiation.js'; |
| 9 | + |
| 10 | +/** |
| 11 | + * State of the enterprise MCP allow list service. |
| 12 | + */ |
| 13 | +export const enum McpAllowListState { |
| 14 | + /** Enterprise allow list enforcement is not applicable (no enterprise entries). */ |
| 15 | + NotApplicable, |
| 16 | + /** The allow list is currently being fetched. */ |
| 17 | + Loading, |
| 18 | + /** The allow list has been loaded and is ready for enforcement. */ |
| 19 | + Ready, |
| 20 | + /** The allow list could not be loaded (network failure, etc.). */ |
| 21 | + Unavailable, |
| 22 | +} |
| 23 | + |
| 24 | +/** |
| 25 | + * Service that manages enterprise MCP server allow lists. |
| 26 | + * |
| 27 | + * When a user is in an enterprise with MCP allow list policies, this service |
| 28 | + * fetches the allow list from the enterprise registry and gates server launches. |
| 29 | + */ |
| 30 | +export const IMcpAllowListService = createDecorator<IMcpAllowListService>('IMcpAllowListService'); |
| 31 | +export interface IMcpAllowListService { |
| 32 | + readonly _serviceBrand: undefined; |
| 33 | + |
| 34 | + /** State of the allow list service. */ |
| 35 | + readonly state: McpAllowListState; |
| 36 | + |
| 37 | + /** |
| 38 | + * Waits until the allow list is loaded or the service determines that |
| 39 | + * enterprise allow list enforcement is not applicable. Returns immediately |
| 40 | + * if already resolved. |
| 41 | + */ |
| 42 | + waitForReady(token?: CancellationToken): Promise<void>; |
| 43 | + |
| 44 | + /** |
| 45 | + * Checks whether a server (identified by its fingerprint) is allowed to run. |
| 46 | + * |
| 47 | + * @param fingerprint The computed SHA-256 fingerprint of the server's identity. |
| 48 | + * @returns `true` if the server is allowed, or an `IMarkdownString` explaining why it was blocked. |
| 49 | + */ |
| 50 | + isAllowed(fingerprint: string): true | IMarkdownString; |
| 51 | +} |
0 commit comments