@@ -12,10 +12,7 @@ import { IContextMenuService } from '../../../../platform/contextview/browser/co
12
12
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js' ;
13
13
import { manageExtensionIcon } from '../../extensions/browser/extensionsIcons.js' ;
14
14
import { getDomNodePagePosition } from '../../../../base/browser/dom.js' ;
15
- import { IMcpSamplingService , IMcpServer , IMcpServerContainer , IMcpService , IMcpWorkbenchService , IWorkbenchMcpServer , McpCapability , McpConnectionState } from '../common/mcpTypes.js' ;
16
- import { IMcpRegistry } from '../common/mcpRegistryTypes.js' ;
17
- import { URI } from '../../../../base/common/uri.js' ;
18
- import { Location } from '../../../../editor/common/languages.js' ;
15
+ import { IMcpSamplingService , IMcpServer , IMcpServerContainer , IMcpService , IMcpWorkbenchService , IWorkbenchMcpServer , McpCapability , McpConnectionState , McpServerEditorTab } from '../common/mcpTypes.js' ;
19
16
import { IEditorService } from '../../../services/editor/common/editorService.js' ;
20
17
import { ICommandService } from '../../../../platform/commands/common/commands.js' ;
21
18
import { McpCommandIds } from '../common/mcpCommandIds.js' ;
@@ -540,9 +537,7 @@ export class ShowServerConfigurationAction extends McpServerAction {
540
537
private static readonly HIDE = `${ this . CLASS } hide` ;
541
538
542
539
constructor (
543
- @IMcpService private readonly mcpService : IMcpService ,
544
- @IMcpRegistry private readonly mcpRegistry : IMcpRegistry ,
545
- @IEditorService private readonly editorService : IEditorService ,
540
+ @IMcpWorkbenchService private readonly mcpWorkbenchService : IMcpWorkbenchService
546
541
) {
547
542
super ( 'extensions.config' , localize ( 'config' , "Show Configuration" ) , ShowServerConfigurationAction . CLASS , false ) ;
548
543
this . update ( ) ;
@@ -551,8 +546,7 @@ export class ShowServerConfigurationAction extends McpServerAction {
551
546
update ( ) : void {
552
547
this . enabled = false ;
553
548
this . class = ShowServerConfigurationAction . HIDE ;
554
- const configurationTarget = this . getConfigurationTarget ( ) ;
555
- if ( ! configurationTarget ) {
549
+ if ( ! this . mcpServer ?. local ) {
556
550
return ;
557
551
}
558
552
this . class = ShowServerConfigurationAction . CLASS ;
@@ -561,31 +555,12 @@ export class ShowServerConfigurationAction extends McpServerAction {
561
555
}
562
556
563
557
override async run ( ) : Promise < any > {
564
- const configurationTarget = this . getConfigurationTarget ( ) ;
565
- if ( ! configurationTarget ) {
558
+ if ( ! this . mcpServer ?. local ) {
566
559
return ;
567
560
}
568
- this . editorService . openEditor ( {
569
- resource : URI . isUri ( configurationTarget ) ? configurationTarget : configurationTarget ! . uri ,
570
- options : { selection : URI . isUri ( configurationTarget ) ? undefined : configurationTarget ! . range }
571
- } ) ;
561
+ this . mcpWorkbenchService . open ( this . mcpServer , { tab : McpServerEditorTab . Configuration } ) ;
572
562
}
573
563
574
- private getConfigurationTarget ( ) : Location | URI | undefined {
575
- if ( ! this . mcpServer ) {
576
- return ;
577
- }
578
- if ( ! this . mcpServer . local ) {
579
- return ;
580
- }
581
- const server = this . mcpService . servers . get ( ) . find ( s => s . definition . label === this . mcpServer ?. name ) ;
582
- if ( ! server ) {
583
- return ;
584
- }
585
- const collection = this . mcpRegistry . collections . get ( ) . find ( c => c . id === server . collection . id ) ;
586
- const serverDefinition = collection ?. serverDefinitions . get ( ) . find ( s => s . id === server . definition . id ) ;
587
- return serverDefinition ?. presentation ?. origin || collection ?. presentation ?. origin ;
588
- }
589
564
}
590
565
591
566
export class ConfigureModelAccessAction extends McpServerAction {
0 commit comments