Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/mcp/tools/compose/composeCleanQueues.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { z } from "zod";
import apiClient from "../../../utils/apiClient.js";
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
import { createTool } from "../toolFactory.js";

export const composeCleanQueues = createTool({
name: "compose-cleanQueues",
description:
"Cleans the deployment queues for a compose stack in Dokploy. Use this to unstick a stuck deployment.",
schema: z.object({
composeId: z
.string()
.min(1)
.describe("The ID of the compose stack to clean queues for."),
}),
annotations: {
title: "Clean Compose Queues",
destructiveHint: false,
idempotentHint: true,
openWorldHint: true,
},
handler: async (input) => {
const response = await apiClient.post("/compose.cleanQueues", input);

return ResponseFormatter.success(
`Compose stack "${input.composeId}" queues cleaned successfully`,
response.data
);
},
});
29 changes: 29 additions & 0 deletions src/mcp/tools/compose/composeDeploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { z } from "zod";
import apiClient from "../../../utils/apiClient.js";
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
import { createTool } from "../toolFactory.js";

export const composeDeploy = createTool({
name: "compose-deploy",
description: "Deploys a compose stack in Dokploy.",
schema: z.object({
composeId: z
.string()
.min(1)
.describe("The ID of the compose stack to deploy."),
}),
annotations: {
title: "Deploy Compose Stack",
destructiveHint: false,
idempotentHint: false,
openWorldHint: true,
},
handler: async (input) => {
const response = await apiClient.post("/compose.deploy", input);

return ResponseFormatter.success(
`Compose stack "${input.composeId}" deployment started successfully`,
response.data
);
},
});
32 changes: 32 additions & 0 deletions src/mcp/tools/compose/composeOne.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { z } from "zod";
import apiClient from "../../../utils/apiClient.js";
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
import { createTool } from "../toolFactory.js";

export const composeOne = createTool({
name: "compose-one",
description: "Retrieves details of a specific compose stack in Dokploy.",
schema: z.object({
composeId: z
.string()
.min(1)
.describe("The ID of the compose stack to retrieve."),
}),
annotations: {
title: "Get Compose Stack",
readOnlyHint: true,
destructiveHint: false,
idempotentHint: true,
openWorldHint: true,
},
handler: async (input) => {
const response = await apiClient.get("/compose.one", {
params: input,
});

return ResponseFormatter.success(
`Compose stack "${input.composeId}" retrieved successfully`,
response.data
);
},
});
29 changes: 29 additions & 0 deletions src/mcp/tools/compose/composeRedeploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { z } from "zod";
import apiClient from "../../../utils/apiClient.js";
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
import { createTool } from "../toolFactory.js";

export const composeRedeploy = createTool({
name: "compose-redeploy",
description: "Redeploys a compose stack in Dokploy (pulls latest images and restarts).",
schema: z.object({
composeId: z
.string()
.min(1)
.describe("The ID of the compose stack to redeploy."),
}),
annotations: {
title: "Redeploy Compose Stack",
destructiveHint: false,
idempotentHint: false,
openWorldHint: true,
},
handler: async (input) => {
const response = await apiClient.post("/compose.redeploy", input);

return ResponseFormatter.success(
`Compose stack "${input.composeId}" redeployment started successfully`,
response.data
);
},
});
29 changes: 29 additions & 0 deletions src/mcp/tools/compose/composeStart.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { z } from "zod";
import apiClient from "../../../utils/apiClient.js";
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
import { createTool } from "../toolFactory.js";

export const composeStart = createTool({
name: "compose-start",
description: "Starts a compose stack in Dokploy.",
schema: z.object({
composeId: z
.string()
.min(1)
.describe("The ID of the compose stack to start."),
}),
annotations: {
title: "Start Compose Stack",
destructiveHint: false,
idempotentHint: false,
openWorldHint: true,
},
handler: async (input) => {
const response = await apiClient.post("/compose.start", input);

return ResponseFormatter.success(
`Compose stack "${input.composeId}" started successfully`,
response.data
);
},
});
29 changes: 29 additions & 0 deletions src/mcp/tools/compose/composeStop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { z } from "zod";
import apiClient from "../../../utils/apiClient.js";
import { ResponseFormatter } from "../../../utils/responseFormatter.js";
import { createTool } from "../toolFactory.js";

export const composeStop = createTool({
name: "compose-stop",
description: "Stops a running compose stack in Dokploy.",
schema: z.object({
composeId: z
.string()
.min(1)
.describe("The ID of the compose stack to stop."),
}),
annotations: {
title: "Stop Compose Stack",
destructiveHint: false,
idempotentHint: false,
openWorldHint: true,
},
handler: async (input) => {
const response = await apiClient.post("/compose.stop", input);

return ResponseFormatter.success(
`Compose stack "${input.composeId}" stopped successfully`,
response.data
);
},
});
6 changes: 6 additions & 0 deletions src/mcp/tools/compose/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export { composeOne } from "./composeOne.js";
export { composeDeploy } from "./composeDeploy.js";
export { composeRedeploy } from "./composeRedeploy.js";
export { composeStart } from "./composeStart.js";
export { composeStop } from "./composeStop.js";
export { composeCleanQueues } from "./composeCleanQueues.js";
2 changes: 2 additions & 0 deletions src/mcp/tools/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as applicationTools from "./application/index.js";
import * as composeTools from "./compose/index.js";
import * as domainTools from "./domain/index.js";
import * as mysqlTools from "./mysql/index.js";
import * as postgresTools from "./postgres/index.js";
Expand All @@ -7,6 +8,7 @@ import * as projectTools from "./project/index.js";
export const allTools = [
...Object.values(projectTools),
...Object.values(applicationTools),
...Object.values(composeTools),
...Object.values(domainTools),
...Object.values(mysqlTools),
...Object.values(postgresTools),
Expand Down