@codingame/monaco-vscode-mcp-service-override 37.1.0 → 37.3.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.
Files changed (44) hide show
  1. package/common.d.ts +2 -0
  2. package/common.js +56 -0
  3. package/index.d.ts +1 -2
  4. package/index.js +1 -51
  5. package/package.json +10 -2
  6. package/session.d.ts +1 -0
  7. package/session.js +2 -0
  8. package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +3 -3
  9. package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +8 -8
  10. package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.js +7 -3
  11. package/vscode/src/vs/workbench/api/browser/mainThreadMcp.d.ts +108 -0
  12. package/vscode/src/vs/workbench/api/browser/mainThreadMcp.js +698 -0
  13. package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +3 -3
  14. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
  15. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +108 -108
  16. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +47 -47
  17. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.js +4 -4
  18. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +37 -37
  19. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +20 -16
  20. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +52 -50
  21. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +45 -43
  22. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +2 -2
  23. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +5 -5
  24. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +5 -5
  25. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +18 -18
  26. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +14 -14
  27. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +8 -6
  28. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +1 -1
  29. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.js +2 -2
  30. package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +13 -13
  31. package/vscode/src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.js +4 -4
  32. package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +7 -7
  33. package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +25 -25
  34. package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.js +1 -1
  35. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +1 -1
  36. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +28 -24
  37. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js +6 -6
  38. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +3 -3
  39. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.js +1 -1
  40. package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +13 -11
  41. package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +13 -18
  42. package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.js +3 -1
  43. package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.service.d.ts +0 -6
  44. package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.service.js +0 -6
package/common.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { type IEditorOverrideServices } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices";
2
+ export default function getServiceOverride(): IEditorOverrideServices;
package/common.js ADDED
@@ -0,0 +1,56 @@
1
+
2
+ import '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices';
3
+ import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
4
+ import { AllowedMcpServersService } from './vscode/src/vs/platform/mcp/common/allowedMcpServersService.js';
5
+ import { IMcpGalleryManifestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpGalleryManifest.service';
6
+ import { McpGalleryService } from './vscode/src/vs/platform/mcp/common/mcpGalleryService.js';
7
+ import { IAllowedMcpServersService, IMcpGalleryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service';
8
+ import { McpResourceScannerService } from './vscode/src/vs/platform/mcp/common/mcpResourceScannerService.js';
9
+ import { IMcpResourceScannerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpResourceScannerService.service';
10
+ import { McpElicitationService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js';
11
+ import { McpWorkbenchService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js';
12
+ import { McpRegistry } from './vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js';
13
+ import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
14
+ import { McpSamplingService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js';
15
+ import { IMcpSandboxService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpSandboxService.service';
16
+ import { McpService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpService.js';
17
+ import { IMcpElicitationService, IMcpSamplingService, IMcpWorkbenchService, IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
18
+ import { AuthenticationMcpAccessService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.js';
19
+ import { IAuthenticationMcpAccessService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpAccessService.service';
20
+ import { AuthenticationMcpService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js';
21
+ import { IAuthenticationMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpService.service';
22
+ import { AuthenticationMcpUsageService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.js';
23
+ import { IAuthenticationMcpUsageService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpUsageService.service';
24
+ import { WorkbenchMcpGalleryManifestService } from './vscode/src/vs/workbench/services/mcp/browser/mcpGalleryManifestService.js';
25
+ import { WorkbenchMcpManagementService } from './vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.js';
26
+ import { IWorkbenchMcpManagementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.service';
27
+ import { McpSandboxService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js';
28
+ import { IWorkbenchMcpGatewayService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpGatewayService.service';
29
+ import { BrowserMcpGatewayService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.js';
30
+ import { IMcpDevModeDebugging } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpDevMode.service';
31
+ import { McpDevModeDebugging } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpDevMode';
32
+ import './vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js';
33
+ import './vscode/src/vs/workbench/api/browser/mainThreadMcp.js';
34
+
35
+ function getServiceOverride() {
36
+ return {
37
+ [IMcpResourceScannerService.toString()]: new SyncDescriptor(McpResourceScannerService, [], true),
38
+ [IMcpService.toString()]: new SyncDescriptor(McpService, [], true),
39
+ [IMcpRegistry.toString()]: new SyncDescriptor(McpRegistry, [], true),
40
+ [IAuthenticationMcpService.toString()]: new SyncDescriptor(AuthenticationMcpService, [], true),
41
+ [IAuthenticationMcpAccessService.toString()]: new SyncDescriptor(AuthenticationMcpAccessService, [], true),
42
+ [IAuthenticationMcpUsageService.toString()]: new SyncDescriptor(AuthenticationMcpUsageService, [], true),
43
+ [IMcpWorkbenchService.toString()]: new SyncDescriptor(McpWorkbenchService, [], true),
44
+ [IMcpGalleryService.toString()]: new SyncDescriptor(McpGalleryService, [], true),
45
+ [IMcpSamplingService.toString()]: new SyncDescriptor(McpSamplingService, [], true),
46
+ [IMcpElicitationService.toString()]: new SyncDescriptor(McpElicitationService, [], true),
47
+ [IWorkbenchMcpManagementService.toString()]: new SyncDescriptor(WorkbenchMcpManagementService, [], true),
48
+ [IAllowedMcpServersService.toString()]: new SyncDescriptor(AllowedMcpServersService, [], true),
49
+ [IMcpGalleryManifestService.toString()]: new SyncDescriptor(WorkbenchMcpGalleryManifestService, [], true),
50
+ [IMcpSandboxService.toString()]: new SyncDescriptor(McpSandboxService, [], true),
51
+ [IWorkbenchMcpGatewayService.toString()]: new SyncDescriptor(BrowserMcpGatewayService, [], true),
52
+ [IMcpDevModeDebugging.toString()]: new SyncDescriptor(McpDevModeDebugging, [], true)
53
+ };
54
+ }
55
+
56
+ export { getServiceOverride as default };
package/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- import { type IEditorOverrideServices } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices";
2
- export default function getServiceOverride(): IEditorOverrideServices;
1
+ export { default } from "./common.js";
package/index.js CHANGED
@@ -1,53 +1,3 @@
1
1
 
2
- import '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices';
3
- import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
4
- import { AllowedMcpServersService } from './vscode/src/vs/platform/mcp/common/allowedMcpServersService.js';
5
- import { IMcpGalleryManifestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpGalleryManifest.service';
6
- import { McpGalleryService } from './vscode/src/vs/platform/mcp/common/mcpGalleryService.js';
7
- import { IAllowedMcpServersService, IMcpGalleryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service';
8
- import { McpResourceScannerService } from './vscode/src/vs/platform/mcp/common/mcpResourceScannerService.js';
9
- import { IMcpResourceScannerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpResourceScannerService.service';
10
- import { McpElicitationService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js';
11
- import { McpWorkbenchService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js';
12
- import { McpRegistry } from './vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js';
13
- import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
14
- import { McpSamplingService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js';
15
- import { IMcpSandboxService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpSandboxService.service';
16
- import { McpService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpService.js';
17
- import { IMcpElicitationService, IMcpSamplingService, IMcpWorkbenchService, IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
18
- import { AuthenticationMcpAccessService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.js';
19
- import { IAuthenticationMcpAccessService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpAccessService.service';
20
- import { AuthenticationMcpService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js';
21
- import { IAuthenticationMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpService.service';
22
- import { AuthenticationMcpUsageService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.js';
23
- import { IAuthenticationMcpUsageService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpUsageService.service';
24
- import { WorkbenchMcpGalleryManifestService } from './vscode/src/vs/workbench/services/mcp/browser/mcpGalleryManifestService.js';
25
- import { WorkbenchMcpManagementService } from './vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.js';
26
- import { IWorkbenchMcpManagementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.service';
27
- import { McpSandboxService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js';
28
- import { IWorkbenchMcpGatewayService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpGatewayService.service';
29
- import { BrowserMcpGatewayService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.js';
30
- import './vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js';
2
+ export { default } from './common.js';
31
3
  import './vscode/src/vs/workbench/contrib/mcp/browser/mcp.view.contribution.js';
32
-
33
- function getServiceOverride() {
34
- return {
35
- [IMcpResourceScannerService.toString()]: new SyncDescriptor(McpResourceScannerService, [], true),
36
- [IMcpService.toString()]: new SyncDescriptor(McpService, [], true),
37
- [IMcpRegistry.toString()]: new SyncDescriptor(McpRegistry, [], true),
38
- [IAuthenticationMcpService.toString()]: new SyncDescriptor(AuthenticationMcpService, [], true),
39
- [IAuthenticationMcpAccessService.toString()]: new SyncDescriptor(AuthenticationMcpAccessService, [], true),
40
- [IAuthenticationMcpUsageService.toString()]: new SyncDescriptor(AuthenticationMcpUsageService, [], true),
41
- [IMcpWorkbenchService.toString()]: new SyncDescriptor(McpWorkbenchService, [], true),
42
- [IMcpGalleryService.toString()]: new SyncDescriptor(McpGalleryService, [], true),
43
- [IMcpSamplingService.toString()]: new SyncDescriptor(McpSamplingService, [], true),
44
- [IMcpElicitationService.toString()]: new SyncDescriptor(McpElicitationService, [], true),
45
- [IWorkbenchMcpManagementService.toString()]: new SyncDescriptor(WorkbenchMcpManagementService, [], true),
46
- [IAllowedMcpServersService.toString()]: new SyncDescriptor(AllowedMcpServersService, [], true),
47
- [IMcpGalleryManifestService.toString()]: new SyncDescriptor(WorkbenchMcpGalleryManifestService, [], true),
48
- [IMcpSandboxService.toString()]: new SyncDescriptor(McpSandboxService, [], true),
49
- [IWorkbenchMcpGatewayService.toString()]: new SyncDescriptor(BrowserMcpGatewayService, [], true)
50
- };
51
- }
52
-
53
- export { getServiceOverride as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-mcp-service-override",
3
- "version": "37.1.0",
3
+ "version": "37.3.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.1.0"
18
+ "@codingame/monaco-vscode-api": "37.3.0"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -31,6 +31,14 @@
31
31
  "types": "./vscode/src/*.d.ts",
32
32
  "default": "./vscode/src/*.js"
33
33
  },
34
+ "./session": {
35
+ "types": "./session.d.ts",
36
+ "default": "./session.js"
37
+ },
38
+ "./common": {
39
+ "types": "./common.d.ts",
40
+ "default": "./common.js"
41
+ },
34
42
  "./*": {
35
43
  "types": "./*.d.ts",
36
44
  "default": "./*.js"
package/session.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { default } from "./common.js";
package/session.js ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { default } from './common.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
- 2398,
35
+ 2416,
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
- 2399,
46
+ 2417,
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
- 2400,
51
+ 2418,
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
  }
@@ -483,7 +483,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
483
483
  }
484
484
  return result;
485
485
  }
486
- await Promise.all(( infos.map(async info => {
486
+ await Promise.all(infos.map(async info => {
487
487
  try {
488
488
  const mcpServer = await this.getMcpServerByName(info, mcpGalleryManifest);
489
489
  result.set(info.name, mcpServer ? {
@@ -498,7 +498,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
498
498
  status: McpGalleryResolveStatus.Failed
499
499
  });
500
500
  }
501
- })));
501
+ }));
502
502
  return result;
503
503
  }
504
504
  async getMcpServerByName(
@@ -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(2401, "No README available")));
548
+ return Promise.resolve(( localize(2419, "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(2402, "You can find information about this server [here]({0})", readmeUrl)))).value;
560
+ return ( new MarkdownString(( localize(2420, "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",
@@ -575,9 +575,9 @@ let McpGalleryService = class McpGalleryService extends Disposable {
575
575
  let displayName = server.title;
576
576
  if (server.githubInfo?.name) {
577
577
  if (!displayName) {
578
- displayName = ( server.githubInfo.name.split("-").map(
578
+ displayName = server.githubInfo.name.split("-").map(
579
579
  s => s.toLowerCase() === "mcp" ? "MCP" : s.toLowerCase() === "github" ? "GitHub" : uppercaseFirstLetter(s)
580
- )).join(" ");
580
+ ).join(" ");
581
581
  }
582
582
  publisher = server.githubInfo.nameWithOwner.split("/")[0];
583
583
  } else {
@@ -589,7 +589,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
589
589
  }
590
590
  }
591
591
  if (!displayName) {
592
- displayName = ( nameParts[nameParts.length - 1].split("-").map(s => uppercaseFirstLetter(s))).join(" ");
592
+ displayName = nameParts[nameParts.length - 1].split("-").map(s => uppercaseFirstLetter(s)).join(" ");
593
593
  }
594
594
  }
595
595
  if (server.githubInfo?.displayName) {
@@ -653,7 +653,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
653
653
  metadata
654
654
  } = await this.queryRawGalleryMcpServers(query, mcpGalleryManifest, token);
655
655
  return {
656
- servers: ( servers.map(item => this.toGalleryMcpServer(item, mcpGalleryManifest))),
656
+ servers: servers.map(item => this.toGalleryMcpServer(item, mcpGalleryManifest)),
657
657
  metadata
658
658
  };
659
659
  }
@@ -36,7 +36,7 @@ let McpResourceScannerService = class McpResourceScannerService extends Disposab
36
36
  } of servers) {
37
37
  existingServers[name] = config;
38
38
  if (inputs) {
39
- const existingInputIds = ( new Set(( updatedInputs.map(input => input.id))));
39
+ const existingInputIds = ( new Set(updatedInputs.map(input => input.id)));
40
40
  const newInputs = inputs.filter(input => !( existingInputIds.has(input.id)));
41
41
  updatedInputs = [...updatedInputs, ...newInputs];
42
42
  }
@@ -73,7 +73,9 @@ let McpResourceScannerService = class McpResourceScannerService extends Disposab
73
73
  allowEmptyContent: true
74
74
  }) || {};
75
75
  if (errors.length > 0) {
76
- throw ( new Error("Failed to parse scanned MCP servers: " + ( errors.map(e => `[${e.offset}, ${e.length}] ${getParseErrorMessage(e.error)}`)).join(", ")));
76
+ throw ( new Error(
77
+ "Failed to parse scanned MCP servers: " + errors.map(e => `[${e.offset}, ${e.length}] ${getParseErrorMessage(e.error)}`).join(", ")
78
+ ));
77
79
  }
78
80
  if (target === ConfigurationTarget.USER) {
79
81
  scannedMcpServers = this.fromUserMcpServers(result);
@@ -131,7 +133,9 @@ let McpResourceScannerService = class McpResourceScannerService extends Disposab
131
133
  allowEmptyContent: true
132
134
  });
133
135
  if (errors.length > 0) {
134
- throw ( new Error("Failed to parse scanned MCP servers: " + ( errors.map(e => `[${e.offset}, ${e.length}] ${getParseErrorMessage(e.error)}`)).join(", ")));
136
+ throw ( new Error(
137
+ "Failed to parse scanned MCP servers: " + errors.map(e => `[${e.offset}, ${e.length}] ${getParseErrorMessage(e.error)}`).join(", ")
138
+ ));
135
139
  }
136
140
  } catch (error) {
137
141
  if (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {
@@ -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
+ }