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
118 changes: 117 additions & 1 deletion TOOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ This document provides detailed information about all available tools in the Dok

## 📊 Overview

- **Total Tools**: 43
- **Total Tools**: 52
- **Project Tools**: 6
- **Application Tools**: 24
- **PostgreSQL Tools**: 13
- **Compose Tools**: 9

All tools include semantic annotations to help MCP clients understand their behavior and are designed to interact with the Dokploy API.

Expand Down Expand Up @@ -751,6 +752,121 @@ All tools include semantic annotations to help MCP clients understand their beha
}
```

## 🐳 Docker Compose Tools

### `compose-one`

- **Description**: Gets a specific compose service by its ID in Dokploy
- **Input Schema**:
```json
{
"composeId": "string"
}
```
- **Annotations**: Read-only, Idempotent
- **Required Fields**: `composeId`

### `compose-create`

- **Description**: Creates a new compose service in Dokploy
- **Input Schema**:
```json
{
"name": "string",
"appName": "string|optional",
"description": "string|null",
"projectId": "string",
"serverId": "string|null",
"composeFile": "string|optional",
"env": "string|null",
"composeType": "docker-compose|stack"
}
```
- **Annotations**: Creation tool (non-destructive)
- **Required Fields**: `name`, `projectId`
- **Default Values**: `composeType` defaults to "docker-compose"

### `compose-update`

- **Description**: Updates an existing compose service in Dokploy
- **Input Schema**: Complex schema with service configuration fields including name, environment, compose file content, and status
- **Annotations**: Non-destructive, Idempotent
- **Required Fields**: `composeId`

### `compose-deploy`

- **Description**: Deploys a compose service in Dokploy
- **Input Schema**:
```json
{
"composeId": "string"
}
```
- **Annotations**: Non-destructive
- **Required Fields**: `composeId`

### `compose-start`

- **Description**: Starts a compose service in Dokploy
- **Input Schema**:
```json
{
"composeId": "string"
}
```
- **Annotations**: Non-destructive
- **Required Fields**: `composeId`

### `compose-stop`

- **Description**: Stops a compose service in Dokploy
- **Input Schema**:
```json
{
"composeId": "string"
}
```
- **Annotations**: Non-destructive, Idempotent
- **Required Fields**: `composeId`

### `compose-reload`

- **Description**: Reloads a compose service in Dokploy
- **Input Schema**:
```json
{
"composeId": "string",
"appName": "string"
}
```
- **Annotations**: Non-destructive
- **Required Fields**: `composeId`, `appName`

### `compose-remove`

- **Description**: Removes/deletes a compose service from Dokploy
- **Input Schema**:
```json
{
"composeId": "string"
}
```
- **Annotations**: Destructive
- **Required Fields**: `composeId`

### `compose-saveEnvironment`

- **Description**: Saves environment variables for a compose service in Dokploy
- **Input Schema**:
```json
{
"composeId": "string",
"env": "string|null"
}
```
- **Annotations**: Non-destructive, Idempotent
- **Required Fields**: `composeId`

## 📝 Notes

- All nullable fields can accept `null` values but must be provided if marked as required
Expand Down
58 changes: 58 additions & 0 deletions src/mcp/tools/compose/composeCreate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { z } from "zod";
import apiClient from "../../../utils/apiClient.js";
import { createTool } from "../toolFactory.js";
import { ResponseFormatter } from "../../../utils/responseFormatter.js";

export const composeCreate = createTool({
name: "compose-create",
description: "Creates a new compose service in Dokploy.",
schema: z.object({
name: z.string().min(1).describe("The name of the compose service."),
appName: z
.string()
.optional()
.describe("The app name for the compose service."),
description: z
.string()
.nullable()
.optional()
.describe("An optional description for the compose service."),
projectId: z
.string()
.min(1)
.describe("The ID of the project where the compose service will be created."),
serverId: z
.string()
.nullable()
.optional()
.describe("The ID of the server where the compose service will be deployed."),
composeFile: z
.string()
.optional()
.describe("The docker-compose.yml content."),
env: z
.string()
.nullable()
.optional()
.describe("Environment variables for the compose service."),
composeType: z
.enum(["docker-compose", "stack"])
.optional()
.default("docker-compose")
.describe("The type of compose deployment."),
}),
annotations: {
title: "Create Compose Service",
destructiveHint: false,
idempotentHint: false,
openWorldHint: true,
},
handler: async (input) => {
const response = await apiClient.post("/compose.create", input);

return ResponseFormatter.success(
`Compose service "${input.name}" created successfully in project "${input.projectId}"`,
response.data
);
},
});
26 changes: 26 additions & 0 deletions src/mcp/tools/compose/composeDeploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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 service in Dokploy.",
schema: z.object({
composeId: z.string().describe("The ID of the compose service to deploy."),
}),
annotations: {
title: "Deploy Compose Service",
destructiveHint: false,
idempotentHint: false,
openWorldHint: true,
},
handler: async (input) => {
const response = await apiClient.post("/compose.deploy", input);

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

export const composeOne = createTool({
name: "compose-one",
description: "Gets a specific compose service by its ID in Dokploy.",
schema: z.object({
composeId: z
.string()
.describe("The ID of the compose service to retrieve."),
}),
annotations: {
title: "Get Compose Service Details",
readOnlyHint: true,
idempotentHint: true,
openWorldHint: true,
},
handler: async (input) => {
const compose = await apiClient.get(
`/compose.one?composeId=${input.composeId}`
);

if (!compose?.data) {
return ResponseFormatter.error(
"Failed to fetch compose service",
`Compose service with ID "${input.composeId}" not found`
);
}

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

export const composeReload = createTool({
name: "compose-reload",
description: "Reloads a compose service in Dokploy.",
schema: z.object({
composeId: z.string().describe("The ID of the compose service to reload."),
appName: z.string().describe("The app name of the compose service to reload."),
}),
annotations: {
title: "Reload Compose Service",
destructiveHint: false,
idempotentHint: false,
openWorldHint: true,
},
handler: async (input) => {
const response = await apiClient.post("/compose.reload", input);

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

export const composeRemove = createTool({
name: "compose-remove",
description: "Removes/deletes a compose service from Dokploy.",
schema: z.object({
composeId: z.string().describe("The ID of the compose service to remove."),
}),
annotations: {
title: "Remove Compose Service",
destructiveHint: true,
idempotentHint: false,
openWorldHint: true,
},
handler: async (input) => {
const response = await apiClient.post("/compose.remove", input);

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

export const composeSaveEnvironment = createTool({
name: "compose-saveEnvironment",
description: "Saves environment variables for a compose service in Dokploy.",
schema: z.object({
composeId: z
.string()
.describe("The ID of the compose service to save environment for."),
env: z
.string()
.nullable()
.optional()
.describe("Environment variables to save for the compose service."),
}),
annotations: {
title: "Save Compose Environment Variables",
destructiveHint: false,
idempotentHint: true,
openWorldHint: false,
},
handler: async (input) => {
const response = await apiClient.post("/compose.saveEnvironment", input);

return ResponseFormatter.success(
`Environment variables saved for compose service "${input.composeId}"`,
response.data
);
},
});
26 changes: 26 additions & 0 deletions src/mcp/tools/compose/composeStart.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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 service in Dokploy.",
schema: z.object({
composeId: z.string().describe("The ID of the compose service to start."),
}),
annotations: {
title: "Start Compose Service",
destructiveHint: false,
idempotentHint: false,
openWorldHint: true,
},
handler: async (input) => {
const response = await apiClient.post("/compose.start", input);

return ResponseFormatter.success(
`Compose service "${input.composeId}" started successfully`,
response.data
);
},
});
Loading