@codingame/monaco-vscode-mcp-service-override 28.4.0 → 29.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.
Files changed (35) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/base/common/jsonRpcProtocol.d.ts +13 -1
  3. package/vscode/src/vs/base/common/jsonRpcProtocol.js +26 -13
  4. package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +1 -1
  5. package/vscode/src/vs/platform/mcp/common/mcpGalleryManifestService.js +2 -1
  6. package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +8 -5
  7. package/vscode/src/vs/platform/mcp/common/mcpGateway.d.ts +49 -18
  8. package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +3 -3
  9. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
  10. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +81 -67
  11. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.d.ts +11 -0
  12. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +267 -50
  13. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.js +17 -3
  14. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +24 -21
  15. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +4 -4
  16. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +8 -8
  17. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +18 -18
  18. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +37 -9
  19. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +4 -4
  20. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +1 -1
  21. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.js +11 -3
  22. package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
  23. package/vscode/src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.d.ts +8 -9
  24. package/vscode/src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.js +147 -132
  25. package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +10 -6
  26. package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +14 -14
  27. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +1 -1
  28. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +11 -11
  29. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.d.ts +2 -0
  30. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js +15 -8
  31. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +7 -22
  32. package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.d.ts +4 -1
  33. package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +16 -4
  34. package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +9 -9
  35. package/vscode/src/vs/workbench/services/mcp/browser/mcpGalleryManifestService.js +2 -2
@@ -8,12 +8,14 @@ import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/com
8
8
  import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
9
9
  import { isDefined } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
10
10
  import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
11
+ import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
11
12
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
12
13
  import '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
13
14
  import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
14
15
  import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
15
16
  import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
16
17
  import { ChatElicitationRequestPart } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatElicitationRequestPart';
18
+ import { ChatQuestionCarouselData } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatQuestionCarouselData';
17
19
  import { ChatModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel';
18
20
  import { ElicitationState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService';
19
21
  import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
@@ -25,8 +27,8 @@ import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/obse
25
27
 
26
28
  const noneItem = {
27
29
  id: undefined,
28
- label: ( localize(10218, "None")),
29
- description: ( localize(10219, "No selection")),
30
+ label: ( localize(10455, "None")),
31
+ description: ( localize(10456, "No selection")),
30
32
  alwaysShow: true
31
33
  };
32
34
  function isFormElicitation(params) {
@@ -78,39 +80,58 @@ let McpElicitationService = class McpElicitationService {
78
80
  if (chatModel instanceof ChatModel) {
79
81
  const request = chatModel.getRequests().at(-1);
80
82
  if (request) {
81
- const part = ( new ChatElicitationRequestPart(( localize(10220, "Request for Input")), elicitation.message, ( localize(10221, "{0} (MCP Server)", server.definition.label)), ( localize(10222, "Respond")), ( localize(10223, "Cancel")), async () => {
82
- const p = this._doElicitForm(elicitation, token);
83
- resolve(p);
84
- const result = await p;
85
- part.acceptedResult = result.content;
86
- return result.action === "accept" ? ElicitationState.Accepted : ElicitationState.Rejected;
87
- }, () => {
88
- resolve({
89
- action: "decline"
83
+ const {
84
+ questions,
85
+ idToPropertyMap
86
+ } = this._convertSchemaToQuestions(elicitation);
87
+ const carousel = ( new ChatQuestionCarouselData(
88
+ questions,
89
+ true,
90
+ undefined,
91
+ undefined,
92
+ undefined,
93
+ ( new MarkdownString(elicitation.message)),
94
+ mcpServerToSourceData(server)
95
+ ));
96
+ chatModel.acceptResponseProgress(request, carousel);
97
+ store.add(token.onCancellationRequested(() => {
98
+ carousel.completion.complete({
99
+ answers: undefined
90
100
  });
91
- return Promise.resolve(ElicitationState.Rejected);
92
- }, mcpServerToSourceData(server)));
93
- chatModel.acceptResponseProgress(request, part);
101
+ }));
102
+ carousel.completion.p.then(result => {
103
+ if (!result.answers) {
104
+ resolve({
105
+ action: "cancel"
106
+ });
107
+ } else {
108
+ const content = this._convertCarouselAnswersToElicitResult(result.answers, idToPropertyMap, elicitation.requestedSchema.properties);
109
+ resolve({
110
+ action: "accept",
111
+ content
112
+ });
113
+ }
114
+ });
115
+ return;
94
116
  }
95
- } else {
96
- const handle = this._notificationService.notify({
97
- message: elicitation.message,
98
- source: ( localize(10224, "MCP Server ({0})", server.definition.label)),
99
- severity: Severity.Info,
100
- actions: {
101
- primary: [store.add(( new Action("mcp.elicit.give", ( localize(10225, "Respond")), undefined, true, () => resolve(this._doElicitForm(elicitation, token)))))],
102
- secondary: [store.add(( new Action("mcp.elicit.cancel", ( localize(10226, "Cancel")), undefined, true, () => resolve({
103
- action: "decline"
104
- }))))]
105
- }
106
- });
107
- store.add(handle.onDidClose(() => resolve({
108
- action: "cancel"
109
- })));
110
- store.add(token.onCancellationRequested(() => resolve({
111
- action: "cancel"
112
- })));
113
117
  }
118
+ const handle = this._notificationService.notify({
119
+ message: elicitation.message,
120
+ source: ( localize(10457, "MCP Server ({0})", server.definition.label)),
121
+ severity: Severity.Info,
122
+ actions: {
123
+ primary: [store.add(( new Action("mcp.elicit.give", ( localize(10458, "Respond")), undefined, true, () => resolve(this._doElicitForm(elicitation, token)))))],
124
+ secondary: [store.add(( new Action("mcp.elicit.cancel", ( localize(10459, "Cancel")), undefined, true, () => resolve({
125
+ action: "decline"
126
+ }))))]
127
+ }
128
+ });
129
+ store.add(handle.onDidClose(() => resolve({
130
+ action: "cancel"
131
+ })));
132
+ store.add(token.onCancellationRequested(() => resolve({
133
+ action: "cancel"
134
+ })));
114
135
  })).finally(() => store.dispose());
115
136
  return {
116
137
  kind: ElicitationKind.Form,
@@ -142,7 +163,7 @@ let McpElicitationService = class McpElicitationService {
142
163
  if (chatModel instanceof ChatModel) {
143
164
  const request = chatModel.getRequests().at(-1);
144
165
  if (request) {
145
- const part = ( new ChatElicitationRequestPart(( localize(10227, "Authorization Required")), ( new MarkdownString()).appendText(elicitation.message).appendMarkdown("\n\n" + ( localize(10228, "Open this URL?"))).appendCodeblock("", elicitation.url), ( localize(10221, "{0} (MCP Server)", server.definition.label)), ( localize(10229, "Open {0}", ( URI.parse(elicitation.url)).authority)), ( localize(10223, "Cancel")), async () => {
166
+ const part = ( new ChatElicitationRequestPart(( localize(10460, "Authorization Required")), ( new MarkdownString()).appendText(elicitation.message).appendMarkdown("\n\n" + ( localize(10461, "Open this URL?"))).appendCodeblock("", elicitation.url), ( localize(10462, "{0} (MCP Server)", server.definition.label)), ( localize(10463, "Open {0}", ( URI.parse(elicitation.url)).authority)), ( localize(10464, "Cancel")), async () => {
146
167
  const result = await this._doElicitUrl(elicitation, token);
147
168
  resolve(result);
148
169
  completePromise.then(() => part.hide());
@@ -157,12 +178,12 @@ let McpElicitationService = class McpElicitationService {
157
178
  }
158
179
  } else {
159
180
  const handle = this._notificationService.notify({
160
- message: elicitation.message + " " + ( localize(10230, "This will open {0}", elicitation.url)),
161
- source: ( localize(10224, "MCP Server ({0})", server.definition.label)),
181
+ message: elicitation.message + " " + ( localize(10465, "This will open {0}", elicitation.url)),
182
+ source: ( localize(10457, "MCP Server ({0})", server.definition.label)),
162
183
  severity: Severity.Info,
163
184
  actions: {
164
- primary: [store.add(( new Action("mcp.elicit.url.open2", ( localize(10231, "Open URL")), undefined, true, () => resolve(this._doElicitUrl(elicitation, token)))))],
165
- secondary: [store.add(( new Action("mcp.elicit.cancel", ( localize(10226, "Cancel")), undefined, true, () => resolve({
185
+ primary: [store.add(( new Action("mcp.elicit.url.open2", ( localize(10466, "Open URL")), undefined, true, () => resolve(this._doElicitUrl(elicitation, token)))))],
186
+ secondary: [store.add(( new Action("mcp.elicit.cancel", ( localize(10459, "Cancel")), undefined, true, () => resolve({
166
187
  action: "decline"
167
188
  }))))]
168
189
  }
@@ -304,7 +325,7 @@ let McpElicitationService = class McpElicitationService {
304
325
  _getFieldPlaceholder(schema, required) {
305
326
  let placeholder = schema.description || "";
306
327
  if (!required) {
307
- placeholder = placeholder ? `${placeholder} (${( localize(10232, "Optional"))})` : ( localize(10232, "Optional"));
328
+ placeholder = placeholder ? `${placeholder} (${( localize(10467, "Optional"))})` : ( localize(10467, "Optional"));
308
329
  }
309
330
  return placeholder;
310
331
  }
@@ -413,7 +434,7 @@ let McpElicitationService = class McpElicitationService {
413
434
  items.push({
414
435
  id: "$default",
415
436
  label: `${schema.default}`,
416
- description: ( localize(10233, "Default value"))
437
+ description: ( localize(10468, "Default value"))
417
438
  });
418
439
  }
419
440
  }
@@ -482,13 +503,13 @@ let McpElicitationService = class McpElicitationService {
482
503
  if (schema.minLength && value.length < schema.minLength) {
483
504
  return {
484
505
  isValid: false,
485
- message: ( localize(10234, "Minimum length is {0}", schema.minLength))
506
+ message: ( localize(10469, "Minimum length is {0}", schema.minLength))
486
507
  };
487
508
  }
488
509
  if (schema.maxLength && value.length > schema.maxLength) {
489
510
  return {
490
511
  isValid: false,
491
- message: ( localize(10235, "Maximum length is {0}", schema.maxLength))
512
+ message: ( localize(10470, "Maximum length is {0}", schema.maxLength))
492
513
  };
493
514
  }
494
515
  if (schema.format) {
@@ -509,7 +530,7 @@ let McpElicitationService = class McpElicitationService {
509
530
  isValid: true
510
531
  } : {
511
532
  isValid: false,
512
- message: ( localize(10236, "Please enter a valid email address"))
533
+ message: ( localize(10471, "Please enter a valid email address"))
513
534
  };
514
535
  case "uri":
515
536
  if (URL.canParse(value)) {
@@ -519,7 +540,7 @@ let McpElicitationService = class McpElicitationService {
519
540
  } else {
520
541
  return {
521
542
  isValid: false,
522
- message: ( localize(10237, "Please enter a valid URI"))
543
+ message: ( localize(10472, "Please enter a valid URI"))
523
544
  };
524
545
  }
525
546
  case "date":
@@ -528,7 +549,7 @@ let McpElicitationService = class McpElicitationService {
528
549
  if (!dateRegex.test(value)) {
529
550
  return {
530
551
  isValid: false,
531
- message: ( localize(10238, "Please enter a valid date (YYYY-MM-DD)"))
552
+ message: ( localize(10473, "Please enter a valid date (YYYY-MM-DD)"))
532
553
  };
533
554
  }
534
555
  const date = ( new Date(value));
@@ -536,7 +557,7 @@ let McpElicitationService = class McpElicitationService {
536
557
  isValid: true
537
558
  } : {
538
559
  isValid: false,
539
- message: ( localize(10238, "Please enter a valid date (YYYY-MM-DD)"))
560
+ message: ( localize(10473, "Please enter a valid date (YYYY-MM-DD)"))
540
561
  };
541
562
  }
542
563
  case "date-time":
@@ -546,7 +567,7 @@ let McpElicitationService = class McpElicitationService {
546
567
  isValid: true
547
568
  } : {
548
569
  isValid: false,
549
- message: ( localize(10239, "Please enter a valid date-time"))
570
+ message: ( localize(10474, "Please enter a valid date-time"))
550
571
  };
551
572
  }
552
573
  default:
@@ -560,25 +581,25 @@ let McpElicitationService = class McpElicitationService {
560
581
  if (isNaN(parsed)) {
561
582
  return {
562
583
  isValid: false,
563
- message: ( localize(10240, "Please enter a valid number"))
584
+ message: ( localize(10475, "Please enter a valid number"))
564
585
  };
565
586
  }
566
587
  if (schema.type === "integer" && !Number.isInteger(parsed)) {
567
588
  return {
568
589
  isValid: false,
569
- message: ( localize(10241, "Please enter a valid integer"))
590
+ message: ( localize(10476, "Please enter a valid integer"))
570
591
  };
571
592
  }
572
593
  if (schema.minimum !== undefined && parsed < schema.minimum) {
573
594
  return {
574
595
  isValid: false,
575
- message: ( localize(10242, "Minimum value is {0}", schema.minimum))
596
+ message: ( localize(10477, "Minimum value is {0}", schema.minimum))
576
597
  };
577
598
  }
578
599
  if (schema.maximum !== undefined && parsed > schema.maximum) {
579
600
  return {
580
601
  isValid: false,
581
- message: ( localize(10243, "Maximum value is {0}", schema.maximum))
602
+ message: ( localize(10478, "Maximum value is {0}", schema.maximum))
582
603
  };
583
604
  }
584
605
  return {
@@ -586,6 +607,202 @@ let McpElicitationService = class McpElicitationService {
586
607
  parsedValue: parsed
587
608
  };
588
609
  }
610
+ _convertSchemaToQuestions(elicitation) {
611
+ const properties = Object.entries(elicitation.requestedSchema.properties);
612
+ const requiredFields = ( new Set(elicitation.requestedSchema.required || []));
613
+ const questions = [];
614
+ const idToPropertyMap = ( new Map());
615
+ for (const [propertyName, schema] of properties) {
616
+ const id = generateUuid();
617
+ idToPropertyMap.set(id, propertyName);
618
+ const title = schema.title || propertyName;
619
+ const description = schema.description;
620
+ const isRequired = ( requiredFields.has(propertyName));
621
+ if (schema.type === "boolean") {
622
+ questions.push({
623
+ id,
624
+ type: "singleSelect",
625
+ title,
626
+ description,
627
+ required: isRequired,
628
+ allowFreeformInput: false,
629
+ options: [{
630
+ id: "true",
631
+ label: ( localize(10479, "True")),
632
+ value: "true"
633
+ }, {
634
+ id: "false",
635
+ label: ( localize(10480, "False")),
636
+ value: "false"
637
+ }],
638
+ defaultValue: schema.default !== undefined ? String(schema.default) : undefined
639
+ });
640
+ } else if (isLegacyTitledEnumSchema(schema)) {
641
+ questions.push({
642
+ id,
643
+ type: "singleSelect",
644
+ title,
645
+ description,
646
+ required: isRequired,
647
+ allowFreeformInput: false,
648
+ options: ( schema.enum.map((v, i) => ({
649
+ id: v,
650
+ label: schema.enumNames[i] ? `${v} - ${schema.enumNames[i]}` : v,
651
+ value: v
652
+ }))),
653
+ defaultValue: schema.default
654
+ });
655
+ } else if (isTitledSingleEnumSchema(schema)) {
656
+ questions.push({
657
+ id,
658
+ type: "singleSelect",
659
+ title,
660
+ description,
661
+ required: isRequired,
662
+ allowFreeformInput: false,
663
+ options: ( schema.oneOf.map((
664
+ {
665
+ const: value,
666
+ title: optTitle
667
+ }
668
+ ) => ({
669
+ id: value,
670
+ label: optTitle ? `${value} - ${optTitle}` : value,
671
+ value
672
+ }))),
673
+ defaultValue: schema.default
674
+ });
675
+ } else if (isUntitledEnumSchema(schema)) {
676
+ questions.push({
677
+ id,
678
+ type: "singleSelect",
679
+ title,
680
+ description,
681
+ required: isRequired,
682
+ allowFreeformInput: false,
683
+ options: ( schema.enum.map(v => ({
684
+ id: v,
685
+ label: v,
686
+ value: v
687
+ }))),
688
+ defaultValue: schema.default
689
+ });
690
+ } else if (isTitledMultiEnumSchema(schema)) {
691
+ questions.push({
692
+ id,
693
+ type: "multiSelect",
694
+ title,
695
+ description,
696
+ required: isRequired,
697
+ allowFreeformInput: false,
698
+ options: ( schema.items.anyOf.map((
699
+ {
700
+ const: value,
701
+ title: optTitle
702
+ }
703
+ ) => ({
704
+ id: value,
705
+ label: optTitle ? `${value} - ${optTitle}` : value,
706
+ value
707
+ }))),
708
+ defaultValue: schema.default
709
+ });
710
+ } else if (isUntitledMultiEnumSchema(schema)) {
711
+ questions.push({
712
+ id,
713
+ type: "multiSelect",
714
+ title,
715
+ description,
716
+ required: isRequired,
717
+ allowFreeformInput: false,
718
+ options: ( schema.items.enum.map(v => ({
719
+ id: v,
720
+ label: v,
721
+ value: v
722
+ }))),
723
+ defaultValue: schema.default
724
+ });
725
+ } else {
726
+ const validation = {};
727
+ if (schema.type === "string") {
728
+ if (schema.minLength !== undefined) {
729
+ validation.minLength = schema.minLength;
730
+ }
731
+ if (schema.maxLength !== undefined) {
732
+ validation.maxLength = schema.maxLength;
733
+ }
734
+ if (schema.format) {
735
+ validation.format = schema.format;
736
+ }
737
+ } else if (schema.type === "number" || schema.type === "integer") {
738
+ if (schema.minimum !== undefined) {
739
+ validation.minimum = schema.minimum;
740
+ }
741
+ if (schema.maximum !== undefined) {
742
+ validation.maximum = schema.maximum;
743
+ }
744
+ if (schema.type === "integer") {
745
+ validation.isInteger = true;
746
+ }
747
+ }
748
+ questions.push({
749
+ id,
750
+ type: "text",
751
+ title,
752
+ description,
753
+ required: isRequired,
754
+ defaultValue: schema.default !== undefined ? String(schema.default) : undefined,
755
+ validation: ( Object.keys(validation)).length > 0 ? validation : undefined
756
+ });
757
+ }
758
+ }
759
+ return {
760
+ questions,
761
+ idToPropertyMap
762
+ };
763
+ }
764
+ _convertCarouselAnswersToElicitResult(answers, idToPropertyMap, schemaProperties) {
765
+ const content = {};
766
+ for (const [questionId, answer] of Object.entries(answers)) {
767
+ const propertyName = idToPropertyMap.get(questionId);
768
+ if (!propertyName) {
769
+ continue;
770
+ }
771
+ const schema = schemaProperties[propertyName];
772
+ if (!schema) {
773
+ continue;
774
+ }
775
+ let rawValue = answer;
776
+ if (typeof answer === "object" && answer !== null) {
777
+ const obj = answer;
778
+ if ("selectedValue" in obj) {
779
+ rawValue = obj.selectedValue;
780
+ } else if ("selectedValues" in obj) {
781
+ rawValue = obj.selectedValues;
782
+ } else if ("freeformValue" in obj && obj.freeformValue) {
783
+ rawValue = obj.freeformValue;
784
+ }
785
+ }
786
+ if (rawValue === undefined || rawValue === null) {
787
+ continue;
788
+ }
789
+ if (schema.type === "boolean") {
790
+ content[propertyName] = rawValue === "true" || rawValue === true;
791
+ } else if (schema.type === "number" || schema.type === "integer") {
792
+ const num = Number(rawValue);
793
+ if (!isNaN(num)) {
794
+ content[propertyName] = num;
795
+ }
796
+ } else if (schema.type === "array") {
797
+ if (Array.isArray(rawValue)) {
798
+ content[propertyName] = ( rawValue.map(v => String(v)));
799
+ }
800
+ } else {
801
+ content[propertyName] = String(rawValue);
802
+ }
803
+ }
804
+ return content;
805
+ }
589
806
  };
590
807
  McpElicitationService = ( __decorate([( __param(0, INotificationService)), ( __param(1, IQuickInputService)), ( __param(2, IChatService)), ( __param(3, IOpenerService))], McpElicitationService));
591
808
 
@@ -1,5 +1,6 @@
1
1
 
2
2
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
3
4
  import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
4
5
  import { ProxyChannel } from '@codingame/monaco-vscode-api/vscode/vs/base/parts/ipc/common/ipc';
5
6
  import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
@@ -32,10 +33,17 @@ let BrowserMcpGatewayService = class BrowserMcpGatewayService {
32
33
  return connection.withChannel(McpGatewayChannelName, async channel => {
33
34
  const service = ProxyChannel.toService(channel);
34
35
  const info = await service.createGateway(undefined);
35
- const address = URI.revive(info.address);
36
- this._logService.info(`[McpGateway][BrowserWorkbench] Remote gateway created: ${address}`);
36
+ const servers = reviveServers(info.servers);
37
+ this._logService.info(
38
+ `[McpGateway][BrowserWorkbench] Remote gateway created with ${servers.length} server(s)`
39
+ );
40
+ const onDidChangeServers = ( Event.map(Event.filter(
41
+ channel.listen("onDidChangeGatewayServers"),
42
+ e => e.gatewayId === info.gatewayId
43
+ ), e => reviveServers(e.servers)));
37
44
  return {
38
- address,
45
+ servers,
46
+ onDidChangeServers,
39
47
  dispose: () => {
40
48
  this._logService.info(
41
49
  `[McpGateway][BrowserWorkbench] Disposing remote gateway: ${info.gatewayId}`
@@ -47,5 +55,11 @@ let BrowserMcpGatewayService = class BrowserMcpGatewayService {
47
55
  }
48
56
  };
49
57
  BrowserMcpGatewayService = ( __decorate([( __param(0, IRemoteAgentService)), ( __param(1, ILogService))], BrowserMcpGatewayService));
58
+ function reviveServers(servers) {
59
+ return ( servers.map(s => ({
60
+ label: s.label,
61
+ address: URI.revive(s.address)
62
+ })));
63
+ }
50
64
 
51
65
  export { BrowserMcpGatewayService };
@@ -115,7 +115,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
115
115
  diagnostics.push({
116
116
  severity: MarkerSeverity.Warning,
117
117
  message: ( localize(
118
- 10244,
118
+ 10481,
119
119
  "Variable `{0}` not found, did you mean ${{1}}?",
120
120
  name,
121
121
  getClosestMatchingVariable(name) + (arg ? `:${arg}` : "")
@@ -181,14 +181,14 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
181
181
  range,
182
182
  command: {
183
183
  id: McpCommandIds.ShowOutput,
184
- title: "$(error) " + ( localize(10245, "Error")),
184
+ title: "$(error) " + ( localize(10482, "Error")),
185
185
  arguments: [server.definition.id]
186
186
  }
187
187
  }, {
188
188
  range,
189
189
  command: {
190
190
  id: McpCommandIds.RestartServer,
191
- title: ( localize(10246, "Restart")),
191
+ title: ( localize(10483, "Restart")),
192
192
  arguments: [server.definition.id, {
193
193
  autoTrustChanges: true
194
194
  }]
@@ -199,7 +199,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
199
199
  range,
200
200
  command: {
201
201
  id: McpCommandIds.RestartServer,
202
- title: ( localize(10247, "Debug")),
202
+ title: ( localize(10484, "Debug")),
203
203
  arguments: [server.definition.id, {
204
204
  debug: true,
205
205
  autoTrustChanges: true
@@ -213,14 +213,14 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
213
213
  range,
214
214
  command: {
215
215
  id: McpCommandIds.ShowOutput,
216
- title: "$(loading~spin) " + ( localize(10248, "Starting")),
216
+ title: "$(loading~spin) " + ( localize(10485, "Starting")),
217
217
  arguments: [server.definition.id]
218
218
  }
219
219
  }, {
220
220
  range,
221
221
  command: {
222
222
  id: McpCommandIds.StopServer,
223
- title: ( localize(10249, "Cancel")),
223
+ title: ( localize(10486, "Cancel")),
224
224
  arguments: [server.definition.id]
225
225
  }
226
226
  });
@@ -230,21 +230,21 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
230
230
  range,
231
231
  command: {
232
232
  id: McpCommandIds.ShowOutput,
233
- title: "$(check) " + ( localize(10250, "Running")),
233
+ title: "$(check) " + ( localize(10487, "Running")),
234
234
  arguments: [server.definition.id]
235
235
  }
236
236
  }, {
237
237
  range,
238
238
  command: {
239
239
  id: McpCommandIds.StopServer,
240
- title: ( localize(10251, "Stop")),
240
+ title: ( localize(10488, "Stop")),
241
241
  arguments: [server.definition.id]
242
242
  }
243
243
  }, {
244
244
  range,
245
245
  command: {
246
246
  id: McpCommandIds.RestartServer,
247
- title: ( localize(10246, "Restart")),
247
+ title: ( localize(10483, "Restart")),
248
248
  arguments: [server.definition.id, {
249
249
  autoTrustChanges: true
250
250
  }]
@@ -255,7 +255,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
255
255
  range,
256
256
  command: {
257
257
  id: McpCommandIds.RestartServer,
258
- title: ( localize(10247, "Debug")),
258
+ title: ( localize(10484, "Debug")),
259
259
  arguments: [server.definition.id, {
260
260
  autoTrustChanges: true,
261
261
  debug: true
@@ -269,7 +269,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
269
269
  range,
270
270
  command: {
271
271
  id: McpCommandIds.StartServer,
272
- title: "$(debug-start) " + ( localize(10252, "Start")),
272
+ title: "$(debug-start) " + ( localize(10489, "Start")),
273
273
  arguments: [server.definition.id, {
274
274
  autoTrustChanges: true
275
275
  }]
@@ -280,7 +280,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
280
280
  range,
281
281
  command: {
282
282
  id: McpCommandIds.StartServer,
283
- title: ( localize(10247, "Debug")),
283
+ title: ( localize(10484, "Debug")),
284
284
  arguments: [server.definition.id, {
285
285
  autoTrustChanges: true,
286
286
  debug: true
@@ -296,7 +296,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
296
296
  range,
297
297
  command: {
298
298
  id: "",
299
- title: ( localize(10253, "{0} tools", toolCount))
299
+ title: ( localize(10490, "{0} tools", toolCount))
300
300
  }
301
301
  });
302
302
  }
@@ -306,7 +306,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
306
306
  range,
307
307
  command: {
308
308
  id: McpCommandIds.StartPromptForServer,
309
- title: ( localize(10254, "{0} prompts", promptCount)),
309
+ title: ( localize(10491, "{0} prompts", promptCount)),
310
310
  arguments: [server]
311
311
  }
312
312
  });
@@ -315,7 +315,7 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
315
315
  range,
316
316
  command: {
317
317
  id: McpCommandIds.ServerOptions,
318
- title: ( localize(10255, "More...")),
318
+ title: ( localize(10492, "More...")),
319
319
  arguments: [server.definition.id]
320
320
  }
321
321
  });
@@ -390,16 +390,19 @@ let McpLanguageFeatures = class McpLanguageFeatures extends Disposable {
390
390
  function pushAnnotation(savedId, offset, saved) {
391
391
  const tooltip = ( new MarkdownString([createMarkdownCommandLink({
392
392
  id: McpCommandIds.EditStoredInput,
393
- title: ( localize(10256, "Edit")),
394
- arguments: [savedId, model.uri, mcpConfigurationSection, inConfig.target]
393
+ text: ( localize(10493, "Edit")),
394
+ arguments: [savedId, model.uri, mcpConfigurationSection, inConfig.target],
395
+ tooltip: ( localize(10494, "Edit saved value"))
395
396
  }), createMarkdownCommandLink({
396
397
  id: McpCommandIds.RemoveStoredInput,
397
- title: ( localize(10257, "Clear")),
398
- arguments: [inConfig.scope, savedId]
398
+ text: ( localize(10495, "Clear")),
399
+ arguments: [inConfig.scope, savedId],
400
+ tooltip: ( localize(10496, "Clear saved value"))
399
401
  }), createMarkdownCommandLink({
400
402
  id: McpCommandIds.RemoveStoredInput,
401
- title: ( localize(10258, "Clear All")),
402
- arguments: [inConfig.scope]
403
+ text: ( localize(10497, "Clear All")),
404
+ arguments: [inConfig.scope],
405
+ tooltip: ( localize(10498, "Clear all saved values"))
403
406
  })].join(" | "), {
404
407
  isTrusted: true
405
408
  }));
@@ -98,16 +98,16 @@ let McpConfigMigrationContribution = class McpConfigMigrationContribution extend
98
98
  }
99
99
  showMcpConfigErrorNotification(isRemote) {
100
100
  const message = isRemote ? ( localize(
101
- 10259,
101
+ 10499,
102
102
  "MCP servers should no longer be configured in remote user settings. Use the dedicated MCP configuration instead."
103
103
  )) : ( localize(
104
- 10260,
104
+ 10500,
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(10261, "Open Remote User MCP Configuration")) : ( localize(10262, "Open User MCP Configuration"));
107
+ const openConfigLabel = isRemote ? ( localize(10501, "Open Remote User MCP Configuration")) : ( localize(10502, "Open User MCP Configuration"));
108
108
  const commandId = isRemote ? McpCommandIds.OpenRemoteUserMcp : McpCommandIds.OpenUserMcp;
109
109
  this.notificationService.prompt(Severity.Error, message, [{
110
- label: ( localize(10263, "Update Now")),
110
+ label: ( localize(10503, "Update Now")),
111
111
  run: async () => {
112
112
  await this.migrateMcpConfig();
113
113
  await this.commandService.executeCommand(commandId);