Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { IEditorService } from '../../../services/editor/common/editorService.js
import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.js';
import { IMcpConfigurationStdio, mcpConfigurationSection, mcpStdioServerSchema } from '../common/mcpConfiguration.js';
import { IMcpRegistry } from '../common/mcpRegistryTypes.js';
import { IMcpService, McpConnectionState } from '../common/mcpTypes.js';
import { McpServerOptionsCommand } from './mcpCommands.js';

const enum AddConfigurationType {
Expand Down Expand Up @@ -110,6 +111,7 @@ export class McpAddConfigurationCommand {
@IFileService private readonly _fileService: IFileService,
@INotificationService private readonly _notificationService: INotificationService,
@ITelemetryService private readonly _telemetryService: ITelemetryService,
@IMcpService private readonly _mcpService: IMcpService,
) { }

private async getServerType(): Promise<AddConfigurationType | undefined> {
Expand Down Expand Up @@ -323,9 +325,11 @@ export class McpAddConfigurationCommand {
const store = new DisposableStore();
store.add(autorun(reader => {
const colls = this._mcpRegistry.collections.read(reader);
const servers = this._mcpService.servers.read(reader);
const match = mapFindFirst(colls, collection => mapFindFirst(collection.serverDefinitions.read(reader),
server => server.label === name ? { server, collection } : undefined));
if (match) {
const server = match && servers.find(s => s.definition.id === match.server.id);
if (match && server) {
if (match.collection.presentation?.origin) {
this._openerService.openEditor({
resource: match.collection.presentation.origin,
Expand All @@ -338,6 +342,12 @@ export class McpAddConfigurationCommand {
this._commandService.executeCommand(McpServerOptionsCommand.id, name);
}

server.start(true).then(state => {
if (state.state === McpConnectionState.Kind.Error) {
server.showOutput();
}
});

store.dispose();
}
}));
Expand Down
Loading