Skip to content

Commit ca8f724

Browse files
authored
open mcp server editor and report telemetry (microsoft#253601)
* open mcp server editor and report telemetry * fix alert
1 parent 499a93c commit ca8f724

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

src/vs/workbench/contrib/mcp/browser/mcpServerActions.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import { ICommandService } from '../../../../platform/commands/common/commands.j
2121
import { McpCommandIds } from '../common/mcpCommandIds.js';
2222
import { IAccountQuery, IAuthenticationQueryService } from '../../../services/authentication/common/authenticationQuery.js';
2323
import { IAuthenticationService } from '../../../services/authentication/common/authentication.js';
24+
import { alert } from '../../../../base/browser/ui/aria/aria.js';
25+
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
2426

2527
export abstract class McpServerAction extends Action implements IMcpServerContainer {
2628

@@ -100,7 +102,9 @@ export class InstallAction extends McpServerAction {
100102
private static readonly HIDE = `${this.CLASS} hide`;
101103

102104
constructor(
105+
private readonly editor: boolean,
103106
@IMcpWorkbenchService private readonly mcpWorkbenchService: IMcpWorkbenchService,
107+
@ITelemetryService private readonly telemetryService: ITelemetryService,
104108
) {
105109
super('extensions.install', localize('install', "Install"), InstallAction.CLASS, false);
106110
this.update();
@@ -124,6 +128,22 @@ export class InstallAction extends McpServerAction {
124128
if (!this.mcpServer) {
125129
return;
126130
}
131+
132+
if (!this.editor) {
133+
this.mcpWorkbenchService.open(this.mcpServer);
134+
alert(localize('mcpServerInstallation', "Installing MCP Server {0} started. An editor is now open with more details on this MCP Server", this.mcpServer.label));
135+
}
136+
137+
type McpServerInstallClassification = {
138+
owner: 'sandy081';
139+
comment: 'Used to understand if the action to install the MCP server is used.';
140+
name?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The gallery name of the MCP server being installed' };
141+
};
142+
type McpServerInstall = {
143+
name?: string;
144+
};
145+
this.telemetryService.publicLog2<McpServerInstall, McpServerInstallClassification>('mcp:action:install', { name: this.mcpServer.gallery?.name });
146+
127147
await this.mcpWorkbenchService.install(this.mcpServer);
128148
}
129149
}

src/vs/workbench/contrib/mcp/browser/mcpServerEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class McpServerEditor extends EditorPane {
220220
const description = append(details, $('.description'));
221221

222222
const actions = [
223-
this.instantiationService.createInstance(InstallAction),
223+
this.instantiationService.createInstance(InstallAction, true),
224224
this.instantiationService.createInstance(UninstallAction),
225225
this.instantiationService.createInstance(ManageMcpServerAction, true),
226226
];

src/vs/workbench/contrib/mcp/browser/mcpServersView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ class McpServerRenderer implements IListRenderer<IWorkbenchMcpServer, IMcpServer
264264
const actionBarListener = actionbar.onDidRun(({ error }) => error && this.notificationService.error(error));
265265

266266
const actions = [
267-
this.instantiationService.createInstance(InstallAction),
267+
this.instantiationService.createInstance(InstallAction, false),
268268
this.instantiationService.createInstance(ManageMcpServerAction, false),
269269
];
270270

0 commit comments

Comments
 (0)