@digitalocean/mcp 0.0.7 → 0.0.11
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/build/DOMcpServer.js +2 -2
- package/build/api.js +0 -0
- package/build/index.js +1 -1
- package/build/index.js.map +7 -0
- package/build/logger.js +40 -35
- package/build/server.js +5 -2
- package/build/specs/digitalocean-openapi.yaml.zod.js +0 -0
- package/build/tools/app.js +50 -68
- package/build/tools/databases.js +306 -0
- package/build/version.js +1 -1
- package/package.json +1 -1
package/build/logger.js
CHANGED
|
@@ -5,38 +5,43 @@ function toMessage(...args) {
|
|
|
5
5
|
.map((arg) => (typeof arg === "object" ? JSON.stringify(arg) : String(arg)))
|
|
6
6
|
.join(" ");
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
8
|
+
class Logger {
|
|
9
|
+
static instance = null;
|
|
10
|
+
server;
|
|
11
|
+
constructor(options = {}) {
|
|
12
|
+
this.server = options.server;
|
|
13
|
+
}
|
|
14
|
+
static createInstance(options = {}) {
|
|
15
|
+
if (!Logger.instance) {
|
|
16
|
+
Logger.instance = new Logger(options);
|
|
17
|
+
}
|
|
18
|
+
return Logger.instance;
|
|
19
|
+
}
|
|
20
|
+
sendLoggingNotification(level, data) {
|
|
21
|
+
if (this.server) {
|
|
22
|
+
this.server?.server.sendLoggingMessage({
|
|
23
|
+
level,
|
|
24
|
+
data: data,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
process.stdout.write(`${JSON.stringify({ level, data })}\n`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
info(...args) {
|
|
32
|
+
this.sendLoggingNotification("info", toMessage(...args));
|
|
33
|
+
}
|
|
34
|
+
error(...args) {
|
|
35
|
+
this.sendLoggingNotification("error", toMessage(...args));
|
|
36
|
+
}
|
|
37
|
+
warn(...args) {
|
|
38
|
+
this.sendLoggingNotification("warning", toMessage(...args));
|
|
39
|
+
}
|
|
40
|
+
debug(...args) {
|
|
41
|
+
this.sendLoggingNotification("debug", toMessage(...args));
|
|
42
|
+
}
|
|
43
|
+
createStdioLogger(server) {
|
|
44
|
+
this.server = server;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.default = Logger.createInstance();
|
package/build/server.js
CHANGED
|
@@ -10,12 +10,15 @@ const DOMcpServer_1 = require("./DOMcpServer");
|
|
|
10
10
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
11
11
|
const logger_1 = __importDefault(require("./logger"));
|
|
12
12
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
13
|
+
const databases_1 = require("./tools/databases");
|
|
13
14
|
function createServer() {
|
|
14
15
|
const server = new DOMcpServer_1.DOMcpServer({
|
|
15
16
|
name: "DigitalOcean MCP Server",
|
|
16
|
-
version:
|
|
17
|
-
});
|
|
17
|
+
version: "1.0.0",
|
|
18
|
+
}, { capabilities: { logging: { subscribe: true } } });
|
|
19
|
+
logger_1.default.createStdioLogger(server);
|
|
18
20
|
(0, app_1.registerAppTools)(server);
|
|
21
|
+
(0, databases_1.registerDatabaseTools)(server);
|
|
19
22
|
return server;
|
|
20
23
|
}
|
|
21
24
|
function startStdioServer(server) {
|
|
File without changes
|
package/build/tools/app.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RevertAppRollback = exports.CommitAppRollback = exports.ValidateAppRollback = exports.RollbackApp = exports.UpdateAppAlertDestinations = exports.ListAppAlerts = exports.ValidateAppSpec = exports.ListRegions = exports.GetInstanceSizeBySlug = exports.ListInstanceSizes = exports.CancelDeployment = exports.GetDeployment = exports.CreateDeployment = exports.ListDeployments = exports.DownloadLogs = exports.GetDeploymentLogsUrl = exports.RestartApp = exports.DeleteApp = exports.UpdateApp = exports.GetApp = exports.CreateApp = exports.ListApps = void 0;
|
|
4
3
|
exports.registerAppTools = registerAppTools;
|
|
5
4
|
const digitalocean_openapi_yaml_zod_1 = require("../specs/digitalocean-openapi.yaml.zod");
|
|
6
5
|
const api_1 = require("../api");
|
|
7
6
|
const zod_1 = require("zod");
|
|
8
|
-
|
|
7
|
+
const ListApps = {
|
|
9
8
|
name: "list_apps",
|
|
10
9
|
description: `
|
|
11
10
|
List all apps on your account. Information about the current active
|
|
@@ -34,11 +33,14 @@ exports.ListApps = {
|
|
|
34
33
|
});
|
|
35
34
|
return {
|
|
36
35
|
content,
|
|
37
|
-
_meta:
|
|
36
|
+
_meta: {
|
|
37
|
+
links: res.links,
|
|
38
|
+
meta: res.meta,
|
|
39
|
+
},
|
|
38
40
|
};
|
|
39
41
|
},
|
|
40
42
|
};
|
|
41
|
-
|
|
43
|
+
const CreateApp = {
|
|
42
44
|
name: "create_app",
|
|
43
45
|
description: `
|
|
44
46
|
Create a new app by submitting an app specification. For documentation
|
|
@@ -62,7 +64,7 @@ exports.CreateApp = {
|
|
|
62
64
|
}
|
|
63
65
|
},
|
|
64
66
|
};
|
|
65
|
-
|
|
67
|
+
const GetApp = {
|
|
66
68
|
name: "get_app",
|
|
67
69
|
description: "Get an app by ID",
|
|
68
70
|
parameters: digitalocean_openapi_yaml_zod_1.get_Apps_get.parameters.shape,
|
|
@@ -84,7 +86,7 @@ exports.GetApp = {
|
|
|
84
86
|
}
|
|
85
87
|
},
|
|
86
88
|
};
|
|
87
|
-
|
|
89
|
+
const UpdateApp = {
|
|
88
90
|
name: "update_app",
|
|
89
91
|
description: `
|
|
90
92
|
Update an existing app by submitting a new app specification. For
|
|
@@ -109,7 +111,7 @@ exports.UpdateApp = {
|
|
|
109
111
|
}
|
|
110
112
|
},
|
|
111
113
|
};
|
|
112
|
-
|
|
114
|
+
const DeleteApp = {
|
|
113
115
|
name: "delete_app",
|
|
114
116
|
description: "Delete an app by ID",
|
|
115
117
|
parameters: digitalocean_openapi_yaml_zod_1.delete_Apps_delete.parameters.shape,
|
|
@@ -129,28 +131,6 @@ exports.DeleteApp = {
|
|
|
129
131
|
}
|
|
130
132
|
},
|
|
131
133
|
};
|
|
132
|
-
exports.RestartApp = {
|
|
133
|
-
name: "restart_app",
|
|
134
|
-
description: "Restart an app by ID",
|
|
135
|
-
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_restart.parameters.shape,
|
|
136
|
-
cb: async (params, extra) => {
|
|
137
|
-
try {
|
|
138
|
-
const { client } = (0, api_1.createClient)(extra);
|
|
139
|
-
const res = await client.post(`/v2/apps/{app_id}/restart`, params);
|
|
140
|
-
return {
|
|
141
|
-
content: [
|
|
142
|
-
{ type: "text", text: JSON.stringify(res.deployment, null, 2) },
|
|
143
|
-
],
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
return {
|
|
148
|
-
content: [{ type: "text", text: `Error restarting app: ${error}` }],
|
|
149
|
-
isError: true,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
134
|
const GetDeploymentLogsUrlSchema = zod_1.z.object({
|
|
155
135
|
deployment_id: zod_1.z
|
|
156
136
|
.string()
|
|
@@ -159,10 +139,10 @@ const GetDeploymentLogsUrlSchema = zod_1.z.object({
|
|
|
159
139
|
type: zod_1.z.enum(["BUILD", "DEPLOY", "RUN", "RUN_RESTARTED"]),
|
|
160
140
|
app_id: zod_1.z.string().describe("The ID of the app."),
|
|
161
141
|
});
|
|
162
|
-
|
|
142
|
+
const GetDeploymentLogsUrl = {
|
|
163
143
|
name: "get_deployment_logs_url",
|
|
164
144
|
description: `
|
|
165
|
-
|
|
145
|
+
Gets the URL of the logs for a deployment. Before fetching the logs, you need to
|
|
166
146
|
get the URL of the logs.
|
|
167
147
|
`,
|
|
168
148
|
parameters: GetDeploymentLogsUrlSchema.shape,
|
|
@@ -213,7 +193,7 @@ exports.GetDeploymentLogsUrl = {
|
|
|
213
193
|
const DownloadLogsSchema = zod_1.z.object({
|
|
214
194
|
url: zod_1.z.string().describe("The URL to the bucket containing the logs"),
|
|
215
195
|
});
|
|
216
|
-
|
|
196
|
+
const DownloadLogs = {
|
|
217
197
|
name: "download_logs",
|
|
218
198
|
description: `
|
|
219
199
|
Give the URL of the logs, download the logs and return them as a string.
|
|
@@ -235,7 +215,7 @@ exports.DownloadLogs = {
|
|
|
235
215
|
}
|
|
236
216
|
},
|
|
237
217
|
};
|
|
238
|
-
|
|
218
|
+
const ListDeployments = {
|
|
239
219
|
name: "list_deployments",
|
|
240
220
|
description: "List all deployments for an app",
|
|
241
221
|
parameters: digitalocean_openapi_yaml_zod_1.get_Apps_list_deployments.parameters.shape,
|
|
@@ -269,7 +249,7 @@ exports.ListDeployments = {
|
|
|
269
249
|
}
|
|
270
250
|
},
|
|
271
251
|
};
|
|
272
|
-
|
|
252
|
+
const CreateDeployment = {
|
|
273
253
|
name: "create_deployment",
|
|
274
254
|
description: "Create a new deployment for an app",
|
|
275
255
|
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_create_deployment.parameters.shape,
|
|
@@ -292,7 +272,7 @@ exports.CreateDeployment = {
|
|
|
292
272
|
}
|
|
293
273
|
},
|
|
294
274
|
};
|
|
295
|
-
|
|
275
|
+
const GetDeployment = {
|
|
296
276
|
name: "get_deployment",
|
|
297
277
|
description: "Get a deployment by ID",
|
|
298
278
|
parameters: digitalocean_openapi_yaml_zod_1.get_Apps_get_deployment.parameters.shape,
|
|
@@ -307,13 +287,15 @@ exports.GetDeployment = {
|
|
|
307
287
|
}
|
|
308
288
|
catch (error) {
|
|
309
289
|
return {
|
|
310
|
-
content: [
|
|
290
|
+
content: [
|
|
291
|
+
{ type: "text", text: `Error getting deployment: ${error}` },
|
|
292
|
+
],
|
|
311
293
|
isError: true,
|
|
312
294
|
};
|
|
313
295
|
}
|
|
314
296
|
},
|
|
315
297
|
};
|
|
316
|
-
|
|
298
|
+
const CancelDeployment = {
|
|
317
299
|
name: "cancel_deployment",
|
|
318
300
|
description: "Cancel a deployment by ID",
|
|
319
301
|
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_cancel_deployment.parameters.shape,
|
|
@@ -334,7 +316,7 @@ exports.CancelDeployment = {
|
|
|
334
316
|
}
|
|
335
317
|
},
|
|
336
318
|
};
|
|
337
|
-
|
|
319
|
+
const ListInstanceSizes = {
|
|
338
320
|
name: "list_instance_sizes",
|
|
339
321
|
description: "List all instance sizes for `service`, `worker`, and `job` components supported by App Platform.",
|
|
340
322
|
parameters: undefined,
|
|
@@ -367,7 +349,7 @@ exports.ListInstanceSizes = {
|
|
|
367
349
|
}
|
|
368
350
|
},
|
|
369
351
|
};
|
|
370
|
-
|
|
352
|
+
const GetInstanceSizeBySlug = {
|
|
371
353
|
name: "get_instance_size_by_slug",
|
|
372
354
|
description: "Retrieve information about a specific instance size slug for `service`,`worker`, and `job` components.",
|
|
373
355
|
parameters: digitalocean_openapi_yaml_zod_1.get_Apps_get_instanceSize.parameters.shape,
|
|
@@ -389,7 +371,7 @@ exports.GetInstanceSizeBySlug = {
|
|
|
389
371
|
}
|
|
390
372
|
},
|
|
391
373
|
};
|
|
392
|
-
|
|
374
|
+
const ListRegions = {
|
|
393
375
|
name: "list_app_regions",
|
|
394
376
|
description: "List all regions supported by App Platform.",
|
|
395
377
|
cb: async (extra) => {
|
|
@@ -421,7 +403,7 @@ exports.ListRegions = {
|
|
|
421
403
|
}
|
|
422
404
|
},
|
|
423
405
|
};
|
|
424
|
-
|
|
406
|
+
const ValidateAppSpec = {
|
|
425
407
|
name: "validate_app_spec",
|
|
426
408
|
description: `
|
|
427
409
|
Propose and validate a spec for a new or existing app. The request returns some
|
|
@@ -448,7 +430,7 @@ exports.ValidateAppSpec = {
|
|
|
448
430
|
}
|
|
449
431
|
},
|
|
450
432
|
};
|
|
451
|
-
|
|
433
|
+
const ListAppAlerts = {
|
|
452
434
|
name: "list_app_alerts",
|
|
453
435
|
description: `
|
|
454
436
|
List alerts associated to the app and any components. This includes
|
|
@@ -477,7 +459,7 @@ exports.ListAppAlerts = {
|
|
|
477
459
|
}
|
|
478
460
|
},
|
|
479
461
|
};
|
|
480
|
-
|
|
462
|
+
const UpdateAppAlertDestinations = {
|
|
481
463
|
name: "update_app_alert_destinations",
|
|
482
464
|
description: "Update alert destinations for an app",
|
|
483
465
|
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_assign_alertDestinations.parameters.shape,
|
|
@@ -499,7 +481,7 @@ exports.UpdateAppAlertDestinations = {
|
|
|
499
481
|
}
|
|
500
482
|
},
|
|
501
483
|
};
|
|
502
|
-
|
|
484
|
+
const RollbackApp = {
|
|
503
485
|
name: "rollback_app",
|
|
504
486
|
description: `
|
|
505
487
|
Rollback an app to a previous deployment. A new deployment will be
|
|
@@ -526,7 +508,7 @@ exports.RollbackApp = {
|
|
|
526
508
|
}
|
|
527
509
|
},
|
|
528
510
|
};
|
|
529
|
-
|
|
511
|
+
const ValidateAppRollback = {
|
|
530
512
|
name: "validate_app_rollback",
|
|
531
513
|
description: `
|
|
532
514
|
Check whether an app can be rolled back to a specific deployment. This
|
|
@@ -553,7 +535,7 @@ exports.ValidateAppRollback = {
|
|
|
553
535
|
}
|
|
554
536
|
},
|
|
555
537
|
};
|
|
556
|
-
|
|
538
|
+
const CommitAppRollback = {
|
|
557
539
|
name: "commit_app_rollback",
|
|
558
540
|
description: `
|
|
559
541
|
Commit an app rollback. This action permanently applies the rollback and
|
|
@@ -580,7 +562,7 @@ exports.CommitAppRollback = {
|
|
|
580
562
|
}
|
|
581
563
|
},
|
|
582
564
|
};
|
|
583
|
-
|
|
565
|
+
const RevertAppRollback = {
|
|
584
566
|
name: "revert_app_rollback",
|
|
585
567
|
description: `
|
|
586
568
|
Revert an app rollback. This action reverts the active rollback by
|
|
@@ -607,25 +589,25 @@ exports.RevertAppRollback = {
|
|
|
607
589
|
},
|
|
608
590
|
};
|
|
609
591
|
function registerAppTools(server) {
|
|
610
|
-
server.registerTool(
|
|
611
|
-
server.registerTool(
|
|
612
|
-
server.registerTool(
|
|
613
|
-
server.registerTool(
|
|
614
|
-
server.registerTool(
|
|
615
|
-
server.registerTool(
|
|
616
|
-
server.registerTool(
|
|
617
|
-
server.registerTool(
|
|
618
|
-
server.registerTool(
|
|
619
|
-
server.registerTool(
|
|
620
|
-
server.registerTool(
|
|
621
|
-
server.registerTool(
|
|
622
|
-
server.registerTool(
|
|
623
|
-
server.registerTool(
|
|
624
|
-
server.registerTool(
|
|
625
|
-
server.registerTool(
|
|
626
|
-
server.registerTool(
|
|
627
|
-
server.registerTool(
|
|
628
|
-
server.registerTool(
|
|
629
|
-
server.registerTool(
|
|
630
|
-
server.registerTool(
|
|
592
|
+
server.registerTool(ListApps);
|
|
593
|
+
server.registerTool(CreateApp);
|
|
594
|
+
server.registerTool(GetApp);
|
|
595
|
+
server.registerTool(UpdateApp);
|
|
596
|
+
server.registerTool(DeleteApp);
|
|
597
|
+
server.registerTool(GetDeploymentLogsUrl);
|
|
598
|
+
server.registerTool(DownloadLogs); // Custom tool to download logs
|
|
599
|
+
server.registerTool(ListDeployments);
|
|
600
|
+
server.registerTool(CreateDeployment);
|
|
601
|
+
server.registerTool(GetDeployment);
|
|
602
|
+
server.registerTool(CancelDeployment);
|
|
603
|
+
server.registerTool(ListInstanceSizes);
|
|
604
|
+
server.registerTool(GetInstanceSizeBySlug);
|
|
605
|
+
server.registerTool(ListRegions);
|
|
606
|
+
server.registerTool(ValidateAppSpec);
|
|
607
|
+
server.registerTool(ListAppAlerts);
|
|
608
|
+
server.registerTool(UpdateAppAlertDestinations);
|
|
609
|
+
server.registerTool(RollbackApp);
|
|
610
|
+
server.registerTool(ValidateAppRollback);
|
|
611
|
+
server.registerTool(CommitAppRollback);
|
|
612
|
+
server.registerTool(RevertAppRollback);
|
|
631
613
|
}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerDatabaseTools = registerDatabaseTools;
|
|
4
|
+
const api_1 = require("../api");
|
|
5
|
+
const digitalocean_openapi_yaml_zod_1 = require("../specs/digitalocean-openapi.yaml.zod");
|
|
6
|
+
const GetDatabaseOptions = {
|
|
7
|
+
name: "get_database_options",
|
|
8
|
+
description: `
|
|
9
|
+
Get a list of all database options available for creating a database cluster.
|
|
10
|
+
This includes available regions, versions, and sizes for each database engine.
|
|
11
|
+
`,
|
|
12
|
+
cb: async (extra) => {
|
|
13
|
+
try {
|
|
14
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
15
|
+
const res = await client.get("/v2/databases/options");
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
18
|
+
isError: true,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
return {
|
|
23
|
+
content: [
|
|
24
|
+
{ type: "text", text: `Error getting database options: ${error}` },
|
|
25
|
+
],
|
|
26
|
+
isError: true,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const ListDatabasesCluster = {
|
|
32
|
+
name: "list_databases_cluster",
|
|
33
|
+
description: `
|
|
34
|
+
List all database clusters in your account. This includes information about
|
|
35
|
+
each cluster's configuration, status, and connection details.
|
|
36
|
+
`,
|
|
37
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Databases_list_clusters.parameters.shape,
|
|
38
|
+
cb: async (params, extra) => {
|
|
39
|
+
try {
|
|
40
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
41
|
+
const res = await client.get("/v2/databases", params);
|
|
42
|
+
const databases = res.databases ?? [];
|
|
43
|
+
if (databases.length === 0) {
|
|
44
|
+
return {
|
|
45
|
+
content: [{ type: "text", text: "No database clusters found" }],
|
|
46
|
+
isError: true,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const content = [];
|
|
50
|
+
databases.forEach((db) => {
|
|
51
|
+
content.push({
|
|
52
|
+
type: "text",
|
|
53
|
+
text: `
|
|
54
|
+
Database Cluster ID: ${db.id}
|
|
55
|
+
Name: ${db.name}
|
|
56
|
+
Engine: ${db.engine}
|
|
57
|
+
Version: ${db.version}
|
|
58
|
+
Region: ${db.region}
|
|
59
|
+
Status: ${db.status}
|
|
60
|
+
Created At: ${db.created_at}
|
|
61
|
+
Number of Nodes: ${db.num_nodes}
|
|
62
|
+
Connection URI: ${db.connection?.uri || "N/A"}
|
|
63
|
+
`,
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
content,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return {
|
|
72
|
+
content: [
|
|
73
|
+
{ type: "text", text: `Error listing database clusters: ${error}` },
|
|
74
|
+
],
|
|
75
|
+
isError: true,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
const CreateDatabaseCluster = {
|
|
81
|
+
name: "create_database_cluster",
|
|
82
|
+
description: `Create a new database cluster.`,
|
|
83
|
+
parameters: digitalocean_openapi_yaml_zod_1.post_Databases_create_cluster.parameters.shape,
|
|
84
|
+
cb: async (params, extra) => {
|
|
85
|
+
try {
|
|
86
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
87
|
+
const res = await client.post("/v2/databases", params);
|
|
88
|
+
return {
|
|
89
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
return {
|
|
94
|
+
content: [
|
|
95
|
+
{ type: "text", text: `Error creating database cluster: ${error}` },
|
|
96
|
+
],
|
|
97
|
+
isError: true,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
const GetDatabaseCluster = {
|
|
103
|
+
name: "get_database_cluster",
|
|
104
|
+
description: `Get information about a specific database cluster.`,
|
|
105
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Databases_get_cluster.parameters.shape,
|
|
106
|
+
cb: async (params, extra) => {
|
|
107
|
+
try {
|
|
108
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
109
|
+
const res = await client.get("/v2/databases/{database_cluster_uuid}", params);
|
|
110
|
+
return {
|
|
111
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
return {
|
|
116
|
+
content: [
|
|
117
|
+
{ type: "text", text: `Error getting database cluster: ${error}` },
|
|
118
|
+
],
|
|
119
|
+
isError: true,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
const GetDatabaseClusterCertificate = {
|
|
125
|
+
name: "get_database_cluster_certificate",
|
|
126
|
+
description: `Get the certificate for a specific database cluster.`,
|
|
127
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Databases_get_ca.parameters.shape,
|
|
128
|
+
cb: async (params, extra) => {
|
|
129
|
+
try {
|
|
130
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
131
|
+
const res = await client.get("/v2/databases/{database_cluster_uuid}/ca", params);
|
|
132
|
+
return {
|
|
133
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
return {
|
|
138
|
+
content: [
|
|
139
|
+
{
|
|
140
|
+
type: "text",
|
|
141
|
+
text: `Error getting database cluster certificate: ${error}`,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
isError: true,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
const ListDatabaseFirewallRules = {
|
|
150
|
+
name: "list_database_firewall_rules",
|
|
151
|
+
description: `List all firewall (trusted sources) rules for a specific database cluster.`,
|
|
152
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Databases_list_firewall_rules.parameters.shape,
|
|
153
|
+
cb: async (params, extra) => {
|
|
154
|
+
try {
|
|
155
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
156
|
+
const res = await client.get("/v2/databases/{database_cluster_uuid}/firewall", params);
|
|
157
|
+
return {
|
|
158
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
return {
|
|
163
|
+
content: [
|
|
164
|
+
{
|
|
165
|
+
type: "text",
|
|
166
|
+
text: `Error listing database firewall rules: ${error}`,
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
isError: true,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
const UpdateDatabaseFirewallRules = {
|
|
175
|
+
name: "update_database_firewall_rules",
|
|
176
|
+
description: `Update the firewall (trusted sources) rules for a specific database cluster.`,
|
|
177
|
+
parameters: digitalocean_openapi_yaml_zod_1.put_Databases_update_firewall_rules.parameters.shape,
|
|
178
|
+
cb: async (params, extra) => {
|
|
179
|
+
try {
|
|
180
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
181
|
+
const res = await client.put("/v2/databases/{database_cluster_uuid}/firewall", params);
|
|
182
|
+
return {
|
|
183
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
return {
|
|
188
|
+
content: [
|
|
189
|
+
{
|
|
190
|
+
type: "text",
|
|
191
|
+
text: `Error updating database firewall rules: ${error}`,
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
isError: true,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
const ListDatabaseClusterUsers = {
|
|
200
|
+
name: "list_database_cluster_users",
|
|
201
|
+
description: `List all users for a specific database cluster.`,
|
|
202
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Databases_list_users.parameters.shape,
|
|
203
|
+
cb: async (params, extra) => {
|
|
204
|
+
try {
|
|
205
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
206
|
+
const res = await client.get("/v2/databases/{database_cluster_uuid}/users", params);
|
|
207
|
+
return {
|
|
208
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
return {
|
|
213
|
+
content: [
|
|
214
|
+
{ type: "text", text: `Error listing database users: ${error}` },
|
|
215
|
+
],
|
|
216
|
+
isError: true,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
const ListDatabaseClusterDatabases = {
|
|
222
|
+
name: "list_database_cluster_databases",
|
|
223
|
+
description: `List all databases for a specific database cluster.`,
|
|
224
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Databases_list.parameters.shape,
|
|
225
|
+
cb: async (params, extra) => {
|
|
226
|
+
try {
|
|
227
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
228
|
+
const res = await client.get("/v2/databases/{database_cluster_uuid}/dbs", params);
|
|
229
|
+
return {
|
|
230
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
231
|
+
_meta: res,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
return {
|
|
236
|
+
content: [
|
|
237
|
+
{
|
|
238
|
+
type: "text",
|
|
239
|
+
text: `Error listing database cluster databases: ${error}`,
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
isError: true,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
const ListDatabaseConnectionPools = {
|
|
248
|
+
name: "list_database_connection_pools",
|
|
249
|
+
description: `List all connection pools for a specific database cluster.`,
|
|
250
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Databases_list_connectionPools.parameters.shape,
|
|
251
|
+
cb: async (params, extra) => {
|
|
252
|
+
try {
|
|
253
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
254
|
+
const res = await client.get("/v2/databases/{database_cluster_uuid}/pools", params);
|
|
255
|
+
return {
|
|
256
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
return {
|
|
261
|
+
content: [
|
|
262
|
+
{
|
|
263
|
+
type: "text",
|
|
264
|
+
text: `Error listing database connection pools: ${error}`,
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
isError: true,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
const ListDatabaseTopics = {
|
|
273
|
+
name: "list_database_topics",
|
|
274
|
+
description: `List all topics for a specific database kafka cluster.`,
|
|
275
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Databases_list_kafka_topics.parameters.shape,
|
|
276
|
+
cb: async (params, extra) => {
|
|
277
|
+
try {
|
|
278
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
279
|
+
const res = await client.get("/v2/databases/{database_cluster_uuid}/topics", params);
|
|
280
|
+
return {
|
|
281
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
return {
|
|
286
|
+
content: [
|
|
287
|
+
{ type: "text", text: `Error listing database topics: ${error}` },
|
|
288
|
+
],
|
|
289
|
+
isError: true,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
function registerDatabaseTools(server) {
|
|
295
|
+
server.registerTool(GetDatabaseOptions);
|
|
296
|
+
server.registerTool(ListDatabasesCluster);
|
|
297
|
+
server.registerTool(CreateDatabaseCluster);
|
|
298
|
+
server.registerTool(ListDatabaseFirewallRules);
|
|
299
|
+
server.registerTool(UpdateDatabaseFirewallRules);
|
|
300
|
+
server.registerTool(GetDatabaseCluster);
|
|
301
|
+
server.registerTool(ListDatabaseClusterUsers);
|
|
302
|
+
server.registerTool(ListDatabaseClusterDatabases);
|
|
303
|
+
server.registerTool(GetDatabaseClusterCertificate);
|
|
304
|
+
server.registerTool(ListDatabaseConnectionPools);
|
|
305
|
+
server.registerTool(ListDatabaseTopics);
|
|
306
|
+
}
|