@codingame/monaco-vscode-mcp-service-override 37.6.0 → 38.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common.js +7 -1
- package/package.json +2 -2
- package/session.d.ts +2 -1
- package/session.js +13 -1
- package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.d.ts +3 -0
- package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +38 -8
- package/vscode/src/vs/platform/mcp/common/mcpGalleryManifestService.d.ts +1 -0
- package/vscode/src/vs/platform/mcp/common/mcpGalleryManifestService.js +3 -0
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.d.ts +11 -5
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +121 -32
- package/vscode/src/vs/sessions/services/mcp/browser/mcpWorkspaceInstallTargetService.d.ts +4 -0
- package/vscode/src/vs/sessions/services/mcp/browser/mcpWorkspaceInstallTargetService.js +12 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadMcp.d.ts +7 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadMcp.js +108 -66
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +8 -4
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +130 -118
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +25 -25
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +35 -35
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +8 -8
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerConfigurationFormAccessibility.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerConfigurationFormAccessibility.js +46 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +37 -37
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.d.ts +4 -12
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +39 -136
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.d.ts +14 -7
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +158 -61
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.js +2 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +3 -10
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.js +16 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceDotMcpDiscovery.d.ts +1 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceDotMcpDiscovery.js +33 -7
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpCopilotGlobalConfigurationService.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpCopilotGlobalConfigurationService.js +49 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpEnvironmentVariableExpansion.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpEnvironmentVariableExpansion.js +21 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +6 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +21 -16
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +11 -11
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.d.ts +5 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js +59 -40
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +26 -13
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.d.ts +2 -2
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +18 -10
- package/vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.d.ts +2 -1
- package/vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.js +6 -3
- package/vscode/src/vs/workbench/services/mcp/common/mcpWorkspaceInstallTargetService.d.ts +11 -0
- package/vscode/src/vs/workbench/services/mcp/common/mcpWorkspaceInstallTargetService.js +24 -0
- package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.d.ts +0 -35
- package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.js +0 -214
- package/vscode/src/vs/workbench/contrib/mcp/browser/media/mcpServersView.css +0 -53
package/common.js
CHANGED
|
@@ -5,10 +5,12 @@ import { AllowedMcpServersService } from './vscode/src/vs/platform/mcp/common/al
|
|
|
5
5
|
import { IMcpGalleryManifestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpGalleryManifest.service';
|
|
6
6
|
import { McpGalleryService } from './vscode/src/vs/platform/mcp/common/mcpGalleryService.js';
|
|
7
7
|
import { IAllowedMcpServersService, IMcpGalleryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service';
|
|
8
|
-
import { McpResourceScannerService } from '
|
|
8
|
+
import { McpResourceScannerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpResourceScannerService';
|
|
9
9
|
import { IMcpResourceScannerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpResourceScannerService.service';
|
|
10
10
|
import { McpElicitationService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js';
|
|
11
11
|
import { McpWorkbenchService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js';
|
|
12
|
+
import { McpCopilotGlobalConfigurationService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpCopilotGlobalConfigurationService.js';
|
|
13
|
+
import { IMcpCopilotGlobalConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpCopilotGlobalConfigurationService.service';
|
|
12
14
|
import { McpRegistry } from './vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js';
|
|
13
15
|
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
14
16
|
import { McpSamplingService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js';
|
|
@@ -24,6 +26,8 @@ import { IAuthenticationMcpUsageService } from '@codingame/monaco-vscode-api/vsc
|
|
|
24
26
|
import { WorkbenchMcpGalleryManifestService } from './vscode/src/vs/workbench/services/mcp/browser/mcpGalleryManifestService.js';
|
|
25
27
|
import { WorkbenchMcpManagementService } from './vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.js';
|
|
26
28
|
import { IWorkbenchMcpManagementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.service';
|
|
29
|
+
import { McpWorkspaceInstallTargetService } from './vscode/src/vs/workbench/services/mcp/common/mcpWorkspaceInstallTargetService.js';
|
|
30
|
+
import { IMcpWorkspaceInstallTargetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/mcp/common/mcpWorkspaceInstallTargetService.service';
|
|
27
31
|
import { McpSandboxService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js';
|
|
28
32
|
import { IWorkbenchMcpGatewayService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpGatewayService.service';
|
|
29
33
|
import { BrowserMcpGatewayService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.js';
|
|
@@ -35,6 +39,8 @@ import './vscode/src/vs/workbench/api/browser/mainThreadMcp.js';
|
|
|
35
39
|
function getServiceOverride() {
|
|
36
40
|
return {
|
|
37
41
|
[IMcpResourceScannerService.toString()]: new SyncDescriptor(McpResourceScannerService, [], true),
|
|
42
|
+
[IMcpCopilotGlobalConfigurationService.toString()]: new SyncDescriptor(McpCopilotGlobalConfigurationService, [], true),
|
|
43
|
+
[IMcpWorkspaceInstallTargetService.toString()]: new SyncDescriptor(McpWorkspaceInstallTargetService, [], true),
|
|
38
44
|
[IMcpService.toString()]: new SyncDescriptor(McpService, [], true),
|
|
39
45
|
[IMcpRegistry.toString()]: new SyncDescriptor(McpRegistry, [], true),
|
|
40
46
|
[IAuthenticationMcpService.toString()]: new SyncDescriptor(AuthenticationMcpService, [], true),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-mcp-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "38.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - mcp service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "38.0.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
package/session.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { IEditorOverrideServices } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices";
|
|
2
|
+
export default function getServiceOverride(): IEditorOverrideServices;
|
package/session.js
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
|
|
3
|
+
import { SessionsMcpWorkspaceInstallTargetService } from './vscode/src/vs/sessions/services/mcp/browser/mcpWorkspaceInstallTargetService.js';
|
|
4
|
+
import { IMcpWorkspaceInstallTargetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/mcp/common/mcpWorkspaceInstallTargetService.service';
|
|
5
|
+
import getServiceOverride$1 from './common.js';
|
|
6
|
+
|
|
7
|
+
function getServiceOverride() {
|
|
8
|
+
return {
|
|
9
|
+
...getServiceOverride$1(),
|
|
10
|
+
[IMcpWorkspaceInstallTargetService.toString()]: new SyncDescriptor(SessionsMcpWorkspaceInstallTargetService, [], true)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { getServiceOverride as default };
|
|
@@ -11,7 +11,10 @@ export declare class AllowedMcpServersService extends Disposable implements IAll
|
|
|
11
11
|
readonly onDidChangeAllowedMcpServers: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
|
|
12
12
|
constructor(configurationService: IConfigurationService);
|
|
13
13
|
isAllowed(mcpServer: IGalleryMcpServer | ILocalMcpServer | IInstallableMcpServer): true | IMarkdownString;
|
|
14
|
+
isServerAllowedBeforeResolution(identity: IMcpServerIdentity): true | IMarkdownString;
|
|
14
15
|
isServerAllowed(identity: IMcpServerIdentity): true | IMarkdownString;
|
|
16
|
+
private checkServerAllowed;
|
|
17
|
+
private checkServerAllowedBeforeResolution;
|
|
15
18
|
private getAllConfiguredMatchers;
|
|
16
19
|
private toIdentity;
|
|
17
20
|
}
|
|
@@ -4,10 +4,11 @@ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/l
|
|
|
4
4
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
5
5
|
import { createCommandUri, MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
6
6
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
7
|
+
import { hasConfigurationVariable } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configurationVariables';
|
|
7
8
|
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
8
|
-
import { hasKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
9
|
+
import { isString, hasKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
9
10
|
import { getMcpServerMatchers, checkMcpServerAllowed, McpServerAllowResult } from './allowedMcpServers.js';
|
|
10
|
-
import { mcpAccessConfig, mcpAllowedServersConfig, mcpDeniedServersConfig, McpAccessValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement';
|
|
11
|
+
import { mcpAccessConfig, mcpAllowedServersConfig, mcpDeniedServersConfig, McpAccessValue, replaceMcpServerVariableReferences } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement';
|
|
11
12
|
import { McpServerType } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpPlatformTypes';
|
|
12
13
|
import { COPILOT_ALLOW_MANAGED_MCP_SERVERS_ONLY_CONFIG } from '@codingame/monaco-vscode-api/vscode/vs/platform/policy/common/copilotManagedSettings';
|
|
13
14
|
|
|
@@ -24,15 +25,21 @@ let AllowedMcpServersService = class AllowedMcpServersService extends Disposable
|
|
|
24
25
|
}));
|
|
25
26
|
}
|
|
26
27
|
isAllowed(mcpServer) {
|
|
27
|
-
return this.
|
|
28
|
+
return this.isServerAllowedBeforeResolution(this.toIdentity(mcpServer));
|
|
29
|
+
}
|
|
30
|
+
isServerAllowedBeforeResolution(identity) {
|
|
31
|
+
return this.checkServerAllowed(identity, "definition");
|
|
28
32
|
}
|
|
29
33
|
isServerAllowed(identity) {
|
|
34
|
+
return this.checkServerAllowed(identity, "resolved");
|
|
35
|
+
}
|
|
36
|
+
checkServerAllowed(identity, phase) {
|
|
30
37
|
if (this.configurationService.getValue(mcpAccessConfig) === McpAccessValue.None) {
|
|
31
38
|
const settingsCommandLink = ( createCommandUri("workbench.action.openSettings", {
|
|
32
39
|
query: `@id:${mcpAccessConfig}`
|
|
33
40
|
}).toString());
|
|
34
41
|
return (new MarkdownString(localize(
|
|
35
|
-
|
|
42
|
+
2790,
|
|
36
43
|
"Model Context Protocol servers are disabled in the Editor. Please check your [settings]({0}).",
|
|
37
44
|
settingsCommandLink
|
|
38
45
|
)));
|
|
@@ -40,20 +47,42 @@ let AllowedMcpServersService = class AllowedMcpServersService extends Disposable
|
|
|
40
47
|
const managedOnly = this.configurationService.getValue(COPILOT_ALLOW_MANAGED_MCP_SERVERS_ONLY_CONFIG) === true;
|
|
41
48
|
const allowlist = managedOnly ? getMcpServerMatchers(this.configurationService.inspect(mcpAllowedServersConfig).policyValue) ?? [] : getMcpServerMatchers(this.configurationService.getValue(mcpAllowedServersConfig));
|
|
42
49
|
const denylist = managedOnly ? this.getAllConfiguredMatchers(mcpDeniedServersConfig) : getMcpServerMatchers(this.configurationService.getValue(mcpDeniedServersConfig));
|
|
43
|
-
|
|
50
|
+
const result = phase === "definition" ? this.checkServerAllowedBeforeResolution(allowlist, denylist, identity) : checkMcpServerAllowed(allowlist, denylist, identity);
|
|
51
|
+
switch (result) {
|
|
44
52
|
case McpServerAllowResult.Denied:
|
|
45
53
|
return (new MarkdownString(localize(
|
|
46
|
-
|
|
54
|
+
2791,
|
|
47
55
|
"This Model Context Protocol server is blocked by your organization's policy. Please contact your administrator for more information."
|
|
48
56
|
)));
|
|
49
57
|
case McpServerAllowResult.NotAllowed:
|
|
50
58
|
return (new MarkdownString(localize(
|
|
51
|
-
|
|
59
|
+
2792,
|
|
52
60
|
"This Model Context Protocol server is not in the list of servers allowed by your organization. Please contact your administrator for more information."
|
|
53
61
|
)));
|
|
54
62
|
}
|
|
55
63
|
return true;
|
|
56
64
|
}
|
|
65
|
+
checkServerAllowedBeforeResolution(allowlist, denylist, identity) {
|
|
66
|
+
const unresolvedUrl = identity.url !== undefined && hasConfigurationVariable(identity.url);
|
|
67
|
+
const unresolvedCommand = identity.command?.some(hasConfigurationVariable) ?? false;
|
|
68
|
+
if (!unresolvedUrl && !unresolvedCommand) {
|
|
69
|
+
return checkMcpServerAllowed(allowlist, denylist, identity);
|
|
70
|
+
}
|
|
71
|
+
const knownIdentity = {
|
|
72
|
+
name: identity.name,
|
|
73
|
+
url: unresolvedUrl ? undefined : identity.url,
|
|
74
|
+
command: unresolvedCommand ? undefined : identity.command
|
|
75
|
+
};
|
|
76
|
+
if (checkMcpServerAllowed(undefined, denylist, knownIdentity) === McpServerAllowResult.Denied) {
|
|
77
|
+
return McpServerAllowResult.Denied;
|
|
78
|
+
}
|
|
79
|
+
if (allowlist === undefined || checkMcpServerAllowed(allowlist, undefined, knownIdentity) === McpServerAllowResult.Allowed) {
|
|
80
|
+
return McpServerAllowResult.Allowed;
|
|
81
|
+
}
|
|
82
|
+
return ( allowlist.some(
|
|
83
|
+
matcher => (unresolvedUrl && isString(matcher.serverUrl)) || (unresolvedCommand && Array.isArray(matcher.serverCommand))
|
|
84
|
+
)) ? McpServerAllowResult.Allowed : McpServerAllowResult.NotAllowed;
|
|
85
|
+
}
|
|
57
86
|
getAllConfiguredMatchers(key) {
|
|
58
87
|
const inspected = this.configurationService.inspect(key);
|
|
59
88
|
return [
|
|
@@ -83,9 +112,10 @@ let AllowedMcpServersService = class AllowedMcpServersService extends Disposable
|
|
|
83
112
|
command: [config.command, ...(config.args ?? [])]
|
|
84
113
|
};
|
|
85
114
|
}
|
|
115
|
+
const remote = mcpServer.configuration.remotes?.[0];
|
|
86
116
|
return {
|
|
87
117
|
name: mcpServer.name,
|
|
88
|
-
url:
|
|
118
|
+
url: remote ? replaceMcpServerVariableReferences(remote.url, remote.variables) : undefined
|
|
89
119
|
};
|
|
90
120
|
}
|
|
91
121
|
};
|
|
@@ -16,6 +16,7 @@ export declare class McpGalleryManifestService extends Disposable implements IMc
|
|
|
16
16
|
get mcpGalleryManifestStatus(): McpGalleryManifestStatus;
|
|
17
17
|
constructor(productService: IProductService, requestService: IRequestService, logService: ILogService);
|
|
18
18
|
getMcpGalleryManifest(): Promise<IMcpGalleryManifest | null>;
|
|
19
|
+
getDefaultMcpGalleryManifest(): Promise<IMcpGalleryManifest | null>;
|
|
19
20
|
protected createMcpGalleryManifest(url: string, version?: string): Promise<IMcpGalleryManifest>;
|
|
20
21
|
private getVersion;
|
|
21
22
|
private checkVersion;
|
|
@@ -24,6 +24,9 @@ let McpGalleryManifestService = class McpGalleryManifestService extends Disposab
|
|
|
24
24
|
this.versionByUrl = ( new Map());
|
|
25
25
|
}
|
|
26
26
|
async getMcpGalleryManifest() {
|
|
27
|
+
return this.getDefaultMcpGalleryManifest();
|
|
28
|
+
}
|
|
29
|
+
async getDefaultMcpGalleryManifest() {
|
|
27
30
|
if (!this.productService.mcpGallery) {
|
|
28
31
|
return null;
|
|
29
32
|
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
2
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
3
4
|
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
4
5
|
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
5
6
|
import { IRequestService } from "@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service";
|
|
6
|
-
import { IGalleryMcpServer, IMcpGalleryServerResolveResult, IQueryOptions } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement";
|
|
7
|
+
import { IGalleryMcpServer, IMcpGalleryQueryPage, IMcpGalleryQueryPageOptions, IMcpGalleryServerResolveResult, IQueryOptions } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement";
|
|
7
8
|
import { IMcpGalleryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service";
|
|
8
9
|
import { IMcpGalleryManifest } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpGalleryManifest";
|
|
9
10
|
import { IMcpGalleryManifestService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpGalleryManifest.service";
|
|
10
11
|
import { IIterativePager } from "@codingame/monaco-vscode-api/vscode/vs/base/common/paging";
|
|
12
|
+
export declare class UnsupportedMcpGalleryPackageError extends Error {
|
|
13
|
+
readonly repositoryUrl: URI | undefined;
|
|
14
|
+
constructor(repositoryUrl: URI | undefined);
|
|
15
|
+
}
|
|
11
16
|
export declare class McpGalleryService extends Disposable implements IMcpGalleryService {
|
|
12
17
|
private readonly requestService;
|
|
13
18
|
private readonly fileService;
|
|
@@ -17,21 +22,22 @@ export declare class McpGalleryService extends Disposable implements IMcpGallery
|
|
|
17
22
|
private galleryMcpServerDataSerializers;
|
|
18
23
|
constructor(requestService: IRequestService, fileService: IFileService, logService: ILogService, mcpGalleryManifestService: IMcpGalleryManifestService);
|
|
19
24
|
isEnabled(): boolean;
|
|
20
|
-
|
|
25
|
+
queryPage(options: IMcpGalleryQueryPageOptions, token: CancellationToken, galleryManifest?: IMcpGalleryManifest): Promise<IMcpGalleryQueryPage>;
|
|
26
|
+
query(options?: IQueryOptions, token?: CancellationToken, manifest?: IMcpGalleryManifest): Promise<IIterativePager<IGalleryMcpServer>>;
|
|
21
27
|
getMcpServersFromGallery(infos: {
|
|
22
28
|
name: string;
|
|
23
29
|
id?: string;
|
|
24
|
-
}[]): Promise<IGalleryMcpServer[]>;
|
|
30
|
+
}[], manifest?: IMcpGalleryManifest): Promise<IGalleryMcpServer[]>;
|
|
25
31
|
resolveMcpServersFromGallery(infos: {
|
|
26
32
|
name: string;
|
|
27
33
|
id?: string;
|
|
28
|
-
}[]): Promise<Map<string, IMcpGalleryServerResolveResult>>;
|
|
34
|
+
}[], manifest?: IMcpGalleryManifest): Promise<Map<string, IMcpGalleryServerResolveResult>>;
|
|
29
35
|
private getMcpServerByName;
|
|
30
36
|
getReadme(gallery: IGalleryMcpServer, token: CancellationToken): Promise<string>;
|
|
31
37
|
private toGalleryMcpServer;
|
|
32
38
|
private queryGalleryMcpServers;
|
|
33
39
|
private queryRawGalleryMcpServers;
|
|
34
|
-
getMcpServer(mcpServerUrl: string, mcpGalleryManifest?: IMcpGalleryManifest | null): Promise<IGalleryMcpServer | undefined>;
|
|
40
|
+
getMcpServer(mcpServerUrl: string, mcpGalleryManifest?: IMcpGalleryManifest | null, token?: CancellationToken): Promise<IGalleryMcpServer | undefined>;
|
|
35
41
|
private serializeMcpServer;
|
|
36
42
|
private serializeMcpServersResult;
|
|
37
43
|
private getSerializer;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
4
|
+
import { raceCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
5
|
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
5
6
|
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
7
|
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
@@ -9,7 +10,7 @@ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
|
9
10
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
10
11
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
11
12
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
12
|
-
import { asText, isSuccess, asJson } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request';
|
|
13
|
+
import { asText, isSuccess, asJson, readBoundedResponse } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request';
|
|
13
14
|
import { IRequestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service';
|
|
14
15
|
import { RegistryType, TransportType, McpGalleryResolveStatus, GalleryMcpServerStatus } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement';
|
|
15
16
|
import { getMcpGalleryManifestResourceUri, McpGalleryResourceType, McpGalleryManifestStatus } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpGalleryManifest';
|
|
@@ -17,6 +18,17 @@ import { IMcpGalleryManifestService } from '@codingame/monaco-vscode-api/vscode/
|
|
|
17
18
|
import { CancellationError, isCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
18
19
|
import { isString, isObject } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
19
20
|
|
|
21
|
+
const maxMcpServerResponseBytes = 5 * 1024 * 1024;
|
|
22
|
+
const mcpServerRequestTimeout = 30_000;
|
|
23
|
+
class UnsupportedMcpGalleryPackageError extends Error {
|
|
24
|
+
constructor(repositoryUrl) {
|
|
25
|
+
super("The MCP server has no supported package or remote endpoint.");
|
|
26
|
+
this.repositoryUrl = repositoryUrl;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function isRecord(value) {
|
|
30
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31
|
+
}
|
|
20
32
|
function toSupportedPackageRegistryType(input) {
|
|
21
33
|
switch (input) {
|
|
22
34
|
case "npm":
|
|
@@ -46,6 +58,25 @@ function filterMcpPackages(packages, getRegistryType, convert) {
|
|
|
46
58
|
}
|
|
47
59
|
return result;
|
|
48
60
|
}
|
|
61
|
+
function getUnsupportedMcpSetup(data) {
|
|
62
|
+
if (!isRecord(data) || !isRecord(data.server) || !isString(data.server.name) || !isString(data.server.version) || !Array.isArray(data.server.packages) || data.server.packages.length === 0 || ( data.server.packages.some(
|
|
63
|
+
item => !isRecord(item) || toSupportedPackageRegistryType(item.registryType)
|
|
64
|
+
)) || (Array.isArray(data.server.remotes) && data.server.remotes.length > 0)) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const repository = data.server.repository;
|
|
68
|
+
if (isRecord(repository) && isString(repository.url)) {
|
|
69
|
+
try {
|
|
70
|
+
const url = ( new URL(repository.url));
|
|
71
|
+
if (url.protocol === `${Schemas.https}:` && !url.username && !url.password) {
|
|
72
|
+
return {
|
|
73
|
+
repositoryUrl: ( URI.parse(url.href))
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
} catch {}
|
|
77
|
+
}
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
49
80
|
function getMcpServerUrlInGallery(mcpServerUrl, mcpGalleryManifest) {
|
|
50
81
|
const mcpGalleryUrl = getMcpGalleryManifestResourceUri(mcpGalleryManifest, McpGalleryResourceType.McpServersQueryService) ?? mcpGalleryManifest.url;
|
|
51
82
|
try {
|
|
@@ -408,8 +439,27 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
408
439
|
isEnabled() {
|
|
409
440
|
return this.mcpGalleryManifestService.mcpGalleryManifestStatus === McpGalleryManifestStatus.Available;
|
|
410
441
|
}
|
|
411
|
-
async
|
|
412
|
-
|
|
442
|
+
async queryPage(options, token, galleryManifest) {
|
|
443
|
+
if (token.isCancellationRequested) {
|
|
444
|
+
throw ( new CancellationError());
|
|
445
|
+
}
|
|
446
|
+
const manifest = galleryManifest ?? (await this.mcpGalleryManifestService.getMcpGalleryManifest());
|
|
447
|
+
if (!manifest) {
|
|
448
|
+
throw ( new Error(( localize(2799, "The MCP gallery is not configured."))));
|
|
449
|
+
}
|
|
450
|
+
const query = ( new Query()).withPage(options.cursor ?? "", options.pageSize).withSearchText(options.cursor ? undefined : options.text?.trim());
|
|
451
|
+
const {
|
|
452
|
+
servers,
|
|
453
|
+
metadata
|
|
454
|
+
} = await this.queryGalleryMcpServers(query, manifest, token, true);
|
|
455
|
+
return {
|
|
456
|
+
items: servers,
|
|
457
|
+
total: metadata.count >= servers.length ? metadata.count : undefined,
|
|
458
|
+
nextCursor: metadata.nextCursor
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
async query(options, token = CancellationToken.None, manifest) {
|
|
462
|
+
const mcpGalleryManifest = manifest ?? (await this.mcpGalleryManifestService.getMcpGalleryManifest());
|
|
413
463
|
if (!mcpGalleryManifest) {
|
|
414
464
|
return {
|
|
415
465
|
firstPage: {
|
|
@@ -462,8 +512,8 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
462
512
|
}
|
|
463
513
|
};
|
|
464
514
|
}
|
|
465
|
-
async getMcpServersFromGallery(infos) {
|
|
466
|
-
const resolved = await this.resolveMcpServersFromGallery(infos);
|
|
515
|
+
async getMcpServersFromGallery(infos, manifest) {
|
|
516
|
+
const resolved = await this.resolveMcpServersFromGallery(infos, manifest);
|
|
467
517
|
const mcpServers = [];
|
|
468
518
|
for (const result of ( resolved.values())) {
|
|
469
519
|
if (result.status === McpGalleryResolveStatus.Found) {
|
|
@@ -472,9 +522,9 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
472
522
|
}
|
|
473
523
|
return mcpServers;
|
|
474
524
|
}
|
|
475
|
-
async resolveMcpServersFromGallery(infos) {
|
|
525
|
+
async resolveMcpServersFromGallery(infos, manifest) {
|
|
476
526
|
const result = ( new Map());
|
|
477
|
-
const mcpGalleryManifest = await this.mcpGalleryManifestService.getMcpGalleryManifest();
|
|
527
|
+
const mcpGalleryManifest = manifest ?? (await this.mcpGalleryManifestService.getMcpGalleryManifest());
|
|
478
528
|
if (!mcpGalleryManifest) {
|
|
479
529
|
for (const info of infos) {
|
|
480
530
|
result.set(info.name, {
|
|
@@ -545,7 +595,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
545
595
|
async getReadme(gallery, token) {
|
|
546
596
|
const readmeUrl = gallery.readmeUrl;
|
|
547
597
|
if (!readmeUrl) {
|
|
548
|
-
return Promise.resolve(( localize(
|
|
598
|
+
return Promise.resolve(( localize(2800, "No README available")));
|
|
549
599
|
}
|
|
550
600
|
const uri = ( URI.parse(readmeUrl));
|
|
551
601
|
if (uri.scheme === Schemas.file) {
|
|
@@ -557,7 +607,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
557
607
|
}
|
|
558
608
|
}
|
|
559
609
|
if (uri.authority !== "raw.githubusercontent.com") {
|
|
560
|
-
return ( new MarkdownString(( localize(
|
|
610
|
+
return ( new MarkdownString(( localize(2801, "You can find information about this server [here]({0})", readmeUrl)))).value;
|
|
561
611
|
}
|
|
562
612
|
const context = await this.requestService.request({
|
|
563
613
|
type: "GET",
|
|
@@ -647,19 +697,22 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
647
697
|
}
|
|
648
698
|
};
|
|
649
699
|
}
|
|
650
|
-
async queryGalleryMcpServers(query, mcpGalleryManifest, token) {
|
|
700
|
+
async queryGalleryMcpServers(query, mcpGalleryManifest, token, strict = false) {
|
|
651
701
|
const {
|
|
652
702
|
servers,
|
|
653
703
|
metadata
|
|
654
|
-
} = await this.queryRawGalleryMcpServers(query, mcpGalleryManifest, token);
|
|
704
|
+
} = await this.queryRawGalleryMcpServers(query, mcpGalleryManifest, token, strict);
|
|
655
705
|
return {
|
|
656
706
|
servers: servers.map(item => this.toGalleryMcpServer(item, mcpGalleryManifest)),
|
|
657
707
|
metadata
|
|
658
708
|
};
|
|
659
709
|
}
|
|
660
|
-
async queryRawGalleryMcpServers(query, mcpGalleryManifest, token) {
|
|
710
|
+
async queryRawGalleryMcpServers(query, mcpGalleryManifest, token, strict = false) {
|
|
661
711
|
const mcpGalleryUrl = this.getMcpGalleryUrl(mcpGalleryManifest);
|
|
662
712
|
if (!mcpGalleryUrl) {
|
|
713
|
+
if (strict) {
|
|
714
|
+
throw ( new Error(( localize(2802, "The MCP gallery has no query endpoint."))));
|
|
715
|
+
}
|
|
663
716
|
return {
|
|
664
717
|
servers: [],
|
|
665
718
|
metadata: {
|
|
@@ -675,11 +728,14 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
675
728
|
return JSON.parse(data);
|
|
676
729
|
} catch (error) {
|
|
677
730
|
this.logService.error(`Failed to read file from ${uri}: ${error}`);
|
|
731
|
+
if (strict) {
|
|
732
|
+
throw error;
|
|
733
|
+
}
|
|
678
734
|
}
|
|
679
735
|
}
|
|
680
736
|
let url = `${mcpGalleryUrl}?limit=${query.pageSize}&version=latest`;
|
|
681
737
|
if (query.cursor) {
|
|
682
|
-
url += `&cursor=${query.cursor}`;
|
|
738
|
+
url += `&cursor=${encodeURIComponent(query.cursor)}`;
|
|
683
739
|
}
|
|
684
740
|
if (query.searchText) {
|
|
685
741
|
const text = encodeURIComponent(query.searchText);
|
|
@@ -697,6 +753,9 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
697
753
|
throw error;
|
|
698
754
|
}
|
|
699
755
|
this.logService.error(`Failed to query MCP gallery: ${error}`);
|
|
756
|
+
if (strict) {
|
|
757
|
+
throw error;
|
|
758
|
+
}
|
|
700
759
|
return {
|
|
701
760
|
servers: [],
|
|
702
761
|
metadata: {
|
|
@@ -706,6 +765,9 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
706
765
|
}
|
|
707
766
|
if (!isSuccess(context)) {
|
|
708
767
|
this.logService.error(`Failed to query MCP gallery: Server returned ${context.res.statusCode}`);
|
|
768
|
+
if (strict) {
|
|
769
|
+
throw ( new Error(( localize(2803, "The MCP gallery returned HTTP {0}.", context.res.statusCode))));
|
|
770
|
+
}
|
|
709
771
|
return {
|
|
710
772
|
servers: [],
|
|
711
773
|
metadata: {
|
|
@@ -715,6 +777,9 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
715
777
|
}
|
|
716
778
|
const data = await asJson(context);
|
|
717
779
|
if (!data) {
|
|
780
|
+
if (strict) {
|
|
781
|
+
throw ( new Error(( localize(2804, "The MCP gallery returned an empty response."))));
|
|
782
|
+
}
|
|
718
783
|
return {
|
|
719
784
|
servers: [],
|
|
720
785
|
metadata: {
|
|
@@ -728,7 +793,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
728
793
|
}
|
|
729
794
|
return result;
|
|
730
795
|
}
|
|
731
|
-
async getMcpServer(mcpServerUrl, mcpGalleryManifest) {
|
|
796
|
+
async getMcpServer(mcpServerUrl, mcpGalleryManifest, token = CancellationToken.None) {
|
|
732
797
|
const manifest = mcpGalleryManifest ?? (await this.mcpGalleryManifestService.getMcpGalleryManifest());
|
|
733
798
|
if (!manifest) {
|
|
734
799
|
throw ( new Error("Cannot fetch MCP server because no MCP gallery is configured"));
|
|
@@ -741,25 +806,49 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
741
806
|
type: "GET",
|
|
742
807
|
url: validatedMcpServerUrl,
|
|
743
808
|
followRedirects: 0,
|
|
809
|
+
...(mcpGalleryManifest ? {
|
|
810
|
+
timeout: mcpServerRequestTimeout
|
|
811
|
+
} : {}),
|
|
744
812
|
callSite: "mcpGalleryService.getMcpServer"
|
|
745
|
-
},
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
813
|
+
}, token);
|
|
814
|
+
try {
|
|
815
|
+
if (context.res.statusCode === 404) {
|
|
816
|
+
return undefined;
|
|
817
|
+
}
|
|
818
|
+
if (!isSuccess(context)) {
|
|
819
|
+
throw ( new Error(
|
|
820
|
+
`Failed to fetch MCP server from ${mcpServerUrl}: server responded with ${context.res.statusCode}`
|
|
821
|
+
));
|
|
822
|
+
}
|
|
823
|
+
let data;
|
|
824
|
+
if (mcpGalleryManifest) {
|
|
825
|
+
const text = await raceCancellationError(
|
|
826
|
+
readBoundedResponse(context, maxMcpServerResponseBytes, () => ( new Error(( localize(2805, "The MCP registry response is too large to install."))))),
|
|
827
|
+
token
|
|
828
|
+
);
|
|
829
|
+
try {
|
|
830
|
+
data = JSON.parse(text);
|
|
831
|
+
} catch {
|
|
832
|
+
throw ( new Error(( localize(2806, "The MCP registry returned invalid server metadata."))));
|
|
833
|
+
}
|
|
834
|
+
} else {
|
|
835
|
+
data = await raceCancellationError(asJson(context), token);
|
|
836
|
+
}
|
|
837
|
+
if (!data) {
|
|
838
|
+
throw ( new Error(`Failed to fetch MCP server from ${mcpServerUrl}: empty response`));
|
|
839
|
+
}
|
|
840
|
+
const server = this.serializeMcpServer(data, manifest);
|
|
841
|
+
if (!server) {
|
|
842
|
+
const setup = getUnsupportedMcpSetup(data);
|
|
843
|
+
if (setup) {
|
|
844
|
+
throw ( new UnsupportedMcpGalleryPackageError(setup.repositoryUrl));
|
|
845
|
+
}
|
|
846
|
+
throw ( new Error(`Failed to serialize MCP server from ${mcpServerUrl}`, data));
|
|
847
|
+
}
|
|
848
|
+
return this.toGalleryMcpServer(server, manifest);
|
|
849
|
+
} finally {
|
|
850
|
+
context.stream.destroy();
|
|
761
851
|
}
|
|
762
|
-
return this.toGalleryMcpServer(server, manifest);
|
|
763
852
|
}
|
|
764
853
|
serializeMcpServer(data, mcpGalleryManifest) {
|
|
765
854
|
return this.getSerializer(mcpGalleryManifest)?.toRawGalleryMcpServer(data);
|
|
@@ -822,4 +911,4 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
822
911
|
};
|
|
823
912
|
McpGalleryService = ( __decorate([( __param(0, IRequestService)), ( __param(1, IFileService)), ( __param(2, ILogService)), ( __param(3, IMcpGalleryManifestService))], McpGalleryService));
|
|
824
913
|
|
|
825
|
-
export { McpGalleryService };
|
|
914
|
+
export { McpGalleryService, UnsupportedMcpGalleryPackageError };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpWorkspaceInstallTargetService, McpWorkspaceInstallTarget } from "../../../../workbench/services/mcp/common/mcpWorkspaceInstallTargetService.js";
|
|
2
|
+
export declare class SessionsMcpWorkspaceInstallTargetService extends McpWorkspaceInstallTargetService {
|
|
3
|
+
getTargets(): readonly McpWorkspaceInstallTarget[];
|
|
4
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
|
|
3
|
+
import { McpWorkspaceInstallTargetService } from '../../../../workbench/services/mcp/common/mcpWorkspaceInstallTargetService.js';
|
|
4
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
+
|
|
6
|
+
class SessionsMcpWorkspaceInstallTargetService extends McpWorkspaceInstallTargetService {
|
|
7
|
+
getTargets() {
|
|
8
|
+
return this.workspaceService.getWorkspace().folders;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { SessionsMcpWorkspaceInstallTargetService };
|
|
@@ -4,6 +4,7 @@ import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platf
|
|
|
4
4
|
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
5
5
|
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
6
6
|
import { LogLevel } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log";
|
|
7
|
+
import { IAllowedMcpServersService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service";
|
|
7
8
|
import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
8
9
|
import { ISecretStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/secrets/common/secrets.service";
|
|
9
10
|
import { IWorkbenchMcpGatewayService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpGatewayService.service";
|
|
@@ -32,17 +33,20 @@ export declare class MainThreadMcp extends Disposable implements MainThreadMcpSh
|
|
|
32
33
|
private readonly _mcpGatewayService;
|
|
33
34
|
private readonly _configurationService;
|
|
34
35
|
private readonly _secretStorageService;
|
|
36
|
+
private readonly _allowedMcpServersService;
|
|
35
37
|
private _serverIdCounter;
|
|
36
38
|
private readonly _servers;
|
|
37
39
|
private readonly _serverDefinitions;
|
|
40
|
+
private readonly _serverRequestUrls;
|
|
38
41
|
private readonly _serverAuthTracking;
|
|
39
42
|
private readonly _proxy;
|
|
40
43
|
private readonly _collectionDefinitions;
|
|
41
44
|
private readonly _gateways;
|
|
42
|
-
constructor(_extHostContext: IExtHostContext, _mcpRegistry: IMcpRegistry, dialogService: IDialogService, _authenticationService: IAuthenticationService, authenticationMcpServersService: IAuthenticationMcpService, authenticationMCPServerAccessService: IAuthenticationMcpAccessService, authenticationMCPServerUsageService: IAuthenticationMcpUsageService, _dynamicAuthenticationProviderStorageService: IDynamicAuthenticationProviderStorageService, _extensionService: IExtensionService, _contextKeyService: IContextKeyService, _telemetryService: ITelemetryService, _mcpGatewayService: IWorkbenchMcpGatewayService, _configurationService: IConfigurationService, _secretStorageService: ISecretStorageService);
|
|
45
|
+
constructor(_extHostContext: IExtHostContext, _mcpRegistry: IMcpRegistry, dialogService: IDialogService, _authenticationService: IAuthenticationService, authenticationMcpServersService: IAuthenticationMcpService, authenticationMCPServerAccessService: IAuthenticationMcpAccessService, authenticationMCPServerUsageService: IAuthenticationMcpUsageService, _dynamicAuthenticationProviderStorageService: IDynamicAuthenticationProviderStorageService, _extensionService: IExtensionService, _contextKeyService: IContextKeyService, _telemetryService: ITelemetryService, _mcpGatewayService: IWorkbenchMcpGatewayService, _configurationService: IConfigurationService, _secretStorageService: ISecretStorageService, _allowedMcpServersService: IAllowedMcpServersService);
|
|
43
46
|
private _publishServerDefinitions;
|
|
44
47
|
$upsertMcpCollection(collection: McpCollectionDefinition.FromExtHost, serversDto: McpServerDefinition.Serialized[]): void;
|
|
45
48
|
$deleteMcpCollection(collectionId: string): void;
|
|
49
|
+
$checkMcpServerAllowed(id: number, url: string): Promise<string | undefined>;
|
|
46
50
|
$onDidChangeState(id: number, update: McpConnectionState): void;
|
|
47
51
|
$onDidPublishLog(id: number, level: LogLevel, log: string): void;
|
|
48
52
|
$onDidReceiveMessage(id: number, message: string): void;
|
|
@@ -77,6 +81,8 @@ export interface IMcpServerAuthContext {
|
|
|
77
81
|
readonly clientId?: string;
|
|
78
82
|
readonly resource?: string;
|
|
79
83
|
readonly audience?: string;
|
|
84
|
+
/** Secret-storage reference; the secret itself is never retained here. */
|
|
85
|
+
readonly clientSecretStorageKey?: string;
|
|
80
86
|
}
|
|
81
87
|
/**
|
|
82
88
|
* Tracks which MCP servers are using which authentication providers.
|