@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
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
4
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
6
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
7
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
|
+
import { IMcpGalleryService, IMcpManagementService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service';
|
|
9
|
+
import { ACTIVE_GROUP } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService';
|
|
10
|
+
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
11
|
+
import { HasInstalledMcpServersContext, McpServersGalleryEnabledContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
12
|
+
import { IMcpWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
|
|
13
|
+
import { McpServerEditorInput } from './mcpServerEditorInput.js';
|
|
14
|
+
|
|
15
|
+
let McpWorkbenchServer = class McpWorkbenchServer {
|
|
16
|
+
constructor(local, gallery, mcpGalleryService, fileService) {
|
|
17
|
+
this.local = local;
|
|
18
|
+
this.gallery = gallery;
|
|
19
|
+
this.mcpGalleryService = mcpGalleryService;
|
|
20
|
+
this.fileService = fileService;
|
|
21
|
+
}
|
|
22
|
+
get id() {
|
|
23
|
+
return this.gallery?.id ?? this.local?.id ?? '';
|
|
24
|
+
}
|
|
25
|
+
get name() {
|
|
26
|
+
return this.gallery?.name ?? this.local?.name ?? '';
|
|
27
|
+
}
|
|
28
|
+
get label() {
|
|
29
|
+
return this.gallery?.displayName ?? this.local?.displayName ?? '';
|
|
30
|
+
}
|
|
31
|
+
get iconUrl() {
|
|
32
|
+
return this.gallery?.iconUrl ?? this.local?.iconUrl;
|
|
33
|
+
}
|
|
34
|
+
get publisherDisplayName() {
|
|
35
|
+
return this.gallery?.publisherDisplayName ?? this.local?.publisherDisplayName ?? this.gallery?.publisher ?? this.local?.publisher;
|
|
36
|
+
}
|
|
37
|
+
get publisherUrl() {
|
|
38
|
+
return this.gallery?.publisherDomain?.link;
|
|
39
|
+
}
|
|
40
|
+
get description() {
|
|
41
|
+
return this.gallery?.description ?? this.local?.description ?? '';
|
|
42
|
+
}
|
|
43
|
+
get installCount() {
|
|
44
|
+
return this.gallery?.installCount ?? 0;
|
|
45
|
+
}
|
|
46
|
+
get url() {
|
|
47
|
+
return this.gallery?.url;
|
|
48
|
+
}
|
|
49
|
+
get repository() {
|
|
50
|
+
return this.gallery?.repositoryUrl;
|
|
51
|
+
}
|
|
52
|
+
async getReadme(token) {
|
|
53
|
+
if (this.local?.readmeUrl) {
|
|
54
|
+
const content = await this.fileService.readFile(this.local.readmeUrl);
|
|
55
|
+
return ( content.value.toString());
|
|
56
|
+
}
|
|
57
|
+
if (this.gallery?.readmeUrl) {
|
|
58
|
+
return this.mcpGalleryService.getReadme(this.gallery, token);
|
|
59
|
+
}
|
|
60
|
+
return Promise.reject(( new Error('not available')));
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
McpWorkbenchServer = ( __decorate([
|
|
64
|
+
( __param(2, IMcpGalleryService)),
|
|
65
|
+
( __param(3, IFileService))
|
|
66
|
+
], McpWorkbenchServer));
|
|
67
|
+
let McpWorkbenchService = class McpWorkbenchService extends Disposable {
|
|
68
|
+
get local() { return this._local; }
|
|
69
|
+
constructor(mcpGalleryService, mcpManagementService, editorService, instantiationService) {
|
|
70
|
+
super();
|
|
71
|
+
this.mcpGalleryService = mcpGalleryService;
|
|
72
|
+
this.mcpManagementService = mcpManagementService;
|
|
73
|
+
this.editorService = editorService;
|
|
74
|
+
this.instantiationService = instantiationService;
|
|
75
|
+
this._local = [];
|
|
76
|
+
this._onChange = this._register(( new Emitter()));
|
|
77
|
+
this.onChange = this._onChange.event;
|
|
78
|
+
this._register(this.mcpManagementService.onDidInstallMcpServers(e => this.onDidInstallMcpServers(e)));
|
|
79
|
+
this._register(this.mcpManagementService.onDidUninstallMcpServer(e => this.onDidUninstallMcpServer(e)));
|
|
80
|
+
this.queryLocal().then(async () => {
|
|
81
|
+
await this.queryGallery();
|
|
82
|
+
this._onChange.fire(undefined);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
onDidUninstallMcpServer(e) {
|
|
86
|
+
if (e.error) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const server = this._local.find(server => server.local?.name === e.name);
|
|
90
|
+
if (server) {
|
|
91
|
+
this._local = this._local.filter(server => server.local?.name !== e.name);
|
|
92
|
+
server.local = undefined;
|
|
93
|
+
this._onChange.fire(server);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
onDidInstallMcpServers(e) {
|
|
97
|
+
for (const result of e) {
|
|
98
|
+
if (!result.local) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
let server = this._local.find(server => server.local?.name === result.name);
|
|
102
|
+
if (server) {
|
|
103
|
+
server.local = result.local;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
server = this.instantiationService.createInstance(McpWorkbenchServer, result.local, result.source);
|
|
107
|
+
this._local.push(server);
|
|
108
|
+
}
|
|
109
|
+
this._onChange.fire(server);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
fromGallery(gallery) {
|
|
113
|
+
for (const local of this._local) {
|
|
114
|
+
if (local.name === gallery.name) {
|
|
115
|
+
local.gallery = gallery;
|
|
116
|
+
return local;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
async queryGallery(options, token) {
|
|
122
|
+
if (!this.mcpGalleryService.isEnabled()) {
|
|
123
|
+
return [];
|
|
124
|
+
}
|
|
125
|
+
const result = await this.mcpGalleryService.query(options, token);
|
|
126
|
+
return ( result.map(
|
|
127
|
+
gallery => this.fromGallery(gallery) ?? this.instantiationService.createInstance(McpWorkbenchServer, undefined, gallery)
|
|
128
|
+
));
|
|
129
|
+
}
|
|
130
|
+
async queryLocal() {
|
|
131
|
+
const installed = await this.mcpManagementService.getInstalled();
|
|
132
|
+
this._local = ( installed.map(i => {
|
|
133
|
+
const local = this._local.find(server => server.name === i.name) ?? this.instantiationService.createInstance(McpWorkbenchServer, undefined, undefined);
|
|
134
|
+
local.local = i;
|
|
135
|
+
return local;
|
|
136
|
+
}));
|
|
137
|
+
return this._local;
|
|
138
|
+
}
|
|
139
|
+
async install(server) {
|
|
140
|
+
if (!server.gallery) {
|
|
141
|
+
throw ( new Error('Gallery server is missing'));
|
|
142
|
+
}
|
|
143
|
+
await this.mcpManagementService.installFromGallery(server.gallery, server.gallery.packageTypes[0]);
|
|
144
|
+
}
|
|
145
|
+
async uninstall(server) {
|
|
146
|
+
if (!server.local) {
|
|
147
|
+
throw ( new Error('Local server is missing'));
|
|
148
|
+
}
|
|
149
|
+
await this.mcpManagementService.uninstall(server.local);
|
|
150
|
+
}
|
|
151
|
+
async open(extension, options) {
|
|
152
|
+
await this.editorService.openEditor(this.instantiationService.createInstance(McpServerEditorInput, extension), options, ACTIVE_GROUP);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
McpWorkbenchService = ( __decorate([
|
|
156
|
+
( __param(0, IMcpGalleryService)),
|
|
157
|
+
( __param(1, IMcpManagementService)),
|
|
158
|
+
( __param(2, IEditorService)),
|
|
159
|
+
( __param(3, IInstantiationService))
|
|
160
|
+
], McpWorkbenchService));
|
|
161
|
+
let MCPContextsInitialisation = class MCPContextsInitialisation extends Disposable {
|
|
162
|
+
static { this.ID = 'workbench.mcp.contexts.initialisation'; }
|
|
163
|
+
constructor(mcpWorkbenchService, mcpGalleryService, contextKeyService) {
|
|
164
|
+
super();
|
|
165
|
+
const hasInstalledMcpServersContextKey = HasInstalledMcpServersContext.bindTo(contextKeyService);
|
|
166
|
+
McpServersGalleryEnabledContext.bindTo(contextKeyService).set(mcpGalleryService.isEnabled());
|
|
167
|
+
this._register(mcpWorkbenchService.onChange(() => hasInstalledMcpServersContextKey.set(mcpWorkbenchService.local.length > 0)));
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
MCPContextsInitialisation = ( __decorate([
|
|
171
|
+
( __param(0, IMcpWorkbenchService)),
|
|
172
|
+
( __param(1, IMcpGalleryService)),
|
|
173
|
+
( __param(2, IContextKeyService))
|
|
174
|
+
], MCPContextsInitialisation));
|
|
175
|
+
|
|
176
|
+
export { MCPContextsInitialisation, McpWorkbenchService };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
2
|
import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service";
|
|
3
3
|
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
4
|
+
import { IRemoteAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service";
|
|
4
5
|
import { IMcpConfigPathsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpConfigPathsService.service";
|
|
5
6
|
import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
|
|
6
7
|
import { IMcpDiscovery } from "./mcpDiscovery.js";
|
|
@@ -9,8 +10,9 @@ export declare class ConfigMcpDiscovery extends Disposable implements IMcpDiscov
|
|
|
9
10
|
private readonly _mcpRegistry;
|
|
10
11
|
private readonly _textModelService;
|
|
11
12
|
private readonly _mcpConfigPathsService;
|
|
13
|
+
private readonly _remoteAgentService;
|
|
12
14
|
private configSources;
|
|
13
|
-
constructor(_configurationService: IConfigurationService, _mcpRegistry: IMcpRegistry, _textModelService: ITextModelService, _mcpConfigPathsService: IMcpConfigPathsService);
|
|
15
|
+
constructor(_configurationService: IConfigurationService, _mcpRegistry: IMcpRegistry, _textModelService: ITextModelService, _mcpConfigPathsService: IMcpConfigPathsService, _remoteAgentService: IRemoteAgentService);
|
|
14
16
|
start(): void;
|
|
15
17
|
private _getServerIdMapping;
|
|
16
18
|
private sync;
|
|
@@ -4,24 +4,28 @@ import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/array
|
|
|
4
4
|
import { Throttler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
5
5
|
import { Disposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
6
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
7
|
+
import { win32, posix, sep } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
8
|
+
import { OperatingSystem, isWindows } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
7
9
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
8
10
|
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
|
|
9
11
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
12
|
+
import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
10
13
|
import { getMcpServerMapping } from '../mcpConfigFileUtils.js';
|
|
11
14
|
import { IMcpConfigPathsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpConfigPathsService.service';
|
|
12
|
-
import { mcpConfigurationSection } from '@codingame/monaco-vscode-
|
|
15
|
+
import { mcpConfigurationSection } from '@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
|
|
13
16
|
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
14
17
|
import { McpServerTransportType, McpServerDefinition } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
15
|
-
import { autorunDelta } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
16
|
-
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/
|
|
18
|
+
import { autorunDelta } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
19
|
+
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
17
20
|
|
|
18
21
|
let ConfigMcpDiscovery = class ConfigMcpDiscovery extends Disposable {
|
|
19
|
-
constructor(_configurationService, _mcpRegistry, _textModelService, _mcpConfigPathsService) {
|
|
22
|
+
constructor(_configurationService, _mcpRegistry, _textModelService, _mcpConfigPathsService, _remoteAgentService) {
|
|
20
23
|
super();
|
|
21
24
|
this._configurationService = _configurationService;
|
|
22
25
|
this._mcpRegistry = _mcpRegistry;
|
|
23
26
|
this._textModelService = _textModelService;
|
|
24
27
|
this._mcpConfigPathsService = _mcpConfigPathsService;
|
|
28
|
+
this._remoteAgentService = _remoteAgentService;
|
|
25
29
|
this.configSources = [];
|
|
26
30
|
}
|
|
27
31
|
start() {
|
|
@@ -78,6 +82,7 @@ let ConfigMcpDiscovery = class ConfigMcpDiscovery extends Disposable {
|
|
|
78
82
|
const uri = src.path.uri;
|
|
79
83
|
return uri && src.getServerToLocationMapping(uri);
|
|
80
84
|
})));
|
|
85
|
+
const remoteEnv = await this._remoteAgentService.getEnvironment();
|
|
81
86
|
for (const [index, src] of this.configSources.entries()) {
|
|
82
87
|
const collectionId = `mcp.config.${src.path.id}`;
|
|
83
88
|
let value = src.path.workspaceFolder
|
|
@@ -88,6 +93,13 @@ let ConfigMcpDiscovery = class ConfigMcpDiscovery extends Disposable {
|
|
|
88
93
|
this._configurationService.updateValue(mcpConfigurationSection, value, {}, src.path.target, { donotNotifyError: true });
|
|
89
94
|
}
|
|
90
95
|
const configMapping = configMappings[index];
|
|
96
|
+
const { isAbsolute, join, sep: sep$1 } = src.path.remoteAuthority && remoteEnv
|
|
97
|
+
? (remoteEnv.os === OperatingSystem.Windows ? win32 : posix)
|
|
98
|
+
: (isWindows ? win32 : posix);
|
|
99
|
+
const fsPathForRemote = (uri) => {
|
|
100
|
+
const fsPathLocal = uri.fsPath;
|
|
101
|
+
return fsPathLocal.replaceAll(sep, sep$1);
|
|
102
|
+
};
|
|
91
103
|
const nextDefinitions = ( Object.entries(value?.servers || {}).map(([name, value]) => ({
|
|
92
104
|
id: `${collectionId}.${name}`,
|
|
93
105
|
label: name,
|
|
@@ -101,7 +113,13 @@ let ConfigMcpDiscovery = class ConfigMcpDiscovery extends Disposable {
|
|
|
101
113
|
command: value.command,
|
|
102
114
|
env: value.env || {},
|
|
103
115
|
envFile: value.envFile,
|
|
104
|
-
cwd:
|
|
116
|
+
cwd: value.cwd
|
|
117
|
+
? (!isAbsolute(value.cwd) && !value.cwd.startsWith('~') && !value.cwd.startsWith('${') && src.path.workspaceFolder
|
|
118
|
+
? join(fsPathForRemote(src.path.workspaceFolder.uri), value.cwd)
|
|
119
|
+
: value.cwd)
|
|
120
|
+
: src.path.workspaceFolder
|
|
121
|
+
? fsPathForRemote(src.path.workspaceFolder.uri)
|
|
122
|
+
: undefined,
|
|
105
123
|
},
|
|
106
124
|
roots: src.path.workspaceFolder ? [src.path.workspaceFolder.uri] : [],
|
|
107
125
|
variableReplacement: {
|
|
@@ -109,6 +127,7 @@ let ConfigMcpDiscovery = class ConfigMcpDiscovery extends Disposable {
|
|
|
109
127
|
section: mcpConfigurationSection,
|
|
110
128
|
target: src.path.target,
|
|
111
129
|
},
|
|
130
|
+
devMode: value.dev,
|
|
112
131
|
presentation: {
|
|
113
132
|
order: src.path.order,
|
|
114
133
|
origin: configMapping?.get(name),
|
|
@@ -130,6 +149,7 @@ let ConfigMcpDiscovery = class ConfigMcpDiscovery extends Disposable {
|
|
|
130
149
|
remoteAuthority: src.path.remoteAuthority || null,
|
|
131
150
|
serverDefinitions: src.serverDefinitions,
|
|
132
151
|
isTrustedByDefault: true,
|
|
152
|
+
configTarget: src.path.target,
|
|
133
153
|
scope: src.path.scope,
|
|
134
154
|
});
|
|
135
155
|
}
|
|
@@ -140,7 +160,8 @@ ConfigMcpDiscovery = ( __decorate([
|
|
|
140
160
|
( __param(0, IConfigurationService)),
|
|
141
161
|
( __param(1, IMcpRegistry)),
|
|
142
162
|
( __param(2, ITextModelService)),
|
|
143
|
-
( __param(3, IMcpConfigPathsService))
|
|
163
|
+
( __param(3, IMcpConfigPathsService)),
|
|
164
|
+
( __param(4, IRemoteAgentService))
|
|
144
165
|
], ConfigMcpDiscovery));
|
|
145
166
|
|
|
146
167
|
export { ConfigMcpDiscovery };
|
|
@@ -4,14 +4,15 @@ import { Disposable, DisposableMap } from '@codingame/monaco-vscode-api/vscode/v
|
|
|
4
4
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
5
5
|
import { isFalsyOrWhitespace } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
6
6
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
7
|
+
import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
7
8
|
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
8
9
|
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
9
10
|
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
10
11
|
import { ExtensionsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
|
|
11
|
-
import { mcpContributionPoint, mcpActivationEvent } from '@codingame/monaco-vscode-
|
|
12
|
+
import { mcpContributionPoint, mcpActivationEvent } from '@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
|
|
12
13
|
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
13
14
|
import { McpServerDefinition, extensionPrefixedIdentifier } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
14
|
-
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/
|
|
15
|
+
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
15
16
|
|
|
16
17
|
var ExtensionMcpDiscovery_1;
|
|
17
18
|
const cacheKey = 'mcp.extCachedServers';
|
|
@@ -64,6 +65,7 @@ let ExtensionMcpDiscovery = ExtensionMcpDiscovery_1 = class ExtensionMcpDiscover
|
|
|
64
65
|
remoteAuthority: null,
|
|
65
66
|
isTrustedByDefault: true,
|
|
66
67
|
scope: StorageScope.WORKSPACE,
|
|
68
|
+
configTarget: ConfigurationTarget.USER,
|
|
67
69
|
serverDefinitions: observableValue(this, serverDefs?.map(McpServerDefinition.fromSerialized) || []),
|
|
68
70
|
lazy: {
|
|
69
71
|
isCached: !!serverDefs,
|
|
@@ -78,21 +80,21 @@ let ExtensionMcpDiscovery = ExtensionMcpDiscovery_1 = class ExtensionMcpDiscover
|
|
|
78
80
|
}
|
|
79
81
|
async _activateExtensionServers(collectionId) {
|
|
80
82
|
await this._extensionService.activateByEvent(mcpActivationEvent(collectionId));
|
|
81
|
-
await Promise.all(( this._mcpRegistry.delegates
|
|
83
|
+
await Promise.all(( this._mcpRegistry.delegates.get()
|
|
82
84
|
.map(r => r.waitForInitialProviderPromises())));
|
|
83
85
|
}
|
|
84
86
|
static _validate(user) {
|
|
85
87
|
if (!Array.isArray(user.value)) {
|
|
86
|
-
user.collector.error(( localize(
|
|
88
|
+
user.collector.error(( localize(7918, "Expected an array of MCP collections")));
|
|
87
89
|
return false;
|
|
88
90
|
}
|
|
89
91
|
for (const contribution of user.value) {
|
|
90
92
|
if (typeof contribution.id !== 'string' || isFalsyOrWhitespace(contribution.id)) {
|
|
91
|
-
user.collector.error(( localize(
|
|
93
|
+
user.collector.error(( localize(7919, "Expected 'id' to be a non-empty string.")));
|
|
92
94
|
return false;
|
|
93
95
|
}
|
|
94
96
|
if (typeof contribution.label !== 'string' || isFalsyOrWhitespace(contribution.label)) {
|
|
95
|
-
user.collector.error(( localize(
|
|
97
|
+
user.collector.error(( localize(7920, "Expected 'label' to be a non-empty string.")));
|
|
96
98
|
return false;
|
|
97
99
|
}
|
|
98
100
|
}
|
package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/pl
|
|
|
8
8
|
import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
|
|
9
9
|
import { INativeMcpDiscoveryData } from "../../../../../platform/mcp/common/nativeMcpDiscoveryHelper.js";
|
|
10
10
|
import { Dto } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/proxyIdentifier";
|
|
11
|
-
import { DiscoverySource } from "@codingame/monaco-vscode-
|
|
11
|
+
import { DiscoverySource } from "@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration";
|
|
12
12
|
import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
|
|
13
13
|
import { McpCollectionDefinition, McpServerDefinition } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
14
14
|
import { IMcpDiscovery } from "./mcpDiscovery.js";
|
|
@@ -6,18 +6,19 @@ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/netw
|
|
|
6
6
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
7
7
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
8
8
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
9
|
+
import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
9
10
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
10
11
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
11
12
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
12
13
|
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
13
14
|
import { observableConfigValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/observable/common/platformObservableUtils';
|
|
14
15
|
import { StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
15
|
-
import { mcpDiscoverySection, discoverySourceLabel } from '@codingame/monaco-vscode-
|
|
16
|
+
import { mcpDiscoverySection, discoverySourceLabel } from '@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
|
|
16
17
|
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
17
18
|
import { McpCollectionSortOrder } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
18
19
|
import { ClaudeDesktopMpcDiscoveryAdapter, CursorDesktopMpcDiscoveryAdapter, WindsurfDesktopMpcDiscoveryAdapter } from './nativeMcpDiscoveryAdapters.js';
|
|
19
|
-
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/
|
|
20
|
-
import { autorunWithStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
20
|
+
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
21
|
+
import { autorunWithStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
21
22
|
|
|
22
23
|
let FilesystemMcpDiscovery = class FilesystemMcpDiscovery extends Disposable {
|
|
23
24
|
constructor(configurationService, _fileService, _mcpRegistry) {
|
|
@@ -81,7 +82,7 @@ let NativeFilesystemMcpDiscovery = class NativeFilesystemMcpDiscovery extends Fi
|
|
|
81
82
|
this.suffix = '';
|
|
82
83
|
if (remoteAuthority) {
|
|
83
84
|
this.suffix = ' ' + ( localize(
|
|
84
|
-
|
|
85
|
+
7921,
|
|
85
86
|
' on {0}',
|
|
86
87
|
labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority)
|
|
87
88
|
));
|
|
@@ -111,6 +112,7 @@ let NativeFilesystemMcpDiscovery = class NativeFilesystemMcpDiscovery extends Fi
|
|
|
111
112
|
id: adapter.id,
|
|
112
113
|
label: discoverySourceLabel[adapter.discoverySource] + this.suffix,
|
|
113
114
|
remoteAuthority: adapter.remoteAuthority,
|
|
115
|
+
configTarget: ConfigurationTarget.USER,
|
|
114
116
|
scope: StorageScope.PROFILE,
|
|
115
117
|
isTrustedByDefault: false,
|
|
116
118
|
serverDefinitions: observableValue(this, []),
|
package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { VSBuffer } from "@codingame/monaco-vscode-api/vscode/vs/base/common/buf
|
|
|
2
2
|
import { Mutable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/types";
|
|
3
3
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
4
|
import { INativeMcpDiscoveryData } from "../../../../../platform/mcp/common/nativeMcpDiscoveryHelper.js";
|
|
5
|
-
import { DiscoverySource } from "@codingame/monaco-vscode-
|
|
5
|
+
import { DiscoverySource } from "@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration";
|
|
6
6
|
import { McpCollectionSortOrder, McpServerDefinition } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
7
7
|
export interface NativeMpcDiscoveryAdapter {
|
|
8
8
|
readonly remoteAuthority: string | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { Platform } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
3
3
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
4
|
-
import { DiscoverySource } from '@codingame/monaco-vscode-
|
|
4
|
+
import { DiscoverySource } from '@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
|
|
5
5
|
import { McpServerTransportType, McpCollectionSortOrder } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
6
6
|
|
|
7
7
|
function claudeConfigToServerDefinition(idPrefix, contents, cwd) {
|
|
@@ -26,7 +26,7 @@ function claudeConfigToServerDefinition(idPrefix, contents, cwd) {
|
|
|
26
26
|
command: server.command,
|
|
27
27
|
env: server.env || {},
|
|
28
28
|
envFile: undefined,
|
|
29
|
-
cwd,
|
|
29
|
+
cwd: cwd?.fsPath,
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
}));
|
package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceMcpDiscoveryAdapter.js
CHANGED
|
@@ -4,17 +4,18 @@ import { DisposableMap } from '@codingame/monaco-vscode-api/vscode/vs/base/commo
|
|
|
4
4
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
5
5
|
import { joinPath } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
6
6
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
7
|
+
import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
7
8
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
8
9
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
9
10
|
import { StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
10
11
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
11
12
|
import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
12
|
-
import { DiscoverySource } from '@codingame/monaco-vscode-
|
|
13
|
+
import { DiscoverySource } from '@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
|
|
13
14
|
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
14
15
|
import { McpCollectionSortOrder } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
15
16
|
import { FilesystemMcpDiscovery } from './nativeMcpDiscoveryAbstract.js';
|
|
16
17
|
import { claudeConfigToServerDefinition } from './nativeMcpDiscoveryAdapters.js';
|
|
17
|
-
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/
|
|
18
|
+
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
18
19
|
|
|
19
20
|
let CursorWorkspaceMcpDiscoveryAdapter = class CursorWorkspaceMcpDiscoveryAdapter extends FilesystemMcpDiscovery {
|
|
20
21
|
constructor(fileService, _workspaceContextService, mcpRegistry, configurationService, _remoteAgentService) {
|
|
@@ -45,6 +46,7 @@ let CursorWorkspaceMcpDiscoveryAdapter = class CursorWorkspaceMcpDiscoveryAdapte
|
|
|
45
46
|
scope: StorageScope.WORKSPACE,
|
|
46
47
|
isTrustedByDefault: false,
|
|
47
48
|
serverDefinitions: observableValue(this, []),
|
|
49
|
+
configTarget: ConfigurationTarget.WORKSPACE_FOLDER,
|
|
48
50
|
presentation: {
|
|
49
51
|
origin: configFile,
|
|
50
52
|
order: McpCollectionSortOrder.WorkspaceFolder + 1,
|
|
@@ -13,12 +13,12 @@ import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform
|
|
|
13
13
|
import { StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
14
14
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
15
15
|
import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
16
|
-
import { FOLDER_SETTINGS_PATH } from '@codingame/monaco-vscode-
|
|
16
|
+
import { FOLDER_SETTINGS_PATH } from '@codingame/monaco-vscode-c87fff3a-2aa9-52ab-ba4d-17e8d1e5e185-common/vscode/vs/workbench/services/preferences/common/preferences';
|
|
17
17
|
import { IPreferencesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/preferences/common/preferences.service';
|
|
18
18
|
import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
19
|
-
import { mcpConfigurationSection } from '@codingame/monaco-vscode-
|
|
19
|
+
import { mcpConfigurationSection } from '@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
|
|
20
20
|
import { McpCollectionSortOrder } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
21
|
-
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/
|
|
21
|
+
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
22
22
|
|
|
23
23
|
let McpConfigPathsService = class McpConfigPathsService extends Disposable {
|
|
24
24
|
get paths() {
|
|
@@ -33,7 +33,7 @@ let McpConfigPathsService = class McpConfigPathsService extends Disposable {
|
|
|
33
33
|
id: 'usrlocal',
|
|
34
34
|
key: 'userLocalValue',
|
|
35
35
|
target: ConfigurationTarget.USER_LOCAL,
|
|
36
|
-
label: ( localize(
|
|
36
|
+
label: ( localize(7922, 'Global in {0}', productService.nameShort)),
|
|
37
37
|
scope: StorageScope.PROFILE,
|
|
38
38
|
order: McpCollectionSortOrder.User,
|
|
39
39
|
uri: preferencesService.userSettingsResource,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
|
|
3
|
+
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
4
|
+
import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
|
|
5
|
+
import { IDebugService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debug.service";
|
|
6
|
+
import { IMcpDevModeDebugging } from "./mcpDevMode.service.js";
|
|
7
|
+
import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
|
|
8
|
+
import { IMcpServer, McpServerDefinition, McpServerLaunch } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
9
|
+
export declare class McpDevModeServerAttache extends Disposable {
|
|
10
|
+
active: boolean;
|
|
11
|
+
constructor(server: IMcpServer, fwdRef: {
|
|
12
|
+
lastModeDebugged: boolean;
|
|
13
|
+
}, registry: IMcpRegistry, fileService: IFileService, workspaceContextService: IWorkspaceContextService);
|
|
14
|
+
}
|
|
15
|
+
export declare class McpDevModeDebugging implements IMcpDevModeDebugging {
|
|
16
|
+
private readonly _debugService;
|
|
17
|
+
private readonly _commandService;
|
|
18
|
+
readonly _serviceBrand: undefined;
|
|
19
|
+
constructor(_debugService: IDebugService, _commandService: ICommandService);
|
|
20
|
+
transform(definition: McpServerDefinition, launch: McpServerLaunch): Promise<McpServerLaunch>;
|
|
21
|
+
protected ensureListeningOnPort(port: number): Promise<void>;
|
|
22
|
+
protected getDebugPort(): Promise<number>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { equals as equals$1 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
4
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
5
|
+
import { Throttler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
6
|
+
import { parse } from '@codingame/monaco-vscode-api/vscode/vs/base/common/glob';
|
|
7
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
|
+
import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
9
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
10
|
+
import '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
11
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
12
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
13
|
+
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
14
|
+
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
15
|
+
import '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
16
|
+
import { autorun, autorunDelta } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
17
|
+
import { derivedOpts } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
|
|
18
|
+
|
|
19
|
+
let McpDevModeServerAttache = class McpDevModeServerAttache extends Disposable {
|
|
20
|
+
constructor(server, fwdRef, registry, fileService, workspaceContextService) {
|
|
21
|
+
super();
|
|
22
|
+
this.active = false;
|
|
23
|
+
const workspaceFolder = ( server.readDefinitions().map(({ collection }) => collection?.presentation?.origin &&
|
|
24
|
+
workspaceContextService.getWorkspaceFolder(collection.presentation?.origin)?.uri));
|
|
25
|
+
const restart = async () => {
|
|
26
|
+
const lastDebugged = fwdRef.lastModeDebugged;
|
|
27
|
+
await server.stop();
|
|
28
|
+
await server.start({ isFromInteraction: false, debug: lastDebugged });
|
|
29
|
+
};
|
|
30
|
+
let didAutoStart = false;
|
|
31
|
+
this._register(autorun(reader => {
|
|
32
|
+
const defs = server.readDefinitions().read(reader);
|
|
33
|
+
if (!defs.collection || !defs.server || !defs.server.devMode) {
|
|
34
|
+
didAutoStart = false;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (didAutoStart) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const delegates = registry.delegates.read(reader);
|
|
41
|
+
if (!( delegates.some(d => d.canStart(defs.collection, defs.server)))) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
server.start();
|
|
45
|
+
didAutoStart = true;
|
|
46
|
+
}));
|
|
47
|
+
const debugMode = ( server.readDefinitions().map(d => !!d.server?.devMode?.debug));
|
|
48
|
+
this._register(autorunDelta(debugMode, ({ lastValue, newValue }) => {
|
|
49
|
+
if (!!newValue && !equals(lastValue, newValue)) {
|
|
50
|
+
restart();
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
const watchObs = derivedOpts({ equalsFn: equals$1 }, reader => {
|
|
54
|
+
const def = server.readDefinitions().read(reader);
|
|
55
|
+
const watch = def.server?.devMode?.watch;
|
|
56
|
+
return typeof watch === 'string' ? [watch] : watch;
|
|
57
|
+
});
|
|
58
|
+
const restartScheduler = this._register(( new Throttler()));
|
|
59
|
+
this._register(autorun(reader => {
|
|
60
|
+
const pattern = watchObs.read(reader);
|
|
61
|
+
const wf = workspaceFolder.read(reader);
|
|
62
|
+
if (!pattern || !wf) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const includes = pattern.filter(p => !p.startsWith('!'));
|
|
66
|
+
const excludes = ( pattern.filter(p => p.startsWith('!')).map(p => p.slice(1)));
|
|
67
|
+
reader.store.add(fileService.watch(wf, { includes, excludes, recursive: true }));
|
|
68
|
+
const includeParse = ( includes.map(p => parse({ base: wf.fsPath, pattern: p })));
|
|
69
|
+
const excludeParse = ( excludes.map(p => parse({ base: wf.fsPath, pattern: p })));
|
|
70
|
+
reader.store.add(fileService.onDidFilesChange(e => {
|
|
71
|
+
for (const change of [e.rawAdded, e.rawDeleted, e.rawUpdated]) {
|
|
72
|
+
for (const uri of change) {
|
|
73
|
+
if (( includeParse.some(i => i(uri.fsPath))) && !( excludeParse.some(e => e(uri.fsPath)))) {
|
|
74
|
+
restartScheduler.queue(restart);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
McpDevModeServerAttache = ( __decorate([
|
|
84
|
+
( __param(2, IMcpRegistry)),
|
|
85
|
+
( __param(3, IFileService)),
|
|
86
|
+
( __param(4, IWorkspaceContextService))
|
|
87
|
+
], McpDevModeServerAttache));
|
|
88
|
+
|
|
89
|
+
export { McpDevModeServerAttache };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { McpServerDefinition, McpServerLaunch } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
2
|
+
export interface IMcpDevModeDebugging {
|
|
3
|
+
readonly _serviceBrand: undefined;
|
|
4
|
+
transform(definition: McpServerDefinition, launch: McpServerLaunch): Promise<McpServerLaunch>;
|
|
5
|
+
}
|
|
6
|
+
export declare const IMcpDevModeDebugging: import("@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation").ServiceIdentifier<IMcpDevModeDebugging>;
|