@codingame/monaco-vscode-mcp-service-override 37.0.0 → 37.2.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/index.js +1 -0
- package/package.json +2 -2
- package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +3 -3
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +2 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadMcp.d.ts +108 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadMcp.js +698 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +96 -96
- 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/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.js +17 -17
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +10 -10
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +6 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +13 -13
- 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.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +3 -3
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +9 -9
package/index.js
CHANGED
|
@@ -29,6 +29,7 @@ import { IWorkbenchMcpGatewayService } from '@codingame/monaco-vscode-api/vscode
|
|
|
29
29
|
import { BrowserMcpGatewayService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.js';
|
|
30
30
|
import './vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js';
|
|
31
31
|
import './vscode/src/vs/workbench/contrib/mcp/browser/mcp.view.contribution.js';
|
|
32
|
+
import './vscode/src/vs/workbench/api/browser/mainThreadMcp.js';
|
|
32
33
|
|
|
33
34
|
function getServiceOverride() {
|
|
34
35
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-mcp-service-override",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.2.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": "37.
|
|
18
|
+
"@codingame/monaco-vscode-api": "37.2.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -32,7 +32,7 @@ let AllowedMcpServersService = class AllowedMcpServersService extends Disposable
|
|
|
32
32
|
query: `@id:${mcpAccessConfig}`
|
|
33
33
|
}).toString());
|
|
34
34
|
return (new MarkdownString(localize(
|
|
35
|
-
|
|
35
|
+
2398,
|
|
36
36
|
"Model Context Protocol servers are disabled in the Editor. Please check your [settings]({0}).",
|
|
37
37
|
settingsCommandLink
|
|
38
38
|
)));
|
|
@@ -43,12 +43,12 @@ let AllowedMcpServersService = class AllowedMcpServersService extends Disposable
|
|
|
43
43
|
switch (checkMcpServerAllowed(allowlist, denylist, identity)) {
|
|
44
44
|
case McpServerAllowResult.Denied:
|
|
45
45
|
return (new MarkdownString(localize(
|
|
46
|
-
|
|
46
|
+
2399,
|
|
47
47
|
"This Model Context Protocol server is blocked by your organization's policy. Please contact your administrator for more information."
|
|
48
48
|
)));
|
|
49
49
|
case McpServerAllowResult.NotAllowed:
|
|
50
50
|
return (new MarkdownString(localize(
|
|
51
|
-
|
|
51
|
+
2400,
|
|
52
52
|
"This Model Context Protocol server is not in the list of servers allowed by your organization. Please contact your administrator for more information."
|
|
53
53
|
)));
|
|
54
54
|
}
|
|
@@ -545,7 +545,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
545
545
|
async getReadme(gallery, token) {
|
|
546
546
|
const readmeUrl = gallery.readmeUrl;
|
|
547
547
|
if (!readmeUrl) {
|
|
548
|
-
return Promise.resolve(( localize(
|
|
548
|
+
return Promise.resolve(( localize(2401, "No README available")));
|
|
549
549
|
}
|
|
550
550
|
const uri = ( URI.parse(readmeUrl));
|
|
551
551
|
if (uri.scheme === Schemas.file) {
|
|
@@ -557,7 +557,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
if (uri.authority !== "raw.githubusercontent.com") {
|
|
560
|
-
return ( new MarkdownString(( localize(
|
|
560
|
+
return ( new MarkdownString(( localize(2402, "You can find information about this server [here]({0})", readmeUrl)))).value;
|
|
561
561
|
}
|
|
562
562
|
const context = await this.requestService.request({
|
|
563
563
|
type: "GET",
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { URI, UriComponents } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
3
|
+
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
4
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
5
|
+
import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
6
|
+
import { LogLevel } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log";
|
|
7
|
+
import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
8
|
+
import { ISecretStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/secrets/common/secrets.service";
|
|
9
|
+
import { IWorkbenchMcpGatewayService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpGatewayService.service";
|
|
10
|
+
import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
|
|
11
|
+
import { McpCollectionDefinition, McpConnectionState, McpServerDefinition } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
12
|
+
import { IAuthenticationMcpAccessService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpAccessService.service";
|
|
13
|
+
import { IAuthenticationMcpService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpService.service";
|
|
14
|
+
import { IAuthenticationMcpUsageService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpUsageService.service";
|
|
15
|
+
import { IAuthenticationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service";
|
|
16
|
+
import { IDynamicAuthenticationProviderStorageService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/dynamicAuthenticationProviderStorage.service";
|
|
17
|
+
import { IExtensionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service";
|
|
18
|
+
import { IExtHostContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers";
|
|
19
|
+
import { IMcpAuthenticationDetails, IMcpAuthenticationOptions, IAuthMetadataSource, MainThreadMcpShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
|
|
20
|
+
export declare class MainThreadMcp extends Disposable implements MainThreadMcpShape {
|
|
21
|
+
private readonly _extHostContext;
|
|
22
|
+
private readonly _mcpRegistry;
|
|
23
|
+
private readonly dialogService;
|
|
24
|
+
private readonly _authenticationService;
|
|
25
|
+
private readonly authenticationMcpServersService;
|
|
26
|
+
private readonly authenticationMCPServerAccessService;
|
|
27
|
+
private readonly authenticationMCPServerUsageService;
|
|
28
|
+
private readonly _dynamicAuthenticationProviderStorageService;
|
|
29
|
+
private readonly _extensionService;
|
|
30
|
+
private readonly _contextKeyService;
|
|
31
|
+
private readonly _telemetryService;
|
|
32
|
+
private readonly _mcpGatewayService;
|
|
33
|
+
private readonly _configurationService;
|
|
34
|
+
private readonly _secretStorageService;
|
|
35
|
+
private _serverIdCounter;
|
|
36
|
+
private readonly _servers;
|
|
37
|
+
private readonly _serverDefinitions;
|
|
38
|
+
private readonly _serverAuthTracking;
|
|
39
|
+
private readonly _proxy;
|
|
40
|
+
private readonly _collectionDefinitions;
|
|
41
|
+
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);
|
|
43
|
+
private _publishServerDefinitions;
|
|
44
|
+
$upsertMcpCollection(collection: McpCollectionDefinition.FromExtHost, serversDto: McpServerDefinition.Serialized[]): void;
|
|
45
|
+
$deleteMcpCollection(collectionId: string): void;
|
|
46
|
+
$onDidChangeState(id: number, update: McpConnectionState): void;
|
|
47
|
+
$onDidPublishLog(id: number, level: LogLevel, log: string): void;
|
|
48
|
+
$onDidReceiveMessage(id: number, message: string): void;
|
|
49
|
+
$getTokenForProviderId(id: number, providerId: string, scopes: string[], options?: IMcpAuthenticationOptions): Promise<string | undefined>;
|
|
50
|
+
$getTokenFromServerMetadata(id: number, authDetails: IMcpAuthenticationDetails, { errorOnUserInteraction, forceNewRegistration, clientId }?: IMcpAuthenticationOptions): Promise<string | undefined>;
|
|
51
|
+
private _ensureXaaIssuer;
|
|
52
|
+
private _getSessionForProvider;
|
|
53
|
+
private continueWithIncorrectAccountPrompt;
|
|
54
|
+
private _onDidChangeAuthSessions;
|
|
55
|
+
$logMcpAuthSetup(data: IAuthMetadataSource): void;
|
|
56
|
+
$startMcpGateway(chatSessionResource?: UriComponents): Promise<{
|
|
57
|
+
servers: {
|
|
58
|
+
label: string;
|
|
59
|
+
address: URI;
|
|
60
|
+
}[];
|
|
61
|
+
gatewayId: string;
|
|
62
|
+
} | undefined>;
|
|
63
|
+
$disposeMcpGateway(gatewayId: string): void;
|
|
64
|
+
private loginPrompt;
|
|
65
|
+
dispose(): void;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The context needed to re-acquire a token for a tracked MCP server, captured when the
|
|
69
|
+
* session was first established. The tracker holds this opaquely and replays it verbatim on
|
|
70
|
+
* re-validation so the silent token request targets the same authority / resource / audience
|
|
71
|
+
* that the original sign-in used. Dropping the authorization server here would let the provider
|
|
72
|
+
* fall back to a default authority (e.g. the Microsoft provider's `organizations` tenant) and
|
|
73
|
+
* request a token against the wrong tenant.
|
|
74
|
+
*/
|
|
75
|
+
export interface IMcpServerAuthContext {
|
|
76
|
+
readonly authorizationServer?: URI;
|
|
77
|
+
readonly clientId?: string;
|
|
78
|
+
readonly resource?: string;
|
|
79
|
+
readonly audience?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Tracks which MCP servers are using which authentication providers.
|
|
83
|
+
* Organized by provider ID for efficient lookup when auth sessions change.
|
|
84
|
+
*/
|
|
85
|
+
export declare class McpServerAuthTracker {
|
|
86
|
+
private readonly _tracking;
|
|
87
|
+
/**
|
|
88
|
+
* Track authentication for a server with a specific provider.
|
|
89
|
+
* Replaces any existing tracking for this server/provider combination.
|
|
90
|
+
*/
|
|
91
|
+
track(providerId: string, serverId: number, scopes: string[], context: IMcpServerAuthContext): void;
|
|
92
|
+
/**
|
|
93
|
+
* Remove all authentication tracking for a server across all providers.
|
|
94
|
+
*/
|
|
95
|
+
untrack(serverId: number): void;
|
|
96
|
+
/**
|
|
97
|
+
* Get all servers using a specific authentication provider.
|
|
98
|
+
*/
|
|
99
|
+
get(providerId: string): ReadonlyArray<{
|
|
100
|
+
serverId: number;
|
|
101
|
+
scopes: string[];
|
|
102
|
+
context: IMcpServerAuthContext;
|
|
103
|
+
}> | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Clear all tracking data.
|
|
106
|
+
*/
|
|
107
|
+
clear(): void;
|
|
108
|
+
}
|