@codingame/monaco-vscode-mcp-service-override 17.2.0 → 18.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/index.js +20 -2
- package/package.json +14 -5
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.d.ts +26 -0
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +170 -0
- package/vscode/src/vs/platform/mcp/common/mcpManagementService.d.ts +35 -0
- package/vscode/src/vs/platform/mcp/common/mcpManagementService.js +292 -0
- package/vscode/src/vs/platform/mcp/common/mcpPlatformTypes.d.ts +65 -0
- package/vscode/src/vs/platform/mcp/common/mcpPlatformTypes.js +9 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +64 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +76 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpDiscovery.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +73 -27
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.d.ts +106 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +423 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.d.ts +61 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +542 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +45 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +272 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +193 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +176 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/configMcpDiscovery.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/configMcpDiscovery.js +27 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +8 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +6 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceMcpDiscoveryAdapter.js +4 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpConfigPathsService.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.js +89 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.service.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.service.js +6 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.d.ts +8 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +30 -47
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.js +206 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +110 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +256 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.d.ts +29 -13
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.js +313 -116
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +15 -17
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.d.ts +16 -7
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.js +58 -39
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +109 -46
- package/vscode/src/vs/workbench/contrib/mcp/common/uriTemplate.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/uriTemplate.js +296 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.d.ts +27 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.js +73 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.d.ts +51 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +391 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.d.ts +27 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.js +105 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocol.d.ts +0 -395
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocol.js +0 -14
package/index.js
CHANGED
|
@@ -2,18 +2,36 @@
|
|
|
2
2
|
import '@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
3
3
|
import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
|
|
4
4
|
import { IMcpConfigPathsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpConfigPathsService.service';
|
|
5
|
-
import { IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
|
|
5
|
+
import { IMcpSamplingService, IMcpWorkbenchService, IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
|
|
6
6
|
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
7
7
|
import { McpConfigPathsService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpConfigPathsService.js';
|
|
8
8
|
import { McpService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpService.js';
|
|
9
9
|
import { McpRegistry } from './vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js';
|
|
10
10
|
import './vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js';
|
|
11
|
+
import { IAuthenticationMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpService.service';
|
|
12
|
+
import { AuthenticationMcpService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js';
|
|
13
|
+
import { IAuthenticationMcpAccessService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpAccessService.service';
|
|
14
|
+
import { AuthenticationMcpAccessService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.js';
|
|
15
|
+
import { IAuthenticationMcpUsageService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/browser/authenticationMcpUsageService.service';
|
|
16
|
+
import { AuthenticationMcpUsageService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.js';
|
|
17
|
+
import { McpWorkbenchService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js';
|
|
18
|
+
import { IMcpManagementService, IMcpGalleryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service';
|
|
19
|
+
import { McpGalleryService } from './vscode/src/vs/platform/mcp/common/mcpGalleryService.js';
|
|
20
|
+
import { McpManagementService } from './vscode/src/vs/platform/mcp/common/mcpManagementService.js';
|
|
21
|
+
import { McpSamplingService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js';
|
|
11
22
|
|
|
12
23
|
function getServiceOverride() {
|
|
13
24
|
return {
|
|
14
25
|
[IMcpConfigPathsService.toString()]: new SyncDescriptor(McpConfigPathsService, [], true),
|
|
15
26
|
[IMcpService.toString()]: new SyncDescriptor(McpService, [], true),
|
|
16
|
-
[IMcpRegistry.toString()]: new SyncDescriptor(McpRegistry, [], true)
|
|
27
|
+
[IMcpRegistry.toString()]: new SyncDescriptor(McpRegistry, [], true),
|
|
28
|
+
[IAuthenticationMcpService.toString()]: new SyncDescriptor(AuthenticationMcpService, [], true),
|
|
29
|
+
[IAuthenticationMcpAccessService.toString()]: new SyncDescriptor(AuthenticationMcpAccessService, [], true),
|
|
30
|
+
[IAuthenticationMcpUsageService.toString()]: new SyncDescriptor(AuthenticationMcpUsageService, [], true),
|
|
31
|
+
[IMcpWorkbenchService.toString()]: new SyncDescriptor(McpWorkbenchService, [], true),
|
|
32
|
+
[IMcpGalleryService.toString()]: new SyncDescriptor(McpGalleryService, [], true),
|
|
33
|
+
[IMcpManagementService.toString()]: new SyncDescriptor(McpManagementService, [], true),
|
|
34
|
+
[IMcpSamplingService.toString()]: new SyncDescriptor(McpSamplingService, [], true)
|
|
17
35
|
};
|
|
18
36
|
}
|
|
19
37
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-mcp-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - mcp service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,10 +15,19 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-1cb11a73-359e-5a2f-9e95-6989cc9858ee-common": "
|
|
19
|
-
"@codingame/monaco-vscode-
|
|
20
|
-
"@codingame/monaco-vscode-4a3ac544-9a61-534c-88df-756262793ef7-common": "
|
|
21
|
-
"@codingame/monaco-vscode-
|
|
18
|
+
"@codingame/monaco-vscode-1cb11a73-359e-5a2f-9e95-6989cc9858ee-common": "18.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-2673c6e2-17c1-5710-b169-46f3d4a28696-common": "18.0.0",
|
|
20
|
+
"@codingame/monaco-vscode-4a3ac544-9a61-534c-88df-756262793ef7-common": "18.0.0",
|
|
21
|
+
"@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common": "18.0.0",
|
|
22
|
+
"@codingame/monaco-vscode-93784a59-b4cf-520c-8339-f8104d3a4f3e-common": "18.0.0",
|
|
23
|
+
"@codingame/monaco-vscode-937ecbdf-94c7-5b16-aefa-ad78ae557a93-common": "18.0.0",
|
|
24
|
+
"@codingame/monaco-vscode-9ed6fe06-a052-57c2-a234-5d9b94d2e7e0-common": "18.0.0",
|
|
25
|
+
"@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common": "18.0.0",
|
|
26
|
+
"@codingame/monaco-vscode-api": "18.0.0",
|
|
27
|
+
"@codingame/monaco-vscode-c87fff3a-2aa9-52ab-ba4d-17e8d1e5e185-common": "18.0.0",
|
|
28
|
+
"@codingame/monaco-vscode-ce7c734f-7712-563c-9335-d7acb43306af-common": "18.0.0",
|
|
29
|
+
"@codingame/monaco-vscode-cf77987b-b1b7-5359-aaf8-a259c63d9f03-common": "18.0.0",
|
|
30
|
+
"@codingame/monaco-vscode-dcfc2191-2da1-54c7-8fb7-e92c5d11ecef-common": "18.0.0"
|
|
22
31
|
},
|
|
23
32
|
"main": "index.js",
|
|
24
33
|
"module": "index.js",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
4
|
+
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
5
|
+
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
6
|
+
import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
|
|
7
|
+
import { IRequestService } from "@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service";
|
|
8
|
+
import { IGalleryMcpServer, IMcpServerManifest, IQueryOptions } from "@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/platform/mcp/common/mcpManagement";
|
|
9
|
+
import { IMcpGalleryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service";
|
|
10
|
+
export declare class McpGalleryService extends Disposable implements IMcpGalleryService {
|
|
11
|
+
private readonly configurationService;
|
|
12
|
+
private readonly requestService;
|
|
13
|
+
private readonly fileService;
|
|
14
|
+
private readonly productService;
|
|
15
|
+
private readonly logService;
|
|
16
|
+
_serviceBrand: undefined;
|
|
17
|
+
constructor(configurationService: IConfigurationService, requestService: IRequestService, fileService: IFileService, productService: IProductService, logService: ILogService);
|
|
18
|
+
isEnabled(): boolean;
|
|
19
|
+
query(options?: IQueryOptions, token?: CancellationToken): Promise<IGalleryMcpServer[]>;
|
|
20
|
+
getManifest(gallery: IGalleryMcpServer, token: CancellationToken): Promise<IMcpServerManifest>;
|
|
21
|
+
getReadme(gallery: IGalleryMcpServer, token: CancellationToken): Promise<string>;
|
|
22
|
+
private toGalleryMcpServer;
|
|
23
|
+
private fetchGallery;
|
|
24
|
+
private getManifestUrl;
|
|
25
|
+
private getMcpGalleryUrl;
|
|
26
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
4
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
6
|
+
import { joinPath, dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
7
|
+
import { uppercaseFirstLetter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
8
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
9
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
10
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
11
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
12
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
13
|
+
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
14
|
+
import { asJson, asText } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request';
|
|
15
|
+
import { IRequestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service';
|
|
16
|
+
import { mcpGalleryServiceUrlConfig } from '@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/platform/mcp/common/mcpManagement';
|
|
17
|
+
|
|
18
|
+
let McpGalleryService = class McpGalleryService extends Disposable {
|
|
19
|
+
constructor(configurationService, requestService, fileService, productService, logService) {
|
|
20
|
+
super();
|
|
21
|
+
this.configurationService = configurationService;
|
|
22
|
+
this.requestService = requestService;
|
|
23
|
+
this.fileService = fileService;
|
|
24
|
+
this.productService = productService;
|
|
25
|
+
this.logService = logService;
|
|
26
|
+
}
|
|
27
|
+
isEnabled() {
|
|
28
|
+
return this.getMcpGalleryUrl() !== undefined;
|
|
29
|
+
}
|
|
30
|
+
async query(options, token = CancellationToken.None) {
|
|
31
|
+
let { servers } = await this.fetchGallery(token);
|
|
32
|
+
if (options?.text) {
|
|
33
|
+
const searchText = options.text.toLowerCase();
|
|
34
|
+
servers = servers.filter(item => item.name.toLowerCase().includes(searchText) || item.description.toLowerCase().includes(searchText));
|
|
35
|
+
}
|
|
36
|
+
const galleryServers = [];
|
|
37
|
+
for (const item of servers) {
|
|
38
|
+
galleryServers.push(this.toGalleryMcpServer(item));
|
|
39
|
+
}
|
|
40
|
+
return galleryServers;
|
|
41
|
+
}
|
|
42
|
+
async getManifest(gallery, token) {
|
|
43
|
+
const uri = ( URI.parse(gallery.manifestUrl));
|
|
44
|
+
if (uri.scheme === Schemas.file) {
|
|
45
|
+
try {
|
|
46
|
+
const content = await this.fileService.readFile(uri);
|
|
47
|
+
const data = ( content.value.toString());
|
|
48
|
+
return JSON.parse(data);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
this.logService.error(`Failed to read file from ${uri}: ${error}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const context = await this.requestService.request({
|
|
55
|
+
type: 'GET',
|
|
56
|
+
url: gallery.manifestUrl,
|
|
57
|
+
}, token);
|
|
58
|
+
const result = await asJson(context);
|
|
59
|
+
if (!result) {
|
|
60
|
+
throw ( new Error(`Failed to fetch manifest from ${gallery.manifestUrl}`));
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
packages: result.packages,
|
|
64
|
+
remotes: result.remotes,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async getReadme(gallery, token) {
|
|
68
|
+
const readmeUrl = gallery.readmeUrl;
|
|
69
|
+
if (!readmeUrl) {
|
|
70
|
+
return Promise.resolve(( localize(1942, 'No README available')));
|
|
71
|
+
}
|
|
72
|
+
const uri = ( URI.parse(readmeUrl));
|
|
73
|
+
if (uri.scheme === Schemas.file) {
|
|
74
|
+
try {
|
|
75
|
+
const content = await this.fileService.readFile(uri);
|
|
76
|
+
return ( content.value.toString());
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
this.logService.error(`Failed to read file from ${uri}: ${error}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const context = await this.requestService.request({
|
|
83
|
+
type: 'GET',
|
|
84
|
+
url: readmeUrl,
|
|
85
|
+
}, token);
|
|
86
|
+
const result = await asText(context);
|
|
87
|
+
if (!result) {
|
|
88
|
+
throw ( new Error(`Failed to fetch README from ${readmeUrl}`));
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
toGalleryMcpServer(item) {
|
|
93
|
+
let publisher = '';
|
|
94
|
+
const nameParts = item.name.split('/');
|
|
95
|
+
if (nameParts.length > 0) {
|
|
96
|
+
const domainParts = nameParts[0].split('.');
|
|
97
|
+
if (domainParts.length > 0) {
|
|
98
|
+
publisher = domainParts[domainParts.length - 1];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
id: item.id,
|
|
103
|
+
name: item.name,
|
|
104
|
+
displayName: item.displayName ?? ( nameParts[nameParts.length - 1].split('-').map(s => uppercaseFirstLetter(s))).join(' '),
|
|
105
|
+
url: item.repository.url,
|
|
106
|
+
description: item.description,
|
|
107
|
+
version: item.version_detail.version,
|
|
108
|
+
lastUpdated: Date.parse(item.version_detail.release_date),
|
|
109
|
+
repositoryUrl: item.repository.url,
|
|
110
|
+
readmeUrl: item.readmeUrl,
|
|
111
|
+
manifestUrl: this.getManifestUrl(item),
|
|
112
|
+
packageTypes: item.package_types ?? [],
|
|
113
|
+
publisher,
|
|
114
|
+
publisherDisplayName: item.publisher?.displayName,
|
|
115
|
+
publisherDomain: item.publisher ? {
|
|
116
|
+
link: item.publisher.url,
|
|
117
|
+
verified: item.publisher.is_verified,
|
|
118
|
+
} : undefined,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
async fetchGallery(token) {
|
|
122
|
+
const mcpGalleryUrl = this.getMcpGalleryUrl();
|
|
123
|
+
if (!mcpGalleryUrl) {
|
|
124
|
+
return Promise.resolve({ servers: [] });
|
|
125
|
+
}
|
|
126
|
+
const uri = ( URI.parse(mcpGalleryUrl));
|
|
127
|
+
if (uri.scheme === Schemas.file) {
|
|
128
|
+
try {
|
|
129
|
+
const content = await this.fileService.readFile(uri);
|
|
130
|
+
const data = ( content.value.toString());
|
|
131
|
+
return JSON.parse(data);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
this.logService.error(`Failed to read file from ${uri}: ${error}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const context = await this.requestService.request({
|
|
138
|
+
type: 'GET',
|
|
139
|
+
url: mcpGalleryUrl,
|
|
140
|
+
}, token);
|
|
141
|
+
const result = await asJson(context);
|
|
142
|
+
return result || { servers: [] };
|
|
143
|
+
}
|
|
144
|
+
getManifestUrl(item) {
|
|
145
|
+
const mcpGalleryUrl = this.getMcpGalleryUrl();
|
|
146
|
+
if (!mcpGalleryUrl) {
|
|
147
|
+
return item.repository.url;
|
|
148
|
+
}
|
|
149
|
+
const uri = ( URI.parse(mcpGalleryUrl));
|
|
150
|
+
if (uri.scheme === Schemas.file) {
|
|
151
|
+
return joinPath(dirname(uri), item.id).fsPath;
|
|
152
|
+
}
|
|
153
|
+
return `${mcpGalleryUrl}/${item.id}`;
|
|
154
|
+
}
|
|
155
|
+
getMcpGalleryUrl() {
|
|
156
|
+
if (this.productService.quality === 'stable') {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
return this.configurationService.getValue(mcpGalleryServiceUrlConfig);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
McpGalleryService = ( __decorate([
|
|
163
|
+
( __param(0, IConfigurationService)),
|
|
164
|
+
( __param(1, IRequestService)),
|
|
165
|
+
( __param(2, IFileService)),
|
|
166
|
+
( __param(3, IProductService)),
|
|
167
|
+
( __param(4, ILogService))
|
|
168
|
+
], McpGalleryService));
|
|
169
|
+
|
|
170
|
+
export { McpGalleryService };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Emitter } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
2
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
4
|
+
import { IEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service";
|
|
5
|
+
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
6
|
+
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
7
|
+
import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
8
|
+
import { DidUninstallMcpServerEvent, IGalleryMcpServer, ILocalMcpServer, InstallMcpServerEvent, InstallMcpServerResult, PackageType, UninstallMcpServerEvent } from "@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/platform/mcp/common/mcpManagement";
|
|
9
|
+
import { IMcpManagementService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service";
|
|
10
|
+
import { IMcpGalleryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service";
|
|
11
|
+
export declare class McpManagementService extends Disposable implements IMcpManagementService {
|
|
12
|
+
private readonly configurationService;
|
|
13
|
+
private readonly mcpGalleryService;
|
|
14
|
+
private readonly fileService;
|
|
15
|
+
private readonly uriIdentityService;
|
|
16
|
+
private readonly logService;
|
|
17
|
+
_serviceBrand: undefined;
|
|
18
|
+
private readonly mcpLocation;
|
|
19
|
+
private readonly _onInstallMcpServer;
|
|
20
|
+
readonly onInstallMcpServer: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<InstallMcpServerEvent>;
|
|
21
|
+
protected readonly _onDidInstallMcpServers: Emitter<InstallMcpServerResult[]>;
|
|
22
|
+
get onDidInstallMcpServers(): import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<InstallMcpServerResult[]>;
|
|
23
|
+
protected readonly _onUninstallMcpServer: Emitter<UninstallMcpServerEvent>;
|
|
24
|
+
get onUninstallMcpServer(): import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<UninstallMcpServerEvent>;
|
|
25
|
+
protected _onDidUninstallMcpServer: Emitter<DidUninstallMcpServerEvent>;
|
|
26
|
+
get onDidUninstallMcpServer(): import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<DidUninstallMcpServerEvent>;
|
|
27
|
+
constructor(configurationService: IConfigurationService, mcpGalleryService: IMcpGalleryService, fileService: IFileService, environmentService: IEnvironmentService, uriIdentityService: IUriIdentityService, logService: ILogService);
|
|
28
|
+
getInstalled(): Promise<ILocalMcpServer[]>;
|
|
29
|
+
private scanServer;
|
|
30
|
+
installFromGallery(server: IGalleryMcpServer, packageType?: PackageType): Promise<void>;
|
|
31
|
+
uninstall(server: ILocalMcpServer): Promise<void>;
|
|
32
|
+
private getServerConfig;
|
|
33
|
+
private getCommandName;
|
|
34
|
+
private getVariables;
|
|
35
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
4
|
+
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
5
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
6
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { deepClone } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
8
|
+
import { uppercaseFirstLetter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
9
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
10
|
+
import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
11
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
12
|
+
import { IEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service';
|
|
13
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
14
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
15
|
+
import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
16
|
+
import { PackageType } from '@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/platform/mcp/common/mcpManagement';
|
|
17
|
+
import { IMcpGalleryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service';
|
|
18
|
+
import { McpServerVariableType } from './mcpPlatformTypes.js';
|
|
19
|
+
|
|
20
|
+
let McpManagementService = class McpManagementService extends Disposable {
|
|
21
|
+
get onDidInstallMcpServers() { return this._onDidInstallMcpServers.event; }
|
|
22
|
+
get onUninstallMcpServer() { return this._onUninstallMcpServer.event; }
|
|
23
|
+
get onDidUninstallMcpServer() { return this._onDidUninstallMcpServer.event; }
|
|
24
|
+
constructor(configurationService, mcpGalleryService, fileService, environmentService, uriIdentityService, logService) {
|
|
25
|
+
super();
|
|
26
|
+
this.configurationService = configurationService;
|
|
27
|
+
this.mcpGalleryService = mcpGalleryService;
|
|
28
|
+
this.fileService = fileService;
|
|
29
|
+
this.uriIdentityService = uriIdentityService;
|
|
30
|
+
this.logService = logService;
|
|
31
|
+
this._onInstallMcpServer = this._register(( new Emitter()));
|
|
32
|
+
this.onInstallMcpServer = this._onInstallMcpServer.event;
|
|
33
|
+
this._onDidInstallMcpServers = this._register(( new Emitter()));
|
|
34
|
+
this._onUninstallMcpServer = this._register(( new Emitter()));
|
|
35
|
+
this._onDidUninstallMcpServer = this._register(( new Emitter()));
|
|
36
|
+
this.mcpLocation = uriIdentityService.extUri.joinPath(environmentService.userRoamingDataHome, 'mcp');
|
|
37
|
+
}
|
|
38
|
+
async getInstalled() {
|
|
39
|
+
const { userLocal } = this.configurationService.inspect('mcp');
|
|
40
|
+
if (!userLocal?.value?.servers) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
return Promise.all(( Object.entries(userLocal.value.servers).map(([name, config]) => this.scanServer(name, config))));
|
|
44
|
+
}
|
|
45
|
+
async scanServer(name, config) {
|
|
46
|
+
let scanned;
|
|
47
|
+
let readmeUrl;
|
|
48
|
+
if (config.location) {
|
|
49
|
+
const manifestLocation = this.uriIdentityService.extUri.joinPath(URI.revive(config.location), 'manifest.json');
|
|
50
|
+
try {
|
|
51
|
+
const content = await this.fileService.readFile(manifestLocation);
|
|
52
|
+
scanned = JSON.parse(( content.value.toString()));
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
this.logService.error('MCP Management Service: failed to read manifest', ( config.location.toString()), e);
|
|
56
|
+
}
|
|
57
|
+
readmeUrl = this.uriIdentityService.extUri.joinPath(URI.revive(config.location), 'README.md');
|
|
58
|
+
if (!(await this.fileService.exists(readmeUrl))) {
|
|
59
|
+
readmeUrl = undefined;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (!scanned) {
|
|
63
|
+
let publisher = '';
|
|
64
|
+
const nameParts = name.split('/');
|
|
65
|
+
if (nameParts.length > 0) {
|
|
66
|
+
const domainParts = nameParts[0].split('.');
|
|
67
|
+
if (domainParts.length > 0) {
|
|
68
|
+
publisher = domainParts[domainParts.length - 1];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
scanned = {
|
|
72
|
+
name,
|
|
73
|
+
version: '1.0.0',
|
|
74
|
+
displayName: ( nameParts[nameParts.length - 1].split('-').map(s => uppercaseFirstLetter(s))).join(' '),
|
|
75
|
+
publisher
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
name,
|
|
80
|
+
config,
|
|
81
|
+
version: scanned.version,
|
|
82
|
+
location: URI.revive(config.location),
|
|
83
|
+
id: scanned.id,
|
|
84
|
+
displayName: scanned.displayName,
|
|
85
|
+
description: scanned.description,
|
|
86
|
+
publisher: scanned.publisher,
|
|
87
|
+
publisherDisplayName: scanned.publisherDisplayName,
|
|
88
|
+
repositoryUrl: scanned.repositoryUrl,
|
|
89
|
+
readmeUrl,
|
|
90
|
+
iconUrl: scanned.iconUrl,
|
|
91
|
+
manifest: scanned.manifest
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
async installFromGallery(server, packageType) {
|
|
95
|
+
this.logService.trace('MCP Management Service: installGallery', server.url);
|
|
96
|
+
this._onInstallMcpServer.fire({ name: server.name });
|
|
97
|
+
try {
|
|
98
|
+
const manifest = await this.mcpGalleryService.getManifest(server, CancellationToken.None);
|
|
99
|
+
const location = this.uriIdentityService.extUri.joinPath(this.mcpLocation, `${server.name.replace('/', '.')}-${server.version}`);
|
|
100
|
+
const manifestPath = this.uriIdentityService.extUri.joinPath(location, 'manifest.json');
|
|
101
|
+
await this.fileService.writeFile(manifestPath, VSBuffer.fromString(JSON.stringify({
|
|
102
|
+
id: server.id,
|
|
103
|
+
name: server.name,
|
|
104
|
+
displayName: server.displayName,
|
|
105
|
+
description: server.description,
|
|
106
|
+
version: server.version,
|
|
107
|
+
publisher: server.publisher,
|
|
108
|
+
publisherDisplayName: server.publisherDisplayName,
|
|
109
|
+
repository: server.repositoryUrl,
|
|
110
|
+
licenseUrl: server.licenseUrl,
|
|
111
|
+
...manifest,
|
|
112
|
+
})));
|
|
113
|
+
if (server.readmeUrl) {
|
|
114
|
+
const readme = await this.mcpGalleryService.getReadme(server, CancellationToken.None);
|
|
115
|
+
await this.fileService.writeFile(this.uriIdentityService.extUri.joinPath(location, 'README.md'), VSBuffer.fromString(readme));
|
|
116
|
+
}
|
|
117
|
+
const { userLocal } = this.configurationService.inspect('mcp');
|
|
118
|
+
const value = deepClone(userLocal?.value ?? { servers: {} });
|
|
119
|
+
if (!value.servers) {
|
|
120
|
+
value.servers = {};
|
|
121
|
+
}
|
|
122
|
+
const serverConfig = this.getServerConfig(manifest, packageType);
|
|
123
|
+
value.servers[server.name] = {
|
|
124
|
+
...serverConfig,
|
|
125
|
+
location: location.toJSON(),
|
|
126
|
+
};
|
|
127
|
+
if (serverConfig.inputs) {
|
|
128
|
+
value.inputs = value.inputs ?? [];
|
|
129
|
+
for (const input of serverConfig.inputs) {
|
|
130
|
+
if (!( value.inputs.some(i => i.id === input.id))) {
|
|
131
|
+
value.inputs.push({ ...input, serverName: server.name });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
await this.configurationService.updateValue('mcp', value, ConfigurationTarget.USER_LOCAL);
|
|
136
|
+
const local = await this.scanServer(server.name, value.servers[server.name]);
|
|
137
|
+
this._onDidInstallMcpServers.fire([{ name: server.name, source: server, local }]);
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
this._onDidInstallMcpServers.fire([{ name: server.name, source: server, error: e }]);
|
|
141
|
+
throw e;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async uninstall(server) {
|
|
145
|
+
this.logService.trace('MCP Management Service: uninstall', server.name);
|
|
146
|
+
this._onUninstallMcpServer.fire({ name: server.name });
|
|
147
|
+
try {
|
|
148
|
+
const { userLocal } = this.configurationService.inspect('mcp');
|
|
149
|
+
const value = deepClone(userLocal?.value ?? { servers: {} });
|
|
150
|
+
if (!value.servers) {
|
|
151
|
+
value.servers = {};
|
|
152
|
+
}
|
|
153
|
+
delete value.servers[server.name];
|
|
154
|
+
if (value.inputs) {
|
|
155
|
+
const index = value.inputs.findIndex(i => i.serverName === server.name);
|
|
156
|
+
if (index !== undefined && index >= 0) {
|
|
157
|
+
value.inputs?.splice(index, 1);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
await this.configurationService.updateValue('mcp', value, ConfigurationTarget.USER_LOCAL);
|
|
161
|
+
if (server.location) {
|
|
162
|
+
await this.fileService.del(URI.revive(server.location), { recursive: true });
|
|
163
|
+
}
|
|
164
|
+
this._onDidUninstallMcpServer.fire({ name: server.name });
|
|
165
|
+
}
|
|
166
|
+
catch (e) {
|
|
167
|
+
this._onDidUninstallMcpServer.fire({ name: server.name, error: e });
|
|
168
|
+
throw e;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
getServerConfig(manifest, packageType) {
|
|
172
|
+
if (packageType === undefined) {
|
|
173
|
+
packageType = manifest.packages?.[0]?.registry_name ?? PackageType.REMOTE;
|
|
174
|
+
}
|
|
175
|
+
if (packageType === PackageType.REMOTE) {
|
|
176
|
+
const inputs = [];
|
|
177
|
+
const headers = {};
|
|
178
|
+
for (const input of manifest.remotes[0].headers ?? []) {
|
|
179
|
+
headers[input.name] = input.value;
|
|
180
|
+
if (input.variables) {
|
|
181
|
+
inputs.push(...this.getVariables(input.variables));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
type: 'http',
|
|
186
|
+
url: manifest.remotes[0].url,
|
|
187
|
+
headers: ( Object.keys(headers)).length ? headers : undefined,
|
|
188
|
+
inputs: inputs.length ? inputs : undefined,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const serverPackage = manifest.packages.find(p => p.registry_name === packageType) ?? manifest.packages[0];
|
|
192
|
+
const inputs = [];
|
|
193
|
+
const args = [];
|
|
194
|
+
const env = {};
|
|
195
|
+
if (serverPackage.registry_name === PackageType.DOCKER) {
|
|
196
|
+
args.push('run');
|
|
197
|
+
args.push('-i');
|
|
198
|
+
args.push('--rm');
|
|
199
|
+
}
|
|
200
|
+
for (const arg of serverPackage.runtime_arguments ?? []) {
|
|
201
|
+
if (arg.type === 'positional') {
|
|
202
|
+
args.push(arg.value ?? arg.value_hint);
|
|
203
|
+
}
|
|
204
|
+
else if (arg.type === 'named') {
|
|
205
|
+
args.push(arg.name);
|
|
206
|
+
if (arg.value) {
|
|
207
|
+
args.push(arg.value);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (arg.variables) {
|
|
211
|
+
inputs.push(...this.getVariables(arg.variables));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
for (const input of serverPackage.environment_variables ?? []) {
|
|
215
|
+
const variables = input.variables ? this.getVariables(input.variables) : [];
|
|
216
|
+
let value = input.value;
|
|
217
|
+
for (const variable of variables) {
|
|
218
|
+
value = value.replace(`{${variable.id}}`, `\${input:${variable.id}}`);
|
|
219
|
+
}
|
|
220
|
+
env[input.name] = value;
|
|
221
|
+
if (variables.length) {
|
|
222
|
+
inputs.push(...variables);
|
|
223
|
+
}
|
|
224
|
+
if (serverPackage.registry_name === PackageType.DOCKER) {
|
|
225
|
+
args.push('-e');
|
|
226
|
+
args.push(input.name);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (serverPackage.registry_name === PackageType.NODE) {
|
|
230
|
+
args.push(`${serverPackage.name}@${serverPackage.version}`);
|
|
231
|
+
}
|
|
232
|
+
else if (serverPackage.registry_name === PackageType.PYTHON) {
|
|
233
|
+
args.push(`${serverPackage.name}==${serverPackage.version}`);
|
|
234
|
+
}
|
|
235
|
+
else if (serverPackage.registry_name === PackageType.DOCKER) {
|
|
236
|
+
args.push(`${serverPackage.name}:${serverPackage.version}`);
|
|
237
|
+
}
|
|
238
|
+
for (const arg of serverPackage.package_arguments ?? []) {
|
|
239
|
+
if (arg.type === 'positional') {
|
|
240
|
+
args.push(arg.value ?? arg.value_hint);
|
|
241
|
+
}
|
|
242
|
+
else if (arg.type === 'named') {
|
|
243
|
+
args.push(arg.name);
|
|
244
|
+
if (arg.value) {
|
|
245
|
+
args.push(arg.value);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (arg.variables) {
|
|
249
|
+
inputs.push(...this.getVariables(arg.variables));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
type: 'stdio',
|
|
254
|
+
command: this.getCommandName(serverPackage.registry_name),
|
|
255
|
+
args: args.length ? args : undefined,
|
|
256
|
+
env: ( Object.keys(env)).length ? env : undefined,
|
|
257
|
+
inputs: inputs.length ? inputs : undefined,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
getCommandName(packageType) {
|
|
261
|
+
switch (packageType) {
|
|
262
|
+
case PackageType.NODE: return 'npx';
|
|
263
|
+
case PackageType.DOCKER: return 'docker';
|
|
264
|
+
case PackageType.PYTHON: return 'uvx';
|
|
265
|
+
}
|
|
266
|
+
return packageType;
|
|
267
|
+
}
|
|
268
|
+
getVariables(variableInputs) {
|
|
269
|
+
const variables = [];
|
|
270
|
+
for (const [key, value] of Object.entries(variableInputs)) {
|
|
271
|
+
variables.push({
|
|
272
|
+
id: key,
|
|
273
|
+
type: value.choices ? McpServerVariableType.PICK : McpServerVariableType.PROMPT,
|
|
274
|
+
description: value.description ?? '',
|
|
275
|
+
password: !!value.is_secret,
|
|
276
|
+
default: value.default,
|
|
277
|
+
options: value.choices,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
return variables;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
McpManagementService = ( __decorate([
|
|
284
|
+
( __param(0, IConfigurationService)),
|
|
285
|
+
( __param(1, IMcpGalleryService)),
|
|
286
|
+
( __param(2, IFileService)),
|
|
287
|
+
( __param(3, IEnvironmentService)),
|
|
288
|
+
( __param(4, IUriIdentityService)),
|
|
289
|
+
( __param(5, ILogService))
|
|
290
|
+
], McpManagementService));
|
|
291
|
+
|
|
292
|
+
export { McpManagementService };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { IStringDictionary } from "@codingame/monaco-vscode-api/vscode/vs/base/common/collections";
|
|
2
|
+
import { UriComponents } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
3
|
+
export interface IMcpConfiguration {
|
|
4
|
+
inputs?: unknown[];
|
|
5
|
+
mcpServers?: Record<string, IMcpConfigurationStdio>;
|
|
6
|
+
servers?: Record<string, IMcpConfigurationStdio | IMcpConfigurationHTTP>;
|
|
7
|
+
}
|
|
8
|
+
export type McpConfigurationServer = IMcpConfigurationStdio | IMcpConfigurationHTTP;
|
|
9
|
+
export interface IMcpDevModeConfig {
|
|
10
|
+
watch?: string | string[];
|
|
11
|
+
debug?: {
|
|
12
|
+
type: "node";
|
|
13
|
+
} | {
|
|
14
|
+
type: "debugpy";
|
|
15
|
+
debugpyPath?: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface IMcpConfigurationCommon {
|
|
19
|
+
dev?: IMcpDevModeConfig;
|
|
20
|
+
}
|
|
21
|
+
export interface IMcpConfigurationStdio extends IMcpConfigurationCommon {
|
|
22
|
+
type?: "stdio";
|
|
23
|
+
command: string;
|
|
24
|
+
args?: readonly string[];
|
|
25
|
+
env?: Record<string, string | number | null>;
|
|
26
|
+
envFile?: string;
|
|
27
|
+
cwd?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface IMcpConfigurationHTTP extends IMcpConfigurationCommon {
|
|
30
|
+
type?: "http";
|
|
31
|
+
url: string;
|
|
32
|
+
headers?: Record<string, string>;
|
|
33
|
+
}
|
|
34
|
+
export declare enum McpServerVariableType {
|
|
35
|
+
PROMPT = "promptString",
|
|
36
|
+
PICK = "pickString"
|
|
37
|
+
}
|
|
38
|
+
export interface IMcpServerVariable {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly type: McpServerVariableType;
|
|
41
|
+
readonly description: string;
|
|
42
|
+
readonly password: boolean;
|
|
43
|
+
readonly default?: string;
|
|
44
|
+
readonly options?: readonly string[];
|
|
45
|
+
readonly serverName?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface IMcpServerConfiguration {
|
|
48
|
+
readonly location?: UriComponents;
|
|
49
|
+
}
|
|
50
|
+
export interface IMcpStdioServerConfiguration extends IMcpServerConfiguration {
|
|
51
|
+
readonly type: "stdio";
|
|
52
|
+
readonly command: string;
|
|
53
|
+
readonly args?: readonly string[];
|
|
54
|
+
readonly env?: Record<string, string | number | null>;
|
|
55
|
+
readonly envFile?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface IMcpRemtoeServerConfiguration extends IMcpServerConfiguration {
|
|
58
|
+
readonly type: "http";
|
|
59
|
+
readonly url: string;
|
|
60
|
+
readonly headers?: Record<string, string>;
|
|
61
|
+
}
|
|
62
|
+
export interface IMcpServersConfiguration {
|
|
63
|
+
servers?: IStringDictionary<IMcpServerConfiguration>;
|
|
64
|
+
inputs?: IMcpServerVariable[];
|
|
65
|
+
}
|