@theia/ai-mcp 1.67.0-next.3 → 1.67.0-next.56
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 +33 -5
- package/package.json +4 -4
- package/lib/browser/mcp-frontend-application-contribution.d.ts +0 -42
- package/lib/browser/mcp-frontend-application-contribution.d.ts.map +0 -1
- package/lib/browser/mcp-frontend-application-contribution.js +0 -169
- package/lib/browser/mcp-frontend-application-contribution.js.map +0 -1
- package/lib/browser/mcp-frontend-module.d.ts +0 -4
- package/lib/browser/mcp-frontend-module.d.ts.map +0 -1
- package/lib/browser/mcp-frontend-module.js +0 -81
- package/lib/browser/mcp-frontend-module.js.map +0 -1
- package/lib/browser/mcp-frontend-notification-service.d.ts +0 -8
- package/lib/browser/mcp-frontend-notification-service.d.ts.map +0 -1
- package/lib/browser/mcp-frontend-notification-service.js +0 -35
- package/lib/browser/mcp-frontend-notification-service.js.map +0 -1
- package/lib/browser/mcp-frontend-service.d.ts +0 -23
- package/lib/browser/mcp-frontend-service.d.ts.map +0 -1
- package/lib/browser/mcp-frontend-service.js +0 -151
- package/lib/browser/mcp-frontend-service.js.map +0 -1
- package/lib/browser/mcp-server-manager-server-client.d.ts +0 -12
- package/lib/browser/mcp-server-manager-server-client.d.ts.map +0 -1
- package/lib/browser/mcp-server-manager-server-client.js +0 -80
- package/lib/browser/mcp-server-manager-server-client.js.map +0 -1
- package/lib/common/index.d.ts +0 -2
- package/lib/common/index.d.ts.map +0 -1
- package/lib/common/index.js +0 -20
- package/lib/common/index.js.map +0 -1
- package/lib/common/mcp-preferences.d.ts +0 -4
- package/lib/common/mcp-preferences.d.ts.map +0 -1
- package/lib/common/mcp-preferences.js +0 -113
- package/lib/common/mcp-preferences.js.map +0 -1
- package/lib/common/mcp-protocol.d.ts +0 -52
- package/lib/common/mcp-protocol.d.ts.map +0 -1
- package/lib/common/mcp-protocol.js +0 -30
- package/lib/common/mcp-protocol.js.map +0 -1
- package/lib/common/mcp-server-manager.d.ts +0 -128
- package/lib/common/mcp-server-manager.d.ts.map +0 -1
- package/lib/common/mcp-server-manager.js +0 -41
- package/lib/common/mcp-server-manager.js.map +0 -1
- package/lib/node/mcp-backend-module.d.ts +0 -4
- package/lib/node/mcp-backend-module.d.ts.map +0 -1
- package/lib/node/mcp-backend-module.js +0 -46
- package/lib/node/mcp-backend-module.js.map +0 -1
- package/lib/node/mcp-server-manager-impl.d.ts +0 -24
- package/lib/node/mcp-server-manager-impl.d.ts.map +0 -1
- package/lib/node/mcp-server-manager-impl.js +0 -151
- package/lib/node/mcp-server-manager-impl.js.map +0 -1
- package/lib/node/mcp-server-manager-server.d.ts +0 -9
- package/lib/node/mcp-server-manager-server.d.ts.map +0 -1
- package/lib/node/mcp-server-manager-server.js +0 -53
- package/lib/node/mcp-server-manager-server.js.map +0 -1
- package/lib/node/mcp-server.d.ts +0 -25
- package/lib/node/mcp-server.d.ts.map +0 -1
- package/lib/node/mcp-server.js +0 -222
- package/lib/node/mcp-server.js.map +0 -1
- package/lib/package.spec.d.ts +0 -1
- package/lib/package.spec.d.ts.map +0 -1
- package/lib/package.spec.js +0 -26
- package/lib/package.spec.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
<div align='center'>
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
+
|
|
7
|
+
<h2>ECLIPSE THEIA - AI MCP EXTENSION</h2>
|
|
8
|
+
|
|
9
|
+
<hr />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Description
|
|
2
14
|
|
|
3
15
|
The AI MCP package provides an integration that allows users to start and use MCP servers to provide additional tool functions to LLMs, e.g. search or file access (outside of the workspace).
|
|
4
16
|
|
|
5
|
-
|
|
17
|
+
### Features
|
|
6
18
|
|
|
7
19
|
- Offers the framework to add/remove and start/stop MCP servers
|
|
8
20
|
- Use tool functions provided by MCP servers in prompt templates
|
|
9
21
|
|
|
10
|
-
|
|
22
|
+
### Commands
|
|
11
23
|
|
|
12
24
|
- Include `@theia/ai-mcp-ui` to gain access to the start and stop MCP sever commands.
|
|
13
25
|
|
|
14
|
-
|
|
26
|
+
### Configuration
|
|
15
27
|
|
|
16
28
|
To configure MCP servers, include `@theia/mcp-ui` or `bind` the included `mcp-preferences`.
|
|
17
29
|
|
|
@@ -83,8 +95,24 @@ Example User query
|
|
|
83
95
|
Search the internet for XYZ
|
|
84
96
|
```
|
|
85
97
|
|
|
86
|
-
|
|
98
|
+
### More Information
|
|
87
99
|
|
|
88
100
|
[Theia AI MCP UI README](https://github.com/eclipse-theia/theia/tree/master/packages/ai-mcp-ui)
|
|
89
101
|
[User documentation on MCP in the Theia IDE](https://theia-ide.org/docs/user_ai/#mcp-integration)
|
|
90
102
|
[List of available MCP servers](https://github.com/modelcontextprotocol/servers)
|
|
103
|
+
|
|
104
|
+
## Additional Information
|
|
105
|
+
|
|
106
|
+
- [API documentation for `@theia/mcp`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-mcp.html)
|
|
107
|
+
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
108
|
+
- [Theia - Website](https://theia-ide.org/)
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
113
|
+
- [GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
114
|
+
|
|
115
|
+
## Trademark
|
|
116
|
+
|
|
117
|
+
"Theia" is a trademark of the Eclipse Foundation
|
|
118
|
+
<https://www.eclipse.org/theia>
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-mcp",
|
|
3
|
-
"version": "1.67.0-next.
|
|
3
|
+
"version": "1.67.0-next.56+d8f18cc386c",
|
|
4
4
|
"description": "Theia - MCP Integration",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@modelcontextprotocol/sdk": "^1.15.1",
|
|
7
|
-
"@theia/ai-core": "1.67.0-next.
|
|
8
|
-
"@theia/core": "1.67.0-next.
|
|
7
|
+
"@theia/ai-core": "1.67.0-next.56+d8f18cc386c",
|
|
8
|
+
"@theia/core": "1.67.0-next.56+d8f18cc386c"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"nyc": {
|
|
48
48
|
"extends": "../../configs/nyc.json"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "d8f18cc386c45a736cd193d42eab02c8f64c6b10"
|
|
51
51
|
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
2
|
-
import { MCPServerDescription, MCPServerManager } from '../common';
|
|
3
|
-
import { MCPFrontendService } from '../common/mcp-server-manager';
|
|
4
|
-
import { PreferenceService } from '@theia/core';
|
|
5
|
-
interface BaseMCPServerPreferenceValue {
|
|
6
|
-
autostart?: boolean;
|
|
7
|
-
}
|
|
8
|
-
interface LocalMCPServerPreferenceValue extends BaseMCPServerPreferenceValue {
|
|
9
|
-
command: string;
|
|
10
|
-
args?: string[];
|
|
11
|
-
env?: {
|
|
12
|
-
[key: string]: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
interface RemoteMCPServerPreferenceValue extends BaseMCPServerPreferenceValue {
|
|
16
|
-
serverUrl: string;
|
|
17
|
-
serverAuthToken?: string;
|
|
18
|
-
serverAuthTokenHeader?: string;
|
|
19
|
-
headers?: {
|
|
20
|
-
[key: string]: string;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
type MCPServersPreferenceValue = LocalMCPServerPreferenceValue | RemoteMCPServerPreferenceValue;
|
|
24
|
-
interface MCPServersPreference {
|
|
25
|
-
[name: string]: MCPServersPreferenceValue;
|
|
26
|
-
}
|
|
27
|
-
declare namespace MCPServersPreference {
|
|
28
|
-
function isValue(obj: unknown): obj is MCPServersPreferenceValue;
|
|
29
|
-
}
|
|
30
|
-
export declare class McpFrontendApplicationContribution implements FrontendApplicationContribution {
|
|
31
|
-
protected preferenceService: PreferenceService;
|
|
32
|
-
protected manager: MCPServerManager;
|
|
33
|
-
protected frontendMCPService: MCPFrontendService;
|
|
34
|
-
protected prevServers: Map<string, MCPServerDescription>;
|
|
35
|
-
onStart(): void;
|
|
36
|
-
protected autoStartServers(servers: Map<string, MCPServerDescription>): Promise<void>;
|
|
37
|
-
protected handleServerChanges(newServers: MCPServersPreference): void;
|
|
38
|
-
protected syncServers(servers: Map<string, MCPServerDescription>): void;
|
|
39
|
-
protected convertToMap(servers: MCPServersPreference): Map<string, MCPServerDescription>;
|
|
40
|
-
}
|
|
41
|
-
export {};
|
|
42
|
-
//# sourceMappingURL=mcp-frontend-application-contribution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-frontend-application-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAmB,MAAM,aAAa,CAAC;AAEjE,UAAU,4BAA4B;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,6BAA8B,SAAQ,4BAA4B;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,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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
|
-
exports.McpFrontendApplicationContribution = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const common_1 = require("../common");
|
|
22
|
-
const mcp_preferences_1 = require("../common/mcp-preferences");
|
|
23
|
-
const mcp_server_manager_1 = require("../common/mcp-server-manager");
|
|
24
|
-
const core_1 = require("@theia/core");
|
|
25
|
-
;
|
|
26
|
-
var MCPServersPreference;
|
|
27
|
-
(function (MCPServersPreference) {
|
|
28
|
-
function isValue(obj) {
|
|
29
|
-
return !!obj && typeof obj === 'object' &&
|
|
30
|
-
('command' in obj || 'serverUrl' in obj) &&
|
|
31
|
-
(!('command' in obj) || typeof obj.command === 'string') &&
|
|
32
|
-
(!('args' in obj) || Array.isArray(obj.args) && obj.args.every(arg => typeof arg === 'string')) &&
|
|
33
|
-
(!('env' in obj) || !!obj.env && typeof obj.env === 'object' && Object.values(obj.env).every(value => typeof value === 'string')) &&
|
|
34
|
-
(!('autostart' in obj) || typeof obj.autostart === 'boolean') &&
|
|
35
|
-
(!('serverUrl' in obj) || typeof obj.serverUrl === 'string') &&
|
|
36
|
-
(!('serverAuthToken' in obj) || typeof obj.serverAuthToken === 'string') &&
|
|
37
|
-
(!('serverAuthTokenHeader' in obj) || typeof obj.serverAuthTokenHeader === 'string') &&
|
|
38
|
-
(!('headers' in obj) || !!obj.headers && typeof obj.headers === 'object' && Object.values(obj.headers).every(value => typeof value === 'string'));
|
|
39
|
-
}
|
|
40
|
-
MCPServersPreference.isValue = isValue;
|
|
41
|
-
})(MCPServersPreference || (MCPServersPreference = {}));
|
|
42
|
-
function filterValidValues(servers) {
|
|
43
|
-
const result = {};
|
|
44
|
-
if (!servers || typeof servers !== 'object') {
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
for (const [name, value] of Object.entries(servers)) {
|
|
48
|
-
if (typeof name === 'string' && MCPServersPreference.isValue(value)) {
|
|
49
|
-
result[name] = value;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return result;
|
|
53
|
-
}
|
|
54
|
-
let McpFrontendApplicationContribution = class McpFrontendApplicationContribution {
|
|
55
|
-
constructor() {
|
|
56
|
-
this.prevServers = new Map();
|
|
57
|
-
}
|
|
58
|
-
onStart() {
|
|
59
|
-
this.preferenceService.ready.then(() => {
|
|
60
|
-
const servers = filterValidValues(this.preferenceService.get(mcp_preferences_1.MCP_SERVERS_PREF, {}));
|
|
61
|
-
this.prevServers = this.convertToMap(servers);
|
|
62
|
-
this.syncServers(this.prevServers);
|
|
63
|
-
this.autoStartServers(this.prevServers);
|
|
64
|
-
this.preferenceService.onPreferenceChanged(event => {
|
|
65
|
-
if (event.preferenceName === mcp_preferences_1.MCP_SERVERS_PREF) {
|
|
66
|
-
this.handleServerChanges(filterValidValues(event.newValue));
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
this.frontendMCPService.registerToolsForAllStartedServers();
|
|
71
|
-
}
|
|
72
|
-
async autoStartServers(servers) {
|
|
73
|
-
const startedServers = await this.frontendMCPService.getStartedServers();
|
|
74
|
-
for (const [name, serverDesc] of servers) {
|
|
75
|
-
if (serverDesc && serverDesc.autostart) {
|
|
76
|
-
if (!startedServers.includes(name)) {
|
|
77
|
-
await this.frontendMCPService.startServer(name);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
handleServerChanges(newServers) {
|
|
83
|
-
const oldServers = this.prevServers;
|
|
84
|
-
const updatedServers = this.convertToMap(newServers);
|
|
85
|
-
for (const [name] of oldServers) {
|
|
86
|
-
if (!updatedServers.has(name)) {
|
|
87
|
-
this.manager.removeServer(name);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
for (const [name, description] of updatedServers) {
|
|
91
|
-
const oldDescription = oldServers.get(name);
|
|
92
|
-
let diff = false;
|
|
93
|
-
try {
|
|
94
|
-
// We know that that the descriptions are actual JSONObjects as we construct them ourselves
|
|
95
|
-
if (!oldDescription || !core_1.PreferenceUtils.deepEqual(oldDescription, description)) {
|
|
96
|
-
diff = true;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
catch (e) {
|
|
100
|
-
// In some cases the deepEqual function throws an error, so we fall back to assuming that there is a difference
|
|
101
|
-
// This seems to happen in cases where the objects are structured differently, e.g. whole sub-objects are missing
|
|
102
|
-
console.debug('Failed to compare MCP server descriptions, assuming a difference', e);
|
|
103
|
-
diff = true;
|
|
104
|
-
}
|
|
105
|
-
if (diff) {
|
|
106
|
-
this.manager.addOrUpdateServer(description);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
this.prevServers = updatedServers;
|
|
110
|
-
}
|
|
111
|
-
syncServers(servers) {
|
|
112
|
-
for (const [, description] of servers) {
|
|
113
|
-
this.manager.addOrUpdateServer(description);
|
|
114
|
-
}
|
|
115
|
-
for (const [name] of this.prevServers) {
|
|
116
|
-
if (!servers.has(name)) {
|
|
117
|
-
this.manager.removeServer(name);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
convertToMap(servers) {
|
|
122
|
-
const map = new Map();
|
|
123
|
-
Object.entries(servers).forEach(([name, description]) => {
|
|
124
|
-
let filteredDescription;
|
|
125
|
-
if ('serverUrl' in description) {
|
|
126
|
-
// Create RemoteMCPServerDescription by picking only remote-specific properties
|
|
127
|
-
const { serverUrl, serverAuthToken, serverAuthTokenHeader, headers, autostart } = description;
|
|
128
|
-
filteredDescription = {
|
|
129
|
-
name,
|
|
130
|
-
serverUrl,
|
|
131
|
-
...(serverAuthToken && { serverAuthToken }),
|
|
132
|
-
...(serverAuthTokenHeader && { serverAuthTokenHeader }),
|
|
133
|
-
...(headers && { headers }),
|
|
134
|
-
autostart: autostart !== null && autostart !== void 0 ? autostart : true,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
// Create LocalMCPServerDescription by picking only local-specific properties
|
|
139
|
-
const { command, args, env, autostart } = description;
|
|
140
|
-
filteredDescription = {
|
|
141
|
-
name,
|
|
142
|
-
command,
|
|
143
|
-
...(args && { args }),
|
|
144
|
-
...(env && { env }),
|
|
145
|
-
autostart: autostart !== null && autostart !== void 0 ? autostart : true,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
map.set(name, filteredDescription);
|
|
149
|
-
});
|
|
150
|
-
return map;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
exports.McpFrontendApplicationContribution = McpFrontendApplicationContribution;
|
|
154
|
-
tslib_1.__decorate([
|
|
155
|
-
(0, inversify_1.inject)(core_1.PreferenceService),
|
|
156
|
-
tslib_1.__metadata("design:type", Object)
|
|
157
|
-
], McpFrontendApplicationContribution.prototype, "preferenceService", void 0);
|
|
158
|
-
tslib_1.__decorate([
|
|
159
|
-
(0, inversify_1.inject)(common_1.MCPServerManager),
|
|
160
|
-
tslib_1.__metadata("design:type", Object)
|
|
161
|
-
], McpFrontendApplicationContribution.prototype, "manager", void 0);
|
|
162
|
-
tslib_1.__decorate([
|
|
163
|
-
(0, inversify_1.inject)(mcp_server_manager_1.MCPFrontendService),
|
|
164
|
-
tslib_1.__metadata("design:type", Object)
|
|
165
|
-
], McpFrontendApplicationContribution.prototype, "frontendMCPService", void 0);
|
|
166
|
-
exports.McpFrontendApplicationContribution = McpFrontendApplicationContribution = tslib_1.__decorate([
|
|
167
|
-
(0, inversify_1.injectable)()
|
|
168
|
-
], McpFrontendApplicationContribution);
|
|
169
|
-
//# sourceMappingURL=mcp-frontend-application-contribution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/mcp-frontend-application-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;;;;AAGhF,4DAAkE;AAClE,sCAAmE;AACnE,+DAA6D;AAE7D,qEAAkE;AAClE,sCAAiE;AAuBhE,CAAC;AAEF,IAAU,oBAAoB,CAa7B;AAbD,WAAU,oBAAoB;IAC1B,SAAgB,OAAO,CAAC,GAAY;QAChC,OAAO,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;YACnC,CAAC,SAAS,IAAI,GAAG,IAAI,WAAW,IAAI,GAAG,CAAC;YACxC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC;YACxD,CAAC,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,GAAG,KAAK,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gBAC7E,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC;gBACtD,mBAAmB,GAAG;oBAClB,IAAI;oBACJ,OAAO;oBACP,GAAG,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC;oBACrB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC;oBACnB,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,IAAI;iBAC/B,CAAC;YACN,CAAC;YAED,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACf,CAAC;CACJ,CAAA;AAxHY,gFAAkC;AAGjC;IADT,IAAA,kBAAM,EAAC,wBAAiB,CAAC;;6EACqB;AAGrC;IADT,IAAA,kBAAM,EAAC,yBAAgB,CAAC;;mEACW;AAG1B;IADT,IAAA,kBAAM,EAAC,uCAAkB,CAAC;;8EACsB;6CATxC,kCAAkC;IAD9C,IAAA,sBAAU,GAAE;GACA,kCAAkC,CAwH9C"}
|
|
@@ -1 +0,0 @@
|
|
|
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;;AAc/D,wBA2DG"}
|
|
@@ -1,81 +0,0 @@
|
|
|
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 inversify_1 = require("@theia/core/shared/inversify");
|
|
19
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
20
|
-
const mcp_server_manager_1 = require("../common/mcp-server-manager");
|
|
21
|
-
const mcp_frontend_application_contribution_1 = require("./mcp-frontend-application-contribution");
|
|
22
|
-
const mcp_frontend_service_1 = require("./mcp-frontend-service");
|
|
23
|
-
const mcp_frontend_notification_service_1 = require("./mcp-frontend-notification-service");
|
|
24
|
-
const mcp_server_manager_server_client_1 = require("./mcp-server-manager-server-client");
|
|
25
|
-
const mcp_protocol_1 = require("../common/mcp-protocol");
|
|
26
|
-
exports.default = new inversify_1.ContainerModule(bind => {
|
|
27
|
-
bind(browser_1.FrontendApplicationContribution).to(mcp_frontend_application_contribution_1.McpFrontendApplicationContribution).inSingletonScope();
|
|
28
|
-
bind(mcp_server_manager_1.MCPFrontendService).to(mcp_frontend_service_1.MCPFrontendServiceImpl).inSingletonScope();
|
|
29
|
-
bind(mcp_server_manager_1.MCPFrontendNotificationService).to(mcp_frontend_notification_service_1.MCPFrontendNotificationServiceImpl).inSingletonScope();
|
|
30
|
-
bind(mcp_protocol_1.MCPServerManagerServerClient).to(mcp_server_manager_server_client_1.MCPServerManagerServerClientImpl).inSingletonScope();
|
|
31
|
-
bind(mcp_protocol_1.MCPServerManagerServer).toDynamicValue(ctx => {
|
|
32
|
-
const connection = ctx.container.get(browser_1.RemoteConnectionProvider);
|
|
33
|
-
const client = ctx.container.get(mcp_protocol_1.MCPServerManagerServerClient);
|
|
34
|
-
return connection.createProxy(mcp_protocol_1.MCPServerManagerServerPath, client);
|
|
35
|
-
}).inSingletonScope();
|
|
36
|
-
bind(mcp_server_manager_1.MCPServerManager).toDynamicValue(ctx => {
|
|
37
|
-
const mgrServer = ctx.container.get(mcp_protocol_1.MCPServerManagerServer);
|
|
38
|
-
const connection = ctx.container.get(browser_1.RemoteConnectionProvider);
|
|
39
|
-
const client = ctx.container.get(mcp_server_manager_1.MCPFrontendNotificationService);
|
|
40
|
-
const serverClient = ctx.container.get(mcp_protocol_1.MCPServerManagerServerClient);
|
|
41
|
-
const backendServerManager = connection.createProxy(mcp_server_manager_1.MCPServerManagerPath, client);
|
|
42
|
-
// Listen to server updates to clean up removed servers
|
|
43
|
-
client.onDidUpdateMCPServers(() => backendServerManager.getServerNames()
|
|
44
|
-
.then(names => serverClient.cleanServers(names))
|
|
45
|
-
.catch((error) => {
|
|
46
|
-
console.error('Error cleaning server descriptions:', error);
|
|
47
|
-
}));
|
|
48
|
-
// We proxy the MCPServerManager to override addOrUpdateServer and getServerDescription
|
|
49
|
-
// to handle the resolve functions via the MCPServerManagerServerClient.
|
|
50
|
-
return new Proxy(backendServerManager, {
|
|
51
|
-
get(target, prop, receiver) {
|
|
52
|
-
// override addOrUpdateServer to store the original description in the MCPServerManagerServerClient
|
|
53
|
-
// to be used in resolveServerDescription if a resolve function is provided
|
|
54
|
-
if (prop === 'addOrUpdateServer') {
|
|
55
|
-
return async function (...args) {
|
|
56
|
-
const updated = serverClient.addServerDescription(args[0]);
|
|
57
|
-
await mgrServer.addOrUpdateServer(updated);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
// override getServerDescription to mix in the resolve function from the client
|
|
61
|
-
if (prop === 'getServerDescription') {
|
|
62
|
-
return async function (name) {
|
|
63
|
-
const description = await Reflect.apply(target.getServerDescription, target, [name]);
|
|
64
|
-
if (description) {
|
|
65
|
-
const resolveFunction = serverClient.getResolveFunction(name);
|
|
66
|
-
if (resolveFunction) {
|
|
67
|
-
return {
|
|
68
|
-
...description,
|
|
69
|
-
resolve: resolveFunction
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return description;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
return Reflect.get(target, prop, receiver);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}).inSingletonScope();
|
|
80
|
-
});
|
|
81
|
-
//# sourceMappingURL=mcp-frontend-module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAE1H,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,yCAA+B,CAAC,CAAC,EAAE,CAAC,0EAAkC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAChG,IAAI,CAAC,uCAAkB,CAAC,CAAC,EAAE,CAAC,6CAAsB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACvE,IAAI,CAAC,mDAA8B,CAAC,CAAC,EAAE,CAAC,sEAAkC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC/F,IAAI,CAAC,2CAA4B,CAAC,CAAC,EAAE,CAAC,mEAAgC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAE3F,IAAI,CAAC,qCAAsB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;QAC9C,MAAM,UAAU,GAAG,GAAG,CAAC,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mB,EAAE,CAAC;oBAC/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"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { MCPFrontendNotificationService } from '../common';
|
|
2
|
-
import { Emitter, Event } from '@theia/core/lib/common/event';
|
|
3
|
-
export declare class MCPFrontendNotificationServiceImpl implements MCPFrontendNotificationService {
|
|
4
|
-
protected readonly onDidUpdateMCPServersEmitter: Emitter<void>;
|
|
5
|
-
readonly onDidUpdateMCPServers: Event<void>;
|
|
6
|
-
didUpdateMCPServers(): void;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=mcp-frontend-notification-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-frontend-notification-service.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-frontend-notification-service.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAE9D,qBACa,kCAAmC,YAAW,8BAA8B;IACrF,SAAS,CAAC,QAAQ,CAAC,4BAA4B,gBAAuB;IACtE,SAAgB,qBAAqB,EAAE,KAAK,CAAC,IAAI,CAAC,CAA2C;IAE7F,mBAAmB,IAAI,IAAI;CAG9B"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2025 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.MCPFrontendNotificationServiceImpl = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const event_1 = require("@theia/core/lib/common/event");
|
|
22
|
-
let MCPFrontendNotificationServiceImpl = class MCPFrontendNotificationServiceImpl {
|
|
23
|
-
constructor() {
|
|
24
|
-
this.onDidUpdateMCPServersEmitter = new event_1.Emitter();
|
|
25
|
-
this.onDidUpdateMCPServers = this.onDidUpdateMCPServersEmitter.event;
|
|
26
|
-
}
|
|
27
|
-
didUpdateMCPServers() {
|
|
28
|
-
this.onDidUpdateMCPServersEmitter.fire();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
exports.MCPFrontendNotificationServiceImpl = MCPFrontendNotificationServiceImpl;
|
|
32
|
-
exports.MCPFrontendNotificationServiceImpl = MCPFrontendNotificationServiceImpl = tslib_1.__decorate([
|
|
33
|
-
(0, inversify_1.injectable)()
|
|
34
|
-
], MCPFrontendNotificationServiceImpl);
|
|
35
|
-
//# sourceMappingURL=mcp-frontend-notification-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-frontend-notification-service.js","sourceRoot":"","sources":["../../src/browser/mcp-frontend-notification-service.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,4DAA0D;AAE1D,wDAA8D;AAGvD,IAAM,kCAAkC,GAAxC,MAAM,kCAAkC;IAAxC;QACgB,iCAA4B,GAAG,IAAI,eAAO,EAAQ,CAAC;QACtD,0BAAqB,GAAgB,IAAI,CAAC,4BAA4B,CAAC,KAAK,CAAC;IAKjG,CAAC;IAHG,mBAAmB;QACf,IAAI,CAAC,4BAA4B,CAAC,IAAI,EAAE,CAAC;IAC7C,CAAC;CACJ,CAAA;AAPY,gFAAkC;6CAAlC,kCAAkC;IAD9C,IAAA,sBAAU,GAAE;GACA,kCAAkC,CAO9C"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { MCPFrontendService, MCPServerDescription, MCPServerManager } from '../common/mcp-server-manager';
|
|
2
|
-
import { ToolInvocationRegistry, ToolRequest, PromptService } from '@theia/ai-core';
|
|
3
|
-
import { ListToolsResult } from '@modelcontextprotocol/sdk/types';
|
|
4
|
-
export declare class MCPFrontendServiceImpl implements MCPFrontendService {
|
|
5
|
-
protected readonly mcpServerManager: MCPServerManager;
|
|
6
|
-
protected readonly toolInvocationRegistry: ToolInvocationRegistry;
|
|
7
|
-
protected readonly promptService: PromptService;
|
|
8
|
-
startServer(serverName: string): Promise<void>;
|
|
9
|
-
hasServer(serverName: string): Promise<boolean>;
|
|
10
|
-
isServerStarted(serverName: string): Promise<boolean>;
|
|
11
|
-
registerToolsForAllStartedServers(): Promise<void>;
|
|
12
|
-
registerTools(serverName: string): Promise<void>;
|
|
13
|
-
getPromptTemplateId(serverName: string): string;
|
|
14
|
-
protected createPromptTemplate(serverName: string, toolRequests: ToolRequest[]): void;
|
|
15
|
-
stopServer(serverName: string): Promise<void>;
|
|
16
|
-
getStartedServers(): Promise<string[]>;
|
|
17
|
-
getServerNames(): Promise<string[]>;
|
|
18
|
-
getServerDescription(name: string): Promise<MCPServerDescription | undefined>;
|
|
19
|
-
getTools(serverName: string): Promise<ListToolsResult | undefined>;
|
|
20
|
-
addOrUpdateServer(description: MCPServerDescription): Promise<void>;
|
|
21
|
-
private convertToToolRequest;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=mcp-frontend-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-frontend-service.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-frontend-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAC1G,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,aAAa,EAA0C,MAAM,gBAAgB,CAAC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defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MCPFrontendServiceImpl = 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 inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const mcp_server_manager_1 = require("../common/mcp-server-manager");
|
|
22
|
-
const ai_core_1 = require("@theia/ai-core");
|
|
23
|
-
let MCPFrontendServiceImpl = class MCPFrontendServiceImpl {
|
|
24
|
-
async startServer(serverName) {
|
|
25
|
-
await this.mcpServerManager.startServer(serverName);
|
|
26
|
-
await this.registerTools(serverName);
|
|
27
|
-
}
|
|
28
|
-
async hasServer(serverName) {
|
|
29
|
-
const serverNames = await this.getServerNames();
|
|
30
|
-
return serverNames.includes(serverName);
|
|
31
|
-
}
|
|
32
|
-
async isServerStarted(serverName) {
|
|
33
|
-
const startedServers = await this.getStartedServers();
|
|
34
|
-
return startedServers.includes(serverName);
|
|
35
|
-
}
|
|
36
|
-
async registerToolsForAllStartedServers() {
|
|
37
|
-
const startedServers = await this.getStartedServers();
|
|
38
|
-
for (const serverName of startedServers) {
|
|
39
|
-
await this.registerTools(serverName);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
async registerTools(serverName) {
|
|
43
|
-
const returnedTools = await this.getTools(serverName);
|
|
44
|
-
if (returnedTools) {
|
|
45
|
-
const toolRequests = returnedTools.tools.map(tool => this.convertToToolRequest(tool, serverName));
|
|
46
|
-
toolRequests.forEach(toolRequest => this.toolInvocationRegistry.registerTool(toolRequest));
|
|
47
|
-
this.createPromptTemplate(serverName, toolRequests);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
getPromptTemplateId(serverName) {
|
|
51
|
-
return `mcp_${serverName}_tools`;
|
|
52
|
-
}
|
|
53
|
-
createPromptTemplate(serverName, toolRequests) {
|
|
54
|
-
const templateId = this.getPromptTemplateId(serverName);
|
|
55
|
-
const functionIds = toolRequests.map(tool => `~{${tool.id}}`);
|
|
56
|
-
const template = functionIds.join('\n');
|
|
57
|
-
this.promptService.addBuiltInPromptFragment({
|
|
58
|
-
id: templateId,
|
|
59
|
-
template
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
async stopServer(serverName) {
|
|
63
|
-
this.toolInvocationRegistry.unregisterAllTools(`mcp_${serverName}`);
|
|
64
|
-
this.promptService.removePromptFragment(this.getPromptTemplateId(serverName));
|
|
65
|
-
await this.mcpServerManager.stopServer(serverName);
|
|
66
|
-
}
|
|
67
|
-
getStartedServers() {
|
|
68
|
-
return this.mcpServerManager.getRunningServers();
|
|
69
|
-
}
|
|
70
|
-
getServerNames() {
|
|
71
|
-
return this.mcpServerManager.getServerNames();
|
|
72
|
-
}
|
|
73
|
-
async getServerDescription(name) {
|
|
74
|
-
return this.mcpServerManager.getServerDescription(name);
|
|
75
|
-
}
|
|
76
|
-
async getTools(serverName) {
|
|
77
|
-
try {
|
|
78
|
-
return await this.mcpServerManager.getTools(serverName);
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
console.error('Error while trying to get tools: ' + error);
|
|
82
|
-
return undefined;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
async addOrUpdateServer(description) {
|
|
86
|
-
return this.mcpServerManager.addOrUpdateServer(description);
|
|
87
|
-
}
|
|
88
|
-
convertToToolRequest(tool, serverName) {
|
|
89
|
-
const id = `mcp_${serverName}_${tool.name}`;
|
|
90
|
-
return {
|
|
91
|
-
id: id,
|
|
92
|
-
name: id,
|
|
93
|
-
providerName: `mcp_${serverName}`,
|
|
94
|
-
parameters: ai_core_1.ToolRequest.isToolRequestParameters(tool.inputSchema) ? {
|
|
95
|
-
type: tool.inputSchema.type,
|
|
96
|
-
properties: tool.inputSchema.properties,
|
|
97
|
-
required: tool.inputSchema.required
|
|
98
|
-
} : {
|
|
99
|
-
type: 'object',
|
|
100
|
-
properties: {}
|
|
101
|
-
},
|
|
102
|
-
description: tool.description,
|
|
103
|
-
handler: async (arg_string) => {
|
|
104
|
-
var _a;
|
|
105
|
-
try {
|
|
106
|
-
const result = await this.mcpServerManager.callTool(serverName, tool.name, arg_string);
|
|
107
|
-
if (result.isError) {
|
|
108
|
-
const textContent = result.content.find(callContent => callContent.type === 'text');
|
|
109
|
-
return { content: [{ type: 'error', data: (_a = textContent === null || textContent === void 0 ? void 0 : textContent.text) !== null && _a !== void 0 ? _a : 'Unknown Error' }] };
|
|
110
|
-
}
|
|
111
|
-
const content = result.content.map(callContent => {
|
|
112
|
-
switch (callContent.type) {
|
|
113
|
-
case 'image':
|
|
114
|
-
return { type: 'image', base64data: callContent.data, mimeType: callContent.mimeType };
|
|
115
|
-
case 'text':
|
|
116
|
-
return { type: 'text', text: callContent.text };
|
|
117
|
-
case 'resource': {
|
|
118
|
-
return { type: 'text', text: JSON.stringify(callContent.resource) };
|
|
119
|
-
}
|
|
120
|
-
default: {
|
|
121
|
-
return { type: 'text', text: JSON.stringify(callContent) };
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
return { content };
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
console.error(`Error in tool handler for ${tool.name} on MCP server ${serverName}:`, error);
|
|
129
|
-
throw error;
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
exports.MCPFrontendServiceImpl = MCPFrontendServiceImpl;
|
|
136
|
-
tslib_1.__decorate([
|
|
137
|
-
(0, inversify_1.inject)(mcp_server_manager_1.MCPServerManager),
|
|
138
|
-
tslib_1.__metadata("design:type", Object)
|
|
139
|
-
], MCPFrontendServiceImpl.prototype, "mcpServerManager", void 0);
|
|
140
|
-
tslib_1.__decorate([
|
|
141
|
-
(0, inversify_1.inject)(ai_core_1.ToolInvocationRegistry),
|
|
142
|
-
tslib_1.__metadata("design:type", Object)
|
|
143
|
-
], MCPFrontendServiceImpl.prototype, "toolInvocationRegistry", void 0);
|
|
144
|
-
tslib_1.__decorate([
|
|
145
|
-
(0, inversify_1.inject)(ai_core_1.PromptService),
|
|
146
|
-
tslib_1.__metadata("design:type", Object)
|
|
147
|
-
], MCPFrontendServiceImpl.prototype, "promptService", void 0);
|
|
148
|
-
exports.MCPFrontendServiceImpl = MCPFrontendServiceImpl = tslib_1.__decorate([
|
|
149
|
-
(0, inversify_1.injectable)()
|
|
150
|
-
], MCPFrontendServiceImpl);
|
|
151
|
-
//# sourceMappingURL=mcp-frontend-service.js.map
|