@theia/ai-mcp 1.69.0-next.81 → 1.69.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/lib/browser/mcp-frontend-module.d.ts.map +1 -1
- package/lib/browser/mcp-frontend-module.js +4 -0
- package/lib/browser/mcp-frontend-module.js.map +1 -1
- package/lib/browser/mcp-generic-capabilities-contribution.d.ts +14 -0
- package/lib/browser/mcp-generic-capabilities-contribution.d.ts.map +1 -0
- package/lib/browser/mcp-generic-capabilities-contribution.js +65 -0
- package/lib/browser/mcp-generic-capabilities-contribution.js.map +1 -0
- package/package.json +6 -6
- package/src/browser/mcp-frontend-module.ts +5 -0
- package/src/browser/mcp-generic-capabilities-contribution.ts +67 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;
|
|
1
|
+
{"version":3,"file":"mcp-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAiB/D,wBAgEG"}
|
|
@@ -24,12 +24,16 @@ const mcp_frontend_notification_service_1 = require("./mcp-frontend-notification
|
|
|
24
24
|
const mcp_server_manager_server_client_1 = require("./mcp-server-manager-server-client");
|
|
25
25
|
const mcp_protocol_1 = require("../common/mcp-protocol");
|
|
26
26
|
const workspace_trust_service_1 = require("@theia/workspace/lib/browser/workspace-trust-service");
|
|
27
|
+
const ai_core_1 = require("@theia/ai-core");
|
|
28
|
+
const mcp_generic_capabilities_contribution_1 = require("./mcp-generic-capabilities-contribution");
|
|
27
29
|
exports.default = new inversify_1.ContainerModule(bind => {
|
|
28
30
|
bind(mcp_frontend_application_contribution_1.McpFrontendApplicationContribution).toSelf().inSingletonScope();
|
|
29
31
|
bind(browser_1.FrontendApplicationContribution).toService(mcp_frontend_application_contribution_1.McpFrontendApplicationContribution);
|
|
30
32
|
bind(workspace_trust_service_1.WorkspaceRestrictionContribution).toService(mcp_frontend_application_contribution_1.McpFrontendApplicationContribution);
|
|
31
33
|
bind(mcp_server_manager_1.MCPFrontendService).to(mcp_frontend_service_1.MCPFrontendServiceImpl).inSingletonScope();
|
|
32
34
|
bind(mcp_server_manager_1.MCPFrontendNotificationService).to(mcp_frontend_notification_service_1.MCPFrontendNotificationServiceImpl).inSingletonScope();
|
|
35
|
+
bind(mcp_generic_capabilities_contribution_1.MCPGenericCapabilitiesContribution).toSelf().inSingletonScope();
|
|
36
|
+
bind(ai_core_1.GenericCapabilitiesContribution).toService(mcp_generic_capabilities_contribution_1.MCPGenericCapabilitiesContribution);
|
|
33
37
|
bind(mcp_protocol_1.MCPServerManagerServerClient).to(mcp_server_manager_server_client_1.MCPServerManagerServerClientImpl).inSingletonScope();
|
|
34
38
|
bind(mcp_protocol_1.MCPServerManagerServer).toDynamicValue(ctx => {
|
|
35
39
|
const connection = ctx.container.get(browser_1.RemoteConnectionProvider);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-frontend-module.js","sourceRoot":"","sources":["../../src/browser/mcp-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,4DAA+D;AAC/D,qDAA+H;AAC/H,qEAKsC;AACtC,mGAA6F;AAC7F,iEAAgE;AAChE,2FAAyF;AACzF,yFAAsF;AACtF,yDAA0H;AAC1H,kGAAwG;
|
|
1
|
+
{"version":3,"file":"mcp-frontend-module.js","sourceRoot":"","sources":["../../src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C/B,OAAO,KAAK,WAAmC,GAAG,IAA+E;wBAC7H,MAAM,OAAO,GAAG,YAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC3D,MAAM,SAAS,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;oBAC/C,CAAC,CAAC;gBACN,CAAC;gBACD,+EAA+E;gBAC/E,IAAI,IAAI,KAAK,sBAAsB,EAAE,CAAC;oBAClC,OAAO,KAAK,WAAmC,IAAY;wBACvD,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;wBACrF,IAAI,WAAW,EAAE,CAAC;4BACd,MAAM,eAAe,GAAG,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;4BAC9D,IAAI,eAAe,EAAE,CAAC;gCAClB,OAAO;oCACH,GAAG,WAAW;oCACd,OAAO,EAAE,eAAe;iCAC3B,CAAC;4BACN,CAAC;wBACL,CAAC;wBACD,OAAO,WAAW,CAAC;oBACvB,CAAC,CAAC;gBACN,CAAC;gBACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC/C,CAAC;SACJ,CAAC,CAAC;IACP,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAC1B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Event } from '@theia/core';
|
|
2
|
+
import { CapabilityType, GenericCapabilitiesContribution, GenericCapabilityGroup } from '@theia/ai-core';
|
|
3
|
+
import { MCPFrontendService, MCPFrontendNotificationService } from '../common/mcp-server-manager';
|
|
4
|
+
/**
|
|
5
|
+
* Contributes MCP tool functions as generic capabilities for selection in the chat UI.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MCPGenericCapabilitiesContribution implements GenericCapabilitiesContribution {
|
|
8
|
+
readonly capabilityType: CapabilityType;
|
|
9
|
+
protected readonly mcpFrontendService: MCPFrontendService;
|
|
10
|
+
protected readonly mcpNotificationService: MCPFrontendNotificationService;
|
|
11
|
+
get onDidChange(): Event<void>;
|
|
12
|
+
getAvailableCapabilities(): Promise<GenericCapabilityGroup[]>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=mcp-generic-capabilities-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-generic-capabilities-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-generic-capabilities-contribution.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACH,cAAc,EACd,+BAA+B,EAC/B,sBAAsB,EAEzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAElG;;GAEG;AACH,qBACa,kCAAmC,YAAW,+BAA+B;IAEtF,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAkB;IAGzD,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAG1D,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,8BAA8B,CAAC;IAE1E,IAAI,WAAW,IAAI,KAAK,CAAC,IAAI,CAAC,CAE7B;IAEK,wBAAwB,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;CAsBtE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 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
|
+
exports.MCPGenericCapabilitiesContribution = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const mcp_server_manager_1 = require("../common/mcp-server-manager");
|
|
22
|
+
/**
|
|
23
|
+
* Contributes MCP tool functions as generic capabilities for selection in the chat UI.
|
|
24
|
+
*/
|
|
25
|
+
let MCPGenericCapabilitiesContribution = class MCPGenericCapabilitiesContribution {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.capabilityType = 'mcpFunctions';
|
|
28
|
+
}
|
|
29
|
+
get onDidChange() {
|
|
30
|
+
return this.mcpNotificationService.onDidUpdateMCPServers;
|
|
31
|
+
}
|
|
32
|
+
async getAvailableCapabilities() {
|
|
33
|
+
const groups = [];
|
|
34
|
+
const startedServers = await this.mcpFrontendService.getStartedServers();
|
|
35
|
+
for (const serverName of startedServers) {
|
|
36
|
+
const tools = await this.mcpFrontendService.getTools(serverName);
|
|
37
|
+
if (tools?.tools && tools.tools.length > 0) {
|
|
38
|
+
const items = tools.tools.map(tool => ({
|
|
39
|
+
id: `mcp_${serverName}_${tool.name}`,
|
|
40
|
+
name: tool.name,
|
|
41
|
+
group: serverName,
|
|
42
|
+
description: tool.description
|
|
43
|
+
}));
|
|
44
|
+
groups.push({
|
|
45
|
+
name: serverName,
|
|
46
|
+
items
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return groups;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
exports.MCPGenericCapabilitiesContribution = MCPGenericCapabilitiesContribution;
|
|
54
|
+
tslib_1.__decorate([
|
|
55
|
+
(0, inversify_1.inject)(mcp_server_manager_1.MCPFrontendService),
|
|
56
|
+
tslib_1.__metadata("design:type", Object)
|
|
57
|
+
], MCPGenericCapabilitiesContribution.prototype, "mcpFrontendService", void 0);
|
|
58
|
+
tslib_1.__decorate([
|
|
59
|
+
(0, inversify_1.inject)(mcp_server_manager_1.MCPFrontendNotificationService),
|
|
60
|
+
tslib_1.__metadata("design:type", Object)
|
|
61
|
+
], MCPGenericCapabilitiesContribution.prototype, "mcpNotificationService", void 0);
|
|
62
|
+
exports.MCPGenericCapabilitiesContribution = MCPGenericCapabilitiesContribution = tslib_1.__decorate([
|
|
63
|
+
(0, inversify_1.injectable)()
|
|
64
|
+
], MCPGenericCapabilitiesContribution);
|
|
65
|
+
//# sourceMappingURL=mcp-generic-capabilities-contribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-generic-capabilities-contribution.js","sourceRoot":"","sources":["../../src/browser/mcp-generic-capabilities-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,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAkE;AAQlE,qEAAkG;AAElG;;GAEG;AAEI,IAAM,kCAAkC,GAAxC,MAAM,kCAAkC;IAAxC;QAEM,mBAAc,GAAmB,cAAc,CAAC;IAkC7D,CAAC;IA1BG,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,wBAAwB;QAC1B,MAAM,MAAM,GAA6B,EAAE,CAAC;QAC5C,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,CAAC;QAEzE,KAAK,MAAM,UAAU,IAAI,cAAc,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YACjE,IAAI,KAAK,EAAE,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACzC,MAAM,KAAK,GAA4B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBAC5D,EAAE,EAAE,OAAO,UAAU,IAAI,IAAI,CAAC,IAAI,EAAE;oBACpC,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,KAAK,EAAE,UAAU;oBACjB,WAAW,EAAE,IAAI,CAAC,WAAW;iBAChC,CAAC,CAAC,CAAC;gBACJ,MAAM,CAAC,IAAI,CAAC;oBACR,IAAI,EAAE,UAAU;oBAChB,KAAK;iBACR,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AApCY,gFAAkC;AAKxB;IADlB,IAAA,kBAAM,EAAC,uCAAkB,CAAC;;8EAC+B;AAGvC;IADlB,IAAA,kBAAM,EAAC,mDAA8B,CAAC;;kFACmC;6CARjE,kCAAkC;IAD9C,IAAA,sBAAU,GAAE;GACA,kCAAkC,CAoC9C"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-mcp",
|
|
3
|
-
"version": "1.69.0
|
|
3
|
+
"version": "1.69.0",
|
|
4
4
|
"description": "Theia - MCP Integration",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
7
|
-
"@theia/ai-core": "1.69.0
|
|
8
|
-
"@theia/core": "1.69.0
|
|
9
|
-
"@theia/workspace": "1.69.0
|
|
7
|
+
"@theia/ai-core": "1.69.0",
|
|
8
|
+
"@theia/core": "1.69.0",
|
|
9
|
+
"@theia/workspace": "1.69.0"
|
|
10
10
|
},
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"watch": "theiaext watch"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@theia/ext-scripts": "1.
|
|
46
|
+
"@theia/ext-scripts": "1.69.0"
|
|
47
47
|
},
|
|
48
48
|
"nyc": {
|
|
49
49
|
"extends": "../../configs/nyc.json"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "3b413470b0f990dc0d6e4287da02a6b6e21d3239"
|
|
52
52
|
}
|
|
@@ -28,6 +28,8 @@ import { MCPFrontendNotificationServiceImpl } from './mcp-frontend-notification-
|
|
|
28
28
|
import { MCPServerManagerServerClientImpl } from './mcp-server-manager-server-client';
|
|
29
29
|
import { MCPServerManagerServer, MCPServerManagerServerClient, MCPServerManagerServerPath } from '../common/mcp-protocol';
|
|
30
30
|
import { WorkspaceRestrictionContribution } from '@theia/workspace/lib/browser/workspace-trust-service';
|
|
31
|
+
import { GenericCapabilitiesContribution } from '@theia/ai-core';
|
|
32
|
+
import { MCPGenericCapabilitiesContribution } from './mcp-generic-capabilities-contribution';
|
|
31
33
|
|
|
32
34
|
export default new ContainerModule(bind => {
|
|
33
35
|
bind(McpFrontendApplicationContribution).toSelf().inSingletonScope();
|
|
@@ -35,6 +37,9 @@ export default new ContainerModule(bind => {
|
|
|
35
37
|
bind(WorkspaceRestrictionContribution).toService(McpFrontendApplicationContribution);
|
|
36
38
|
bind(MCPFrontendService).to(MCPFrontendServiceImpl).inSingletonScope();
|
|
37
39
|
bind(MCPFrontendNotificationService).to(MCPFrontendNotificationServiceImpl).inSingletonScope();
|
|
40
|
+
|
|
41
|
+
bind(MCPGenericCapabilitiesContribution).toSelf().inSingletonScope();
|
|
42
|
+
bind(GenericCapabilitiesContribution).toService(MCPGenericCapabilitiesContribution);
|
|
38
43
|
bind(MCPServerManagerServerClient).to(MCPServerManagerServerClientImpl).inSingletonScope();
|
|
39
44
|
|
|
40
45
|
bind(MCPServerManagerServer).toDynamicValue(ctx => {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 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 { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { Event } from '@theia/core';
|
|
19
|
+
import {
|
|
20
|
+
CapabilityType,
|
|
21
|
+
GenericCapabilitiesContribution,
|
|
22
|
+
GenericCapabilityGroup,
|
|
23
|
+
GenericCapabilityItem
|
|
24
|
+
} from '@theia/ai-core';
|
|
25
|
+
import { MCPFrontendService, MCPFrontendNotificationService } from '../common/mcp-server-manager';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Contributes MCP tool functions as generic capabilities for selection in the chat UI.
|
|
29
|
+
*/
|
|
30
|
+
@injectable()
|
|
31
|
+
export class MCPGenericCapabilitiesContribution implements GenericCapabilitiesContribution {
|
|
32
|
+
|
|
33
|
+
readonly capabilityType: CapabilityType = 'mcpFunctions';
|
|
34
|
+
|
|
35
|
+
@inject(MCPFrontendService)
|
|
36
|
+
protected readonly mcpFrontendService: MCPFrontendService;
|
|
37
|
+
|
|
38
|
+
@inject(MCPFrontendNotificationService)
|
|
39
|
+
protected readonly mcpNotificationService: MCPFrontendNotificationService;
|
|
40
|
+
|
|
41
|
+
get onDidChange(): Event<void> {
|
|
42
|
+
return this.mcpNotificationService.onDidUpdateMCPServers;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async getAvailableCapabilities(): Promise<GenericCapabilityGroup[]> {
|
|
46
|
+
const groups: GenericCapabilityGroup[] = [];
|
|
47
|
+
const startedServers = await this.mcpFrontendService.getStartedServers();
|
|
48
|
+
|
|
49
|
+
for (const serverName of startedServers) {
|
|
50
|
+
const tools = await this.mcpFrontendService.getTools(serverName);
|
|
51
|
+
if (tools?.tools && tools.tools.length > 0) {
|
|
52
|
+
const items: GenericCapabilityItem[] = tools.tools.map(tool => ({
|
|
53
|
+
id: `mcp_${serverName}_${tool.name}`,
|
|
54
|
+
name: tool.name,
|
|
55
|
+
group: serverName,
|
|
56
|
+
description: tool.description
|
|
57
|
+
}));
|
|
58
|
+
groups.push({
|
|
59
|
+
name: serverName,
|
|
60
|
+
items
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return groups;
|
|
66
|
+
}
|
|
67
|
+
}
|