@codingame/monaco-vscode-mcp-service-override 33.0.7 → 34.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/package.json +3 -3
- package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +1 -1
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +5 -4
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +150 -63
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +25 -25
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +86 -25
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +8 -8
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +37 -37
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +9 -9
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +17 -17
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +34 -11
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.js +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +6 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +13 -13
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +11 -11
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js +15 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +7 -25
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.d.ts +15 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.js +26 -1
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +9 -9
|
@@ -27,8 +27,8 @@ import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/obse
|
|
|
27
27
|
|
|
28
28
|
const noneItem = {
|
|
29
29
|
id: undefined,
|
|
30
|
-
label: ( localize(
|
|
31
|
-
description: ( localize(
|
|
30
|
+
label: ( localize(11279, "None")),
|
|
31
|
+
description: ( localize(11280, "No selection")),
|
|
32
32
|
alwaysShow: true
|
|
33
33
|
};
|
|
34
34
|
function isFormElicitation(params) {
|
|
@@ -117,11 +117,11 @@ let McpElicitationService = class McpElicitationService {
|
|
|
117
117
|
}
|
|
118
118
|
const handle = this._notificationService.notify({
|
|
119
119
|
message: elicitation.message,
|
|
120
|
-
source: ( localize(
|
|
120
|
+
source: ( localize(11281, "MCP Server ({0})", server.definition.label)),
|
|
121
121
|
severity: Severity.Info,
|
|
122
122
|
actions: {
|
|
123
|
-
primary: [store.add(( new Action("mcp.elicit.give", ( localize(
|
|
124
|
-
secondary: [store.add(( new Action("mcp.elicit.cancel", ( localize(
|
|
123
|
+
primary: [store.add(( new Action("mcp.elicit.give", ( localize(11282, "Respond")), undefined, true, () => resolve(this._doElicitForm(elicitation, token)))))],
|
|
124
|
+
secondary: [store.add(( new Action("mcp.elicit.cancel", ( localize(11283, "Cancel")), undefined, true, () => resolve({
|
|
125
125
|
action: "decline"
|
|
126
126
|
}))))]
|
|
127
127
|
}
|
|
@@ -163,7 +163,7 @@ let McpElicitationService = class McpElicitationService {
|
|
|
163
163
|
if (chatModel instanceof ChatModel) {
|
|
164
164
|
const request = chatModel.getRequests().at(-1);
|
|
165
165
|
if (request) {
|
|
166
|
-
const part = ( new ChatElicitationRequestPart(( localize(
|
|
166
|
+
const part = ( new ChatElicitationRequestPart(( localize(11284, "Authorization Required")), ( new MarkdownString()).appendText(elicitation.message).appendMarkdown("\n\n" + ( localize(11285, "Open this URL?"))).appendCodeblock("", elicitation.url), ( localize(11286, "{0} (MCP Server)", server.definition.label)), ( localize(11287, "Open {0}", ( URI.parse(elicitation.url)).authority)), ( localize(11288, "Cancel")), async () => {
|
|
167
167
|
const result = await this._doElicitUrl(elicitation, token);
|
|
168
168
|
resolve(result);
|
|
169
169
|
completePromise.then(() => part.hide());
|
|
@@ -178,12 +178,12 @@ let McpElicitationService = class McpElicitationService {
|
|
|
178
178
|
}
|
|
179
179
|
} else {
|
|
180
180
|
const handle = this._notificationService.notify({
|
|
181
|
-
message: elicitation.message + " " + ( localize(
|
|
182
|
-
source: ( localize(
|
|
181
|
+
message: elicitation.message + " " + ( localize(11289, "This will open {0}", elicitation.url)),
|
|
182
|
+
source: ( localize(11281, "MCP Server ({0})", server.definition.label)),
|
|
183
183
|
severity: Severity.Info,
|
|
184
184
|
actions: {
|
|
185
|
-
primary: [store.add(( new Action("mcp.elicit.url.open2", ( localize(
|
|
186
|
-
secondary: [store.add(( new Action("mcp.elicit.cancel", ( localize(
|
|
185
|
+
primary: [store.add(( new Action("mcp.elicit.url.open2", ( localize(11290, "Open URL")), undefined, true, () => resolve(this._doElicitUrl(elicitation, token)))))],
|
|
186
|
+
secondary: [store.add(( new Action("mcp.elicit.cancel", ( localize(11283, "Cancel")), undefined, true, () => resolve({
|
|
187
187
|
action: "decline"
|
|
188
188
|
}))))]
|
|
189
189
|
}
|
|
@@ -325,7 +325,7 @@ let McpElicitationService = class McpElicitationService {
|
|
|
325
325
|
_getFieldPlaceholder(schema, required) {
|
|
326
326
|
let placeholder = schema.description || "";
|
|
327
327
|
if (!required) {
|
|
328
|
-
placeholder = placeholder ? `${placeholder} (${( localize(
|
|
328
|
+
placeholder = placeholder ? `${placeholder} (${( localize(11291, "Optional"))})` : ( localize(11291, "Optional"));
|
|
329
329
|
}
|
|
330
330
|
return placeholder;
|
|
331
331
|
}
|
|
@@ -434,7 +434,7 @@ let McpElicitationService = class McpElicitationService {
|
|
|
434
434
|
items.push({
|
|
435
435
|
id: "$default",
|
|
436
436
|
label: `${schema.default}`,
|
|
437
|
-
description: ( localize(
|
|
437
|
+
description: ( localize(11292, "Default value"))
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
440
|
}
|
|
@@ -503,13 +503,13 @@ let McpElicitationService = class McpElicitationService {
|
|
|
503
503
|
if (schema.minLength && value.length < schema.minLength) {
|
|
504
504
|
return {
|
|
505
505
|
isValid: false,
|
|
506
|
-
message: ( localize(
|
|
506
|
+
message: ( localize(11293, "Minimum length is {0}", schema.minLength))
|
|
507
507
|
};
|
|
508
508
|
}
|
|
509
509
|
if (schema.maxLength && value.length > schema.maxLength) {
|
|
510
510
|
return {
|
|
511
511
|
isValid: false,
|
|
512
|
-
message: ( localize(
|
|
512
|
+
message: ( localize(11294, "Maximum length is {0}", schema.maxLength))
|
|
513
513
|
};
|
|
514
514
|
}
|
|
515
515
|
if (schema.format) {
|
|
@@ -530,7 +530,7 @@ let McpElicitationService = class McpElicitationService {
|
|
|
530
530
|
isValid: true
|
|
531
531
|
} : {
|
|
532
532
|
isValid: false,
|
|
533
|
-
message: ( localize(
|
|
533
|
+
message: ( localize(11295, "Please enter a valid email address"))
|
|
534
534
|
};
|
|
535
535
|
case "uri":
|
|
536
536
|
if (URL.canParse(value)) {
|
|
@@ -540,7 +540,7 @@ let McpElicitationService = class McpElicitationService {
|
|
|
540
540
|
} else {
|
|
541
541
|
return {
|
|
542
542
|
isValid: false,
|
|
543
|
-
message: ( localize(
|
|
543
|
+
message: ( localize(11296, "Please enter a valid URI"))
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
546
|
case "date":
|
|
@@ -549,7 +549,7 @@ let McpElicitationService = class McpElicitationService {
|
|
|
549
549
|
if (!dateRegex.test(value)) {
|
|
550
550
|
return {
|
|
551
551
|
isValid: false,
|
|
552
|
-
message: ( localize(
|
|
552
|
+
message: ( localize(11297, "Please enter a valid date (YYYY-MM-DD)"))
|
|
553
553
|
};
|
|
554
554
|
}
|
|
555
555
|
const date = ( new Date(value));
|
|
@@ -557,7 +557,7 @@ let McpElicitationService = class McpElicitationService {
|
|
|
557
557
|
isValid: true
|
|
558
558
|
} : {
|
|
559
559
|
isValid: false,
|
|
560
|
-
message: ( localize(
|
|
560
|
+
message: ( localize(11297, "Please enter a valid date (YYYY-MM-DD)"))
|
|
561
561
|
};
|
|
562
562
|
}
|
|
563
563
|
case "date-time":
|
|
@@ -567,7 +567,7 @@ let McpElicitationService = class McpElicitationService {
|
|
|
567
567
|
isValid: true
|
|
568
568
|
} : {
|
|
569
569
|
isValid: false,
|
|
570
|
-
message: ( localize(
|
|
570
|
+
message: ( localize(11298, "Please enter a valid date-time"))
|
|
571
571
|
};
|
|
572
572
|
}
|
|
573
573
|
default:
|
|
@@ -581,25 +581,25 @@ let McpElicitationService = class McpElicitationService {
|
|
|
581
581
|
if (isNaN(parsed)) {
|
|
582
582
|
return {
|
|
583
583
|
isValid: false,
|
|
584
|
-
message: ( localize(
|
|
584
|
+
message: ( localize(11299, "Please enter a valid number"))
|
|
585
585
|
};
|
|
586
586
|
}
|
|
587
587
|
if (schema.type === "integer" && !Number.isInteger(parsed)) {
|
|
588
588
|
return {
|
|
589
589
|
isValid: false,
|
|
590
|
-
message: ( localize(
|
|
590
|
+
message: ( localize(11300, "Please enter a valid integer"))
|
|
591
591
|
};
|
|
592
592
|
}
|
|
593
593
|
if (schema.minimum !== undefined && parsed < schema.minimum) {
|
|
594
594
|
return {
|
|
595
595
|
isValid: false,
|
|
596
|
-
message: ( localize(
|
|
596
|
+
message: ( localize(11301, "Minimum value is {0}", schema.minimum))
|
|
597
597
|
};
|
|
598
598
|
}
|
|
599
599
|
if (schema.maximum !== undefined && parsed > schema.maximum) {
|
|
600
600
|
return {
|
|
601
601
|
isValid: false,
|
|
602
|
-
message: ( localize(
|
|
602
|
+
message: ( localize(11302, "Maximum value is {0}", schema.maximum))
|
|
603
603
|
};
|
|
604
604
|
}
|
|
605
605
|
return {
|
|
@@ -628,11 +628,11 @@ let McpElicitationService = class McpElicitationService {
|
|
|
628
628
|
allowFreeformInput: false,
|
|
629
629
|
options: [{
|
|
630
630
|
id: "true",
|
|
631
|
-
label: ( localize(
|
|
631
|
+
label: ( localize(11303, "True")),
|
|
632
632
|
value: "true"
|
|
633
633
|
}, {
|
|
634
634
|
id: "false",
|
|
635
|
-
label: ( localize(
|
|
635
|
+
label: ( localize(11304, "False")),
|
|
636
636
|
value: "false"
|
|
637
637
|
}],
|
|
638
638
|
defaultValue: schema.default !== undefined ? String(schema.default) : undefined
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
2
|
import { ILanguageFeaturesService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures.service";
|
|
3
3
|
import { IMarkerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service";
|
|
4
|
+
import { ISecretStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/secrets/common/secrets.service";
|
|
4
5
|
import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
|
|
5
6
|
import { IConfigurationResolverService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolver.service";
|
|
6
7
|
import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
|
|
@@ -12,8 +13,9 @@ export declare class McpLanguageFeatures extends Disposable implements IWorkbenc
|
|
|
12
13
|
private readonly _mcpService;
|
|
13
14
|
private readonly _markerService;
|
|
14
15
|
private readonly _configurationResolverService;
|
|
16
|
+
private readonly _secretStorageService;
|
|
15
17
|
private readonly _cachedMcpSection;
|
|
16
|
-
constructor(languageFeaturesService: ILanguageFeaturesService, _mcpRegistry: IMcpRegistry, _mcpWorkbenchService: IMcpWorkbenchService, _mcpService: IMcpService, _markerService: IMarkerService, _configurationResolverService: IConfigurationResolverService);
|
|
18
|
+
constructor(languageFeaturesService: ILanguageFeaturesService, _mcpRegistry: IMcpRegistry, _mcpWorkbenchService: IMcpWorkbenchService, _mcpService: IMcpService, _markerService: IMarkerService, _configurationResolverService: IConfigurationResolverService, _secretStorageService: ISecretStorageService);
|
|
17
19
|
/** Simple mechanism to avoid extra json parsing for hints+lenses */
|
|
18
20
|
private _parseModel;
|
|
19
21
|
private _addDiagnostics;
|
|
@@ -6,12 +6,14 @@ import { MarkdownString, createMarkdownCommandLink } from '@codingame/monaco-vsc
|
|
|
6
6
|
import { parseTree, findNodeAtLocation } from '@codingame/monaco-vscode-api/vscode/vs/base/common/json';
|
|
7
7
|
import { Disposable, MutableDisposable, dispose, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
8
|
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
9
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
9
10
|
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
10
11
|
import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures.service';
|
|
11
12
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
12
13
|
import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
13
14
|
import { MarkerSeverity } from '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers';
|
|
14
15
|
import { IMarkerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markers/common/markers.service';
|
|
16
|
+
import { ISecretStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/secrets/common/secrets.service';
|
|
15
17
|
import { StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
16
18
|
import { IConfigurationResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolver.service';
|
|
17
19
|
import { ConfigurationResolverExpression } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolverExpression';
|
|
@@ -19,7 +21,7 @@ import { McpCommandIds } from '@codingame/monaco-vscode-api/vscode/vs/workbench/
|
|
|
19
21
|
import { mcpConfigurationSection } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
|
|
20
22
|
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
21
23
|
import { isContributionDisabled } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement';
|
|
22
|
-
import { McpConnectionState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
24
|
+
import { McpConnectionState, mcpOAuthClientSecretStorageKey } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
23
25
|
import { IMcpWorkbenchService, IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
|
|
24
26
|
|
|
25
27
|
const diagnosticOwner = "vscode.mcp";
|
|
@@ -30,7 +32,8 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
30
32
|
_mcpWorkbenchService,
|
|
31
33
|
_mcpService,
|
|
32
34
|
_markerService,
|
|
33
|
-
_configurationResolverService
|
|
35
|
+
_configurationResolverService,
|
|
36
|
+
_secretStorageService
|
|
34
37
|
) {
|
|
35
38
|
super();
|
|
36
39
|
this._mcpRegistry = _mcpRegistry;
|
|
@@ -38,6 +41,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
38
41
|
this._mcpService = _mcpService;
|
|
39
42
|
this._markerService = _markerService;
|
|
40
43
|
this._configurationResolverService = _configurationResolverService;
|
|
44
|
+
this._secretStorageService = _secretStorageService;
|
|
41
45
|
this._cachedMcpSection = this._register(( new MutableDisposable()));
|
|
42
46
|
const patterns = [{
|
|
43
47
|
pattern: "**/mcp.json"
|
|
@@ -54,6 +58,11 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
54
58
|
this._register(
|
|
55
59
|
languageFeaturesService.codeLensProvider.register(patterns, codeLensProvider)
|
|
56
60
|
);
|
|
61
|
+
this._register(this._secretStorageService.onDidChangeSecret(key => {
|
|
62
|
+
if (key.startsWith("mcp.oauth.clientSecret:")) {
|
|
63
|
+
onDidChangeCodeLens.fire(codeLensProvider);
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
57
66
|
this._register(languageFeaturesService.inlayHintsProvider.register(patterns, {
|
|
58
67
|
onDidChangeInlayHints: _mcpRegistry.onDidChangeInputs,
|
|
59
68
|
provideInlayHints: (model, range) => this._provideInlayHints(model, range)
|
|
@@ -125,7 +134,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
125
134
|
diagnostics.push({
|
|
126
135
|
severity: MarkerSeverity.Warning,
|
|
127
136
|
message: ( localize(
|
|
128
|
-
|
|
137
|
+
11305,
|
|
129
138
|
"Variable `{0}` not found, did you mean ${{1}}?",
|
|
130
139
|
name,
|
|
131
140
|
getClosestMatchingVariable(name) + (arg ? `:${arg}` : "")
|
|
@@ -189,7 +198,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
189
198
|
range,
|
|
190
199
|
command: {
|
|
191
200
|
id: McpCommandIds.ServerOptions,
|
|
192
|
-
title: "$(circle-slash) " + ( localize(
|
|
201
|
+
title: "$(circle-slash) " + ( localize(11306, "Disabled")),
|
|
193
202
|
arguments: [server.definition.id]
|
|
194
203
|
}
|
|
195
204
|
});
|
|
@@ -203,14 +212,14 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
203
212
|
range,
|
|
204
213
|
command: {
|
|
205
214
|
id: McpCommandIds.ShowOutput,
|
|
206
|
-
title: "$(error) " + ( localize(
|
|
215
|
+
title: "$(error) " + ( localize(11307, "Error")),
|
|
207
216
|
arguments: [server.definition.id]
|
|
208
217
|
}
|
|
209
218
|
}, {
|
|
210
219
|
range,
|
|
211
220
|
command: {
|
|
212
221
|
id: McpCommandIds.RestartServer,
|
|
213
|
-
title: ( localize(
|
|
222
|
+
title: ( localize(11308, "Restart")),
|
|
214
223
|
arguments: [server.definition.id, {
|
|
215
224
|
autoTrustChanges: true
|
|
216
225
|
}]
|
|
@@ -221,7 +230,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
221
230
|
range,
|
|
222
231
|
command: {
|
|
223
232
|
id: McpCommandIds.RestartServer,
|
|
224
|
-
title: ( localize(
|
|
233
|
+
title: ( localize(11309, "Debug")),
|
|
225
234
|
arguments: [server.definition.id, {
|
|
226
235
|
debug: true,
|
|
227
236
|
autoTrustChanges: true
|
|
@@ -235,14 +244,14 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
235
244
|
range,
|
|
236
245
|
command: {
|
|
237
246
|
id: McpCommandIds.ShowOutput,
|
|
238
|
-
title: "$(loading~spin) " + ( localize(
|
|
247
|
+
title: "$(loading~spin) " + ( localize(11310, "Starting")),
|
|
239
248
|
arguments: [server.definition.id]
|
|
240
249
|
}
|
|
241
250
|
}, {
|
|
242
251
|
range,
|
|
243
252
|
command: {
|
|
244
253
|
id: McpCommandIds.StopServer,
|
|
245
|
-
title: ( localize(
|
|
254
|
+
title: ( localize(11311, "Cancel")),
|
|
246
255
|
arguments: [server.definition.id]
|
|
247
256
|
}
|
|
248
257
|
});
|
|
@@ -252,21 +261,21 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
252
261
|
range,
|
|
253
262
|
command: {
|
|
254
263
|
id: McpCommandIds.ShowOutput,
|
|
255
|
-
title: "$(check) " + ( localize(
|
|
264
|
+
title: "$(check) " + ( localize(11312, "Running")),
|
|
256
265
|
arguments: [server.definition.id]
|
|
257
266
|
}
|
|
258
267
|
}, {
|
|
259
268
|
range,
|
|
260
269
|
command: {
|
|
261
270
|
id: McpCommandIds.StopServer,
|
|
262
|
-
title: ( localize(
|
|
271
|
+
title: ( localize(11313, "Stop")),
|
|
263
272
|
arguments: [server.definition.id]
|
|
264
273
|
}
|
|
265
274
|
}, {
|
|
266
275
|
range,
|
|
267
276
|
command: {
|
|
268
277
|
id: McpCommandIds.RestartServer,
|
|
269
|
-
title: ( localize(
|
|
278
|
+
title: ( localize(11308, "Restart")),
|
|
270
279
|
arguments: [server.definition.id, {
|
|
271
280
|
autoTrustChanges: true
|
|
272
281
|
}]
|
|
@@ -277,7 +286,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
277
286
|
range,
|
|
278
287
|
command: {
|
|
279
288
|
id: McpCommandIds.RestartServer,
|
|
280
|
-
title: ( localize(
|
|
289
|
+
title: ( localize(11309, "Debug")),
|
|
281
290
|
arguments: [server.definition.id, {
|
|
282
291
|
autoTrustChanges: true,
|
|
283
292
|
debug: true
|
|
@@ -291,7 +300,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
291
300
|
range,
|
|
292
301
|
command: {
|
|
293
302
|
id: McpCommandIds.StartServer,
|
|
294
|
-
title: "$(debug-start) " + ( localize(
|
|
303
|
+
title: "$(debug-start) " + ( localize(11314, "Start")),
|
|
295
304
|
arguments: [server.definition.id, {
|
|
296
305
|
autoTrustChanges: true
|
|
297
306
|
}]
|
|
@@ -302,7 +311,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
302
311
|
range,
|
|
303
312
|
command: {
|
|
304
313
|
id: McpCommandIds.StartServer,
|
|
305
|
-
title: ( localize(
|
|
314
|
+
title: ( localize(11309, "Debug")),
|
|
306
315
|
arguments: [server.definition.id, {
|
|
307
316
|
autoTrustChanges: true,
|
|
308
317
|
debug: true
|
|
@@ -318,7 +327,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
318
327
|
range,
|
|
319
328
|
command: {
|
|
320
329
|
id: "",
|
|
321
|
-
title: ( localize(
|
|
330
|
+
title: ( localize(11315, "{0} tools", toolCount))
|
|
322
331
|
}
|
|
323
332
|
});
|
|
324
333
|
}
|
|
@@ -328,7 +337,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
328
337
|
range,
|
|
329
338
|
command: {
|
|
330
339
|
id: McpCommandIds.StartPromptForServer,
|
|
331
|
-
title: ( localize(
|
|
340
|
+
title: ( localize(11316, "{0} prompts", promptCount)),
|
|
332
341
|
arguments: [server]
|
|
333
342
|
}
|
|
334
343
|
});
|
|
@@ -337,12 +346,64 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
337
346
|
range,
|
|
338
347
|
command: {
|
|
339
348
|
id: McpCommandIds.ServerOptions,
|
|
340
|
-
title: ( localize(
|
|
349
|
+
title: ( localize(11317, "More...")),
|
|
341
350
|
arguments: [server.definition.id]
|
|
342
351
|
}
|
|
343
352
|
});
|
|
344
353
|
}
|
|
345
354
|
}
|
|
355
|
+
const candidates = [];
|
|
356
|
+
for (const node of serversNode.children || []) {
|
|
357
|
+
if (node.type !== "property" || node.children?.[0]?.type !== "string" || !node.children[1]) {
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
const serverName = node.children[0].value;
|
|
361
|
+
const serverValue = node.children[1];
|
|
362
|
+
const clientIdNode = findNodeAtLocation(serverValue, ["oauth", "clientId"]);
|
|
363
|
+
if (clientIdNode && clientIdNode.type === "string") {
|
|
364
|
+
const clientId = clientIdNode.value;
|
|
365
|
+
if (clientId) {
|
|
366
|
+
const urlNode = findNodeAtLocation(serverValue, ["url"]);
|
|
367
|
+
const rawUrl = urlNode && urlNode.type === "string" ? urlNode.value : undefined;
|
|
368
|
+
if (!rawUrl) {
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
let mcpServerUrl;
|
|
372
|
+
try {
|
|
373
|
+
mcpServerUrl = ( ( URI.parse(rawUrl)).toString(true));
|
|
374
|
+
} catch {
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
candidates.push({
|
|
378
|
+
clientId,
|
|
379
|
+
mcpServerUrl,
|
|
380
|
+
serverName,
|
|
381
|
+
clientIdOffset: clientIdNode.offset
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const existingSecrets = await Promise.all(( candidates.map(
|
|
387
|
+
c => this._secretStorageService.get(mcpOAuthClientSecretStorageKey(c.mcpServerUrl, c.clientId))
|
|
388
|
+
)));
|
|
389
|
+
for (let i = 0; i < candidates.length; i++) {
|
|
390
|
+
const {
|
|
391
|
+
clientId,
|
|
392
|
+
mcpServerUrl,
|
|
393
|
+
serverName,
|
|
394
|
+
clientIdOffset
|
|
395
|
+
} = candidates[i];
|
|
396
|
+
const existing = existingSecrets[i];
|
|
397
|
+
const title = existing ? ( localize(11318, "Replace Client Secret")) : ( localize(11319, "Set Client Secret"));
|
|
398
|
+
lenses.push({
|
|
399
|
+
range: Range.fromPositions(model.getPositionAt(clientIdOffset)),
|
|
400
|
+
command: {
|
|
401
|
+
id: McpCommandIds.SetOAuthClientSecret,
|
|
402
|
+
title,
|
|
403
|
+
arguments: [clientId, mcpServerUrl, serverName]
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
346
407
|
return lensList;
|
|
347
408
|
}
|
|
348
409
|
async _provideInlayHints(model, range) {
|
|
@@ -412,19 +473,19 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
412
473
|
function pushAnnotation(savedId, offset, saved) {
|
|
413
474
|
const tooltip = ( new MarkdownString([createMarkdownCommandLink({
|
|
414
475
|
id: McpCommandIds.EditStoredInput,
|
|
415
|
-
text: ( localize(
|
|
476
|
+
text: ( localize(11320, "Edit")),
|
|
416
477
|
arguments: [savedId, model.uri, mcpConfigurationSection, inConfig.target],
|
|
417
|
-
tooltip: ( localize(
|
|
478
|
+
tooltip: ( localize(11321, "Edit saved value"))
|
|
418
479
|
}), createMarkdownCommandLink({
|
|
419
480
|
id: McpCommandIds.RemoveStoredInput,
|
|
420
|
-
text: ( localize(
|
|
481
|
+
text: ( localize(11322, "Clear")),
|
|
421
482
|
arguments: [inConfig.scope, savedId],
|
|
422
|
-
tooltip: ( localize(
|
|
483
|
+
tooltip: ( localize(11323, "Clear saved value"))
|
|
423
484
|
}), createMarkdownCommandLink({
|
|
424
485
|
id: McpCommandIds.RemoveStoredInput,
|
|
425
|
-
text: ( localize(
|
|
486
|
+
text: ( localize(11324, "Clear All")),
|
|
426
487
|
arguments: [inConfig.scope],
|
|
427
|
-
tooltip: ( localize(
|
|
488
|
+
tooltip: ( localize(11325, "Clear all saved values"))
|
|
428
489
|
})].join(" | "), {
|
|
429
490
|
isTrusted: true
|
|
430
491
|
}));
|
|
@@ -439,7 +500,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
|
|
|
439
500
|
}
|
|
440
501
|
}
|
|
441
502
|
};
|
|
442
|
-
McpLanguageFeatures = ( __decorate([( __param(0, ILanguageFeaturesService)), ( __param(1, IMcpRegistry)), ( __param(2, IMcpWorkbenchService)), ( __param(3, IMcpService)), ( __param(4, IMarkerService)), ( __param(5, IConfigurationResolverService))], McpLanguageFeatures));
|
|
503
|
+
McpLanguageFeatures = ( __decorate([( __param(0, ILanguageFeaturesService)), ( __param(1, IMcpRegistry)), ( __param(2, IMcpWorkbenchService)), ( __param(3, IMcpService)), ( __param(4, IMarkerService)), ( __param(5, IConfigurationResolverService)), ( __param(6, ISecretStorageService))], McpLanguageFeatures));
|
|
443
504
|
function forEachPropertyWithReplacement(node, callback) {
|
|
444
505
|
if (node.type === "string" && typeof node.value === "string" && node.value.includes(ConfigurationResolverExpression.VARIABLE_LHS)) {
|
|
445
506
|
callback(node);
|
|
@@ -98,16 +98,16 @@ let McpConfigMigrationContribution = class McpConfigMigrationContribution extend
|
|
|
98
98
|
}
|
|
99
99
|
showMcpConfigErrorNotification(isRemote) {
|
|
100
100
|
const message = isRemote ? ( localize(
|
|
101
|
-
|
|
101
|
+
11326,
|
|
102
102
|
"MCP servers should no longer be configured in remote user settings. Use the dedicated MCP configuration instead."
|
|
103
103
|
)) : ( localize(
|
|
104
|
-
|
|
104
|
+
11327,
|
|
105
105
|
"MCP servers should no longer be configured in user settings. Use the dedicated MCP configuration instead."
|
|
106
106
|
));
|
|
107
|
-
const openConfigLabel = isRemote ? ( localize(
|
|
107
|
+
const openConfigLabel = isRemote ? ( localize(11328, "Open Remote User MCP Configuration")) : ( localize(11329, "Open User MCP Configuration"));
|
|
108
108
|
const commandId = isRemote ? McpCommandIds.OpenRemoteUserMcp : McpCommandIds.OpenUserMcp;
|
|
109
109
|
this.notificationService.prompt(Severity.Error, message, [{
|
|
110
|
-
label: ( localize(
|
|
110
|
+
label: ( localize(11330, "Update Now")),
|
|
111
111
|
run: async () => {
|
|
112
112
|
await this.migrateMcpConfig();
|
|
113
113
|
await this.commandService.executeCommand(commandId);
|
|
@@ -74,7 +74,7 @@ let McpResourcePickHelper = class McpResourcePickHelper extends Disposable {
|
|
|
74
74
|
id: resource.template.template,
|
|
75
75
|
label: resource.title || resource.name,
|
|
76
76
|
description: resource.description,
|
|
77
|
-
detail: ( localize(
|
|
77
|
+
detail: ( localize(11346, "Resource template: {0}", resource.template.template)),
|
|
78
78
|
iconPath
|
|
79
79
|
};
|
|
80
80
|
}
|
|
@@ -221,7 +221,7 @@ let McpResourcePickHelper = class McpResourcePickHelper extends Disposable {
|
|
|
221
221
|
return uri;
|
|
222
222
|
}
|
|
223
223
|
this._notificationService.warn(( localize(
|
|
224
|
-
|
|
224
|
+
11347,
|
|
225
225
|
"The resource {0} was not found.",
|
|
226
226
|
(McpResourceURI.toServer(uri).resourceURL.toString())
|
|
227
227
|
)));
|
|
@@ -266,13 +266,13 @@ let McpResourcePickHelper = class McpResourcePickHelper extends Disposable {
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
let placeholder = ( localize(
|
|
269
|
-
|
|
269
|
+
11348,
|
|
270
270
|
"Value for ${0} in {1}",
|
|
271
271
|
variable.name.toUpperCase(),
|
|
272
272
|
rt.template.resolve(variablesWithPlaceholders).replaceAll("%24", "$")
|
|
273
273
|
));
|
|
274
274
|
if (variable.optional) {
|
|
275
|
-
placeholder += " (" + ( localize(
|
|
275
|
+
placeholder += " (" + ( localize(11349, "Optional")) + ")";
|
|
276
276
|
}
|
|
277
277
|
input.placeholder = placeholder;
|
|
278
278
|
input.value = "";
|
|
@@ -292,7 +292,7 @@ let McpResourcePickHelper = class McpResourcePickHelper extends Disposable {
|
|
|
292
292
|
} else if (variable.optional) {
|
|
293
293
|
items.unshift({
|
|
294
294
|
id: currentID,
|
|
295
|
-
label: ( localize(
|
|
295
|
+
label: ( localize(11350, "<Empty>"))
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
298
|
input.items = items;
|
|
@@ -463,7 +463,7 @@ let AbstractMcpResourceAccessPick = class AbstractMcpResourceAccessPick {
|
|
|
463
463
|
picker.keepScrollPosition = true;
|
|
464
464
|
const store = ( new DisposableStore());
|
|
465
465
|
const goBackId = "_goback_";
|
|
466
|
-
const attachButton = ( localize(
|
|
466
|
+
const attachButton = ( localize(11351, "Attach to chat"));
|
|
467
467
|
const helper = store.add(this._instantiationService.createInstance(McpResourcePickHelper));
|
|
468
468
|
if (this._scopeTo) {
|
|
469
469
|
helper.explicitServers = [this._scopeTo];
|
|
@@ -491,7 +491,7 @@ let AbstractMcpResourceAccessPick = class AbstractMcpResourceAccessPick {
|
|
|
491
491
|
if (helper.checkIfNestedResources()) {
|
|
492
492
|
const goBackItem = {
|
|
493
493
|
id: goBackId,
|
|
494
|
-
label: ( localize(
|
|
494
|
+
label: ( localize(11352, "Go back ↩")),
|
|
495
495
|
alwaysShow: true
|
|
496
496
|
};
|
|
497
497
|
items.push(goBackItem);
|
|
@@ -573,7 +573,7 @@ let McpResourceQuickPick = class McpResourceQuickPick extends AbstractMcpResourc
|
|
|
573
573
|
const qp = store.add(this._quickInputService.createQuickPick({
|
|
574
574
|
useSeparators: true
|
|
575
575
|
}));
|
|
576
|
-
qp.placeholder = ( localize(
|
|
576
|
+
qp.placeholder = ( localize(11353, "Search for resources"));
|
|
577
577
|
store.add(this.applyToPick(qp, token));
|
|
578
578
|
store.add(qp.onDidHide(() => store.dispose()));
|
|
579
579
|
qp.show();
|