@theia/ai-mcp-server 1.65.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 +175 -0
- package/lib/browser/index.d.ts +3 -0
- package/lib/browser/index.d.ts.map +1 -0
- package/lib/browser/index.js +21 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/browser/mcp-frontend-bootstrap.d.ts +17 -0
- package/lib/browser/mcp-frontend-bootstrap.d.ts.map +1 -0
- package/lib/browser/mcp-frontend-bootstrap.js +47 -0
- package/lib/browser/mcp-frontend-bootstrap.js.map +1 -0
- package/lib/browser/mcp-frontend-contribution.d.ts +44 -0
- package/lib/browser/mcp-frontend-contribution.d.ts.map +1 -0
- package/lib/browser/mcp-frontend-contribution.js +21 -0
- package/lib/browser/mcp-frontend-contribution.js.map +1 -0
- package/lib/browser/mcp-frontend-module.d.ts +4 -0
- package/lib/browser/mcp-frontend-module.d.ts.map +1 -0
- package/lib/browser/mcp-frontend-module.js +37 -0
- package/lib/browser/mcp-frontend-module.js.map +1 -0
- package/lib/browser/mcp-tool-delegate-client.d.ts +27 -0
- package/lib/browser/mcp-tool-delegate-client.d.ts.map +1 -0
- package/lib/browser/mcp-tool-delegate-client.js +128 -0
- package/lib/browser/mcp-tool-delegate-client.js.map +1 -0
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +20 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/mcp-tool-delegate.d.ts +25 -0
- package/lib/common/mcp-tool-delegate.d.ts.map +1 -0
- package/lib/common/mcp-tool-delegate.js +22 -0
- package/lib/common/mcp-tool-delegate.js.map +1 -0
- package/lib/node/index.d.ts +5 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +23 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/mcp-backend-contribution-manager.d.ts +16 -0
- package/lib/node/mcp-backend-contribution-manager.d.ts.map +1 -0
- package/lib/node/mcp-backend-contribution-manager.js +61 -0
- package/lib/node/mcp-backend-contribution-manager.js.map +1 -0
- package/lib/node/mcp-backend-module.d.ts +4 -0
- package/lib/node/mcp-backend-module.d.ts.map +1 -0
- package/lib/node/mcp-backend-module.js +56 -0
- package/lib/node/mcp-backend-module.js.map +1 -0
- package/lib/node/mcp-frontend-contribution-manager.d.ts +55 -0
- package/lib/node/mcp-frontend-contribution-manager.d.ts.map +1 -0
- package/lib/node/mcp-frontend-contribution-manager.js +242 -0
- package/lib/node/mcp-frontend-contribution-manager.js.map +1 -0
- package/lib/node/mcp-theia-server-impl.d.ts +32 -0
- package/lib/node/mcp-theia-server-impl.d.ts.map +1 -0
- package/lib/node/mcp-theia-server-impl.js +220 -0
- package/lib/node/mcp-theia-server-impl.js.map +1 -0
- package/lib/node/mcp-theia-server.d.ts +43 -0
- package/lib/node/mcp-theia-server.d.ts.map +1 -0
- package/lib/node/mcp-theia-server.js +22 -0
- package/lib/node/mcp-theia-server.js.map +1 -0
- package/lib/node/mcp-tool-frontend-delegate.d.ts +13 -0
- package/lib/node/mcp-tool-frontend-delegate.d.ts.map +1 -0
- package/lib/node/mcp-tool-frontend-delegate.js +66 -0
- package/lib/node/mcp-tool-frontend-delegate.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +26 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +52 -0
- package/src/browser/index.ts +18 -0
- package/src/browser/mcp-frontend-bootstrap.ts +43 -0
- package/src/browser/mcp-frontend-contribution.ts +67 -0
- package/src/browser/mcp-frontend-module.ts +42 -0
- package/src/browser/mcp-tool-delegate-client.ts +133 -0
- package/src/common/index.ts +17 -0
- package/src/common/mcp-tool-delegate.ts +43 -0
- package/src/node/index.ts +20 -0
- package/src/node/mcp-backend-contribution-manager.ts +56 -0
- package/src/node/mcp-backend-module.ts +75 -0
- package/src/node/mcp-frontend-contribution-manager.ts +268 -0
- package/src/node/mcp-theia-server-impl.ts +241 -0
- package/src/node/mcp-theia-server.ts +66 -0
- package/src/node/mcp-tool-frontend-delegate.ts +71 -0
- package/src/package.spec.ts +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Theia AI MCP Server
|
|
2
|
+
|
|
3
|
+
This package provides Model Context Protocol (MCP) server functionality for Theia, enabling AI tools to access Theia services and workspace information.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **HTTP Transport**: RESTful HTTP API for MCP communication using the StreamableHTTPServerTransport
|
|
8
|
+
- **Backend MCP Contributions**: Register backend-only tools, resources, and prompts
|
|
9
|
+
- **Frontend MCP Contributions**: Register frontend-only tools, resources, and prompts that can access frontend services
|
|
10
|
+
- **Frontend-Backend Delegation**: Allows frontend contributions to be exposed through the backend MCP server
|
|
11
|
+
|
|
12
|
+
## Development Setup
|
|
13
|
+
|
|
14
|
+
### Starting the MCP Server
|
|
15
|
+
|
|
16
|
+
1. Start Theia application
|
|
17
|
+
2. The MCP server will automatically start and be available at `/mcp` e.g. `http://localhost:3000/mcp`
|
|
18
|
+
|
|
19
|
+
## API Endpoints
|
|
20
|
+
|
|
21
|
+
- `POST /mcp` - MCP protocol endpoint (for all MCP protocol operations)
|
|
22
|
+
|
|
23
|
+
## Architecture
|
|
24
|
+
|
|
25
|
+
The MCP server architecture consists of:
|
|
26
|
+
|
|
27
|
+
1. **HTTP Transport Layer**: Manages HTTP connections using StreamableHTTPServerTransport
|
|
28
|
+
2. **MCP Server**: Core server implementation that handles MCP protocol messages
|
|
29
|
+
3. **Backend Contributions**: Extensions that run on the Node.js backend
|
|
30
|
+
4. **Frontend Contributions**: Extensions that run in the browser frontend
|
|
31
|
+
5. **Frontend-Backend Bridge**: RPC mechanism to connect frontend and backend
|
|
32
|
+
|
|
33
|
+
## Creating Backend Contributions
|
|
34
|
+
|
|
35
|
+
Backend contributions run in the Node.js backend and have access to backend services:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
@injectable()
|
|
39
|
+
export class MyBackendContribution implements MCPBackendContribution {
|
|
40
|
+
@inject(ILogger)
|
|
41
|
+
protected readonly logger: ILogger;
|
|
42
|
+
|
|
43
|
+
async configure(server: McpServer): Promise<void> {
|
|
44
|
+
// Register a tool
|
|
45
|
+
server.tool('my-backend-tool', {
|
|
46
|
+
type: 'object',
|
|
47
|
+
properties: {
|
|
48
|
+
input: { type: 'string' }
|
|
49
|
+
}
|
|
50
|
+
}, async (args) => {
|
|
51
|
+
this.logger.info('my-backend-tool called with args:', args);
|
|
52
|
+
return {
|
|
53
|
+
content: [{ type: 'text', text: 'Result from backend' }]
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Register a resource
|
|
58
|
+
server.resource(
|
|
59
|
+
'my-resource',
|
|
60
|
+
'theia://resource-uri',
|
|
61
|
+
async (uri) => {
|
|
62
|
+
return {
|
|
63
|
+
content: 'Resource content'
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// Register a prompt
|
|
69
|
+
server.prompt(
|
|
70
|
+
'my-prompt',
|
|
71
|
+
'Prompt description',
|
|
72
|
+
{}, // Arguments schema
|
|
73
|
+
async (args) => {
|
|
74
|
+
return {
|
|
75
|
+
messages: [{
|
|
76
|
+
role: 'user',
|
|
77
|
+
content: { type: 'text', text: 'Prompt content' }
|
|
78
|
+
}]
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Register the contribution in your backend module:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
bind(MyBackendContribution).toSelf().inSingletonScope();
|
|
90
|
+
bind(MCPBackendContribution).toService(MyBackendContribution);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Creating Frontend Contributions
|
|
94
|
+
|
|
95
|
+
Frontend contributions run in the browser and have access to frontend services:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
@injectable()
|
|
99
|
+
export class MyFrontendContribution implements MCPFrontendContribution {
|
|
100
|
+
@inject(WorkspaceService)
|
|
101
|
+
protected readonly workspaceService: WorkspaceService;
|
|
102
|
+
|
|
103
|
+
async getTools(): Promise<Tool[]> {
|
|
104
|
+
return [{
|
|
105
|
+
name: 'workspace-info',
|
|
106
|
+
description: 'Get workspace info',
|
|
107
|
+
inputSchema: {
|
|
108
|
+
type: 'object',
|
|
109
|
+
properties: {}
|
|
110
|
+
}
|
|
111
|
+
}];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async getTool(name: string): Promise<ToolProvider | undefined> {
|
|
115
|
+
if (name === 'workspace-info') {
|
|
116
|
+
return {
|
|
117
|
+
handler: async () => {
|
|
118
|
+
const roots = await this.workspaceService.roots;
|
|
119
|
+
return {
|
|
120
|
+
roots: roots.map(r => r.resource.toString())
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
inputSchema: z.object({})
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async getResources(): Promise<Resource[]> {
|
|
129
|
+
return [{
|
|
130
|
+
name: 'Workspace Information',
|
|
131
|
+
uri: 'workspace://info',
|
|
132
|
+
description: 'Workspace info',
|
|
133
|
+
mimeType: 'application/json'
|
|
134
|
+
}];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async readResource(uri: string): Promise<unknown> {
|
|
138
|
+
if (uri === 'workspace://info') {
|
|
139
|
+
const roots = await this.workspaceService.roots;
|
|
140
|
+
return { roots: roots.map(r => r.resource.toString()) };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async getPrompts(): Promise<Prompt[]> {
|
|
145
|
+
return [{
|
|
146
|
+
name: 'workspace-context',
|
|
147
|
+
description: 'Generate workspace context',
|
|
148
|
+
arguments: []
|
|
149
|
+
}];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async getPrompt(name: string, args: unknown): Promise<PromptMessage[]> {
|
|
153
|
+
if (name === 'workspace-context') {
|
|
154
|
+
return [{
|
|
155
|
+
role: 'user',
|
|
156
|
+
content: { type: 'text', text: 'Workspace context information' }
|
|
157
|
+
}];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Register the contribution in your frontend module:
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
bind(MyFrontendContribution).toSelf().inSingletonScope();
|
|
167
|
+
bind(MCPFrontendContribution).toService(MyFrontendContribution);
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Security Considerations
|
|
171
|
+
|
|
172
|
+
- The MCP server exposes Theia functionality over HTTP
|
|
173
|
+
- Only enable the server in trusted environments
|
|
174
|
+
- Consider adding authentication and authorization for production use
|
|
175
|
+
- Restrict access to sensitive operations in your contributions
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAgBA,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource.
|
|
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 tslib_1 = require("tslib");
|
|
19
|
+
tslib_1.__exportStar(require("./mcp-frontend-bootstrap"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./mcp-frontend-contribution"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oCAAoC;AACpC,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,mEAAyC;AACzC,sEAA4C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MaybePromise } from '@theia/core';
|
|
2
|
+
import { FrontendApplication, FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
3
|
+
import { ILogger } from '@theia/core/lib/common/logger';
|
|
4
|
+
import { MCPToolFrontendDelegate } from '../common/mcp-tool-delegate';
|
|
5
|
+
/**
|
|
6
|
+
* Bootstraps MCP frontend components during application startup.
|
|
7
|
+
*
|
|
8
|
+
* This contribution ensures that the MCPToolFrontendDelegate is properly instantiated
|
|
9
|
+
* and available in the dependency injection container when the frontend application starts.
|
|
10
|
+
* It acts as a lightweight initializer to activate MCP functionality in the browser.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MCPFrontendBootstrap implements FrontendApplicationContribution {
|
|
13
|
+
protected readonly frontendDelegate: MCPToolFrontendDelegate;
|
|
14
|
+
protected readonly logger: ILogger;
|
|
15
|
+
onStart(_app: FrontendApplication): MaybePromise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=mcp-frontend-bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-frontend-bootstrap.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-frontend-bootstrap.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;;;GAMG;AACH,qBACa,oBAAqB,YAAW,+BAA+B;IAGxE,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;IAG7D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEnC,OAAO,CAAC,IAAI,EAAE,mBAAmB,GAAG,YAAY,CAAC,IAAI,CAAC;CAIzD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource.
|
|
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.MCPFrontendBootstrap = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const logger_1 = require("@theia/core/lib/common/logger");
|
|
22
|
+
const mcp_tool_delegate_1 = require("../common/mcp-tool-delegate");
|
|
23
|
+
/**
|
|
24
|
+
* Bootstraps MCP frontend components during application startup.
|
|
25
|
+
*
|
|
26
|
+
* This contribution ensures that the MCPToolFrontendDelegate is properly instantiated
|
|
27
|
+
* and available in the dependency injection container when the frontend application starts.
|
|
28
|
+
* It acts as a lightweight initializer to activate MCP functionality in the browser.
|
|
29
|
+
*/
|
|
30
|
+
let MCPFrontendBootstrap = class MCPFrontendBootstrap {
|
|
31
|
+
onStart(_app) {
|
|
32
|
+
this.logger.debug('MCPFrontendBootstrap initialized');
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.MCPFrontendBootstrap = MCPFrontendBootstrap;
|
|
36
|
+
tslib_1.__decorate([
|
|
37
|
+
(0, inversify_1.inject)(mcp_tool_delegate_1.MCPToolFrontendDelegate),
|
|
38
|
+
tslib_1.__metadata("design:type", Object)
|
|
39
|
+
], MCPFrontendBootstrap.prototype, "frontendDelegate", void 0);
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, inversify_1.inject)(logger_1.ILogger),
|
|
42
|
+
tslib_1.__metadata("design:type", Object)
|
|
43
|
+
], MCPFrontendBootstrap.prototype, "logger", void 0);
|
|
44
|
+
exports.MCPFrontendBootstrap = MCPFrontendBootstrap = tslib_1.__decorate([
|
|
45
|
+
(0, inversify_1.injectable)()
|
|
46
|
+
], MCPFrontendBootstrap);
|
|
47
|
+
//# sourceMappingURL=mcp-frontend-bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-frontend-bootstrap.js","sourceRoot":"","sources":["../../src/browser/mcp-frontend-bootstrap.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oCAAoC;AACpC,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;AAGlE,0DAAwD;AACxD,mEAAsE;AAEtE;;;;;;GAMG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAQ7B,OAAO,CAAC,IAAyB;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC1D,CAAC;CAEJ,CAAA;AAZY,oDAAoB;AAGV;IADlB,IAAA,kBAAM,EAAC,2CAAuB,CAAC;;8DAC6B;AAG1C;IADlB,IAAA,kBAAM,EAAC,gBAAO,CAAC;;oDACmB;+BAN1B,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CAYhC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
|
|
2
|
+
import { Tool, Resource, Prompt, PromptMessage } from '@modelcontextprotocol/sdk/types';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export declare const MCPFrontendContribution: unique symbol;
|
|
5
|
+
/**
|
|
6
|
+
* Tool provider interface for frontend contributions
|
|
7
|
+
*/
|
|
8
|
+
export interface ToolProvider {
|
|
9
|
+
handler: (args: unknown) => Promise<unknown>;
|
|
10
|
+
inputSchema: z.ZodSchema;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Contribution interface for extending the MCP server with frontend-only tools, resources, and prompts
|
|
14
|
+
*/
|
|
15
|
+
export interface MCPFrontendContribution {
|
|
16
|
+
/**
|
|
17
|
+
* Get tools provided by this contribution
|
|
18
|
+
*/
|
|
19
|
+
getTools?(): Promise<Tool[]> | Tool[];
|
|
20
|
+
/**
|
|
21
|
+
* Get specific tool by name
|
|
22
|
+
*/
|
|
23
|
+
getTool?(name: string): Promise<ToolProvider | undefined> | ToolProvider | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Get resources provided by this contribution
|
|
26
|
+
*/
|
|
27
|
+
getResources?(): Promise<Resource[]> | Resource[];
|
|
28
|
+
/**
|
|
29
|
+
* Read specific resource by URI
|
|
30
|
+
*/
|
|
31
|
+
readResource?(uri: string): Promise<unknown> | unknown;
|
|
32
|
+
/**
|
|
33
|
+
* Get prompts provided by this contribution
|
|
34
|
+
*/
|
|
35
|
+
getPrompts?(): Promise<Prompt[]> | Prompt[];
|
|
36
|
+
/**
|
|
37
|
+
* Get specific prompt by name with arguments
|
|
38
|
+
*/
|
|
39
|
+
getPrompt?(name: string, args: unknown): Promise<PromptMessage[]> | PromptMessage[];
|
|
40
|
+
}
|
|
41
|
+
export declare const MCPFrontendContributionProvider: unique symbol;
|
|
42
|
+
export interface MCPFrontendContributionProvider extends ContributionProvider<MCPFrontendContribution> {
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=mcp-frontend-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-frontend-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-frontend-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB,eAAoC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC;;OAEG;IACH,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;IAEtC;;OAEG;IACH,OAAO,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,YAAY,GAAG,SAAS,CAAC;IAErF;;OAEG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC;IAElD;;OAEG;IACH,YAAY,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAEvD;;OAEG;IACH,UAAU,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;IAE5C;;OAEG;IACH,SAAS,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC;CACvF;AAED,eAAO,MAAM,+BAA+B,eAA4C,CAAC;AACzF,MAAM,WAAW,+BAAgC,SAAQ,oBAAoB,CAAC,uBAAuB,CAAC;CAAI"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource.
|
|
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.MCPFrontendContributionProvider = exports.MCPFrontendContribution = void 0;
|
|
19
|
+
exports.MCPFrontendContribution = Symbol('MCPFrontendContribution');
|
|
20
|
+
exports.MCPFrontendContributionProvider = Symbol('MCPFrontendContributionProvider');
|
|
21
|
+
//# sourceMappingURL=mcp-frontend-contribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-frontend-contribution.js","sourceRoot":"","sources":["../../src/browser/mcp-frontend-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oCAAoC;AACpC,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;;;AAMnE,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AA6C5D,QAAA,+BAA+B,GAAG,MAAM,CAAC,iCAAiC,CAAC,CAAC"}
|
|
@@ -0,0 +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;;AAY/D,wBAaG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource.
|
|
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 core_1 = require("@theia/core");
|
|
20
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
21
|
+
const service_connection_provider_1 = require("@theia/core/lib/browser/messaging/service-connection-provider");
|
|
22
|
+
const mcp_tool_delegate_1 = require("../common/mcp-tool-delegate");
|
|
23
|
+
const mcp_frontend_bootstrap_1 = require("./mcp-frontend-bootstrap");
|
|
24
|
+
const mcp_frontend_contribution_1 = require("./mcp-frontend-contribution");
|
|
25
|
+
const mcp_tool_delegate_client_1 = require("./mcp-tool-delegate-client");
|
|
26
|
+
exports.default = new inversify_1.ContainerModule(bind => {
|
|
27
|
+
bind(mcp_frontend_bootstrap_1.MCPFrontendBootstrap).toSelf().inSingletonScope();
|
|
28
|
+
bind(browser_1.FrontendApplicationContribution).toService(mcp_frontend_bootstrap_1.MCPFrontendBootstrap);
|
|
29
|
+
bind(mcp_tool_delegate_1.MCPToolDelegateClient).to(mcp_tool_delegate_client_1.MCPToolDelegateClientImpl).inSingletonScope();
|
|
30
|
+
bind(mcp_tool_delegate_1.MCPToolFrontendDelegate).toDynamicValue(ctx => {
|
|
31
|
+
const connection = ctx.container.get(service_connection_provider_1.RemoteConnectionProvider);
|
|
32
|
+
const client = ctx.container.get(mcp_tool_delegate_1.MCPToolDelegateClient);
|
|
33
|
+
return connection.createProxy(mcp_tool_delegate_1.mcpToolDelegatePath, client);
|
|
34
|
+
}).inSingletonScope();
|
|
35
|
+
(0, core_1.bindContributionProvider)(bind, mcp_frontend_contribution_1.MCPFrontendContribution);
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=mcp-frontend-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-frontend-module.js","sourceRoot":"","sources":["../../src/browser/mcp-frontend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oCAAoC;AACpC,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,sCAAuD;AACvD,qDAA0E;AAC1E,+GAGuE;AACvE,mEAAkH;AAClH,qEAAgE;AAChE,2EAAsE;AACtE,yEAAuE;AAEvE,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,6CAAoB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACvD,IAAI,CAAC,yCAA+B,CAAC,CAAC,SAAS,CAAC,6CAAoB,CAAC,CAAC;IAEtE,IAAI,CAAC,yCAAqB,CAAC,CAAC,EAAE,CAAC,oDAAyB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAE7E,IAAI,CAAC,2CAAuB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;QAC/C,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAA4B,sDAAwB,CAAC,CAAC;QAC1F,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAwB,yCAAqB,CAAC,CAAC;QAC/E,OAAO,UAAU,CAAC,WAAW,CAA0B,uCAAmB,EAAE,MAAM,CAAC,CAAC;IACxF,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAEtB,IAAA,+BAAwB,EAAC,IAAI,EAAE,mDAAuB,CAAC,CAAC;AAC5D,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ContributionProvider } from '@theia/core';
|
|
2
|
+
import { ILogger } from '@theia/core/lib/common/logger';
|
|
3
|
+
import { Tool, Resource, ResourceContents, Prompt, PromptMessage } from '@modelcontextprotocol/sdk/types';
|
|
4
|
+
import { MCPToolDelegateClient } from '../common/mcp-tool-delegate';
|
|
5
|
+
import { MCPFrontendContribution } from './mcp-frontend-contribution';
|
|
6
|
+
/**
|
|
7
|
+
* Frontend client implementation that handles MCP tool delegation requests from the backend.
|
|
8
|
+
*
|
|
9
|
+
* This class acts as a bridge between the backend MCP server and frontend contributions,
|
|
10
|
+
* forwarding backend requests (tool calls, resource access, prompts) to registered
|
|
11
|
+
* MCPFrontendContribution instances and aggregating their responses.
|
|
12
|
+
*
|
|
13
|
+
* Called by the backend via the MCPToolDelegateClient interface to access frontend-provided
|
|
14
|
+
* MCP tools, resources, and prompts.
|
|
15
|
+
*/
|
|
16
|
+
export declare class MCPToolDelegateClientImpl implements MCPToolDelegateClient {
|
|
17
|
+
protected readonly contributions: ContributionProvider<MCPFrontendContribution>;
|
|
18
|
+
protected readonly logger: ILogger;
|
|
19
|
+
private getFrontendContributions;
|
|
20
|
+
callTool(serverId: string, toolName: string, args: unknown): Promise<unknown>;
|
|
21
|
+
listTools(serverId: string): Promise<Tool[]>;
|
|
22
|
+
listResources(serverId: string): Promise<Resource[]>;
|
|
23
|
+
readResource(serverId: string, uri: string): Promise<ResourceContents>;
|
|
24
|
+
listPrompts(serverId: string): Promise<Prompt[]>;
|
|
25
|
+
getPrompt(serverId: string, name: string, args: unknown): Promise<PromptMessage[]>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=mcp-tool-delegate-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tool-delegate-client.d.ts","sourceRoot":"","sources":["../../src/browser/mcp-tool-delegate-client.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC1G,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;;;;;;GASG;AACH,qBACa,yBAA0B,YAAW,qBAAqB;IAInE,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;IAGhF,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEnC,OAAO,CAAC,wBAAwB;IAI1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAc7E,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAa5C,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAapD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAiBtE,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAahD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAe3F"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource.
|
|
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.MCPToolDelegateClientImpl = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const core_1 = require("@theia/core");
|
|
22
|
+
const logger_1 = require("@theia/core/lib/common/logger");
|
|
23
|
+
const mcp_frontend_contribution_1 = require("./mcp-frontend-contribution");
|
|
24
|
+
/**
|
|
25
|
+
* Frontend client implementation that handles MCP tool delegation requests from the backend.
|
|
26
|
+
*
|
|
27
|
+
* This class acts as a bridge between the backend MCP server and frontend contributions,
|
|
28
|
+
* forwarding backend requests (tool calls, resource access, prompts) to registered
|
|
29
|
+
* MCPFrontendContribution instances and aggregating their responses.
|
|
30
|
+
*
|
|
31
|
+
* Called by the backend via the MCPToolDelegateClient interface to access frontend-provided
|
|
32
|
+
* MCP tools, resources, and prompts.
|
|
33
|
+
*/
|
|
34
|
+
let MCPToolDelegateClientImpl = class MCPToolDelegateClientImpl {
|
|
35
|
+
getFrontendContributions() {
|
|
36
|
+
return this.contributions.getContributions();
|
|
37
|
+
}
|
|
38
|
+
async callTool(serverId, toolName, args) {
|
|
39
|
+
const contributions = this.getFrontendContributions();
|
|
40
|
+
for (const contribution of contributions) {
|
|
41
|
+
if (contribution.getTool) {
|
|
42
|
+
const tool = await contribution.getTool(toolName);
|
|
43
|
+
if (tool) {
|
|
44
|
+
return await tool.handler(JSON.stringify(args));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
throw new Error(`Tool ${toolName} not found in server ${serverId}`);
|
|
49
|
+
}
|
|
50
|
+
async listTools(serverId) {
|
|
51
|
+
const contributions = this.getFrontendContributions();
|
|
52
|
+
const allTools = [];
|
|
53
|
+
for (const contribution of contributions) {
|
|
54
|
+
if (contribution.getTools) {
|
|
55
|
+
const tools = await contribution.getTools();
|
|
56
|
+
allTools.push(...tools);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return allTools;
|
|
60
|
+
}
|
|
61
|
+
async listResources(serverId) {
|
|
62
|
+
const contributions = this.getFrontendContributions();
|
|
63
|
+
const allResources = [];
|
|
64
|
+
for (const contribution of contributions) {
|
|
65
|
+
if (contribution.getResources) {
|
|
66
|
+
const resources = await contribution.getResources();
|
|
67
|
+
allResources.push(...resources);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return allResources;
|
|
71
|
+
}
|
|
72
|
+
async readResource(serverId, uri) {
|
|
73
|
+
const contributions = this.getFrontendContributions();
|
|
74
|
+
for (const contribution of contributions) {
|
|
75
|
+
if (contribution.readResource) {
|
|
76
|
+
try {
|
|
77
|
+
const result = await contribution.readResource(uri);
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
// Continue to next contribution
|
|
82
|
+
this.logger.debug(`Error getting resource ${uri}:`, error);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
throw new Error(`Resource ${uri} not found in server ${serverId}`);
|
|
87
|
+
}
|
|
88
|
+
async listPrompts(serverId) {
|
|
89
|
+
const contributions = this.getFrontendContributions();
|
|
90
|
+
const allPrompts = [];
|
|
91
|
+
for (const contribution of contributions) {
|
|
92
|
+
if (contribution.getPrompts) {
|
|
93
|
+
const prompts = await contribution.getPrompts();
|
|
94
|
+
allPrompts.push(...prompts);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return allPrompts;
|
|
98
|
+
}
|
|
99
|
+
async getPrompt(serverId, name, args) {
|
|
100
|
+
const contributions = this.getFrontendContributions();
|
|
101
|
+
for (const contribution of contributions) {
|
|
102
|
+
if (contribution.getPrompt) {
|
|
103
|
+
try {
|
|
104
|
+
return await contribution.getPrompt(name, args);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
// Continue to next contribution
|
|
108
|
+
this.logger.debug(`Error getting prompt ${name}:`, error);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
throw new Error(`Prompt ${name} not found in server ${serverId}`);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
exports.MCPToolDelegateClientImpl = MCPToolDelegateClientImpl;
|
|
116
|
+
tslib_1.__decorate([
|
|
117
|
+
(0, inversify_1.inject)(core_1.ContributionProvider),
|
|
118
|
+
(0, inversify_1.named)(mcp_frontend_contribution_1.MCPFrontendContribution),
|
|
119
|
+
tslib_1.__metadata("design:type", Object)
|
|
120
|
+
], MCPToolDelegateClientImpl.prototype, "contributions", void 0);
|
|
121
|
+
tslib_1.__decorate([
|
|
122
|
+
(0, inversify_1.inject)(logger_1.ILogger),
|
|
123
|
+
tslib_1.__metadata("design:type", Object)
|
|
124
|
+
], MCPToolDelegateClientImpl.prototype, "logger", void 0);
|
|
125
|
+
exports.MCPToolDelegateClientImpl = MCPToolDelegateClientImpl = tslib_1.__decorate([
|
|
126
|
+
(0, inversify_1.injectable)()
|
|
127
|
+
], MCPToolDelegateClientImpl);
|
|
128
|
+
//# sourceMappingURL=mcp-tool-delegate-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tool-delegate-client.js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],"names":[],"mappings":"AAgBA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource.
|
|
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 tslib_1 = require("tslib");
|
|
19
|
+
tslib_1.__exportStar(require("./mcp-tool-delegate"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oCAAoC;AACpC,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,8DAAoC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Tool, Resource, ResourceContents, Prompt, PromptMessage } from '@modelcontextprotocol/sdk/types';
|
|
2
|
+
export declare const MCPToolDelegateClient: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* Client interface for MCP tool operations.
|
|
5
|
+
* This interface is implemented by the frontend and called by the backend.
|
|
6
|
+
*/
|
|
7
|
+
export interface MCPToolDelegateClient {
|
|
8
|
+
callTool(serverId: string, toolName: string, args: unknown): Promise<unknown>;
|
|
9
|
+
listTools(serverId: string): Promise<Tool[]>;
|
|
10
|
+
listResources(serverId: string): Promise<Resource[]>;
|
|
11
|
+
readResource(serverId: string, uri: string): Promise<ResourceContents>;
|
|
12
|
+
listPrompts(serverId: string): Promise<Prompt[]>;
|
|
13
|
+
getPrompt(serverId: string, name: string, args: unknown): Promise<PromptMessage[]>;
|
|
14
|
+
}
|
|
15
|
+
export declare const MCPToolFrontendDelegate: unique symbol;
|
|
16
|
+
/**
|
|
17
|
+
* Backend delegate interface for MCP tool operations.
|
|
18
|
+
* This interface extends MCPToolDelegateClient with RPC client setup capability.
|
|
19
|
+
* It is implemented by the backend and acts as a proxy to forward calls to the frontend.
|
|
20
|
+
*/
|
|
21
|
+
export interface MCPToolFrontendDelegate extends MCPToolDelegateClient {
|
|
22
|
+
setClient(client: MCPToolDelegateClient): void;
|
|
23
|
+
}
|
|
24
|
+
export declare const mcpToolDelegatePath = "/services/mcpToolDelegate";
|
|
25
|
+
//# sourceMappingURL=mcp-tool-delegate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tool-delegate.d.ts","sourceRoot":"","sources":["../../src/common/mcp-tool-delegate.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAE1G,eAAO,MAAM,qBAAqB,eAAkC,CAAC;AACrE;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9E,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7C,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACvE,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACjD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;CACtF;AAED,eAAO,MAAM,uBAAuB,eAAoC,CAAC;AACzE;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IAClE,SAAS,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAClD;AAED,eAAO,MAAM,mBAAmB,8BAA8B,CAAC"}
|