@theia/ai-mcp-ui 1.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Model Context Server (MCP) UI Integration
2
+
3
+ The AI MCP UI package provides the UI for users to start and use MCP servers
4
+
5
+ ## Features
6
+
7
+ - Start and stop MCP servers.
8
+ - Provide preference schema for autocomplete etc. in preferences
9
+
10
+ ## Commands
11
+
12
+ ### Start MCP Server
13
+
14
+ - **Command ID:** `mcp.startserver`
15
+ - **Label:** `MCP: Start MCP Server`
16
+ - **Functionality:** Allows you to start a MCP server by selecting from a list of configured servers.
17
+
18
+ ### Stop MCP Server
19
+
20
+ - **Command ID:** `mcp.stopserver`
21
+ - **Label:** `MCP: Stop MCP Server`
22
+ - **Functionality:** Allows you to stop a running MCP server by selecting from a list of currently running servers.
23
+
24
+ ## Usage
25
+
26
+ 1. **Starting a MCP Server:**
27
+ - Use the command palette to invoke `MCP: Start MCP Server`.
28
+ - A quick pick menu will appear with a list of configured MCP servers.
29
+ - Select a server to start.
30
+
31
+ 2. **Stopping a MCP Server:**
32
+ - Use the command palette to invoke `MCP: Stop MCP Server`.
33
+ - A quick pick menu will display a list of currently running MCP servers.
34
+ - Select a server to stop.
35
+
36
+ 3. **Using provided tool functions**
37
+ - Only functions of started MCP servers can be used
38
+ - Open a prompt template and add the added tool functions
39
+ - Type '~{' to open the auto completion
40
+
41
+ ## Configuration
42
+
43
+ To configure MCP servers, open the preferences and add entries to the `MCP Servers Configuration` section.
44
+ See the Theia MCP package (`@theia/ai-mcp`) README for more information.
45
+
46
+ ## More Information
47
+
48
+ [Theia AI MCP README](https://github.com/eclipse-theia/theia/tree/master/packages/ai-mcp)
49
+ [User documentation on MCP in the Theia IDE](https://theia-ide.org/docs/user_ai/#mcp-integration)
50
+ [List of available MCP servers](https://github.com/modelcontextprotocol/servers)
@@ -0,0 +1,21 @@
1
+ import { AICommandHandlerFactory } from '@theia/ai-core/lib/browser/ai-command-handler-factory';
2
+ import { CommandContribution, CommandRegistry, MessageService } from '@theia/core';
3
+ import { QuickInputService } from '@theia/core/lib/browser';
4
+ import { MCPFrontendService } from '@theia/ai-mcp';
5
+ export declare const StartMCPServer: {
6
+ id: string;
7
+ label: string;
8
+ };
9
+ export declare const StopMCPServer: {
10
+ id: string;
11
+ label: string;
12
+ };
13
+ export declare class MCPCommandContribution implements CommandContribution {
14
+ protected readonly commandHandlerFactory: AICommandHandlerFactory;
15
+ protected readonly quickInputService: QuickInputService;
16
+ protected messageService: MessageService;
17
+ protected readonly mcpFrontendService: MCPFrontendService;
18
+ private getMCPServerSelection;
19
+ registerCommands(commandRegistry: CommandRegistry): void;
20
+ }
21
+ //# sourceMappingURL=mcp-command-contribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-command-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-command-contribution.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,cAAc,EAAO,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAmB,MAAM,eAAe,CAAC;AAEpE,eAAO,MAAM,cAAc;;;CAG1B,CAAC;AACF,eAAO,MAAM,aAAa;;;CAGzB,CAAC;AAEF,qBACa,sBAAuB,YAAW,mBAAmB;IAE9D,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,uBAAuB,CAAC;IAGlE,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAGxD,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;IAGzC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;YAE5C,qBAAqB;IASnC,gBAAgB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;CAkE3D"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MCPCommandContribution = exports.StopMCPServer = exports.StartMCPServer = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // *****************************************************************************
6
+ // Copyright (C) 2024 EclipseSource GmbH.
7
+ //
8
+ // This program and the accompanying materials are made available under the
9
+ // terms of the Eclipse Public License v. 2.0 which is available at
10
+ // http://www.eclipse.org/legal/epl-2.0.
11
+ //
12
+ // This Source Code may also be made available under the following Secondary
13
+ // Licenses when the conditions for such availability set forth in the Eclipse
14
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
15
+ // with the GNU Classpath Exception which is available at
16
+ // https://www.gnu.org/software/classpath/license.html.
17
+ //
18
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
19
+ // *****************************************************************************
20
+ const ai_command_handler_factory_1 = require("@theia/ai-core/lib/browser/ai-command-handler-factory");
21
+ const core_1 = require("@theia/core");
22
+ const browser_1 = require("@theia/core/lib/browser");
23
+ const inversify_1 = require("@theia/core/shared/inversify");
24
+ const ai_mcp_1 = require("@theia/ai-mcp");
25
+ exports.StartMCPServer = {
26
+ id: 'mcp.startserver',
27
+ label: core_1.nls.localize('theia/ai/mcp/start/label', 'MCP: Start MCP Server'),
28
+ };
29
+ exports.StopMCPServer = {
30
+ id: 'mcp.stopserver',
31
+ label: core_1.nls.localize('theia/ai/mcp/stop/label', 'MCP: Stop MCP Server'),
32
+ };
33
+ let MCPCommandContribution = class MCPCommandContribution {
34
+ async getMCPServerSelection(serverNames) {
35
+ if (!serverNames || serverNames.length === 0) {
36
+ return undefined;
37
+ }
38
+ const options = serverNames.map(mcpServerName => ({ label: mcpServerName }));
39
+ const result = await this.quickInputService.showQuickPick(options);
40
+ return result === null || result === void 0 ? void 0 : result.label;
41
+ }
42
+ registerCommands(commandRegistry) {
43
+ commandRegistry.registerCommand(exports.StopMCPServer, this.commandHandlerFactory({
44
+ execute: async () => {
45
+ try {
46
+ const startedServers = await this.mcpFrontendService.getStartedServers();
47
+ if (!startedServers || startedServers.length === 0) {
48
+ this.messageService.error(core_1.nls.localize('theia/ai/mcp/error/noRunningServers', 'No MCP servers running.'));
49
+ return;
50
+ }
51
+ const selection = await this.getMCPServerSelection(startedServers);
52
+ if (!selection) {
53
+ return;
54
+ }
55
+ await this.mcpFrontendService.stopServer(selection);
56
+ }
57
+ catch (error) {
58
+ console.error('Error while stopping MCP server:', error);
59
+ }
60
+ }
61
+ }));
62
+ commandRegistry.registerCommand(exports.StartMCPServer, this.commandHandlerFactory({
63
+ execute: async () => {
64
+ try {
65
+ const servers = await this.mcpFrontendService.getServerNames();
66
+ const startedServers = await this.mcpFrontendService.getStartedServers();
67
+ const startableServers = servers.filter(server => !startedServers.includes(server));
68
+ if (!startableServers || startableServers.length === 0) {
69
+ if (startedServers && startedServers.length > 0) {
70
+ this.messageService.error(core_1.nls.localize('theia/ai/mcp/error/allServersRunning', 'All MCP servers are already running.'));
71
+ }
72
+ else {
73
+ this.messageService.error(core_1.nls.localize('theia/ai/mcp/error/noServersConfigured', 'No MCP servers configured.'));
74
+ }
75
+ return;
76
+ }
77
+ const selection = await this.getMCPServerSelection(startableServers);
78
+ if (!selection) {
79
+ return;
80
+ }
81
+ await this.mcpFrontendService.startServer(selection);
82
+ const serverDescription = await this.mcpFrontendService.getServerDescription(selection);
83
+ if (serverDescription && serverDescription.status) {
84
+ if (serverDescription.status === ai_mcp_1.MCPServerStatus.Running
85
+ || serverDescription.status === ai_mcp_1.MCPServerStatus.Connected) {
86
+ let toolNames = undefined;
87
+ if (serverDescription.tools) {
88
+ toolNames = serverDescription.tools.map(tool => tool.name).join(',');
89
+ }
90
+ this.messageService.info(core_1.nls.localize('theia/ai/mcp/info/serverStarted', 'MCP server "{0}" successfully started. Registered tools: {1}', selection, toolNames ||
91
+ core_1.nls.localize('theia/ai/mcp/tool/noTools', 'No tools available.')));
92
+ return;
93
+ }
94
+ if (serverDescription.error) {
95
+ console.error('Error while starting MCP server:', serverDescription.error);
96
+ }
97
+ }
98
+ this.messageService.error(core_1.nls.localize('theia/ai/mcp/error/startFailed', 'An error occurred while starting the MCP server.'));
99
+ }
100
+ catch (error) {
101
+ this.messageService.error(core_1.nls.localize('theia/ai/mcp/error/startFailed', 'An error occurred while starting the MCP server.'));
102
+ console.error('Error while starting MCP server:', error);
103
+ }
104
+ }
105
+ }));
106
+ }
107
+ };
108
+ exports.MCPCommandContribution = MCPCommandContribution;
109
+ tslib_1.__decorate([
110
+ (0, inversify_1.inject)(ai_command_handler_factory_1.AICommandHandlerFactory),
111
+ tslib_1.__metadata("design:type", Function)
112
+ ], MCPCommandContribution.prototype, "commandHandlerFactory", void 0);
113
+ tslib_1.__decorate([
114
+ (0, inversify_1.inject)(browser_1.QuickInputService),
115
+ tslib_1.__metadata("design:type", Object)
116
+ ], MCPCommandContribution.prototype, "quickInputService", void 0);
117
+ tslib_1.__decorate([
118
+ (0, inversify_1.inject)(core_1.MessageService),
119
+ tslib_1.__metadata("design:type", core_1.MessageService)
120
+ ], MCPCommandContribution.prototype, "messageService", void 0);
121
+ tslib_1.__decorate([
122
+ (0, inversify_1.inject)(ai_mcp_1.MCPFrontendService),
123
+ tslib_1.__metadata("design:type", Object)
124
+ ], MCPCommandContribution.prototype, "mcpFrontendService", void 0);
125
+ exports.MCPCommandContribution = MCPCommandContribution = tslib_1.__decorate([
126
+ (0, inversify_1.injectable)()
127
+ ], MCPCommandContribution);
128
+ //# sourceMappingURL=mcp-command-contribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-command-contribution.js","sourceRoot":"","sources":["../../src/browser/mcp-command-contribution.ts"],"names":[],"mappings":";;;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E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gC,EAAE,kDAAkD,CAAC,CAAC,CAAC;gBAClI,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACb,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,UAAG,CAAC,QAAQ,CAAC,gCAAgC,EAAE,kDAAkD,CAAC,CAAC,CAAC;oBAC9H,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;gBAC7D,CAAC;YACL,CAAC;SACJ,CAAC,CAAC,CAAC;IACR,CAAC;CACJ,CAAA;AAxFY,wDAAsB;AAEZ;IADlB,IAAA,kBAAM,EAAC,oDAAuB,CAAC;;qEACkC;AAG/C;IADlB,IAAA,kBAAM,EAAC,2BAAiB,CAAC;;iEAC8B;AAG9C;IADT,IAAA,kBAAM,EAAC,qBAAc,CAAC;sCACG,qBAAc;8DAAC;AAGtB;IADlB,IAAA,kBAAM,EAAC,2BAAkB,CAAC;;kEAC+B;iCAXjD,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CAwFlC"}
@@ -0,0 +1,4 @@
1
+ import { ContainerModule } from '@theia/core/shared/inversify';
2
+ declare const _default: ContainerModule;
3
+ export default _default;
4
+ //# sourceMappingURL=mcp-ui-frontend-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-ui-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-ui-frontend-module.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAK/D,wBAGG"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2024 EclipseSource GmbH.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const core_1 = require("@theia/core");
19
+ const inversify_1 = require("@theia/core/shared/inversify");
20
+ const mcp_command_contribution_1 = require("./mcp-command-contribution");
21
+ const browser_1 = require("@theia/core/lib/browser");
22
+ const mcp_preferences_1 = require("@theia/ai-mcp/lib/browser/mcp-preferences");
23
+ exports.default = new inversify_1.ContainerModule(bind => {
24
+ bind(browser_1.PreferenceContribution).toConstantValue({ schema: mcp_preferences_1.McpServersPreferenceSchema });
25
+ bind(core_1.CommandContribution).to(mcp_command_contribution_1.MCPCommandContribution);
26
+ });
27
+ //# sourceMappingURL=mcp-ui-frontend-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-ui-frontend-module.js","sourceRoot":"","sources":["../../src/browser/mcp-ui-frontend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,sCAAkD;AAClD,4DAA+D;AAC/D,yEAAoE;AACpE,qDAAiE;AACjE,+EAAuF;AAEvF,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,gCAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,4CAA0B,EAAE,CAAC,CAAC;IACrF,IAAI,CAAC,0BAAmB,CAAC,CAAC,EAAE,CAAC,iDAAsB,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=package.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2025 EclipseSource GmbH and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+ /* note: this bogus test file is required so that
17
+ we are able to run mocha unit tests on this
18
+ package, without having any actual unit tests in it.
19
+ This way a coverage report will be generated,
20
+ showing 0% coverage, instead of no report.
21
+ This file can be removed once we have real unit
22
+ tests in place. */
23
+ describe('ai-mcp-ui package', () => {
24
+ it('support code coverage statistics', () => true);
25
+ });
26
+ //# sourceMappingURL=package.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF;;;;;;qBAMqB;AAErB,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAE/B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@theia/ai-mcp-ui",
3
+ "version": "1.64.0",
4
+ "description": "Theia - MCP UI Integration",
5
+ "dependencies": {
6
+ "@theia/ai-core": "1.64.0",
7
+ "@theia/ai-mcp": "1.64.0",
8
+ "@theia/core": "1.64.0"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "theiaExtensions": [
14
+ {
15
+ "frontend": "lib/browser/mcp-ui-frontend-module"
16
+ }
17
+ ],
18
+ "keywords": [
19
+ "theia-extension"
20
+ ],
21
+ "license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/eclipse-theia/theia.git"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/eclipse-theia/theia/issues"
28
+ },
29
+ "homepage": "https://github.com/eclipse-theia/theia",
30
+ "files": [
31
+ "lib",
32
+ "src"
33
+ ],
34
+ "scripts": {
35
+ "build": "theiaext build",
36
+ "clean": "theiaext clean",
37
+ "compile": "theiaext compile",
38
+ "lint": "theiaext lint",
39
+ "test": "theiaext test",
40
+ "watch": "theiaext watch"
41
+ },
42
+ "devDependencies": {
43
+ "@theia/ext-scripts": "1.64.0"
44
+ },
45
+ "nyc": {
46
+ "extends": "../../configs/nyc.json"
47
+ },
48
+ "gitHead": "4c074e0d16c48e96a044b2f8bc4717de2e031c4b"
49
+ }
@@ -0,0 +1,120 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2024 EclipseSource GmbH.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+ import { AICommandHandlerFactory } from '@theia/ai-core/lib/browser/ai-command-handler-factory';
17
+ import { CommandContribution, CommandRegistry, MessageService, nls } from '@theia/core';
18
+ import { QuickInputService } from '@theia/core/lib/browser';
19
+ import { inject, injectable } from '@theia/core/shared/inversify';
20
+ import { MCPFrontendService, MCPServerStatus } from '@theia/ai-mcp';
21
+
22
+ export const StartMCPServer = {
23
+ id: 'mcp.startserver',
24
+ label: nls.localize('theia/ai/mcp/start/label', 'MCP: Start MCP Server'),
25
+ };
26
+ export const StopMCPServer = {
27
+ id: 'mcp.stopserver',
28
+ label: nls.localize('theia/ai/mcp/stop/label', 'MCP: Stop MCP Server'),
29
+ };
30
+
31
+ @injectable()
32
+ export class MCPCommandContribution implements CommandContribution {
33
+ @inject(AICommandHandlerFactory)
34
+ protected readonly commandHandlerFactory: AICommandHandlerFactory;
35
+
36
+ @inject(QuickInputService)
37
+ protected readonly quickInputService: QuickInputService;
38
+
39
+ @inject(MessageService)
40
+ protected messageService: MessageService;
41
+
42
+ @inject(MCPFrontendService)
43
+ protected readonly mcpFrontendService: MCPFrontendService;
44
+
45
+ private async getMCPServerSelection(serverNames: string[]): Promise<string | undefined> {
46
+ if (!serverNames || serverNames.length === 0) {
47
+ return undefined;
48
+ }
49
+ const options = serverNames.map(mcpServerName => ({ label: mcpServerName }));
50
+ const result = await this.quickInputService.showQuickPick(options);
51
+ return result?.label;
52
+ }
53
+
54
+ registerCommands(commandRegistry: CommandRegistry): void {
55
+ commandRegistry.registerCommand(StopMCPServer, this.commandHandlerFactory({
56
+ execute: async () => {
57
+ try {
58
+ const startedServers = await this.mcpFrontendService.getStartedServers();
59
+ if (!startedServers || startedServers.length === 0) {
60
+ this.messageService.error(nls.localize('theia/ai/mcp/error/noRunningServers', 'No MCP servers running.'));
61
+ return;
62
+ }
63
+ const selection = await this.getMCPServerSelection(startedServers);
64
+ if (!selection) {
65
+ return;
66
+ }
67
+ await this.mcpFrontendService.stopServer(selection);
68
+ } catch (error) {
69
+ console.error('Error while stopping MCP server:', error);
70
+ }
71
+ }
72
+ }));
73
+
74
+ commandRegistry.registerCommand(StartMCPServer, this.commandHandlerFactory({
75
+ execute: async () => {
76
+ try {
77
+ const servers = await this.mcpFrontendService.getServerNames();
78
+ const startedServers = await this.mcpFrontendService.getStartedServers();
79
+ const startableServers = servers.filter(server => !startedServers.includes(server));
80
+ if (!startableServers || startableServers.length === 0) {
81
+ if (startedServers && startedServers.length > 0) {
82
+ this.messageService.error(nls.localize('theia/ai/mcp/error/allServersRunning', 'All MCP servers are already running.'));
83
+ } else {
84
+ this.messageService.error(nls.localize('theia/ai/mcp/error/noServersConfigured', 'No MCP servers configured.'));
85
+ }
86
+ return;
87
+ }
88
+
89
+ const selection = await this.getMCPServerSelection(startableServers);
90
+ if (!selection) {
91
+ return;
92
+ }
93
+ await this.mcpFrontendService.startServer(selection);
94
+ const serverDescription = await this.mcpFrontendService.getServerDescription(selection);
95
+ if (serverDescription && serverDescription.status) {
96
+ if (serverDescription.status === MCPServerStatus.Running
97
+ || serverDescription.status === MCPServerStatus.Connected) {
98
+ let toolNames: string | undefined = undefined;
99
+ if (serverDescription.tools) {
100
+ toolNames = serverDescription.tools.map(tool => tool.name).join(',');
101
+ }
102
+ this.messageService.info(
103
+ nls.localize('theia/ai/mcp/info/serverStarted', 'MCP server "{0}" successfully started. Registered tools: {1}', selection, toolNames ||
104
+ nls.localize('theia/ai/mcp/tool/noTools', 'No tools available.'))
105
+ );
106
+ return;
107
+ }
108
+ if (serverDescription.error) {
109
+ console.error('Error while starting MCP server:', serverDescription.error);
110
+ }
111
+ }
112
+ this.messageService.error(nls.localize('theia/ai/mcp/error/startFailed', 'An error occurred while starting the MCP server.'));
113
+ } catch (error) {
114
+ this.messageService.error(nls.localize('theia/ai/mcp/error/startFailed', 'An error occurred while starting the MCP server.'));
115
+ console.error('Error while starting MCP server:', error);
116
+ }
117
+ }
118
+ }));
119
+ }
120
+ }
@@ -0,0 +1,26 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2024 EclipseSource GmbH.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { CommandContribution } from '@theia/core';
18
+ import { ContainerModule } from '@theia/core/shared/inversify';
19
+ import { MCPCommandContribution } from './mcp-command-contribution';
20
+ import { PreferenceContribution } from '@theia/core/lib/browser';
21
+ import { McpServersPreferenceSchema } from '@theia/ai-mcp/lib/browser/mcp-preferences';
22
+
23
+ export default new ContainerModule(bind => {
24
+ bind(PreferenceContribution).toConstantValue({ schema: McpServersPreferenceSchema });
25
+ bind(CommandContribution).to(MCPCommandContribution);
26
+ });
@@ -0,0 +1,28 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2025 EclipseSource GmbH and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ /* note: this bogus test file is required so that
18
+ we are able to run mocha unit tests on this
19
+ package, without having any actual unit tests in it.
20
+ This way a coverage report will be generated,
21
+ showing 0% coverage, instead of no report.
22
+ This file can be removed once we have real unit
23
+ tests in place. */
24
+
25
+ describe('ai-mcp-ui package', () => {
26
+
27
+ it('support code coverage statistics', () => true);
28
+ });