@digitalocean/mcp 0.0.7
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 +153 -0
- package/build/DOMcpServer.js +18 -0
- package/build/api.js +94 -0
- package/build/index.js +18 -0
- package/build/logger.js +42 -0
- package/build/server.js +26 -0
- package/build/specs/digitalocean-openapi.yaml.zod.js +10231 -0
- package/build/tools/app.js +631 -0
- package/build/version.js +5 -0
- package/package.json +38 -0
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
exports.registerAppTools = registerAppTools;
|
|
5
|
+
const digitalocean_openapi_yaml_zod_1 = require("../specs/digitalocean-openapi.yaml.zod");
|
|
6
|
+
const api_1 = require("../api");
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
exports.ListApps = {
|
|
9
|
+
name: "list_apps",
|
|
10
|
+
description: `
|
|
11
|
+
List all apps on your account. Information about the current active
|
|
12
|
+
deployment as well as any in progress ones will also be included for
|
|
13
|
+
each app.
|
|
14
|
+
`,
|
|
15
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Apps_list.parameters.shape,
|
|
16
|
+
cb: async (params, extra) => {
|
|
17
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
18
|
+
const res = await client.get("/v2/apps", {
|
|
19
|
+
query: params.query,
|
|
20
|
+
});
|
|
21
|
+
const apps = res.apps ?? [];
|
|
22
|
+
if (apps.length === 0) {
|
|
23
|
+
return {
|
|
24
|
+
content: [{ type: "text", text: "No apps found" }],
|
|
25
|
+
isError: true,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const content = [];
|
|
29
|
+
apps.forEach((app) => {
|
|
30
|
+
content.push({
|
|
31
|
+
type: "text",
|
|
32
|
+
text: `App ID: ${app.id}\nName: ${app.spec.name}\nRegion: ${app.spec.region}\n`,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
content,
|
|
37
|
+
_meta: res,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
exports.CreateApp = {
|
|
42
|
+
name: "create_app",
|
|
43
|
+
description: `
|
|
44
|
+
Create a new app by submitting an app specification. For documentation
|
|
45
|
+
on app specifications ("AppSpec" objects), please refer to [the product
|
|
46
|
+
documentation](https://docs.digitalocean.com/products/app-platform/reference/app-spec/).
|
|
47
|
+
`,
|
|
48
|
+
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_create.parameters.shape,
|
|
49
|
+
cb: async (params, extra) => {
|
|
50
|
+
try {
|
|
51
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
52
|
+
const res = await client.post("/v2/apps", params);
|
|
53
|
+
return {
|
|
54
|
+
content: [{ type: "text", text: JSON.stringify(res.app, null, 2) }],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
return {
|
|
59
|
+
content: [{ type: "text", text: `Error creating app: ${error}` }],
|
|
60
|
+
isError: true,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
exports.GetApp = {
|
|
66
|
+
name: "get_app",
|
|
67
|
+
description: "Get an app by ID",
|
|
68
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Apps_get.parameters.shape,
|
|
69
|
+
cb: async (params, extra) => {
|
|
70
|
+
try {
|
|
71
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
72
|
+
const res = await client.get(`/v2/apps/{id}`, {
|
|
73
|
+
query: {},
|
|
74
|
+
path: params.path,
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
content: [{ type: "text", text: JSON.stringify(res.app, null, 2) }],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
return {
|
|
82
|
+
content: [{ type: "text", text: `Error getting app: ${error}` }],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
exports.UpdateApp = {
|
|
88
|
+
name: "update_app",
|
|
89
|
+
description: `
|
|
90
|
+
Update an existing app by submitting a new app specification. For
|
|
91
|
+
documentation on app specifications ("AppSpec" objects), please refer to
|
|
92
|
+
[the product documentation](https://docs.digitalocean.com/products/app-platform/reference/app-spec/).
|
|
93
|
+
`,
|
|
94
|
+
parameters: digitalocean_openapi_yaml_zod_1.put_Apps_update.parameters.shape,
|
|
95
|
+
cb: async (params, extra) => {
|
|
96
|
+
try {
|
|
97
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
98
|
+
const res = await client.put(`/v2/apps/{id}`, params);
|
|
99
|
+
const app = res.app;
|
|
100
|
+
return {
|
|
101
|
+
content: [{ type: "text", text: JSON.stringify(app, null, 2) }],
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
return {
|
|
106
|
+
content: [{ type: "text", text: `Error updating app: ${error}` }],
|
|
107
|
+
isError: true,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
exports.DeleteApp = {
|
|
113
|
+
name: "delete_app",
|
|
114
|
+
description: "Delete an app by ID",
|
|
115
|
+
parameters: digitalocean_openapi_yaml_zod_1.delete_Apps_delete.parameters.shape,
|
|
116
|
+
cb: async (params, extra) => {
|
|
117
|
+
try {
|
|
118
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
119
|
+
const res = await client.delete(`/v2/apps/{id}`, params);
|
|
120
|
+
return {
|
|
121
|
+
content: [{ type: "text", text: "Add successfully deleted" }],
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
return {
|
|
126
|
+
content: [{ type: "text", text: `Error deleting app: ${error}` }],
|
|
127
|
+
isError: true,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
};
|
|
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
|
+
const GetDeploymentLogsUrlSchema = zod_1.z.object({
|
|
155
|
+
deployment_id: zod_1.z
|
|
156
|
+
.string()
|
|
157
|
+
.describe("The ID of the deployment. If not provided, the active deployment will be used.")
|
|
158
|
+
.optional(),
|
|
159
|
+
type: zod_1.z.enum(["BUILD", "DEPLOY", "RUN", "RUN_RESTARTED"]),
|
|
160
|
+
app_id: zod_1.z.string().describe("The ID of the app."),
|
|
161
|
+
});
|
|
162
|
+
exports.GetDeploymentLogsUrl = {
|
|
163
|
+
name: "get_deployment_logs_url",
|
|
164
|
+
description: `
|
|
165
|
+
Get the URL of the logs for a deployment. Before fetching the logs, you need to
|
|
166
|
+
get the URL of the logs.
|
|
167
|
+
`,
|
|
168
|
+
parameters: GetDeploymentLogsUrlSchema.shape,
|
|
169
|
+
cb: async (params, extra) => {
|
|
170
|
+
try {
|
|
171
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
172
|
+
let content = [];
|
|
173
|
+
if (params.deployment_id) {
|
|
174
|
+
const res = await client.get(`/v2/apps/{app_id}/deployments/{deployment_id}/logs`, {
|
|
175
|
+
query: {
|
|
176
|
+
type: params.type,
|
|
177
|
+
},
|
|
178
|
+
path: {
|
|
179
|
+
app_id: params.app_id,
|
|
180
|
+
deployment_id: params.deployment_id,
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
content.push({
|
|
184
|
+
type: "text",
|
|
185
|
+
text: JSON.stringify(res, null, 2),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
const res = await client.get(`/v2/apps/{app_id}/logs`, {
|
|
190
|
+
query: {
|
|
191
|
+
type: params.type,
|
|
192
|
+
},
|
|
193
|
+
path: {
|
|
194
|
+
app_id: params.app_id,
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
content.push({
|
|
198
|
+
type: "text",
|
|
199
|
+
text: JSON.stringify(res, null, 2),
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
content,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
return {
|
|
208
|
+
content: [{ type: "text", text: `Error getting logs: ${error}` }],
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
const DownloadLogsSchema = zod_1.z.object({
|
|
214
|
+
url: zod_1.z.string().describe("The URL to the bucket containing the logs"),
|
|
215
|
+
});
|
|
216
|
+
exports.DownloadLogs = {
|
|
217
|
+
name: "download_logs",
|
|
218
|
+
description: `
|
|
219
|
+
Give the URL of the logs, download the logs and return them as a string.
|
|
220
|
+
`,
|
|
221
|
+
parameters: DownloadLogsSchema.shape,
|
|
222
|
+
cb: async (params, extra) => {
|
|
223
|
+
try {
|
|
224
|
+
const res = await fetch(params.url);
|
|
225
|
+
const text = await res.text();
|
|
226
|
+
return {
|
|
227
|
+
content: [{ type: "text", text }],
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
return {
|
|
232
|
+
content: [{ type: "text", text: `Error getting logs: ${error}` }],
|
|
233
|
+
isError: true,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
exports.ListDeployments = {
|
|
239
|
+
name: "list_deployments",
|
|
240
|
+
description: "List all deployments for an app",
|
|
241
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Apps_list_deployments.parameters.shape,
|
|
242
|
+
cb: async (params, extra) => {
|
|
243
|
+
try {
|
|
244
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
245
|
+
const res = await client.get(`/v2/apps/{app_id}/deployments`, params);
|
|
246
|
+
const deployments = res.deployments ?? [];
|
|
247
|
+
const content = [];
|
|
248
|
+
deployments.forEach((deployment) => {
|
|
249
|
+
content.push({
|
|
250
|
+
type: "text",
|
|
251
|
+
text: `Deployment ID: ${deployment.id}\nStatus: ${deployment.phase}\nCreated At: ${deployment.created_at}\nUpdated At: ${deployment.updated_at}\n `,
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
content.push({
|
|
255
|
+
type: "text",
|
|
256
|
+
text: `${JSON.stringify(res.links, null, 2)}`,
|
|
257
|
+
});
|
|
258
|
+
return {
|
|
259
|
+
content,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
return {
|
|
264
|
+
content: [
|
|
265
|
+
{ type: "text", text: `Error listing deployments: ${error}` },
|
|
266
|
+
],
|
|
267
|
+
isError: true,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
exports.CreateDeployment = {
|
|
273
|
+
name: "create_deployment",
|
|
274
|
+
description: "Create a new deployment for an app",
|
|
275
|
+
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_create_deployment.parameters.shape,
|
|
276
|
+
cb: async (params, extra) => {
|
|
277
|
+
try {
|
|
278
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
279
|
+
const res = await client.post(`/v2/apps/{app_id}/deployments`, params);
|
|
280
|
+
const deployment = res.deployment;
|
|
281
|
+
return {
|
|
282
|
+
content: [{ type: "text", text: JSON.stringify(deployment) }],
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
catch (error) {
|
|
286
|
+
return {
|
|
287
|
+
content: [
|
|
288
|
+
{ type: "text", text: `Error creating deployment: ${error}` },
|
|
289
|
+
],
|
|
290
|
+
isError: true,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
};
|
|
295
|
+
exports.GetDeployment = {
|
|
296
|
+
name: "get_deployment",
|
|
297
|
+
description: "Get a deployment by ID",
|
|
298
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Apps_get_deployment.parameters.shape,
|
|
299
|
+
cb: async (params, extra) => {
|
|
300
|
+
try {
|
|
301
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
302
|
+
const res = await client.get(`/v2/apps/{app_id}/deployments/{deployment_id}`, params);
|
|
303
|
+
const deployment = res.deployment;
|
|
304
|
+
return {
|
|
305
|
+
content: [{ type: "text", text: JSON.stringify(deployment) }],
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
return {
|
|
310
|
+
content: [{ type: "text", text: `Error getting deployment: ${error}` }],
|
|
311
|
+
isError: true,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
exports.CancelDeployment = {
|
|
317
|
+
name: "cancel_deployment",
|
|
318
|
+
description: "Cancel a deployment by ID",
|
|
319
|
+
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_cancel_deployment.parameters.shape,
|
|
320
|
+
cb: async (params, extra) => {
|
|
321
|
+
try {
|
|
322
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
323
|
+
const res = await client.post(`/v2/apps/{app_id}/deployments/{deployment_id}/cancel`, params);
|
|
324
|
+
return {
|
|
325
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
catch (error) {
|
|
329
|
+
return {
|
|
330
|
+
content: [
|
|
331
|
+
{ type: "text", text: `Error canceling deployment: ${error}` },
|
|
332
|
+
],
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
exports.ListInstanceSizes = {
|
|
338
|
+
name: "list_instance_sizes",
|
|
339
|
+
description: "List all instance sizes for `service`, `worker`, and `job` components supported by App Platform.",
|
|
340
|
+
parameters: undefined,
|
|
341
|
+
cb: async (extra) => {
|
|
342
|
+
try {
|
|
343
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
344
|
+
const res = await client.get("/v2/apps/tiers/instance_sizes");
|
|
345
|
+
const instanceSizes = res.instance_sizes ?? [];
|
|
346
|
+
const content = [];
|
|
347
|
+
instanceSizes.forEach((instanceSize) => {
|
|
348
|
+
content.push({
|
|
349
|
+
type: "text",
|
|
350
|
+
text: `${JSON.stringify(instanceSize, null, 2)}`,
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
return {
|
|
354
|
+
content,
|
|
355
|
+
_meta: {
|
|
356
|
+
instanceSizes,
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
catch (error) {
|
|
361
|
+
return {
|
|
362
|
+
content: [
|
|
363
|
+
{ type: "text", text: `Error listing instance sizes: ${error}` },
|
|
364
|
+
],
|
|
365
|
+
isError: true,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
};
|
|
370
|
+
exports.GetInstanceSizeBySlug = {
|
|
371
|
+
name: "get_instance_size_by_slug",
|
|
372
|
+
description: "Retrieve information about a specific instance size slug for `service`,`worker`, and `job` components.",
|
|
373
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Apps_get_instanceSize.parameters.shape,
|
|
374
|
+
cb: async (params, extra) => {
|
|
375
|
+
try {
|
|
376
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
377
|
+
const res = await client.get(`/v2/apps/tiers/instance_sizes/{slug}`, params);
|
|
378
|
+
return {
|
|
379
|
+
content: [{ type: "text", text: JSON.stringify(res.instance_size) }],
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
catch (error) {
|
|
383
|
+
return {
|
|
384
|
+
content: [
|
|
385
|
+
{ type: "text", text: `Error getting instance size: ${error}` },
|
|
386
|
+
],
|
|
387
|
+
isError: true,
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
};
|
|
392
|
+
exports.ListRegions = {
|
|
393
|
+
name: "list_app_regions",
|
|
394
|
+
description: "List all regions supported by App Platform.",
|
|
395
|
+
cb: async (extra) => {
|
|
396
|
+
try {
|
|
397
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
398
|
+
const res = await client.get("/v2/apps/regions");
|
|
399
|
+
const regions = res.regions ?? [];
|
|
400
|
+
const content = [];
|
|
401
|
+
regions.forEach((region) => {
|
|
402
|
+
content.push({
|
|
403
|
+
type: "text",
|
|
404
|
+
text: `Region: ${region.label}
|
|
405
|
+
Slug: ${region.slug}
|
|
406
|
+
Continent: ${region.continent}
|
|
407
|
+
Default: ${region.default ? "Yes" : "No"}
|
|
408
|
+
Disabled: ${region.disabled ? "Yes" : "No"}
|
|
409
|
+
`,
|
|
410
|
+
});
|
|
411
|
+
});
|
|
412
|
+
return {
|
|
413
|
+
content,
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
catch (error) {
|
|
417
|
+
return {
|
|
418
|
+
content: [{ type: "text", text: `Error listing regions: ${error}` }],
|
|
419
|
+
isError: true,
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
};
|
|
424
|
+
exports.ValidateAppSpec = {
|
|
425
|
+
name: "validate_app_spec",
|
|
426
|
+
description: `
|
|
427
|
+
Propose and validate a spec for a new or existing app. The request returns some
|
|
428
|
+
information about the proposed app, including app cost and upgrade cost.
|
|
429
|
+
If an existing app ID is specified, the app spec is treated as a
|
|
430
|
+
proposed update to the existing app.
|
|
431
|
+
`,
|
|
432
|
+
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_validate_appSpec.parameters.shape,
|
|
433
|
+
cb: async (params, extra) => {
|
|
434
|
+
try {
|
|
435
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
436
|
+
const res = await client.post("/v2/apps/propose", params);
|
|
437
|
+
return {
|
|
438
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
return {
|
|
443
|
+
content: [
|
|
444
|
+
{ type: "text", text: `Error validating app spec: ${error}` },
|
|
445
|
+
],
|
|
446
|
+
isError: true,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
};
|
|
451
|
+
exports.ListAppAlerts = {
|
|
452
|
+
name: "list_app_alerts",
|
|
453
|
+
description: `
|
|
454
|
+
List alerts associated to the app and any components. This includes
|
|
455
|
+
configuration information about the alerts including emails, slack
|
|
456
|
+
webhooks, and triggering events or conditions.
|
|
457
|
+
`,
|
|
458
|
+
parameters: digitalocean_openapi_yaml_zod_1.get_Apps_list_alerts.parameters.shape,
|
|
459
|
+
cb: async (params, extra) => {
|
|
460
|
+
try {
|
|
461
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
462
|
+
const res = await client.get(`/v2/apps/{app_id}/alerts`, params);
|
|
463
|
+
return {
|
|
464
|
+
content: [
|
|
465
|
+
{
|
|
466
|
+
type: "text",
|
|
467
|
+
text: JSON.stringify(res, null, 2),
|
|
468
|
+
},
|
|
469
|
+
],
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
catch (error) {
|
|
473
|
+
return {
|
|
474
|
+
content: [{ type: "text", text: `Error listing app alerts: ${error}` }],
|
|
475
|
+
isError: true,
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
};
|
|
480
|
+
exports.UpdateAppAlertDestinations = {
|
|
481
|
+
name: "update_app_alert_destinations",
|
|
482
|
+
description: "Update alert destinations for an app",
|
|
483
|
+
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_assign_alertDestinations.parameters.shape,
|
|
484
|
+
cb: async (params, extra) => {
|
|
485
|
+
try {
|
|
486
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
487
|
+
const res = await client.post(`/v2/apps/{app_id}/alerts/{alert_id}/destinations`, params);
|
|
488
|
+
return {
|
|
489
|
+
content: [{ type: "text", text: JSON.stringify(res) }],
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
catch (error) {
|
|
493
|
+
return {
|
|
494
|
+
content: [
|
|
495
|
+
{ type: "text", text: `Error updating alert destinations: ${error}` },
|
|
496
|
+
],
|
|
497
|
+
isError: true,
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
};
|
|
502
|
+
exports.RollbackApp = {
|
|
503
|
+
name: "rollback_app",
|
|
504
|
+
description: `
|
|
505
|
+
Rollback an app to a previous deployment. A new deployment will be
|
|
506
|
+
created to perform the rollback.
|
|
507
|
+
The app will be pinned to the rollback deployment preventing any new
|
|
508
|
+
deployments from being created, either manually or through Auto Deploy on Push webhooks.
|
|
509
|
+
To resume deployments, the rollback must beeither committed or reverted.
|
|
510
|
+
It is recommended to use the Validate App Rollback endpoint to double check if the rollback is valid and if there are any warnings.
|
|
511
|
+
`,
|
|
512
|
+
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_create_rollback.parameters.shape,
|
|
513
|
+
cb: async (params, extra) => {
|
|
514
|
+
try {
|
|
515
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
516
|
+
const res = await client.post(`/v2/apps/{app_id}/rollback`, params);
|
|
517
|
+
return {
|
|
518
|
+
content: [{ type: "text", text: JSON.stringify(res, null, 2) }],
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
catch (error) {
|
|
522
|
+
return {
|
|
523
|
+
content: [{ type: "text", text: `Error rolling back app: ${error}` }],
|
|
524
|
+
isError: true,
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
};
|
|
529
|
+
exports.ValidateAppRollback = {
|
|
530
|
+
name: "validate_app_rollback",
|
|
531
|
+
description: `
|
|
532
|
+
Check whether an app can be rolled back to a specific deployment. This
|
|
533
|
+
endpoint can also be used to check if there are any warnings or validation conditions that will
|
|
534
|
+
cause the rollback to proceed under un-ideal circumstances. For example, if a component must be rebuilt
|
|
535
|
+
as part of the rollback causing it to take longer than usual.
|
|
536
|
+
`,
|
|
537
|
+
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_validate_rollback.parameters.shape,
|
|
538
|
+
cb: async (params, extra) => {
|
|
539
|
+
try {
|
|
540
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
541
|
+
const res = await client.post(`/v2/apps/{app_id}/rollback/validate`, params);
|
|
542
|
+
return {
|
|
543
|
+
content: [{ type: "text", text: JSON.stringify(res, null, 2) }],
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
catch (error) {
|
|
547
|
+
return {
|
|
548
|
+
content: [
|
|
549
|
+
{ type: "text", text: `Error validating app rollback: ${error}` },
|
|
550
|
+
],
|
|
551
|
+
isError: true,
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
};
|
|
556
|
+
exports.CommitAppRollback = {
|
|
557
|
+
name: "commit_app_rollback",
|
|
558
|
+
description: `
|
|
559
|
+
Commit an app rollback. This action permanently applies the rollback and
|
|
560
|
+
unpins the app to resume new deployments.
|
|
561
|
+
`,
|
|
562
|
+
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_commit_rollback.parameters.shape,
|
|
563
|
+
cb: async (params, extra) => {
|
|
564
|
+
try {
|
|
565
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
566
|
+
await client.post(`/v2/apps/{app_id}/rollback/commit`, params);
|
|
567
|
+
return {
|
|
568
|
+
content: [
|
|
569
|
+
{ type: "text", text: "App rollback committed successfully." },
|
|
570
|
+
],
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
catch (error) {
|
|
574
|
+
return {
|
|
575
|
+
content: [
|
|
576
|
+
{ type: "text", text: `Error committing app rollback: ${error}` },
|
|
577
|
+
],
|
|
578
|
+
isError: true,
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
},
|
|
582
|
+
};
|
|
583
|
+
exports.RevertAppRollback = {
|
|
584
|
+
name: "revert_app_rollback",
|
|
585
|
+
description: `
|
|
586
|
+
Revert an app rollback. This action reverts the active rollback by
|
|
587
|
+
creating a new deployment from the latest app spec prior to the
|
|
588
|
+
rollback and unpins the app to resume new deployments.
|
|
589
|
+
`,
|
|
590
|
+
parameters: digitalocean_openapi_yaml_zod_1.post_Apps_revert_rollback.parameters.shape,
|
|
591
|
+
cb: async (params, extra) => {
|
|
592
|
+
try {
|
|
593
|
+
const { client } = (0, api_1.createClient)(extra);
|
|
594
|
+
const res = await client.post(`/v2/apps/{app_id}/rollback/revert`, params);
|
|
595
|
+
return {
|
|
596
|
+
content: [{ type: "text", text: JSON.stringify(res, null, 2) }],
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
catch (error) {
|
|
600
|
+
return {
|
|
601
|
+
content: [
|
|
602
|
+
{ type: "text", text: `Error reverting app rollback: ${error}` },
|
|
603
|
+
],
|
|
604
|
+
isError: true,
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
};
|
|
609
|
+
function registerAppTools(server) {
|
|
610
|
+
server.registerTool(exports.ListApps);
|
|
611
|
+
server.registerTool(exports.CreateApp);
|
|
612
|
+
server.registerTool(exports.GetApp);
|
|
613
|
+
server.registerTool(exports.UpdateApp);
|
|
614
|
+
server.registerTool(exports.DeleteApp);
|
|
615
|
+
server.registerTool(exports.RestartApp);
|
|
616
|
+
server.registerTool(exports.DownloadLogs); // Custom tool to download logs
|
|
617
|
+
server.registerTool(exports.ListDeployments);
|
|
618
|
+
server.registerTool(exports.CreateDeployment);
|
|
619
|
+
server.registerTool(exports.GetDeployment);
|
|
620
|
+
server.registerTool(exports.CancelDeployment);
|
|
621
|
+
server.registerTool(exports.ListInstanceSizes);
|
|
622
|
+
server.registerTool(exports.GetInstanceSizeBySlug);
|
|
623
|
+
server.registerTool(exports.ListRegions);
|
|
624
|
+
server.registerTool(exports.ValidateAppSpec);
|
|
625
|
+
server.registerTool(exports.ListAppAlerts);
|
|
626
|
+
server.registerTool(exports.UpdateAppAlertDestinations);
|
|
627
|
+
server.registerTool(exports.RollbackApp);
|
|
628
|
+
server.registerTool(exports.ValidateAppRollback);
|
|
629
|
+
server.registerTool(exports.CommitAppRollback);
|
|
630
|
+
server.registerTool(exports.RevertAppRollback);
|
|
631
|
+
}
|
package/build/version.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@digitalocean/mcp",
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"description": "DigitalOcean MCP",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/digitalocean/digitalocean-mcp"
|
|
8
|
+
},
|
|
9
|
+
"author": "DigitalOcean",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"mcp": "build/index.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"build"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"prebuild": "node -p \"'// This file is generated. Do not modify.\\nexport const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"dev": "tsc --watch",
|
|
24
|
+
"start:stdio": "node build/index.js",
|
|
25
|
+
"generate:schema": "npx typed-openapi src/specs/digitalocean-openapi.yaml -r zod"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@modelcontextprotocol/sdk": "^1.9.0",
|
|
29
|
+
"dotenv": "^16.5.0",
|
|
30
|
+
"zod": "^3.24.2"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^22.14.0",
|
|
34
|
+
"js-yaml": "^4.1.0",
|
|
35
|
+
"typed-openapi": "^0.10.1",
|
|
36
|
+
"typescript": "^5.8.3"
|
|
37
|
+
}
|
|
38
|
+
}
|