@platoona/mcp 1.0.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/LICENSE +21 -0
- package/README.md +238 -0
- package/dist/api-client.d.ts +74 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +261 -0
- package/dist/api-client.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +504 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +188 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Platoona
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# Platoona MCP Server
|
|
2
|
+
|
|
3
|
+
An MCP (Model Context Protocol) server that connects AI assistants like Claude Code, Cursor, and others to **10,000+ SaaS integrations** through Platoona Connect.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **search-tools** - Semantic search (RAG) for 10K+ integration actions
|
|
8
|
+
- **list-integrations** - Browse available integrations
|
|
9
|
+
- **list-connections** - View your active connections
|
|
10
|
+
- **connect-app** - Connect to integrations (OAuth or API key)
|
|
11
|
+
- **execute-tool** - Execute integration actions
|
|
12
|
+
- **disconnect-app** - Disconnect from integrations
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
1. A Platoona Connect account
|
|
17
|
+
2. Your Platoona API key (get it from [Platoona Connect Portal](https://app.platoona.com/connect))
|
|
18
|
+
3. Node.js 18+
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### Option 1: Install from npm (recommended)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g @platoona/mcp
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Option 2: Install from source
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git clone https://github.com/platoona/platoona-mcp.git
|
|
32
|
+
cd platoona-mcp
|
|
33
|
+
npm install
|
|
34
|
+
npm run build
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
### Environment Variables
|
|
40
|
+
|
|
41
|
+
| Variable | Required | Description |
|
|
42
|
+
|----------|----------|-------------|
|
|
43
|
+
| `PLATOONA_API_KEY` | Yes | Your Platoona Connect API key |
|
|
44
|
+
| `PLATOONA_BASE_URL` | No | Custom API URL (for self-hosted) |
|
|
45
|
+
|
|
46
|
+
**Note:** User ID is automatically derived from your API key using a deterministic hash. This ensures consistent identification across sessions - same API key always produces the same user ID (`mcp_<hash>`).
|
|
47
|
+
|
|
48
|
+
## Usage with Claude Code
|
|
49
|
+
|
|
50
|
+
Add to your Claude Code configuration (`~/.claude/claude_desktop_config.json`):
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"platoona": {
|
|
56
|
+
"command": "npx",
|
|
57
|
+
"args": ["@platoona/mcp"],
|
|
58
|
+
"env": {
|
|
59
|
+
"PLATOONA_API_KEY": "platoona_xxx..."
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or if installed globally:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"platoona": {
|
|
72
|
+
"command": "platoona-mcp",
|
|
73
|
+
"env": {
|
|
74
|
+
"PLATOONA_API_KEY": "platoona_xxx..."
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Usage with Cursor
|
|
82
|
+
|
|
83
|
+
Add to your Cursor MCP settings:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"platoona": {
|
|
89
|
+
"command": "npx",
|
|
90
|
+
"args": ["@platoona/mcp"],
|
|
91
|
+
"env": {
|
|
92
|
+
"PLATOONA_API_KEY": "platoona_xxx..."
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Available Tools
|
|
100
|
+
|
|
101
|
+
### search-tools
|
|
102
|
+
|
|
103
|
+
Search for integration tools using semantic/RAG search.
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
Input:
|
|
107
|
+
- query: "send a message to slack"
|
|
108
|
+
- integrationFilter: "slack" (optional)
|
|
109
|
+
- limit: 10 (optional)
|
|
110
|
+
|
|
111
|
+
Output:
|
|
112
|
+
- List of matching tools with IDs, descriptions, and similarity scores
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### list-integrations
|
|
116
|
+
|
|
117
|
+
List available integrations that can be connected.
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
Input:
|
|
121
|
+
- search: "email" (optional)
|
|
122
|
+
- limit: 20 (optional)
|
|
123
|
+
|
|
124
|
+
Output:
|
|
125
|
+
- List of integrations with IDs, names, and slugs
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### list-connections
|
|
129
|
+
|
|
130
|
+
List all active connections for your MCP user.
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
Input: (none required)
|
|
134
|
+
|
|
135
|
+
Output:
|
|
136
|
+
- List of connections with IDs, status, and expiration
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### connect-app
|
|
140
|
+
|
|
141
|
+
Connect to an integration.
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
Input:
|
|
145
|
+
- integration: "slack" or UUID
|
|
146
|
+
- apiKey: "..." (for API key integrations)
|
|
147
|
+
- scopes: ["read", "write"] (for OAuth)
|
|
148
|
+
|
|
149
|
+
Output:
|
|
150
|
+
- For API key: connectionId and status
|
|
151
|
+
- For OAuth: authUrl to complete authorization
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### execute-tool
|
|
155
|
+
|
|
156
|
+
Execute an integration action.
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
Input:
|
|
160
|
+
- action: "slack:send-message" or UUID
|
|
161
|
+
- parameters: { channel: "#general", text: "Hello!" }
|
|
162
|
+
- timeout: 30000 (optional)
|
|
163
|
+
|
|
164
|
+
Output:
|
|
165
|
+
- Execution result with output data
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### disconnect-app
|
|
169
|
+
|
|
170
|
+
Disconnect from an integration.
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
Input:
|
|
174
|
+
- integration: "slack" or UUID
|
|
175
|
+
|
|
176
|
+
Output:
|
|
177
|
+
- Success confirmation
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Example Workflow
|
|
181
|
+
|
|
182
|
+
1. **Search for tools:**
|
|
183
|
+
```
|
|
184
|
+
"Search for tools to send a Slack message"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
2. **Check connections:**
|
|
188
|
+
```
|
|
189
|
+
"List my Slack connections"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
3. **Connect if needed:**
|
|
193
|
+
```
|
|
194
|
+
"Connect to Slack" (will return OAuth URL)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
4. **Execute the tool:**
|
|
198
|
+
```
|
|
199
|
+
"Send a Slack message to #general saying Hello!"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## API Endpoints Used
|
|
203
|
+
|
|
204
|
+
This MCP uses the dedicated `/mcp/*` endpoints for simplified integration:
|
|
205
|
+
|
|
206
|
+
| Endpoint | Purpose |
|
|
207
|
+
|----------|---------|
|
|
208
|
+
| `POST /mcp/tools/search` | RAG search for integration tools |
|
|
209
|
+
| `POST /mcp/connect` | Connect to integration (OAuth or API key) |
|
|
210
|
+
| `POST /mcp/execute` | Execute an integration action |
|
|
211
|
+
| `GET /mcp/connections` | List active connections |
|
|
212
|
+
| `POST /mcp/disconnect` | Disconnect from integration |
|
|
213
|
+
| `GET /ipaas/integrations` | List available integrations |
|
|
214
|
+
|
|
215
|
+
## Development
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Install dependencies
|
|
219
|
+
bun install
|
|
220
|
+
|
|
221
|
+
# Run in development mode
|
|
222
|
+
bun run dev
|
|
223
|
+
|
|
224
|
+
# Build for production
|
|
225
|
+
bun run build
|
|
226
|
+
|
|
227
|
+
# Start production server
|
|
228
|
+
bun start
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## License
|
|
232
|
+
|
|
233
|
+
MIT
|
|
234
|
+
|
|
235
|
+
## Support
|
|
236
|
+
|
|
237
|
+
- [Platoona Documentation](https://docs.platoona.com)
|
|
238
|
+
- [GitHub Issues](https://github.com/platoona/platoona-mcp/issues)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platoona API Client
|
|
3
|
+
* Handles all communication with the Platoona backend via /ipaas endpoints
|
|
4
|
+
*/
|
|
5
|
+
import type { PlatoonaConfig, Integration, IntegrationAction, IntegrationConnection, SearchActionsRequest, SearchActionsResponse, InitiateConnectionRequest, InitiateConnectionResponse, ExecuteActionRequest, ExecuteActionResponse, ApiResponse } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* API client for communicating with Platoona backend
|
|
8
|
+
* Uses the /ipaas endpoints (Platoona Connect)
|
|
9
|
+
*/
|
|
10
|
+
export declare class PlatoonaClient {
|
|
11
|
+
private readonly apiKey;
|
|
12
|
+
private readonly baseUrl;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new Platoona API client
|
|
15
|
+
* @param config - Configuration with API key and optional base URL
|
|
16
|
+
*/
|
|
17
|
+
constructor(config: PlatoonaConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Make an authenticated request to the Platoona API
|
|
20
|
+
* @param endpoint - API endpoint path
|
|
21
|
+
* @param options - Fetch options
|
|
22
|
+
* @returns Parsed JSON response
|
|
23
|
+
*/
|
|
24
|
+
private request;
|
|
25
|
+
/**
|
|
26
|
+
* Search for available integration actions using RAG/vector search
|
|
27
|
+
* @param request - Search parameters
|
|
28
|
+
* @returns List of matching actions with similarity scores
|
|
29
|
+
*/
|
|
30
|
+
searchActions(request: SearchActionsRequest): Promise<SearchActionsResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Get list of available integrations
|
|
33
|
+
* @param search - Optional search term
|
|
34
|
+
* @param limit - Maximum results
|
|
35
|
+
* @returns List of integrations
|
|
36
|
+
*/
|
|
37
|
+
listIntegrations(search?: string, limit?: number): Promise<ApiResponse<Integration[]>>;
|
|
38
|
+
/**
|
|
39
|
+
* Get actions for a specific integration
|
|
40
|
+
* @param integrationSlug - Integration slug
|
|
41
|
+
* @returns List of actions
|
|
42
|
+
*/
|
|
43
|
+
getIntegrationActions(integrationSlug: string): Promise<ApiResponse<IntegrationAction[]>>;
|
|
44
|
+
/**
|
|
45
|
+
* List existing connections for the MCP user
|
|
46
|
+
* User ID is automatically derived from API key on the server
|
|
47
|
+
* @returns List of connections
|
|
48
|
+
*/
|
|
49
|
+
listConnections(): Promise<ApiResponse<IntegrationConnection[]>>;
|
|
50
|
+
/**
|
|
51
|
+
* Initiate a new connection to an integration
|
|
52
|
+
* For OAuth: Returns authUrl to redirect user
|
|
53
|
+
* For API Key: Creates connection directly
|
|
54
|
+
* User ID is automatically derived from API key on the server
|
|
55
|
+
* @param request - Connection request
|
|
56
|
+
* @returns Connection result or OAuth URL
|
|
57
|
+
*/
|
|
58
|
+
initiateConnection(request: InitiateConnectionRequest): Promise<InitiateConnectionResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* Disconnect from an integration
|
|
61
|
+
* User ID is automatically derived from API key on the server
|
|
62
|
+
* @param integrationId - Integration ID or slug
|
|
63
|
+
* @returns Disconnection result
|
|
64
|
+
*/
|
|
65
|
+
disconnectConnection(integrationId: string): Promise<ApiResponse<void>>;
|
|
66
|
+
/**
|
|
67
|
+
* Execute an integration action
|
|
68
|
+
* User ID is automatically derived from API key on the server
|
|
69
|
+
* @param request - Execution request with action ID and parameters
|
|
70
|
+
* @returns Execution result
|
|
71
|
+
*/
|
|
72
|
+
executeAction(request: ExecuteActionRequest): Promise<ExecuteActionResponse>;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["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Platoona backend via /ipaas endpoints
|
|
4
|
+
*/
|
|
5
|
+
/** Default Platoona API base URL */
|
|
6
|
+
const DEFAULT_BASE_URL = 'https://api.platoona.com';
|
|
7
|
+
/**
|
|
8
|
+
* API client for communicating with Platoona backend
|
|
9
|
+
* Uses the /ipaas endpoints (Platoona Connect)
|
|
10
|
+
*/
|
|
11
|
+
export class PlatoonaClient {
|
|
12
|
+
apiKey;
|
|
13
|
+
baseUrl;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new Platoona API client
|
|
16
|
+
* @param config - Configuration with API key and optional base URL
|
|
17
|
+
*/
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.apiKey = config.apiKey;
|
|
20
|
+
this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
|
|
21
|
+
}
|
|
22
|
+
// ==========================================================================
|
|
23
|
+
// Private Helpers
|
|
24
|
+
// ==========================================================================
|
|
25
|
+
/**
|
|
26
|
+
* Make an authenticated request to the Platoona API
|
|
27
|
+
* @param endpoint - API endpoint path
|
|
28
|
+
* @param options - Fetch options
|
|
29
|
+
* @returns Parsed JSON response
|
|
30
|
+
*/
|
|
31
|
+
async request(endpoint, options = {}) {
|
|
32
|
+
const url = `${this.baseUrl}${endpoint}`;
|
|
33
|
+
const headers = {
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
'X-API-Key': this.apiKey,
|
|
36
|
+
...(options.headers || {}),
|
|
37
|
+
};
|
|
38
|
+
try {
|
|
39
|
+
const response = await fetch(url, {
|
|
40
|
+
...options,
|
|
41
|
+
headers,
|
|
42
|
+
});
|
|
43
|
+
const data = (await response.json());
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
return {
|
|
46
|
+
success: false,
|
|
47
|
+
error: data.message || `HTTP ${response.status}: ${response.statusText}`,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return data;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
54
|
+
return {
|
|
55
|
+
success: false,
|
|
56
|
+
error: `Request failed: ${errorMessage}`,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// ==========================================================================
|
|
61
|
+
// Search Tools (RAG)
|
|
62
|
+
// ==========================================================================
|
|
63
|
+
/**
|
|
64
|
+
* Search for available integration actions using RAG/vector search
|
|
65
|
+
* @param request - Search parameters
|
|
66
|
+
* @returns List of matching actions with similarity scores
|
|
67
|
+
*/
|
|
68
|
+
async searchActions(request) {
|
|
69
|
+
const response = await this.request('/mcp/tools/search', {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
body: JSON.stringify({
|
|
72
|
+
query: request.query,
|
|
73
|
+
integration: request.integrationIds?.[0], // MCP supports single integration filter
|
|
74
|
+
limit: request.limit || 20,
|
|
75
|
+
}),
|
|
76
|
+
});
|
|
77
|
+
if (!response.success || !response.data) {
|
|
78
|
+
return {
|
|
79
|
+
success: false,
|
|
80
|
+
data: [],
|
|
81
|
+
message: response.error,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Map response to IntegrationAction format
|
|
85
|
+
const actions = response.data.tools.map((t) => ({
|
|
86
|
+
id: t.id,
|
|
87
|
+
name: t.name,
|
|
88
|
+
slug: t.name.toLowerCase().replace(/\s+/g, '-'),
|
|
89
|
+
description: t.description || undefined,
|
|
90
|
+
integrationId: t.integration.id,
|
|
91
|
+
integrationName: t.integration.name || undefined,
|
|
92
|
+
integrationSlug: t.integration.slug || undefined,
|
|
93
|
+
similarity: t.similarity,
|
|
94
|
+
inputSchema: t.inputSchema || undefined,
|
|
95
|
+
}));
|
|
96
|
+
return {
|
|
97
|
+
success: true,
|
|
98
|
+
data: actions,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get list of available integrations
|
|
103
|
+
* @param search - Optional search term
|
|
104
|
+
* @param limit - Maximum results
|
|
105
|
+
* @returns List of integrations
|
|
106
|
+
*/
|
|
107
|
+
async listIntegrations(search, limit = 50) {
|
|
108
|
+
const params = new URLSearchParams();
|
|
109
|
+
if (search)
|
|
110
|
+
params.append('search', search);
|
|
111
|
+
params.append('limit', limit.toString());
|
|
112
|
+
const response = await this.request(`/ipaas/integrations?${params.toString()}`);
|
|
113
|
+
if (!response.success || !response.data) {
|
|
114
|
+
return { success: false, error: response.error };
|
|
115
|
+
}
|
|
116
|
+
const integrations = response.data.integrations.map((i) => ({
|
|
117
|
+
id: i.id,
|
|
118
|
+
name: i.name,
|
|
119
|
+
slug: i.slug,
|
|
120
|
+
description: i.description,
|
|
121
|
+
logo: i.logo,
|
|
122
|
+
status: i.status,
|
|
123
|
+
}));
|
|
124
|
+
return { success: true, data: integrations };
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get actions for a specific integration
|
|
128
|
+
* @param integrationSlug - Integration slug
|
|
129
|
+
* @returns List of actions
|
|
130
|
+
*/
|
|
131
|
+
async getIntegrationActions(integrationSlug) {
|
|
132
|
+
const response = await this.request(`/ipaas/integrations/${integrationSlug}/actions`);
|
|
133
|
+
if (!response.success || !response.data) {
|
|
134
|
+
return { success: false, error: response.error };
|
|
135
|
+
}
|
|
136
|
+
const actions = response.data.actions.map((a) => ({
|
|
137
|
+
id: a.id,
|
|
138
|
+
name: a.name,
|
|
139
|
+
slug: a.slug,
|
|
140
|
+
description: a.description,
|
|
141
|
+
integrationId: '',
|
|
142
|
+
integrationSlug: integrationSlug,
|
|
143
|
+
category: a.category,
|
|
144
|
+
inputSchema: a.input_schema,
|
|
145
|
+
}));
|
|
146
|
+
return { success: true, data: actions };
|
|
147
|
+
}
|
|
148
|
+
// ==========================================================================
|
|
149
|
+
// Connect App
|
|
150
|
+
// ==========================================================================
|
|
151
|
+
/**
|
|
152
|
+
* List existing connections for the MCP user
|
|
153
|
+
* User ID is automatically derived from API key on the server
|
|
154
|
+
* @returns List of connections
|
|
155
|
+
*/
|
|
156
|
+
async listConnections() {
|
|
157
|
+
const response = await this.request('/mcp/connections');
|
|
158
|
+
if (!response.success || !response.data) {
|
|
159
|
+
return { success: false, error: response.error };
|
|
160
|
+
}
|
|
161
|
+
const connections = response.data.connections.map((c) => ({
|
|
162
|
+
id: c.id,
|
|
163
|
+
integrationId: c.integration.id,
|
|
164
|
+
integrationName: c.integration.name,
|
|
165
|
+
status: c.status,
|
|
166
|
+
expiresAt: c.expiresAt,
|
|
167
|
+
}));
|
|
168
|
+
return { success: true, data: connections };
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Initiate a new connection to an integration
|
|
172
|
+
* For OAuth: Returns authUrl to redirect user
|
|
173
|
+
* For API Key: Creates connection directly
|
|
174
|
+
* User ID is automatically derived from API key on the server
|
|
175
|
+
* @param request - Connection request
|
|
176
|
+
* @returns Connection result or OAuth URL
|
|
177
|
+
*/
|
|
178
|
+
async initiateConnection(request) {
|
|
179
|
+
// Use unified /mcp/connect endpoint
|
|
180
|
+
const response = await this.request('/mcp/connect', {
|
|
181
|
+
method: 'POST',
|
|
182
|
+
body: JSON.stringify({
|
|
183
|
+
integration: request.integrationId,
|
|
184
|
+
apiKey: request.apiKey,
|
|
185
|
+
scopes: request.scopes,
|
|
186
|
+
redirectUri: request.redirectUrl,
|
|
187
|
+
}),
|
|
188
|
+
});
|
|
189
|
+
if (!response.success || !response.data) {
|
|
190
|
+
return { success: false, message: response.error };
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
success: true,
|
|
194
|
+
data: {
|
|
195
|
+
connectionId: response.data.connectionId,
|
|
196
|
+
authUrl: response.data.authUrl,
|
|
197
|
+
status: response.data.status,
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Disconnect from an integration
|
|
203
|
+
* User ID is automatically derived from API key on the server
|
|
204
|
+
* @param integrationId - Integration ID or slug
|
|
205
|
+
* @returns Disconnection result
|
|
206
|
+
*/
|
|
207
|
+
async disconnectConnection(integrationId) {
|
|
208
|
+
return this.request('/mcp/disconnect', {
|
|
209
|
+
method: 'POST',
|
|
210
|
+
body: JSON.stringify({
|
|
211
|
+
integration: integrationId,
|
|
212
|
+
}),
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
// ==========================================================================
|
|
216
|
+
// Execute Tool
|
|
217
|
+
// ==========================================================================
|
|
218
|
+
/**
|
|
219
|
+
* Execute an integration action
|
|
220
|
+
* User ID is automatically derived from API key on the server
|
|
221
|
+
* @param request - Execution request with action ID and parameters
|
|
222
|
+
* @returns Execution result
|
|
223
|
+
*/
|
|
224
|
+
async executeAction(request) {
|
|
225
|
+
const response = await this.request('/mcp/execute', {
|
|
226
|
+
method: 'POST',
|
|
227
|
+
body: JSON.stringify({
|
|
228
|
+
action: request.actionId,
|
|
229
|
+
parameters: request.parameters,
|
|
230
|
+
timeout: request.timeout,
|
|
231
|
+
}),
|
|
232
|
+
});
|
|
233
|
+
if (!response.success || !response.data) {
|
|
234
|
+
return {
|
|
235
|
+
success: false,
|
|
236
|
+
error: response.error,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
// Check if execution itself failed (API call succeeded but action failed)
|
|
240
|
+
if (!response.data.success || response.data.status === 'failure') {
|
|
241
|
+
return {
|
|
242
|
+
success: false,
|
|
243
|
+
error: response.data.error || `Execution failed with status: ${response.data.status}`,
|
|
244
|
+
data: {
|
|
245
|
+
output: response.data.output,
|
|
246
|
+
duration: response.data.duration,
|
|
247
|
+
status: response.data.status,
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
success: true,
|
|
253
|
+
data: {
|
|
254
|
+
output: response.data.output,
|
|
255
|
+
duration: response.data.duration,
|
|
256
|
+
status: response.data.status,
|
|
257
|
+
},
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.js","source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AE;gBACJ,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;gBAC5B,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ;gBAChC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAA4D;aACnF;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Platoona MCP Server
|
|
4
|
+
*
|
|
5
|
+
* An MCP server that provides tools for:
|
|
6
|
+
* 1. search-tools - Search for integration tools using RAG
|
|
7
|
+
* 2. connect-app - Connect to integrations (OAuth or API key)
|
|
8
|
+
* 3. execute-tool - Execute integration actions
|
|
9
|
+
*
|
|
10
|
+
* Prerequisites:
|
|
11
|
+
* - PLATOONA_API_KEY environment variable must be set
|
|
12
|
+
* - Optionally set PLATOONA_BASE_URL for custom API endpoint
|
|
13
|
+
*
|
|
14
|
+
* User ID is automatically derived from the API key for consistent identification.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;GAaG"}
|