ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / workbench / contrib / mcp / browser / mcpServerActions.ts 1396 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
import { ActionViewItem, IActionViewItemOptions } from '../../../../base/browser/ui/actionbar/actionViewItems.js' ;
import { alert } from '../../../../base/browser/ui/aria/aria.js' ;
import { Action, IAction, IActionChangeEvent, Separator } from '../../../../base/common/actions.js' ;
import { Emitter, Event } from '../../../../base/common/event.js' ;
import { IMarkdownString } from '../../../../base/common/htmlContent.js' ;
import { disposeIfDisposable } from '../../../../base/common/lifecycle.js' ;
import { ThemeIcon }
localize
Location
ICommandService
IContextMenuService
IInstantiationService
ITelemetryService
IAuthenticationService
IAccountQuery IAuthenticationQueryService
IEditorService
errorIcon infoIcon manageExtensionIcon trustIcon warningIcon
McpCommandIds
IMcpRegistry
IMcpSamplingService IMcpServer IMcpServerContainer IMcpService IMcpWorkbenchService IWorkbenchMcpServer McpCapability McpConnectionState McpServerEditorTab McpServerInstallState
startServerByFilter
ConfigurationTarget
IWorkspaceContextService IWorkspaceFolder WorkbenchState
IQuickInputService QuickPickItem
IWorkbenchEnvironmentService
Schemas
ILabelService
LocalMcpServerScope
ExtensionAction
ActionWithDropdownActionViewItem IActionWithDropdownActionViewItemOptions
IContextMenuProvider
Severity
ContributionEnablementState isContributionDisabled isContributionEnabled
getWorkbenchMenuMotionContextMenuOptions
hidden
menuActions IAction
override _onDidChange
override _onDidChange event
_hidden
_hidden
hidden
_hidden hidden
_hidden hidden
_onDidChange hidden
override value
value
hideOnDisabled
hidden value
hideOnDisabled
_mcpServer IWorkbenchMcpServer
IWorkbenchMcpServer _mcpServer
mcpServer IWorkbenchMcpServer _mcpServer mcpServer
primaryAction IAction
menuActionClassNames
_menuActions IAction
IAction _menuActions
override IWorkbenchMcpServer
mcpServer
override mcpServer IWorkbenchMcpServer
actions a a mcpServer mcpServer
mcpServer mcpServer
actions McpServerAction
id
clazz
actionsGroups McpServerAction
clazz
id clazz
menuActionClassNames clazz
hideOnDisabled
actions actionsGroups
Event actions a a onDidChange
actions a a
donotUpdateActions
donotUpdateActions
actions a a
actionsGroups actionsGroups actionsGroup actionsGroup a a hidden
actions IAction
visibleActions actionsGroups
visibleActions length
actions actions visibleActions
actions actions length actions actions length actions
primaryAction actions
_menuActions actions length actions
_onDidChange menuActions _menuActions
primaryAction
hidden
enabled primaryAction enabled
label primaryAction ExtensionAction
tooltip primaryAction tooltip
hidden
enabled
override
enabled
primaryAction
action ExtensionAction
action label
action ButtonWithDropDownExtensionAction
options IActionViewItemOptions IActionWithDropdownActionViewItemOptions
contextMenuProvider IContextMenuProvider
action options contextMenuProvider
action e
e hidden e menuActions
override container HTMLElement
container
override
element dropdownMenuActionViewItem element
element classList ButtonWithDropDownExtensionAction _action hidden
isMenuEmpty ButtonWithDropDownExtensionAction _action menuActions length
element classList isMenuEmpty
dropdownMenuActionViewItem element classList isMenuEmpty
id
label
cssClass
enabled
instantiationService IInstantiationService
id label cssClass enabled
_actionViewItem DropDownExtensionActionViewItem
options IActionViewItemOptions DropDownExtensionActionViewItem
_actionViewItem instantiationService DropDownExtensionActionViewItem options
_actionViewItem
override actionGroups IAction
_actionViewItem actionGroups
action IAction
options IActionViewItemOptions
contextMenuService IContextMenuService
action options icon label
menuActionGroups IAction
element
actions menuActionGroups
contextMenuService
element
actions
actionRunner actionRunner
actions
menuActionGroups IAction IAction
actions IAction
menuActions menuActionGroups
actions actions menuActions
actions length actions actions length actions
open
mcpWorkbenchService IMcpWorkbenchService
telemetryService ITelemetryService
mcpService IMcpService
InstallAction
enabled
class InstallAction
mcpServer gallery mcpServer installable
mcpServer installState McpServerInstallState Uninstalled
class InstallAction
enabled mcpWorkbenchService mcpServer
override
mcpServer
open
mcpWorkbenchService mcpServer
mcpServer label
owner
comment
name classification purpose comment
name
telemetryService name mcpServer gallery name
installed mcpWorkbenchService mcpServer
mcpService s
s definition label installed name
open
mcpWorkbenchService IMcpWorkbenchService
workspaceService IWorkspaceContextService
quickInputService IQuickInputService
telemetryService ITelemetryService
mcpService IMcpService
InstallAction
enabled
class InstallInWorkspaceAction
workspaceService WorkbenchState
mcpServer gallery mcpServer installable
mcpServer installState McpServerInstallState Uninstalled mcpServer local scope LocalMcpServerScope Workspace
class InstallAction
enabled mcpWorkbenchService mcpServer
override
mcpServer
open
mcpWorkbenchService mcpServer preserveFocus
mcpServer label
target
target
owner
comment
name classification purpose comment
name
telemetryService name mcpServer gallery name
installed mcpWorkbenchService mcpServer target
mcpService s
s definition label installed name
ConfigurationTarget IWorkspaceFolder
QuickPickItem target ConfigurationTarget IWorkspaceFolder
options OptionQuickPickItem
folder workspaceService folders
options target folder label folder name description
workspaceService WorkbenchState
options length
options type
options target ConfigurationTarget label
options length
options target
targetPick quickInputService options
title
targetPick OptionQuickPickItem target
open
mcpWorkbenchService IMcpWorkbenchService
environmentService IWorkbenchEnvironmentService
telemetryService ITelemetryService
labelService ILabelService
mcpService IMcpService
InstallAction
remoteLabel labelService Schemas vscodeRemote environmentService remoteAuthority
label remoteLabel
enabled
class InstallInRemoteAction
environmentService remoteAuthority
mcpServer gallery mcpServer installable
mcpServer installState McpServerInstallState Uninstalled
mcpServer local scope LocalMcpServerScope RemoteUser
mcpWorkbenchService local mcpServer mcpServer name mcpServer name mcpServer local scope LocalMcpServerScope RemoteUser
class InstallAction
enabled mcpWorkbenchService mcpServer
override
mcpServer
open
mcpWorkbenchService mcpServer
mcpServer label
owner
comment
name classification purpose comment
name
telemetryService name mcpServer gallery name
installed mcpWorkbenchService mcpServer target ConfigurationTarget
mcpService s
s definition label installed name
InstallingLabelAction InstallingLabelAction
class
mcpWorkbenchService IMcpWorkbenchService
UninstallAction
enabled
class UninstallAction
mcpServer
mcpServer local
mcpServer installState McpServerInstallState Installed
enabled
class UninstallAction
enabled
label
override
mcpServer
mcpWorkbenchService mcpServer
mcpService IMcpService
EnableMcpServerGloballyAction McpServerAction
tooltip
enabled
mcpServer local
server mcpService servers s s definition id mcpServer id
server
enablement server enablement
enabled enablement
override
mcpServer
mcpService enablementModel mcpServer id ContributionEnablementState EnabledProfile
mcpService IMcpService
workspaceService IWorkspaceContextService
EnableMcpServerForWorkspaceAction McpServerAction
tooltip
enabled
mcpServer local
workspaceService WorkbenchState
server mcpService servers s s definition id mcpServer id
server
enablement server enablement
enabled enablement
override
mcpServer
mcpService enablementModel mcpServer id ContributionEnablementState EnabledWorkspace
mcpService IMcpService
DisableMcpServerGloballyAction McpServerAction
tooltip
enabled
mcpServer local
server mcpService servers s s definition id mcpServer id
server
enablement server enablement
enabled enablement
override
mcpServer
mcpService enablementModel mcpServer id ContributionEnablementState DisabledProfile
mcpService IMcpService
workspaceService IWorkspaceContextService
DisableMcpServerForWorkspaceAction McpServerAction
tooltip
enabled
mcpServer local
workspaceService WorkbenchState
server mcpService servers s s definition id mcpServer id
server
enablement server enablement
enabled enablement
override
mcpServer
mcpService enablementModel mcpServer id ContributionEnablementState DisabledWorkspace
instantiationService IInstantiationService
McpServerAction
instantiationService EnableMcpServerGloballyAction
instantiationService EnableMcpServerForWorkspaceAction
instantiationService IInstantiationService
McpServerAction
instantiationService DisableMcpServerGloballyAction
instantiationService DisableMcpServerForWorkspaceAction
mcpServer IWorkbenchMcpServer isEditorAction instantiationService IInstantiationService IAction
instantiationService accessor
workspaceService accessor IWorkspaceContextService
environmentService accessor IWorkbenchEnvironmentService
groups McpServerAction
isInstalled mcpServer installState McpServerInstallState Installed
isInstalled
groups
instantiationService StartServerAction
groups
instantiationService StopServerAction
instantiationService RestartServerAction
groups
instantiationService EnableMcpServerGloballyAction
instantiationService EnableMcpServerForWorkspaceAction
instantiationService DisableMcpServerGloballyAction
instantiationService DisableMcpServerForWorkspaceAction
groups
instantiationService AuthServerAction
groups
instantiationService ShowServerOutputAction
instantiationService ShowServerConfigurationAction
instantiationService ShowServerJsonConfigurationAction
groups
instantiationService ConfigureModelAccessAction
instantiationService ShowSamplingRequestsAction
groups
instantiationService BrowseResourcesAction
isEditorAction
installGroup McpServerAction instantiationService UninstallAction
workspaceService WorkbenchState
installGroup instantiationService InstallInWorkspaceAction
environmentService remoteAuthority mcpServer local scope LocalMcpServerScope RemoteUser
installGroup instantiationService InstallInRemoteAction
groups installGroup
installGroup
workspaceService WorkbenchState
installGroup instantiationService InstallInWorkspaceAction isEditorAction
environmentService remoteAuthority
installGroup instantiationService InstallInRemoteAction isEditorAction
groups installGroup
groups group group extensionAction extensionAction mcpServer mcpServer
groups
Class ThemeIcon manageExtensionIcon
HideManageExtensionClass
isEditorAction
instantiationService IInstantiationService
ManageMcpServerAction instantiationService
tooltip
override
mcpServer mcpServer isEditorAction instantiationService
class ManageMcpServerAction HideManageExtensionClass
enabled
mcpServer
isEditorAction
enabled
class ManageMcpServerAction Class
enabled mcpServer local
class enabled ManageMcpServerAction Class ManageMcpServerAction HideManageExtensionClass
mcpService IMcpService
StartServerAction
enabled
class StartServerAction
server
server
serverState server connectionState
McpConnectionState serverState state
class StartServerAction
enabled
label
override
server
server
server promptType
server
IMcpServer
mcpServer
mcpServer local
mcpService servers s s definition id mcpServer id
mcpService IMcpService
StopServerAction
enabled
class StopServerAction
server
server
serverState server connectionState
McpConnectionState serverState state
class StopServerAction
enabled
label
override
server
server
server
IMcpServer
mcpServer
mcpServer local
mcpService servers s s definition id mcpServer id
mcpService IMcpService
RestartServerAction
enabled
class RestartServerAction
server
server
serverState server connectionState
McpConnectionState serverState state
class RestartServerAction
enabled
label
override
server
server
server
server promptType
server
IMcpServer
mcpServer
mcpServer local
mcpService servers s s definition id mcpServer id
_accountQuery IAccountQuery
mcpService IMcpService
_authenticationQueryService IAuthenticationQueryService
_authenticationService IAuthenticationService
RestartServerAction
enabled
class AuthServerAction
server
server
accountQuery
accountQuery
_accountQuery accountQuery
class AuthServerAction
enabled
label accountQuery total AuthServerAction AuthServerAction
label
label label
override
server
server
accountQuery
accountQuery
server
providerId accountName accountQuery
accountQuery server definition id server definition label
label AuthServerAction
accounts _authenticationService providerId
account accounts a a label accountName
account
sessions _authenticationService providerId account
session sessions
_authenticationService providerId session id
IMcpServer
mcpServer
mcpServer local
mcpService servers s s definition id mcpServer id
IAccountQuery
server
server
_accountQuery
_accountQuery
serverId server definition id
preferences _authenticationQueryService serverId
preferences size
providerId accountName preferences
accountQuery _authenticationQueryService providerId accountName
accountQuery serverId
accountQuery
mcpService IMcpService
ShowServerOutputAction
enabled
class ShowServerOutputAction
server
server
class ShowServerOutputAction
enabled
label
override
server
server
server
IMcpServer
mcpServer
mcpServer local
mcpService servers s s definition id mcpServer id
mcpWorkbenchService IMcpWorkbenchService
ShowServerConfigurationAction
enabled
class ShowServerConfigurationAction
mcpServer local
class ShowServerConfigurationAction
enabled
override
mcpServer local
mcpWorkbenchService mcpServer tab McpServerEditorTab Configuration
mcpService IMcpService
mcpRegistry IMcpRegistry
editorService IEditorService
ShowServerJsonConfigurationAction
enabled
class ShowServerJsonConfigurationAction
configurationTarget
configurationTarget
class ShowServerConfigurationAction
enabled
override
configurationTarget
configurationTarget
editorService
resource configurationTarget configurationTarget configurationTarget uri
options selection configurationTarget configurationTarget range
Location
mcpServer
mcpServer local
server mcpService servers s s definition label mcpServer name
server
collection mcpRegistry collections c c id server collection id
serverDefinition collection serverDefinitions s s id server definition id
serverDefinition presentation origin collection presentation origin
mcpService IMcpService
commandService ICommandService
ConfigureModelAccessAction
enabled
class ConfigureModelAccessAction
server
server
class ConfigureModelAccessAction
enabled
label
override
server
server
commandService McpCommandIds ConfigureSamplingModels server
IMcpServer
mcpServer
mcpServer local
mcpService servers s s definition id mcpServer id
mcpService IMcpService
samplingService IMcpSamplingService
editorService IEditorService
ShowSamplingRequestsAction
enabled
class ShowSamplingRequestsAction
server
server
samplingService server
class ShowSamplingRequestsAction
enabled
override
server
server
samplingService server
editorService
resource
contents samplingService server
label server definition label
IMcpServer
mcpServer
mcpServer local
mcpService servers s s definition id mcpServer id
mcpService IMcpService
commandService ICommandService
BrowseResourcesAction
enabled
class BrowseResourcesAction
server
server
capabilities server capabilities
capabilities capabilities McpCapability Resources
class BrowseResourcesAction
enabled
override
server
server
capabilities server capabilities
capabilities capabilities McpCapability Resources
commandService McpCommandIds BrowseResources server
IMcpServer
mcpServer
mcpServer local
mcpService servers s s definition id mcpServer id
message IMarkdownString icon ThemeIcon
_status McpServerStatus
McpServerStatus _status
_onDidChangeStatus
onDidChangeStatus _onDidChangeStatus event
mcpWorkbenchService IMcpWorkbenchService
commandService ICommandService
enabled
mcpServer
mcpServer gallery mcpServer installable mcpServer installState McpServerInstallState Uninstalled
result mcpWorkbenchService mcpServer
result
icon warningIcon message result
runtimeState mcpServer runtimeStatus
runtimeState message
icon runtimeState message severity Severity Warning warningIcon runtimeState message severity Severity Error errorIcon infoIcon message runtimeState message text
status McpServerStatus updateClass
status
_status s s message value status message value s icon id status icon id
_status length
_status
status
_status status
_status a b
b icon trustIcon
a icon trustIcon
b icon errorIcon
a icon errorIcon
b icon warningIcon
a icon warningIcon
b icon infoIcon
a icon infoIcon
updateClass
status icon errorIcon
class
status icon warningIcon
class
status icon infoIcon
class
status icon trustIcon
class
class
_onDidChangeStatus
override
_status icon trustIcon
commandService
from
'../../../../base/common/themables.js'
;
import
{
URI
}
from
'../../../../base/common/uri.js'
;
import
{
}
from
'../../../../nls.js'
;
import
{
}
from
'../../../../editor/common/languages.js'
;
import
{
}
from
'../../../../platform/commands/common/commands.js'
;
import
{
}
from
'../../../../platform/contextview/browser/contextView.js'
;
import
{
}
from
'../../../../platform/instantiation/common/instantiation.js'
;
import
{
}
from
'../../../../platform/telemetry/common/telemetry.js'
;
import
{
}
from
'../../../services/authentication/common/authentication.js'
;
import
{
,
}
from
'../../../services/authentication/common/authenticationQuery.js'
;
import
{
}
from
'../../../services/editor/common/editorService.js'
;
import
{
,
,
,
,
}
from
'../../extensions/browser/extensionsIcons.js'
;
import
{
}
from
'../common/mcpCommandIds.js'
;
import
{
}
from
'../common/mcpRegistryTypes.js'
;
import
{
,
,
,
,
,
,
,
,
,
}
from
'../common/mcpTypes.js'
;
import
{
}
from
'../common/mcpTypesUtils.js'
;
import
{
}
from
'../../../../platform/configuration/common/configuration.js'
;
import
{
,
,
}
from
'../../../../platform/workspace/common/workspace.js'
;
import
{
,
}
from
'../../../../platform/quickinput/common/quickInput.js'
;
import
{
}
from
'../../../services/environment/common/environmentService.js'
;
import
{
}
from
'../../../../base/common/network.js'
;
import
{
}
from
'../../../../platform/label/common/label.js'
;
import
{
}
from
'../../../services/mcp/common/mcpWorkbenchManagementService.js'
;
import
{
}
from
'../../extensions/browser/extensionsActions.js'
;
import
{
,
}
from
'../../../../base/browser/ui/dropdown/dropdownActionViewItem.js'
;
import
{
}
from
'../../../../base/browser/contextmenu.js'
;
import
from
'../../../../base/common/severity.js'
;
import
{
,
,
}
from
'../../chat/common/enablement.js'
;
import
{
}
from
'../../../browser/actions/menuMotion.js'
;
export
interface
IMcpServerActionChangeEvent
extends
IActionChangeEvent
{
readonly
?
:
boolean
;
readonly
?
:
[
]
;
}
export
abstract
class
McpServerAction
extends
Action
implements
IMcpServerContainer
{
protected
=
this
.
_register
(
new
Emitter< IMcpServerActionChangeEvent>
(
)
)
;
get
onDidChange
(
)
{
return
this
.
.
;
}
static
readonly
EXTENSION_ACTION_CLASS
=
'extension-action'
;
static
readonly
TEXT_ACTION_CLASS
=
` ${ McpServerAction. EXTENSION_ACTION_CLASS } text `
;
static
readonly
LABEL_ACTION_CLASS
=
` ${ McpServerAction. EXTENSION_ACTION_CLASS } label `
;
static
readonly
PROMINENT_LABEL_ACTION_CLASS
=
` ${ McpServerAction. LABEL_ACTION_CLASS } prominent `
;
static
readonly
ICON_ACTION_CLASS
=
` ${ McpServerAction. EXTENSION_ACTION_CLASS } icon `
;
private
:
boolean
=
false
;
get
hidden
(
)
:
boolean
{
return
this
.
;
}
set
hidden
(
:
boolean
)
{
if
(
this
.
!==
)
{
this
.
=
;
this
.
.
fire
(
{
}
)
;
}
}
protected
_setEnabled
(
:
boolean
)
:
void
{
super
.
_setEnabled
(
)
;
if
(
this
.
)
{
this
.
=
!
;
}
}
protected
:
boolean
=
true
;
private
:
|
null
=
null
;
get
mcpServer
(
)
:
|
null
{
return
this
.
;
}
set
mcpServer
(
:
|
null
)
{
this
.
=
;
this
.
update
(
)
;
}
abstract
update
(
)
:
void
;
}
export
class
ButtonWithDropDownExtensionAction
extends
McpServerAction
{
private
:
|
undefined
;
readonly
:
string
[
]
=
[
]
;
private
:
[
]
=
[
]
;
get
menuActions
(
)
:
[
]
{
return
[
...
this
.
]
;
}
get
mcpServer
(
)
:
|
null
{
return
super
.
;
}
set
mcpServer
(
:
|
null
)
{
this
.
.
forEach
(
=>
.
=
)
;
super
.
=
;
}
protected
readonly
:
[
]
;
constructor
(
:
string
,
:
string
,
private
readonly
:
[
]
[
]
,
)
{
=
` ${ clazz} action-dropdown `
;
super
(
,
undefined
,
)
;
this
.
=
.
split
(
' '
)
;
this
.
=
false
;
this
.
=
.
flat
(
)
;
this
.
update
(
)
;
this
.
_register
(
.
any
(
...
this
.
.
map
(
=>
.
)
)
(
(
)
=>
this
.
update
(
true
)
)
)
;
this
.
.
forEach
(
=>
this
.
_register
(
)
)
;
}
update
(
?
:
boolean
)
:
void
{
if
(
!
)
{
this
.
.
forEach
(
=>
.
update
(
)
)
;
}
const
=
this
.
.
map
(
=>
.
filter
(
=>
!
.
)
)
;
let
:
[
]
=
[
]
;
for
(
const
of
)
{
if
(
.
)
{
=
[
...
,
...
,
new
Separator
(
)
]
;
}
}
=
.
?
.
slice
(
0
,
.
-
1
)
:
;
this
.
=
[
0
]
;
this
.
=
.
>
1
?
:
[
]
;
this
.
.
fire
(
{
:
this
.
}
)
;
if
(
this
.
)
{
this
.
=
false
;
this
.
=
this
.
.
;
this
.
=
this
.
getLabel
(
this
.
as
)
;
this
.
=
this
.
.
;
}
else
{
this
.
=
true
;
this
.
=
false
;
}
}
async
run
(
)
:
Promise
<
void
>
{
if
(
this
.
)
{
await
this
.
?.
run
(
)
;
}
}
protected
getLabel
(
:
)
:
string
{
return
.
;
}
}
export
class
ButtonWithDropdownExtensionActionViewItem
extends
ActionWithDropdownActionViewItem
{
constructor
(
:
,
:
&
,
:
)
{
super
(
null
,
,
,
)
;
this
.
_register
(
.
onDidChange
(
=>
{
if
(
.
!==
undefined
||
.
!==
undefined
)
{
this
.
updateClass
(
)
;
}
}
)
)
;
}
render
(
:
)
:
void
{
super
.
render
(
)
;
this
.
updateClass
(
)
;
}
protected
updateClass
(
)
:
void
{
super
.
updateClass
(
)
;
if
(
this
.
&&
this
.
?.
)
{
this
.
.
.
toggle
(
'hide'
,
(
<
>
this
.
)
.
)
;
const
=
(
<
>
this
.
)
.
.
===
0
;
this
.
.
.
toggle
(
'empty'
,
)
;
this
.
.
.
.
toggle
(
'hide'
,
)
;
}
}
}
export
abstract
class
DropDownAction
extends
McpServerAction
{
constructor
(
:
string
,
:
string
,
:
string
,
:
boolean
,
@ IInstantiationService
protected
:
)
{
super
(
,
,
,
)
;
}
private
:
|
null
=
null
;
createActionViewItem
(
:
)
:
{
this
.
=
this
.
.
createInstance
(
,
this
,
)
;
return
this
.
;
}
public
run
(
:
[
]
[
]
)
:
Promise
<
void
>
{
this
.
?.
showMenu
(
)
;
return
Promise
.
resolve
(
)
;
}
}
export
class
DropDownExtensionActionViewItem
extends
ActionViewItem
{
constructor
(
:
,
:
,
@ IContextMenuService
private
readonly
:
)
{
super
(
null
,
,
{
...
,
:
true
,
:
true
}
)
;
}
public
showMenu
(
:
[
]
[
]
)
:
void
{
if
(
this
.
)
{
const
=
this
.
getActions
(
)
;
this
.
.
showContextMenu
(
{
...
getWorkbenchMenuMotionContextMenuOptions
(
this
.
)
,
getActions
:
(
)
=>
,
:
this
.
,
onHide
:
(
)
=>
disposeIfDisposable
(
)
}
)
;
}
}
private
getActions
(
:
[
]
[
]
)
:
[
]
{
let
:
[
]
=
[
]
;
for
(
const
of
)
{
=
[
...
,
...
,
new
Separator
(
)
]
;
}
return
.
?
.
slice
(
0
,
.
-
1
)
:
;
}
}
export
class
InstallAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent install `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
private
readonly
:
boolean
,
@ IMcpWorkbenchService
private
readonly
:
,
@ ITelemetryService
private
readonly
:
,
@ IMcpService
private
readonly
:
,
)
{
super
(
'extensions.install'
,
localize
(
'install'
,
"Install"
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
if
(
!
this
.
?.
&&
!
this
.
?.
)
{
return
;
}
if
(
this
.
.
!==
.
)
{
return
;
}
this
.
=
.
CLASS
;
this
.
=
this
.
.
canInstall
(
this
.
)
===
true
;
}
async
run
(
)
:
Promise
<
void
>
{
if
(
!
this
.
)
{
return
;
}
if
(
this
.
)
{
this
.
.
open
(
this
.
)
;
alert
(
localize
(
'mcpServerInstallation'
,
"Installing MCP Server {0} started. An editor is now open with more details on this MCP Server"
,
this
.
.
)
)
;
}
type
McpServerInstallClassification
=
{
:
'sandy081'
;
:
'Used to understand if the action to install the MCP server is used.'
;
?
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The gallery name of the MCP server being installed'
}
;
}
;
type
McpServerInstall
=
{
?
:
string
;
}
;
this
.
.
publicLog2 < McpServerInstall, McpServerInstallClassification>
(
'mcp:action:install'
,
{
:
this
.
.
?.
}
)
;
const
=
await
this
.
.
install
(
this
.
)
;
await
startServerByFilter
(
this
.
,
=>
{
return
.
.
===
.
;
}
)
;
}
}
export
class
InstallInWorkspaceAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent install `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
private
readonly
:
boolean
,
@ IMcpWorkbenchService
private
readonly
:
,
@ IWorkspaceContextService
private
readonly
:
,
@ IQuickInputService
private
readonly
:
,
@ ITelemetryService
private
readonly
:
,
@ IMcpService
private
readonly
:
,
)
{
super
(
'extensions.installWorkspace'
,
localize
(
'installInWorkspace'
,
"Install in Workspace"
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
if
(
this
.
.
getWorkbenchState
(
)
===
.
EMPTY
)
{
return
;
}
if
(
!
this
.
?.
&&
!
this
.
?.
)
{
return
;
}
if
(
this
.
.
!==
.
&&
this
.
.
?.
===
.
)
{
return
;
}
this
.
=
.
CLASS
;
this
.
=
this
.
.
canInstall
(
this
.
)
===
true
;
}
async
run
(
)
:
Promise
<
void
>
{
if
(
!
this
.
)
{
return
;
}
if
(
this
.
)
{
this
.
.
open
(
this
.
,
{
:
true
}
)
;
alert
(
localize
(
'mcpServerInstallation'
,
"Installing MCP Server {0} started. An editor is now open with more details on this MCP Server"
,
this
.
.
)
)
;
}
const
=
await
this
.
getConfigurationTarget
(
)
;
if
(
!
)
{
return
;
}
type
McpServerInstallClassification
=
{
:
'sandy081'
;
:
'Used to understand if the action to install the MCP server is used.'
;
?
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The gallery name of the MCP server being installed'
}
;
}
;
type
McpServerInstall
=
{
?
:
string
;
}
;
this
.
.
publicLog2 < McpServerInstall, McpServerInstallClassification>
(
'mcp:action:install:workspace'
,
{
:
this
.
.
?.
}
)
;
const
=
await
this
.
.
install
(
this
.
,
{
}
)
;
await
startServerByFilter
(
this
.
,
=>
{
return
.
.
===
.
;
}
)
;
}
private
async
getConfigurationTarget
(
)
:
Promise
<
|
|
undefined
>
{
type
OptionQuickPickItem
=
&
{
?
:
|
}
;
const
:
[
]
=
[
]
;
for
(
const
of
this
.
.
getWorkspace
(
)
.
)
{
.
push
(
{
:
,
:
.
,
:
localize
(
'install in workspace folder'
,
"Workspace Folder"
)
}
)
;
}
if
(
this
.
.
getWorkbenchState
(
)
===
.
WORKSPACE
)
{
if
(
.
>
0
)
{
.
push
(
{
:
'separator'
}
)
;
}
.
push
(
{
:
.
WORKSPACE
,
:
localize
(
'mcp.target.workspace'
,
"Workspace"
)
}
)
;
}
if
(
.
===
1
)
{
return
[
0
]
.
;
}
const
=
await
this
.
.
pick
(
,
{
:
localize
(
'mcp.target.title'
,
"Choose where to install the MCP server"
)
,
}
)
;
return
(
as
)
?.
;
}
}
export
class
InstallInRemoteAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent install `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
private
readonly
:
boolean
,
@ IMcpWorkbenchService
private
readonly
:
,
@ IWorkbenchEnvironmentService
private
readonly
:
,
@ ITelemetryService
private
readonly
:
,
@ ILabelService
private
readonly
:
,
@ IMcpService
private
readonly
:
,
)
{
super
(
'extensions.installRemote'
,
localize
(
'installInRemote'
,
"Install (Remote)"
)
,
.
CLASS
,
false
)
;
const
=
this
.
.
getHostLabel
(
.
,
this
.
.
)
;
this
.
=
localize
(
'installInRemoteLabel'
,
"Install in {0}"
,
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
if
(
!
this
.
.
)
{
return
;
}
if
(
!
this
.
?.
&&
!
this
.
?.
)
{
return
;
}
if
(
this
.
.
!==
.
)
{
if
(
this
.
.
?.
===
.
)
{
return
;
}
if
(
this
.
.
.
find
(
=>
.
===
this
.
?.
&&
.
?.
===
.
)
)
{
return
;
}
}
this
.
=
.
CLASS
;
this
.
=
this
.
.
canInstall
(
this
.
)
===
true
;
}
async
run
(
)
:
Promise
<
void
>
{
if
(
!
this
.
)
{
return
;
}
if
(
this
.
)
{
this
.
.
open
(
this
.
)
;
alert
(
localize
(
'mcpServerInstallation'
,
"Installing MCP Server {0} started. An editor is now open with more details on this MCP Server"
,
this
.
.
)
)
;
}
type
McpServerInstallClassification
=
{
:
'sandy081'
;
:
'Used to understand if the action to install the MCP server is used.'
;
?
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The gallery name of the MCP server being installed'
}
;
}
;
type
McpServerInstall
=
{
?
:
string
;
}
;
this
.
.
publicLog2 < McpServerInstall, McpServerInstallClassification>
(
'mcp:action:install:remote'
,
{
:
this
.
.
?.
}
)
;
const
=
await
this
.
.
install
(
this
.
,
{
:
.
USER_REMOTE
}
)
;
await
startServerByFilter
(
this
.
,
=>
{
return
.
.
===
.
;
}
)
;
}
}
export
class
InstallingLabelAction
extends
McpServerAction
{
private
static
readonly
LABEL
=
localize
(
'installing'
,
"Installing"
)
;
private
static
readonly
CLASS
=
` ${ McpServerAction. LABEL_ACTION_CLASS } install installing `
;
constructor
(
)
{
super
(
'extension.installing'
,
.
LABEL
,
.
CLASS
,
false
)
;
}
update
(
)
:
void
{
this
.
=
` ${ InstallingLabelAction. CLASS } ${ this . mcpServer && this . mcpServer. installState === McpServerInstallState. Installing ? '' : ' hide' } `
;
}
}
export
class
UninstallAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent uninstall `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
@ IMcpWorkbenchService
private
readonly
:
,
)
{
super
(
'extensions.uninstall'
,
localize
(
'uninstall'
,
"Uninstall"
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
if
(
!
this
.
)
{
return
;
}
if
(
!
this
.
.
)
{
return
;
}
if
(
this
.
.
!==
.
)
{
this
.
=
false
;
return
;
}
this
.
=
.
CLASS
;
this
.
=
true
;
this
.
=
localize
(
'uninstall'
,
"Uninstall"
)
;
}
async
run
(
)
:
Promise
<
void
>
{
if
(
!
this
.
)
{
return
;
}
await
this
.
.
uninstall
(
this
.
)
;
}
}
export
class
EnableMcpServerGloballyAction
extends
McpServerAction
{
static
readonly
ID
=
'mcpServer.enableGlobally'
;
constructor
(
@ IMcpService
private
readonly
:
,
)
{
super
(
.
ID
,
localize
(
'enableGlobally'
,
"Enable"
)
,
.
LABEL_ACTION_CLASS
)
;
this
.
=
localize
(
'enableGloballyTooltip'
,
"Enable this MCP server"
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
if
(
!
this
.
?.
)
{
return
;
}
const
=
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
if
(
!
)
{
return
;
}
const
=
.
.
get
(
)
;
this
.
=
isContributionDisabled
(
)
;
}
async
run
(
)
:
Promise
<
void
>
{
if
(
!
this
.
)
{
return
;
}
this
.
.
.
setEnabled
(
this
.
.
,
.
)
;
}
}
export
class
EnableMcpServerForWorkspaceAction
extends
McpServerAction
{
static
readonly
ID
=
'mcpServer.enableForWorkspace'
;
constructor
(
@ IMcpService
private
readonly
:
,
@ IWorkspaceContextService
private
readonly
:
,
)
{
super
(
.
ID
,
localize
(
'enableForWorkspace'
,
"Enable (Workspace)"
)
,
.
LABEL_ACTION_CLASS
)
;
this
.
=
localize
(
'enableForWorkspaceTooltip'
,
"Enable this MCP server only in this workspace"
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
if
(
!
this
.
?.
)
{
return
;
}
if
(
this
.
.
getWorkbenchState
(
)
===
.
EMPTY
)
{
return
;
}
const
=
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
if
(
!
)
{
return
;
}
const
=
.
.
get
(
)
;
this
.
=
isContributionDisabled
(
)
;
}
async
run
(
)
:
Promise
<
void
>
{
if
(
!
this
.
)
{
return
;
}
this
.
.
.
setEnabled
(
this
.
.
,
.
)
;
}
}
export
class
DisableMcpServerGloballyAction
extends
McpServerAction
{
static
readonly
ID
=
'mcpServer.disableGlobally'
;
constructor
(
@ IMcpService
private
readonly
:
,
)
{
super
(
.
ID
,
localize
(
'disableGlobally'
,
"Disable"
)
,
.
LABEL_ACTION_CLASS
)
;
this
.
=
localize
(
'disableGloballyTooltip'
,
"Disable this MCP server"
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
if
(
!
this
.
?.
)
{
return
;
}
const
=
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
if
(
!
)
{
return
;
}
const
=
.
.
get
(
)
;
this
.
=
isContributionEnabled
(
)
;
}
async
run
(
)
:
Promise
<
void
>
{
if
(
!
this
.
)
{
return
;
}
this
.
.
.
setEnabled
(
this
.
.
,
.
)
;
}
}
export
class
DisableMcpServerForWorkspaceAction
extends
McpServerAction
{
static
readonly
ID
=
'mcpServer.disableForWorkspace'
;
constructor
(
@ IMcpService
private
readonly
:
,
@ IWorkspaceContextService
private
readonly
:
,
)
{
super
(
.
ID
,
localize
(
'disableForWorkspace'
,
"Disable (Workspace)"
)
,
.
LABEL_ACTION_CLASS
)
;
this
.
=
localize
(
'disableForWorkspaceTooltip'
,
"Disable this MCP server only in this workspace"
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
if
(
!
this
.
?.
)
{
return
;
}
if
(
this
.
.
getWorkbenchState
(
)
===
.
EMPTY
)
{
return
;
}
const
=
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
if
(
!
)
{
return
;
}
const
=
.
.
get
(
)
;
this
.
=
isContributionEnabled
(
)
;
}
async
run
(
)
:
Promise
<
void
>
{
if
(
!
this
.
)
{
return
;
}
this
.
.
.
setEnabled
(
this
.
.
,
.
)
;
}
}
export
class
EnableMcpDropDownAction
extends
ButtonWithDropDownExtensionAction
{
constructor
(
@ IInstantiationService
:
,
)
{
super
(
'mcpServer.enable'
,
.
LABEL_ACTION_CLASS
,
[
[
.
createInstance
(
)
,
.
createInstance
(
)
,
]
]
)
;
}
}
export
class
DisableMcpDropDownAction
extends
ButtonWithDropDownExtensionAction
{
constructor
(
@ IInstantiationService
:
,
)
{
super
(
'mcpServer.disable'
,
.
LABEL_ACTION_CLASS
,
[
[
.
createInstance
(
)
,
.
createInstance
(
)
,
]
]
)
;
}
}
export
function
getContextMenuActions
(
:
,
:
boolean
,
:
)
:
[
]
[
]
{
return
.
invokeFunction
(
=>
{
const
=
.
get
(
)
;
const
=
.
get
(
)
;
const
:
[
]
[
]
=
[
]
;
const
=
.
===
.
;
if
(
)
{
.
push
(
[
.
createInstance
(
)
,
]
)
;
.
push
(
[
.
createInstance
(
)
,
.
createInstance
(
)
,
]
)
;
.
push
(
[
.
createInstance
(
)
,
.
createInstance
(
)
,
.
createInstance
(
)
,
.
createInstance
(
)
,
]
)
;
.
push
(
[
.
createInstance
(
)
,
]
)
;
.
push
(
[
.
createInstance
(
)
,
.
createInstance
(
)
,
.
createInstance
(
)
,
]
)
;
.
push
(
[
.
createInstance
(
)
,
.
createInstance
(
)
,
]
)
;
.
push
(
[
.
createInstance
(
)
,
]
)
;
if
(
!
)
{
const
:
[
]
=
[
.
createInstance
(
)
]
;
if
(
.
getWorkbenchState
(
)
!==
.
EMPTY
)
{
.
push
(
.
createInstance
(
,
false
)
)
;
}
if
(
.
&&
.
?.
!==
.
)
{
.
push
(
.
createInstance
(
,
false
)
)
;
}
.
push
(
)
;
}
}
else
{
const
=
[
]
;
if
(
.
getWorkbenchState
(
)
!==
.
EMPTY
)
{
.
push
(
.
createInstance
(
,
!
)
)
;
}
if
(
.
)
{
.
push
(
.
createInstance
(
,
!
)
)
;
}
.
push
(
)
;
}
.
forEach
(
=>
.
forEach
(
=>
.
=
)
)
;
return
;
}
)
;
}
export
class
ManageMcpServerAction
extends
DropDownAction
{
static
readonly
ID
=
'mcpServer.manage'
;
private
static
readonly
=
` ${ McpServerAction. ICON_ACTION_CLASS } manage `
+
.
asClassName
(
)
;
private
static
readonly
=
` ${ this . Class} hide `
;
constructor
(
private
readonly
:
boolean
,
@ IInstantiationService
:
,
)
{
super
(
.
ID
,
''
,
''
,
true
,
)
;
this
.
=
localize
(
'manage'
,
"Manage"
)
;
this
.
update
(
)
;
}
async
run
(
)
:
Promise
<
void
>
{
return
super
.
run
(
this
.
?
getContextMenuActions
(
this
.
,
this
.
,
this
.
)
:
[
]
)
;
}
update
(
)
:
void
{
this
.
=
.
;
this
.
=
false
;
if
(
!
this
.
)
{
return
;
}
if
(
this
.
)
{
this
.
=
true
;
this
.
=
.
;
}
else
{
this
.
=
!
!
this
.
.
;
this
.
=
this
.
?
.
:
.
;
}
}
}
export
class
StartServerAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent start `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
@ IMcpService
private
readonly
:
,
)
{
super
(
'extensions.start'
,
localize
(
'start'
,
"Start Server"
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
const
=
.
.
get
(
)
;
if
(
!
.
canBeStarted
(
.
)
)
{
return
;
}
this
.
=
.
CLASS
;
this
.
=
true
;
this
.
=
localize
(
'start'
,
"Start Server"
)
;
}
async
run
(
)
:
Promise
<
void
>
{
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
await
.
start
(
{
:
'all-untrusted'
}
)
;
.
showOutput
(
)
;
}
private
getServer
(
)
:
|
undefined
{
if
(
!
this
.
)
{
return
;
}
if
(
!
this
.
.
)
{
return
;
}
return
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
}
}
export
class
StopServerAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent stop `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
@ IMcpService
private
readonly
:
,
)
{
super
(
'extensions.stop'
,
localize
(
'stop'
,
"Stop Server"
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
const
=
.
.
get
(
)
;
if
(
.
canBeStarted
(
.
)
)
{
return
;
}
this
.
=
.
CLASS
;
this
.
=
true
;
this
.
=
localize
(
'stop'
,
"Stop Server"
)
;
}
async
run
(
)
:
Promise
<
void
>
{
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
await
.
stop
(
)
;
}
private
getServer
(
)
:
|
undefined
{
if
(
!
this
.
)
{
return
;
}
if
(
!
this
.
.
)
{
return
;
}
return
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
}
}
export
class
RestartServerAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent restart `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
@ IMcpService
private
readonly
:
,
)
{
super
(
'extensions.restart'
,
localize
(
'restart'
,
"Restart Server"
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
const
=
.
.
get
(
)
;
if
(
.
canBeStarted
(
.
)
)
{
return
;
}
this
.
=
.
CLASS
;
this
.
=
true
;
this
.
=
localize
(
'restart'
,
"Restart Server"
)
;
}
async
run
(
)
:
Promise
<
void
>
{
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
await
.
stop
(
)
;
await
.
start
(
{
:
'all-untrusted'
}
)
;
.
showOutput
(
)
;
}
private
getServer
(
)
:
|
undefined
{
if
(
!
this
.
)
{
return
;
}
if
(
!
this
.
.
)
{
return
;
}
return
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
}
}
export
class
AuthServerAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent account `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
private
static
readonly
SIGN_OUT
=
localize
(
'mcp.signOut'
,
'Sign Out'
)
;
private
static
readonly
DISCONNECT
=
localize
(
'mcp.disconnect'
,
'Disconnect Account'
)
;
private
:
|
undefined
;
constructor
(
@ IMcpService
private
readonly
:
,
@ IAuthenticationQueryService
private
readonly
:
,
@ IAuthenticationService
private
readonly
:
)
{
super
(
'extensions.restart'
,
localize
(
'restart'
,
"Restart Server"
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
const
=
this
.
getAccountQuery
(
)
;
if
(
!
)
{
return
;
}
this
.
=
;
this
.
=
.
CLASS
;
this
.
=
true
;
let
=
.
entities
(
)
.
getEntityCount
(
)
.
>
1
?
.
DISCONNECT
:
.
SIGN_OUT
;
+=
` ( ${ accountQuery. accountName} ) `
;
this
.
=
;
}
async
run
(
)
:
Promise
<
void
>
{
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
const
=
this
.
getAccountQuery
(
)
;
if
(
!
)
{
return
;
}
await
.
stop
(
)
;
const
{
,
}
=
;
.
mcpServer
(
.
.
)
.
setAccessAllowed
(
false
,
.
.
)
;
if
(
this
.
===
.
SIGN_OUT
)
{
const
=
await
this
.
.
getAccounts
(
)
;
const
=
.
find
(
=>
.
===
)
;
if
(
)
{
const
=
await
this
.
.
getSessions
(
,
undefined
,
{
}
)
;
for
(
const
of
)
{
await
this
.
.
removeSession
(
,
.
)
;
}
}
}
}
private
getServer
(
)
:
|
undefined
{
if
(
!
this
.
)
{
return
;
}
if
(
!
this
.
.
)
{
return
;
}
return
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
}
private
getAccountQuery
(
)
:
|
undefined
{
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
undefined
;
}
if
(
this
.
)
{
return
this
.
;
}
const
=
.
.
;
const
=
this
.
.
mcpServer
(
)
.
getAllAccountPreferences
(
)
;
if
(
!
.
)
{
return
undefined
;
}
for
(
const
[
,
]
of
)
{
const
=
this
.
.
provider
(
)
.
account
(
)
;
if
(
!
.
mcpServer
(
)
.
isAccessAllowed
(
)
)
{
continue
;
}
return
;
}
return
undefined
;
}
}
export
class
ShowServerOutputAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent output `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
@ IMcpService
private
readonly
:
,
)
{
super
(
'extensions.output'
,
localize
(
'output'
,
"Show Output"
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
this
.
=
.
CLASS
;
this
.
=
true
;
this
.
=
localize
(
'output'
,
"Show Output"
)
;
}
async
run
(
)
:
Promise
<
void
>
{
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
.
showOutput
(
)
;
}
private
getServer
(
)
:
|
undefined
{
if
(
!
this
.
)
{
return
;
}
if
(
!
this
.
.
)
{
return
;
}
return
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
}
}
export
class
ShowServerConfigurationAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent config `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
@ IMcpWorkbenchService
private
readonly
:
)
{
super
(
'extensions.config'
,
localize
(
'config'
,
"Show Configuration"
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
if
(
!
this
.
?.
)
{
return
;
}
this
.
=
.
CLASS
;
this
.
=
true
;
}
async
run
(
)
:
Promise
<
void
>
{
if
(
!
this
.
?.
)
{
return
;
}
this
.
.
open
(
this
.
,
{
:
.
}
)
;
}
}
export
class
ShowServerJsonConfigurationAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent config `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
@ IMcpService
private
readonly
:
,
@ IMcpRegistry
private
readonly
:
,
@ IEditorService
private
readonly
:
,
)
{
super
(
'extensions.jsonConfig'
,
localize
(
'configJson'
,
"Show Configuration (JSON)"
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
const
=
this
.
getConfigurationTarget
(
)
;
if
(
!
)
{
return
;
}
this
.
=
.
CLASS
;
this
.
=
true
;
}
async
run
(
)
:
Promise
<
void
>
{
const
=
this
.
getConfigurationTarget
(
)
;
if
(
!
)
{
return
;
}
this
.
.
openEditor
(
{
:
URI
.
isUri
(
)
?
:
!
.
,
:
{
:
URI
.
isUri
(
)
?
undefined
:
!
.
}
}
)
;
}
private
getConfigurationTarget
(
)
:
|
URI
|
undefined
{
if
(
!
this
.
)
{
return
;
}
if
(
!
this
.
.
)
{
return
;
}
const
=
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
if
(
!
)
{
return
;
}
const
=
this
.
.
.
get
(
)
.
find
(
=>
.
===
.
.
)
;
const
=
?.
.
get
(
)
.
find
(
=>
.
===
.
.
)
;
return
?.
?.
||
?.
?.
;
}
}
export
class
ConfigureModelAccessAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent config `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
@ IMcpService
private
readonly
:
,
@ ICommandService
private
readonly
:
,
)
{
super
(
'extensions.config'
,
localize
(
'mcp.configAccess'
,
'Configure Model Access'
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
this
.
=
.
CLASS
;
this
.
=
true
;
this
.
=
localize
(
'mcp.configAccess'
,
'Configure Model Access'
)
;
}
async
run
(
)
:
Promise
<
void
>
{
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
this
.
.
executeCommand
(
.
,
)
;
}
private
getServer
(
)
:
|
undefined
{
if
(
!
this
.
)
{
return
;
}
if
(
!
this
.
.
)
{
return
;
}
return
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
}
}
export
class
ShowSamplingRequestsAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent config `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
@ IMcpService
private
readonly
:
,
@ IMcpSamplingService
private
readonly
:
,
@ IEditorService
private
readonly
:
,
)
{
super
(
'extensions.config'
,
localize
(
'mcp.samplingLog'
,
'Show Sampling Requests'
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
if
(
!
this
.
.
hasLogs
(
)
)
{
return
;
}
this
.
=
.
CLASS
;
this
.
=
true
;
}
async
run
(
)
:
Promise
<
void
>
{
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
if
(
!
this
.
.
hasLogs
(
)
)
{
return
;
}
this
.
.
openEditor
(
{
:
undefined
,
:
this
.
.
getLogText
(
)
,
:
localize
(
'mcp.samplingLog.title'
,
'MCP Sampling: {0}'
,
.
.
)
,
}
)
;
}
private
getServer
(
)
:
|
undefined
{
if
(
!
this
.
)
{
return
;
}
if
(
!
this
.
.
)
{
return
;
}
return
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
}
}
export
class
BrowseResourcesAction
extends
McpServerAction
{
static
readonly
CLASS
=
` ${ this . LABEL_ACTION_CLASS } prominent config `
;
private
static
readonly
HIDE
=
` ${ this . CLASS } hide `
;
constructor
(
@ IMcpService
private
readonly
:
,
@ ICommandService
private
readonly
:
,
)
{
super
(
'extensions.config'
,
localize
(
'mcp.resources'
,
'Browse Resources'
)
,
.
CLASS
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
=
false
;
this
.
=
.
HIDE
;
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
const
=
.
.
get
(
)
;
if
(
!==
undefined
&&
!
(
&
.
)
)
{
return
;
}
this
.
=
.
CLASS
;
this
.
=
true
;
}
async
run
(
)
:
Promise
<
void
>
{
const
=
this
.
getServer
(
)
;
if
(
!
)
{
return
;
}
const
=
.
.
get
(
)
;
if
(
!==
undefined
&&
!
(
&
.
)
)
{
return
;
}
return
this
.
.
executeCommand
(
.
,
)
;
}
private
getServer
(
)
:
|
undefined
{
if
(
!
this
.
)
{
return
;
}
if
(
!
this
.
.
)
{
return
;
}
return
this
.
.
.
get
(
)
.
find
(
=>
.
.
===
this
.
?.
)
;
}
}
export
type
McpServerStatus
=
{
readonly
:
;
readonly
?
:
}
;
export
class
McpServerStatusAction
extends
McpServerAction
{
private
static
readonly
CLASS
=
` ${ McpServerAction. ICON_ACTION_CLASS } extension-status `
;
private
:
[
]
=
[
]
;
get
status
(
)
:
[
]
{
return
this
.
;
}
private
readonly
=
this
.
_register
(
new
Emitter< void >
(
)
)
;
readonly
=
this
.
.
;
constructor
(
@ IMcpWorkbenchService
private
readonly
:
,
@ ICommandService
private
readonly
:
,
)
{
super
(
'extensions.status'
,
''
,
` ${ McpServerStatusAction. CLASS } hide `
,
false
)
;
this
.
update
(
)
;
}
update
(
)
:
void
{
this
.
computeAndUpdateStatus
(
)
;
}
private
computeAndUpdateStatus
(
)
:
void
{
this
.
updateStatus
(
undefined
,
true
)
;
this
.
=
false
;
if
(
!
this
.
)
{
return
;
}
if
(
(
this
.
.
||
this
.
.
)
&&
this
.
.
===
.
)
{
const
=
this
.
.
canInstall
(
this
.
)
;
if
(
!==
true
)
{
this
.
updateStatus
(
{
:
,
:
}
,
true
)
;
return
;
}
}
const
=
this
.
.
;
if
(
?.
)
{
this
.
updateStatus
(
{
:
.
.
===
.
?
:
.
.
===
.
?
:
,
:
.
.
}
,
true
)
;
}
}
private
updateStatus
(
:
|
undefined
,
:
boolean
)
:
void
{
if
(
)
{
if
(
this
.
.
some
(
=>
.
.
===
.
.
&&
.
?.
===
.
?.
)
)
{
return
;
}
}
else
{
if
(
this
.
.
===
0
)
{
return
;
}
this
.
=
[
]
;
}
if
(
)
{
this
.
.
push
(
)
;
this
.
.
sort
(
(
,
)
=>
.
===
?
-
1
:
.
===
?
1
:
.
===
?
-
1
:
.
===
?
1
:
.
===
?
-
1
:
.
===
?
1
:
.
===
?
-
1
:
.
===
?
1
:
0
)
;
}
if
(
)
{
if
(
?.
===
)
{
this
.
=
` ${ McpServerStatusAction. CLASS } extension-status-error ${ ThemeIcon. asClassName ( errorIcon) } `
;
}
else
if
(
?.
===
)
{
this
.
=
` ${ McpServerStatusAction. CLASS } extension-status-warning ${ ThemeIcon. asClassName ( warningIcon) } `
;
}
else
if
(
?.
===
)
{
this
.
=
` ${ McpServerStatusAction. CLASS } extension-status-info ${ ThemeIcon. asClassName ( infoIcon) } `
;
}
else
if
(
?.
===
)
{
this
.
=
` ${ McpServerStatusAction. CLASS } ${ ThemeIcon. asClassName ( trustIcon) } `
;
}
else
{
this
.
=
` ${ McpServerStatusAction. CLASS } hide `
;
}
}
this
.
.
fire
(
)
;
}
async
run
(
)
:
Promise
<
void
>
{
if
(
this
.
[
0
]
?.
===
)
{
return
this
.
.
executeCommand
(
'workbench.trust.manage'
)
;
}
}
}