@hanzo/platform-mcp 1.4.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.
Files changed (83) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +534 -0
  3. package/build/http-server.js +286 -0
  4. package/build/index.js +35 -0
  5. package/build/mcp/tools/application/applicationCleanQueues.js +23 -0
  6. package/build/mcp/tools/application/applicationCreate.js +39 -0
  7. package/build/mcp/tools/application/applicationDelete.js +21 -0
  8. package/build/mcp/tools/application/applicationDeploy.js +21 -0
  9. package/build/mcp/tools/application/applicationMarkRunning.js +23 -0
  10. package/build/mcp/tools/application/applicationMove.js +22 -0
  11. package/build/mcp/tools/application/applicationOne.js +26 -0
  12. package/build/mcp/tools/application/applicationReadAppMonitoring.js +26 -0
  13. package/build/mcp/tools/application/applicationReadTraefikConfig.js +26 -0
  14. package/build/mcp/tools/application/applicationRedeploy.js +23 -0
  15. package/build/mcp/tools/application/applicationRefreshToken.js +23 -0
  16. package/build/mcp/tools/application/applicationReload.js +22 -0
  17. package/build/mcp/tools/application/applicationSaveBitbucketProvider.js +49 -0
  18. package/build/mcp/tools/application/applicationSaveBuildType.js +56 -0
  19. package/build/mcp/tools/application/applicationSaveDockerProvider.js +43 -0
  20. package/build/mcp/tools/application/applicationSaveEnvironment.js +33 -0
  21. package/build/mcp/tools/application/applicationSaveGitProvider.js +49 -0
  22. package/build/mcp/tools/application/applicationSaveGiteaProvider.js +43 -0
  23. package/build/mcp/tools/application/applicationSaveGithubProvider.js +51 -0
  24. package/build/mcp/tools/application/applicationSaveGitlabProvider.js +48 -0
  25. package/build/mcp/tools/application/applicationStart.js +21 -0
  26. package/build/mcp/tools/application/applicationStop.js +21 -0
  27. package/build/mcp/tools/application/applicationUpdate.js +319 -0
  28. package/build/mcp/tools/application/applicationUpdateTraefikConfig.js +26 -0
  29. package/build/mcp/tools/application/index.js +24 -0
  30. package/build/mcp/tools/compose/composeCreate.js +31 -0
  31. package/build/mcp/tools/compose/composeDeploy.js +26 -0
  32. package/build/mcp/tools/compose/composeOne.js +24 -0
  33. package/build/mcp/tools/compose/composeReload.js +28 -0
  34. package/build/mcp/tools/compose/composeRemove.js +26 -0
  35. package/build/mcp/tools/compose/composeSaveEnvironment.js +28 -0
  36. package/build/mcp/tools/compose/composeStart.js +26 -0
  37. package/build/mcp/tools/compose/composeStop.js +26 -0
  38. package/build/mcp/tools/compose/composeUpdate.js +34 -0
  39. package/build/mcp/tools/compose/index.js +9 -0
  40. package/build/mcp/tools/index.js +12 -0
  41. package/build/mcp/tools/mysql/index.js +13 -0
  42. package/build/mcp/tools/mysql/mysqlChangeStatus.js +24 -0
  43. package/build/mcp/tools/mysql/mysqlCreate.js +50 -0
  44. package/build/mcp/tools/mysql/mysqlDeploy.js +21 -0
  45. package/build/mcp/tools/mysql/mysqlMove.js +24 -0
  46. package/build/mcp/tools/mysql/mysqlOne.js +23 -0
  47. package/build/mcp/tools/mysql/mysqlRebuild.js +21 -0
  48. package/build/mcp/tools/mysql/mysqlReload.js +22 -0
  49. package/build/mcp/tools/mysql/mysqlRemove.js +21 -0
  50. package/build/mcp/tools/mysql/mysqlSaveEnvironment.js +26 -0
  51. package/build/mcp/tools/mysql/mysqlSaveExternalPort.js +25 -0
  52. package/build/mcp/tools/mysql/mysqlStart.js +21 -0
  53. package/build/mcp/tools/mysql/mysqlStop.js +21 -0
  54. package/build/mcp/tools/mysql/mysqlUpdate.js +103 -0
  55. package/build/mcp/tools/postgres/index.js +13 -0
  56. package/build/mcp/tools/postgres/postgresChangeStatus.js +26 -0
  57. package/build/mcp/tools/postgres/postgresCreate.js +48 -0
  58. package/build/mcp/tools/postgres/postgresDeploy.js +23 -0
  59. package/build/mcp/tools/postgres/postgresMove.js +26 -0
  60. package/build/mcp/tools/postgres/postgresOne.js +26 -0
  61. package/build/mcp/tools/postgres/postgresRebuild.js +23 -0
  62. package/build/mcp/tools/postgres/postgresReload.js +26 -0
  63. package/build/mcp/tools/postgres/postgresRemove.js +23 -0
  64. package/build/mcp/tools/postgres/postgresSaveEnvironment.js +28 -0
  65. package/build/mcp/tools/postgres/postgresSaveExternalPort.js +27 -0
  66. package/build/mcp/tools/postgres/postgresStart.js +23 -0
  67. package/build/mcp/tools/postgres/postgresStop.js +23 -0
  68. package/build/mcp/tools/postgres/postgresUpdate.js +97 -0
  69. package/build/mcp/tools/project/index.js +6 -0
  70. package/build/mcp/tools/project/projectAll.js +68 -0
  71. package/build/mcp/tools/project/projectCreate.js +30 -0
  72. package/build/mcp/tools/project/projectDuplicate.js +54 -0
  73. package/build/mcp/tools/project/projectOne.js +24 -0
  74. package/build/mcp/tools/project/projectRemove.js +21 -0
  75. package/build/mcp/tools/project/projectUpdate.js +39 -0
  76. package/build/mcp/tools/toolFactory.js +60 -0
  77. package/build/server.js +12 -0
  78. package/build/types/platform.js +3 -0
  79. package/build/utils/apiClient.js +126 -0
  80. package/build/utils/clientConfig.js +37 -0
  81. package/build/utils/logger.js +38 -0
  82. package/build/utils/responseFormatter.js +33 -0
  83. package/package.json +63 -0
@@ -0,0 +1,319 @@
1
+ import { z } from "zod";
2
+ import apiClient from "../../../utils/apiClient.js";
3
+ import { ResponseFormatter } from "../../../utils/responseFormatter.js";
4
+ import { createTool } from "../toolFactory.js";
5
+ export const applicationUpdate = createTool({
6
+ name: "application-update",
7
+ description: "Updates an existing application in Platform.",
8
+ schema: z.object({
9
+ applicationId: z.string().describe("The ID of the application to update."),
10
+ name: z
11
+ .string()
12
+ .min(1)
13
+ .optional()
14
+ .describe("The new name of the application."),
15
+ appName: z
16
+ .string()
17
+ .optional()
18
+ .describe("The new app name of the application."),
19
+ description: z
20
+ .string()
21
+ .nullable()
22
+ .optional()
23
+ .describe("The new description for the application."),
24
+ env: z
25
+ .string()
26
+ .nullable()
27
+ .optional()
28
+ .describe("Environment variables for the application."),
29
+ previewEnv: z
30
+ .string()
31
+ .nullable()
32
+ .optional()
33
+ .describe("Preview environment variables."),
34
+ watchPaths: z
35
+ .array(z.string())
36
+ .nullable()
37
+ .optional()
38
+ .describe("Paths to watch for changes."),
39
+ previewBuildArgs: z
40
+ .string()
41
+ .nullable()
42
+ .optional()
43
+ .describe("Preview build arguments."),
44
+ previewWildcard: z
45
+ .string()
46
+ .nullable()
47
+ .optional()
48
+ .describe("Preview wildcard configuration."),
49
+ previewPort: z
50
+ .number()
51
+ .nullable()
52
+ .optional()
53
+ .describe("Preview port number."),
54
+ previewHttps: z.boolean().optional().describe("Enable HTTPS for preview."),
55
+ previewPath: z.string().nullable().optional().describe("Preview path."),
56
+ previewCertificateType: z
57
+ .enum(["letsencrypt", "none", "custom"])
58
+ .optional()
59
+ .describe("Preview certificate type."),
60
+ previewCustomCertResolver: z
61
+ .string()
62
+ .nullable()
63
+ .optional()
64
+ .describe("Custom certificate resolver for preview."),
65
+ previewLimit: z
66
+ .number()
67
+ .nullable()
68
+ .optional()
69
+ .describe("Preview deployment limit."),
70
+ isPreviewDeploymentsActive: z
71
+ .boolean()
72
+ .nullable()
73
+ .optional()
74
+ .describe("Whether preview deployments are active."),
75
+ buildArgs: z.string().nullable().optional().describe("Build arguments."),
76
+ memoryReservation: z
77
+ .string()
78
+ .nullable()
79
+ .optional()
80
+ .describe("Memory reservation for the application."),
81
+ memoryLimit: z
82
+ .string()
83
+ .nullable()
84
+ .optional()
85
+ .describe("Memory limit for the application."),
86
+ cpuReservation: z
87
+ .string()
88
+ .nullable()
89
+ .optional()
90
+ .describe("CPU reservation for the application."),
91
+ cpuLimit: z
92
+ .string()
93
+ .nullable()
94
+ .optional()
95
+ .describe("CPU limit for the application."),
96
+ title: z.string().nullable().optional().describe("Application title."),
97
+ enabled: z
98
+ .boolean()
99
+ .nullable()
100
+ .optional()
101
+ .describe("Whether the application is enabled."),
102
+ subtitle: z
103
+ .string()
104
+ .nullable()
105
+ .optional()
106
+ .describe("Application subtitle."),
107
+ command: z
108
+ .string()
109
+ .nullable()
110
+ .optional()
111
+ .describe("Command to run the application."),
112
+ refreshToken: z
113
+ .string()
114
+ .nullable()
115
+ .optional()
116
+ .describe("Refresh token for the application."),
117
+ sourceType: z
118
+ .enum(["github", "docker", "git", "gitlab", "bitbucket", "gitea", "drop"])
119
+ .optional()
120
+ .describe("Source type for the application."),
121
+ cleanCache: z
122
+ .boolean()
123
+ .nullable()
124
+ .optional()
125
+ .describe("Whether to clean cache on build."),
126
+ repository: z.string().nullable().optional().describe("Repository URL."),
127
+ owner: z.string().nullable().optional().describe("Repository owner."),
128
+ branch: z.string().nullable().optional().describe("Repository branch."),
129
+ buildPath: z
130
+ .string()
131
+ .nullable()
132
+ .optional()
133
+ .describe("Build path within repository."),
134
+ triggerType: z
135
+ .enum(["push", "tag"])
136
+ .nullable()
137
+ .optional()
138
+ .describe("Trigger type for deployments."),
139
+ autoDeploy: z
140
+ .boolean()
141
+ .nullable()
142
+ .optional()
143
+ .describe("Whether to auto-deploy."),
144
+ gitlabProjectId: z
145
+ .number()
146
+ .nullable()
147
+ .optional()
148
+ .describe("GitLab project ID."),
149
+ gitlabRepository: z
150
+ .string()
151
+ .nullable()
152
+ .optional()
153
+ .describe("GitLab repository."),
154
+ gitlabOwner: z
155
+ .string()
156
+ .nullable()
157
+ .optional()
158
+ .describe("GitLab repository owner."),
159
+ gitlabBranch: z.string().nullable().optional().describe("GitLab branch."),
160
+ gitlabBuildPath: z
161
+ .string()
162
+ .nullable()
163
+ .optional()
164
+ .describe("GitLab build path."),
165
+ gitlabPathNamespace: z
166
+ .string()
167
+ .nullable()
168
+ .optional()
169
+ .describe("GitLab path namespace."),
170
+ giteaRepository: z
171
+ .string()
172
+ .nullable()
173
+ .optional()
174
+ .describe("Gitea repository."),
175
+ giteaOwner: z
176
+ .string()
177
+ .nullable()
178
+ .optional()
179
+ .describe("Gitea repository owner."),
180
+ giteaBranch: z.string().nullable().optional().describe("Gitea branch."),
181
+ giteaBuildPath: z
182
+ .string()
183
+ .nullable()
184
+ .optional()
185
+ .describe("Gitea build path."),
186
+ bitbucketRepository: z
187
+ .string()
188
+ .nullable()
189
+ .optional()
190
+ .describe("Bitbucket repository."),
191
+ bitbucketOwner: z
192
+ .string()
193
+ .nullable()
194
+ .optional()
195
+ .describe("Bitbucket repository owner."),
196
+ bitbucketBranch: z
197
+ .string()
198
+ .nullable()
199
+ .optional()
200
+ .describe("Bitbucket branch."),
201
+ bitbucketBuildPath: z
202
+ .string()
203
+ .nullable()
204
+ .optional()
205
+ .describe("Bitbucket build path."),
206
+ username: z
207
+ .string()
208
+ .nullable()
209
+ .optional()
210
+ .describe("Username for authentication."),
211
+ password: z
212
+ .string()
213
+ .nullable()
214
+ .optional()
215
+ .describe("Password for authentication."),
216
+ dockerImage: z.string().nullable().optional().describe("Docker image."),
217
+ registryUrl: z
218
+ .string()
219
+ .nullable()
220
+ .optional()
221
+ .describe("Docker registry URL."),
222
+ customGitUrl: z.string().nullable().optional().describe("Custom Git URL."),
223
+ customGitBranch: z
224
+ .string()
225
+ .nullable()
226
+ .optional()
227
+ .describe("Custom Git branch."),
228
+ customGitBuildPath: z
229
+ .string()
230
+ .nullable()
231
+ .optional()
232
+ .describe("Custom Git build path."),
233
+ customGitSSHKeyId: z
234
+ .string()
235
+ .nullable()
236
+ .optional()
237
+ .describe("Custom Git SSH key ID."),
238
+ enableSubmodules: z
239
+ .boolean()
240
+ .optional()
241
+ .describe("Whether to enable Git submodules."),
242
+ dockerfile: z
243
+ .string()
244
+ .nullable()
245
+ .optional()
246
+ .describe("Dockerfile content or path."),
247
+ dockerContextPath: z
248
+ .string()
249
+ .nullable()
250
+ .optional()
251
+ .describe("Docker context path."),
252
+ dockerBuildStage: z
253
+ .string()
254
+ .nullable()
255
+ .optional()
256
+ .describe("Docker build stage."),
257
+ dropBuildPath: z
258
+ .string()
259
+ .nullable()
260
+ .optional()
261
+ .describe("Drop build path."),
262
+ replicas: z.number().optional().describe("Number of replicas."),
263
+ applicationStatus: z
264
+ .enum(["idle", "running", "done", "error"])
265
+ .optional()
266
+ .describe("Application status."),
267
+ buildType: z
268
+ .enum([
269
+ "dockerfile",
270
+ "heroku_buildpacks",
271
+ "paketo_buildpacks",
272
+ "nixpacks",
273
+ "static",
274
+ "railpack",
275
+ ])
276
+ .optional()
277
+ .describe("Build type."),
278
+ herokuVersion: z.string().nullable().optional().describe("Heroku version."),
279
+ publishDirectory: z
280
+ .string()
281
+ .nullable()
282
+ .optional()
283
+ .describe("Publish directory."),
284
+ createdAt: z.string().optional().describe("Creation date."),
285
+ registryId: z.string().nullable().optional().describe("Registry ID."),
286
+ projectId: z.string().optional().describe("Project ID."),
287
+ githubId: z
288
+ .string()
289
+ .nullable()
290
+ .optional()
291
+ .describe("GitHub integration ID."),
292
+ gitlabId: z
293
+ .string()
294
+ .nullable()
295
+ .optional()
296
+ .describe("GitLab integration ID."),
297
+ giteaId: z.string().nullable().optional().describe("Gitea integration ID."),
298
+ bitbucketId: z
299
+ .string()
300
+ .nullable()
301
+ .optional()
302
+ .describe("Bitbucket integration ID."),
303
+ serverId: z
304
+ .string()
305
+ .nullable()
306
+ .optional()
307
+ .describe("The ID of the server where the application is deployed."),
308
+ }),
309
+ annotations: {
310
+ title: "Update Application",
311
+ destructiveHint: true,
312
+ idempotentHint: false,
313
+ openWorldHint: true,
314
+ },
315
+ handler: async (input) => {
316
+ const response = await apiClient.post("/application.update", input);
317
+ return ResponseFormatter.success(`Application "${input.applicationId}" updated successfully`, response.data);
318
+ },
319
+ });
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ import apiClient from "../../../utils/apiClient.js";
3
+ import { ResponseFormatter } from "../../../utils/responseFormatter.js";
4
+ import { createTool } from "../toolFactory.js";
5
+ export const applicationUpdateTraefikConfig = createTool({
6
+ name: "application-updateTraefikConfig",
7
+ description: "Updates Traefik configuration for an application in Platform.",
8
+ schema: z.object({
9
+ applicationId: z
10
+ .string()
11
+ .describe("The ID of the application to update Traefik config for."),
12
+ traefikConfig: z
13
+ .string()
14
+ .describe("The new Traefik configuration content."),
15
+ }),
16
+ annotations: {
17
+ title: "Update Application Traefik Config",
18
+ destructiveHint: true,
19
+ idempotentHint: false,
20
+ openWorldHint: true,
21
+ },
22
+ handler: async (input) => {
23
+ const response = await apiClient.post("/application.updateTraefikConfig", input);
24
+ return ResponseFormatter.success(`Traefik configuration for application "${input.applicationId}" updated successfully`, response.data);
25
+ },
26
+ });
@@ -0,0 +1,24 @@
1
+ export { applicationCleanQueues } from "./applicationCleanQueues.js";
2
+ export { applicationCreate } from "./applicationCreate.js";
3
+ export { applicationDelete } from "./applicationDelete.js";
4
+ export { applicationDeploy } from "./applicationDeploy.js";
5
+ export { applicationMarkRunning } from "./applicationMarkRunning.js";
6
+ export { applicationMove } from "./applicationMove.js";
7
+ export { applicationOne } from "./applicationOne.js";
8
+ export { applicationReadAppMonitoring } from "./applicationReadAppMonitoring.js";
9
+ export { applicationReadTraefikConfig } from "./applicationReadTraefikConfig.js";
10
+ export { applicationRedeploy } from "./applicationRedeploy.js";
11
+ export { applicationRefreshToken } from "./applicationRefreshToken.js";
12
+ export { applicationReload } from "./applicationReload.js";
13
+ export { applicationSaveBitbucketProvider } from "./applicationSaveBitbucketProvider.js";
14
+ export { applicationSaveBuildType } from "./applicationSaveBuildType.js";
15
+ export { applicationSaveDockerProvider } from "./applicationSaveDockerProvider.js";
16
+ export { applicationSaveEnvironment } from "./applicationSaveEnvironment.js";
17
+ export { applicationSaveGiteaProvider } from "./applicationSaveGiteaProvider.js";
18
+ export { applicationSaveGithubProvider } from "./applicationSaveGithubProvider.js";
19
+ export { applicationSaveGitlabProvider } from "./applicationSaveGitlabProvider.js";
20
+ export { applicationSaveGitProvider } from "./applicationSaveGitProvider.js";
21
+ export { applicationStart } from "./applicationStart.js";
22
+ export { applicationStop } from "./applicationStop.js";
23
+ export { applicationUpdate } from "./applicationUpdate.js";
24
+ export { applicationUpdateTraefikConfig } from "./applicationUpdateTraefikConfig.js";
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ import apiClient from "../../../utils/apiClient.js";
3
+ import { createTool } from "../toolFactory.js";
4
+ import { ResponseFormatter } from "../../../utils/responseFormatter.js";
5
+ export const composeCreate = createTool({
6
+ name: "compose-create",
7
+ description: "Creates a new compose service in Platform",
8
+ schema: z.object({
9
+ name: z.string().describe("The name of the compose service"),
10
+ appName: z.string().optional().describe("Optional application name"),
11
+ description: z.string().nullable().describe("Description of the compose service"),
12
+ projectId: z.string().describe("The ID of the project"),
13
+ serverId: z.string().nullable().describe("The ID of the server"),
14
+ composeFile: z.string().optional().describe("Docker Compose file content"),
15
+ env: z.string().nullable().describe("Environment variables"),
16
+ composeType: z.enum(["docker-compose", "stack"]).default("docker-compose").describe("Type of compose service"),
17
+ }),
18
+ annotations: {
19
+ title: "Create Compose Service",
20
+ destructiveHint: false,
21
+ idempotentHint: false,
22
+ openWorldHint: false,
23
+ },
24
+ handler: async (input) => {
25
+ const compose = await apiClient.post("/compose.create", input);
26
+ if (!compose?.data) {
27
+ return ResponseFormatter.error("Failed to create compose service", "Could not create the compose service");
28
+ }
29
+ return ResponseFormatter.success(`Successfully created compose service "${input.name}"`, compose.data);
30
+ },
31
+ });
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ import apiClient from "../../../utils/apiClient.js";
3
+ import { createTool } from "../toolFactory.js";
4
+ import { ResponseFormatter } from "../../../utils/responseFormatter.js";
5
+ export const composeDeploy = createTool({
6
+ name: "compose-deploy",
7
+ description: "Deploys a compose service in Platform",
8
+ schema: z.object({
9
+ composeId: z.string().describe("The ID of the compose service to deploy"),
10
+ }),
11
+ annotations: {
12
+ title: "Deploy Compose Service",
13
+ destructiveHint: false,
14
+ idempotentHint: false,
15
+ openWorldHint: false,
16
+ },
17
+ handler: async (input) => {
18
+ const result = await apiClient.post("/compose.deploy", {
19
+ composeId: input.composeId
20
+ });
21
+ if (!result?.data) {
22
+ return ResponseFormatter.error("Failed to deploy compose service", `Could not deploy compose service with ID "${input.composeId}"`);
23
+ }
24
+ return ResponseFormatter.success(`Successfully deployed compose service "${input.composeId}"`, result.data);
25
+ },
26
+ });
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ import apiClient from "../../../utils/apiClient.js";
3
+ import { createTool } from "../toolFactory.js";
4
+ import { ResponseFormatter } from "../../../utils/responseFormatter.js";
5
+ export const composeOne = createTool({
6
+ name: "compose-one",
7
+ description: "Gets a specific compose service by its ID in Platform",
8
+ schema: z.object({
9
+ composeId: z.string().describe("The ID of the compose service to retrieve"),
10
+ }),
11
+ annotations: {
12
+ title: "Get Compose Service Details",
13
+ readOnlyHint: true,
14
+ idempotentHint: true,
15
+ openWorldHint: true,
16
+ },
17
+ handler: async (input) => {
18
+ const compose = await apiClient.get(`/compose.one?composeId=${input.composeId}`);
19
+ if (!compose?.data) {
20
+ return ResponseFormatter.error("Failed to fetch compose service", `Compose service with ID "${input.composeId}" not found`);
21
+ }
22
+ return ResponseFormatter.success(`Successfully fetched compose service "${input.composeId}"`, compose.data);
23
+ },
24
+ });
@@ -0,0 +1,28 @@
1
+ import { z } from "zod";
2
+ import apiClient from "../../../utils/apiClient.js";
3
+ import { createTool } from "../toolFactory.js";
4
+ import { ResponseFormatter } from "../../../utils/responseFormatter.js";
5
+ export const composeReload = createTool({
6
+ name: "compose-reload",
7
+ description: "Reloads a compose service in Platform",
8
+ schema: z.object({
9
+ composeId: z.string().describe("The ID of the compose service to reload"),
10
+ appName: z.string().describe("The application name"),
11
+ }),
12
+ annotations: {
13
+ title: "Reload Compose Service",
14
+ destructiveHint: false,
15
+ idempotentHint: false,
16
+ openWorldHint: false,
17
+ },
18
+ handler: async (input) => {
19
+ const result = await apiClient.post("/compose.reload", {
20
+ composeId: input.composeId,
21
+ appName: input.appName
22
+ });
23
+ if (!result?.data) {
24
+ return ResponseFormatter.error("Failed to reload compose service", `Could not reload compose service with ID "${input.composeId}"`);
25
+ }
26
+ return ResponseFormatter.success(`Successfully reloaded compose service "${input.composeId}"`, result.data);
27
+ },
28
+ });
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ import apiClient from "../../../utils/apiClient.js";
3
+ import { createTool } from "../toolFactory.js";
4
+ import { ResponseFormatter } from "../../../utils/responseFormatter.js";
5
+ export const composeRemove = createTool({
6
+ name: "compose-remove",
7
+ description: "Removes/deletes a compose service from Platform",
8
+ schema: z.object({
9
+ composeId: z.string().describe("The ID of the compose service to remove"),
10
+ }),
11
+ annotations: {
12
+ title: "Remove Compose Service",
13
+ destructiveHint: true,
14
+ idempotentHint: false,
15
+ openWorldHint: false,
16
+ },
17
+ handler: async (input) => {
18
+ const result = await apiClient.post("/compose.remove", {
19
+ composeId: input.composeId
20
+ });
21
+ if (!result?.data) {
22
+ return ResponseFormatter.error("Failed to remove compose service", `Could not remove compose service with ID "${input.composeId}"`);
23
+ }
24
+ return ResponseFormatter.success(`Successfully removed compose service "${input.composeId}"`, result.data);
25
+ },
26
+ });
@@ -0,0 +1,28 @@
1
+ import { z } from "zod";
2
+ import apiClient from "../../../utils/apiClient.js";
3
+ import { createTool } from "../toolFactory.js";
4
+ import { ResponseFormatter } from "../../../utils/responseFormatter.js";
5
+ export const composeSaveEnvironment = createTool({
6
+ name: "compose-saveEnvironment",
7
+ description: "Saves environment variables for a compose service in Platform",
8
+ schema: z.object({
9
+ composeId: z.string().describe("The ID of the compose service"),
10
+ env: z.string().nullable().describe("Environment variables to save"),
11
+ }),
12
+ annotations: {
13
+ title: "Save Compose Environment Variables",
14
+ destructiveHint: false,
15
+ idempotentHint: true,
16
+ openWorldHint: false,
17
+ },
18
+ handler: async (input) => {
19
+ const result = await apiClient.post("/compose.saveEnvironment", {
20
+ composeId: input.composeId,
21
+ env: input.env
22
+ });
23
+ if (!result?.data) {
24
+ return ResponseFormatter.error("Failed to save environment variables", `Could not save environment variables for compose service "${input.composeId}"`);
25
+ }
26
+ return ResponseFormatter.success(`Successfully saved environment variables for compose service "${input.composeId}"`, result.data);
27
+ },
28
+ });
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ import apiClient from "../../../utils/apiClient.js";
3
+ import { createTool } from "../toolFactory.js";
4
+ import { ResponseFormatter } from "../../../utils/responseFormatter.js";
5
+ export const composeStart = createTool({
6
+ name: "compose-start",
7
+ description: "Starts a compose service in Platform",
8
+ schema: z.object({
9
+ composeId: z.string().describe("The ID of the compose service to start"),
10
+ }),
11
+ annotations: {
12
+ title: "Start Compose Service",
13
+ destructiveHint: false,
14
+ idempotentHint: false,
15
+ openWorldHint: false,
16
+ },
17
+ handler: async (input) => {
18
+ const result = await apiClient.post("/compose.start", {
19
+ composeId: input.composeId
20
+ });
21
+ if (!result?.data) {
22
+ return ResponseFormatter.error("Failed to start compose service", `Could not start compose service with ID "${input.composeId}"`);
23
+ }
24
+ return ResponseFormatter.success(`Successfully started compose service "${input.composeId}"`, result.data);
25
+ },
26
+ });
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ import apiClient from "../../../utils/apiClient.js";
3
+ import { createTool } from "../toolFactory.js";
4
+ import { ResponseFormatter } from "../../../utils/responseFormatter.js";
5
+ export const composeStop = createTool({
6
+ name: "compose-stop",
7
+ description: "Stops a compose service in Platform",
8
+ schema: z.object({
9
+ composeId: z.string().describe("The ID of the compose service to stop"),
10
+ }),
11
+ annotations: {
12
+ title: "Stop Compose Service",
13
+ destructiveHint: false,
14
+ idempotentHint: true,
15
+ openWorldHint: false,
16
+ },
17
+ handler: async (input) => {
18
+ const result = await apiClient.post("/compose.stop", {
19
+ composeId: input.composeId
20
+ });
21
+ if (!result?.data) {
22
+ return ResponseFormatter.error("Failed to stop compose service", `Could not stop compose service with ID "${input.composeId}"`);
23
+ }
24
+ return ResponseFormatter.success(`Successfully stopped compose service "${input.composeId}"`, result.data);
25
+ },
26
+ });
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+ import apiClient from "../../../utils/apiClient.js";
3
+ import { createTool } from "../toolFactory.js";
4
+ import { ResponseFormatter } from "../../../utils/responseFormatter.js";
5
+ export const composeUpdate = createTool({
6
+ name: "compose-update",
7
+ description: "Updates an existing compose service in Platform",
8
+ schema: z.object({
9
+ composeId: z.string().describe("The ID of the compose service"),
10
+ name: z.string().optional().describe("New name for the compose service"),
11
+ appName: z.string().optional().describe("New application name"),
12
+ description: z.string().nullable().optional().describe("New description"),
13
+ env: z.string().nullable().optional().describe("New environment variables"),
14
+ composeFile: z.string().optional().describe("New Docker Compose file content"),
15
+ sourceType: z.enum(["git", "github", "gitlab", "bitbucket", "raw"]).optional().describe("Source type"),
16
+ composeType: z.enum(["docker-compose", "stack"]).optional().describe("Compose type"),
17
+ serverId: z.string().nullable().optional().describe("New server ID"),
18
+ composeStatus: z.enum(["idle", "running", "done", "error"]).optional().describe("Compose status"),
19
+ projectId: z.string().optional().describe("New project ID"),
20
+ }),
21
+ annotations: {
22
+ title: "Update Compose Service",
23
+ destructiveHint: false,
24
+ idempotentHint: true,
25
+ openWorldHint: false,
26
+ },
27
+ handler: async (input) => {
28
+ const compose = await apiClient.post("/compose.update", input);
29
+ if (!compose?.data) {
30
+ return ResponseFormatter.error("Failed to update compose service", `Could not update compose service with ID "${input.composeId}"`);
31
+ }
32
+ return ResponseFormatter.success(`Successfully updated compose service "${input.composeId}"`, compose.data);
33
+ },
34
+ });
@@ -0,0 +1,9 @@
1
+ export { composeOne } from "./composeOne.js";
2
+ export { composeCreate } from "./composeCreate.js";
3
+ export { composeUpdate } from "./composeUpdate.js";
4
+ export { composeDeploy } from "./composeDeploy.js";
5
+ export { composeStart } from "./composeStart.js";
6
+ export { composeStop } from "./composeStop.js";
7
+ export { composeReload } from "./composeReload.js";
8
+ export { composeRemove } from "./composeRemove.js";
9
+ export { composeSaveEnvironment } from "./composeSaveEnvironment.js";
@@ -0,0 +1,12 @@
1
+ import * as applicationTools from "./application/index.js";
2
+ import * as composeTools from "./compose/index.js";
3
+ import * as mysqlTools from "./mysql/index.js";
4
+ import * as postgresTools from "./postgres/index.js";
5
+ import * as projectTools from "./project/index.js";
6
+ export const allTools = [
7
+ ...Object.values(projectTools),
8
+ ...Object.values(applicationTools),
9
+ ...Object.values(mysqlTools),
10
+ ...Object.values(postgresTools),
11
+ ...Object.values(composeTools),
12
+ ];
@@ -0,0 +1,13 @@
1
+ export { mysqlChangeStatus } from "./mysqlChangeStatus.js";
2
+ export { mysqlCreate } from "./mysqlCreate.js";
3
+ export { mysqlDeploy } from "./mysqlDeploy.js";
4
+ export { mysqlMove } from "./mysqlMove.js";
5
+ export { mysqlOne } from "./mysqlOne.js";
6
+ export { mysqlRebuild } from "./mysqlRebuild.js";
7
+ export { mysqlReload } from "./mysqlReload.js";
8
+ export { mysqlRemove } from "./mysqlRemove.js";
9
+ export { mysqlSaveEnvironment } from "./mysqlSaveEnvironment.js";
10
+ export { mysqlSaveExternalPort } from "./mysqlSaveExternalPort.js";
11
+ export { mysqlStart } from "./mysqlStart.js";
12
+ export { mysqlStop } from "./mysqlStop.js";
13
+ export { mysqlUpdate } from "./mysqlUpdate.js";