@@ -26,8 +26,8 @@ import { IInstantiationService, ServicesAccessor } from '../../../../platform/in
26
26
import { IQuickInputService , IQuickPickItem , IQuickPickSeparator } from '../../../../platform/quickinput/common/quickInput.js' ;
27
27
import { StorageScope } from '../../../../platform/storage/common/storage.js' ;
28
28
import { spinningLoading } from '../../../../platform/theme/common/iconRegistry.js' ;
29
- import { IWorkspaceContextService } from '../../../../platform/workspace/common/workspace.js' ;
30
- import { ActiveEditorContext , ResourceContextKey } from '../../../common/contextkeys.js' ;
29
+ import { IWorkspaceContextService , IWorkspaceFolder } from '../../../../platform/workspace/common/workspace.js' ;
30
+ import { ActiveEditorContext , RemoteNameContext , ResourceContextKey , WorkbenchStateContext , WorkspaceFolderCountContext } from '../../../common/contextkeys.js' ;
31
31
import { IWorkbenchContribution } from '../../../common/contributions.js' ;
32
32
import { IAccountQuery , IAuthenticationQueryService } from '../../../services/authentication/common/authenticationQuery.js' ;
33
33
import { IAuthenticationService } from '../../../services/authentication/common/authentication.js' ;
@@ -46,6 +46,10 @@ import { HasInstalledMcpServersContext, IMcpSamplingService, IMcpServer, IMcpSer
46
46
import { McpAddConfigurationCommand } from './mcpCommandsAddConfiguration.js' ;
47
47
import { McpResourceQuickAccess , McpResourceQuickPick } from './mcpResourceQuickAccess.js' ;
48
48
import { openPanelChatAndGetWidget } from './openPanelChatAndGetWidget.js' ;
49
+ import { IUserDataProfileService } from '../../../services/userDataProfile/common/userDataProfile.js' ;
50
+ import { IRemoteUserDataProfilesService } from '../../../services/userDataProfile/common/remoteUserDataProfiles.js' ;
51
+ import { PICK_WORKSPACE_FOLDER_COMMAND_ID } from '../../../browser/actions/workspaceCommands.js' ;
52
+ import { MCP_CONFIGURATION_KEY , WORKSPACE_STANDALONE_CONFIGURATIONS } from '../../../services/configuration/common/configuration.js' ;
49
53
50
54
// acroynms do not get localized
51
55
const category : ILocalizedString = {
@@ -708,6 +712,87 @@ export class ShowInstalledMcpServersCommand extends Action2 {
708
712
}
709
713
}
710
714
715
+ export class OpenUserMcpResourceCommand extends Action2 {
716
+ constructor ( ) {
717
+ super ( {
718
+ id : McpCommandIds . OpenUserMcp ,
719
+ title : localize2 ( 'mcp.command.openUserMcp' , "Open User MCP Servers" ) ,
720
+ category,
721
+ f1 : true
722
+ } ) ;
723
+ }
724
+
725
+ async run ( accessor : ServicesAccessor ) {
726
+ const userDataProfileService = accessor . get ( IUserDataProfileService ) ;
727
+ const editorService = accessor . get ( IEditorService ) ;
728
+ await editorService . openEditor ( { resource : userDataProfileService . currentProfile . mcpResource } ) ;
729
+ }
730
+ }
731
+
732
+ export class OpenRemoteUserMcpResourceCommand extends Action2 {
733
+ constructor ( ) {
734
+ super ( {
735
+ id : McpCommandIds . OpenRemoteUserMcp ,
736
+ title : localize2 ( 'mcp.command.openRemoteUserMcp' , "Open Remote User MCP Servers" ) ,
737
+ category,
738
+ f1 : true ,
739
+ precondition : RemoteNameContext . notEqualsTo ( '' )
740
+ } ) ;
741
+ }
742
+
743
+ async run ( accessor : ServicesAccessor ) {
744
+ const userDataProfileService = accessor . get ( IUserDataProfileService ) ;
745
+ const remoteUserDataProfileService = accessor . get ( IRemoteUserDataProfilesService ) ;
746
+ const editorService = accessor . get ( IEditorService ) ;
747
+ const remoteProfile = await remoteUserDataProfileService . getRemoteProfile ( userDataProfileService . currentProfile ) ;
748
+ await editorService . openEditor ( { resource : remoteProfile . mcpResource } ) ;
749
+ }
750
+ }
751
+
752
+ export class OpenWorkspaceFolderMcpResourceCommand extends Action2 {
753
+ constructor ( ) {
754
+ super ( {
755
+ id : McpCommandIds . OpenWorkspaceFolderMcp ,
756
+ title : localize2 ( 'mcp.command.openWorkspaceFolderMcp' , "Open Workspace Folder MCP Servers" ) ,
757
+ category,
758
+ f1 : true ,
759
+ precondition : WorkspaceFolderCountContext . notEqualsTo ( 0 )
760
+ } ) ;
761
+ }
762
+
763
+ async run ( accessor : ServicesAccessor ) {
764
+ const workspaceContextService = accessor . get ( IWorkspaceContextService ) ;
765
+ const commandService = accessor . get ( ICommandService ) ;
766
+ const editorService = accessor . get ( IEditorService ) ;
767
+ const workspaceFolders = workspaceContextService . getWorkspace ( ) . folders ;
768
+ const workspaceFolder = workspaceFolders . length === 1 ? workspaceFolders [ 0 ] : await commandService . executeCommand < IWorkspaceFolder > ( PICK_WORKSPACE_FOLDER_COMMAND_ID ) ;
769
+ if ( workspaceFolder ) {
770
+ await editorService . openEditor ( { resource : workspaceFolder . toResource ( WORKSPACE_STANDALONE_CONFIGURATIONS [ MCP_CONFIGURATION_KEY ] ) } ) ;
771
+ }
772
+ }
773
+ }
774
+
775
+ export class OpenWorkspaceMcpResourceCommand extends Action2 {
776
+ constructor ( ) {
777
+ super ( {
778
+ id : McpCommandIds . OpenWorkspaceMcp ,
779
+ title : localize2 ( 'mcp.command.openWorkspaceMcp' , "Open Workspace MCP Servers" ) ,
780
+ category,
781
+ f1 : true ,
782
+ precondition : WorkbenchStateContext . isEqualTo ( 'workspace' )
783
+ } ) ;
784
+ }
785
+
786
+ async run ( accessor : ServicesAccessor ) {
787
+ const workspaceContextService = accessor . get ( IWorkspaceContextService ) ;
788
+ const editorService = accessor . get ( IEditorService ) ;
789
+ const workspaceConfiguration = workspaceContextService . getWorkspace ( ) . configuration ;
790
+ if ( workspaceConfiguration ) {
791
+ await editorService . openEditor ( { resource : workspaceConfiguration } ) ;
792
+ }
793
+ }
794
+ }
795
+
711
796
export class McpBrowseResourcesCommand extends Action2 {
712
797
constructor ( ) {
713
798
super ( {
0 commit comments