diff --git a/.gitignore b/.gitignore index af474db..1855c0a 100644 --- a/.gitignore +++ b/.gitignore @@ -131,3 +131,4 @@ junit.xml # Misc *.tgz *.tar.gz +TOOLS.md.backup diff --git a/TOOLS.md b/TOOLS.md index feca276..c30710d 100644 --- a/TOOLS.md +++ b/TOOLS.md @@ -4,1019 +4,347 @@ This document provides detailed information about all available tools in the Dok ## 📊 Overview -- **Total Tools**: 67 -- **Project Tools**: 6 -- **Application Tools**: 26 -- **Domain Tools**: 9 -- **PostgreSQL Tools**: 13 -- **MySQL Tools**: 13 +- **Total Tools**: 4 (consolidated from 67 individual tools) +- **dokploy_application**: Application and domain management (35 actions) +- **dokploy_project**: Project management (6 actions) +- **dokploy_postgres**: PostgreSQL database management (13 actions) +- **dokploy_mysql**: MySQL database management (13 actions) -All tools include semantic annotations (`readOnlyHint`, `destructiveHint`, `idempotentHint`) to help MCP clients understand their behavior. +All tools use a consolidated architecture with a mandatory **`action`** parameter to specify the operation, and an optional **`params`** object containing action-specific parameters. -## 🗂️ Project Management Tools +## 🏗️ Architecture -### `project-all` +Each consolidated tool follows this pattern: -- **Description**: Lists all projects in Dokploy -- **Input Schema**: None -- **Annotations**: Read-only, Idempotent -- **Example**: `{}` - -### `project-one` - -- **Description**: Gets a specific project by its ID in Dokploy -- **Input Schema**: - ```json - { - "projectId": "string" - } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `projectId` - -### `project-create` - -- **Description**: Creates a new project in Dokploy -- **Input Schema**: - ```json - { - "name": "string", - "description": "string|null", - "env": "string" - } - ``` -- **Annotations**: Non-destructive, Non-idempotent -- **Required Fields**: `name` -- **Optional Fields**: `description`, `env` - -### `project-update` - -- **Description**: Updates an existing project in Dokploy -- **Input Schema**: - ```json - { - "projectId": "string", - "name": "string", - "description": "string|null", - "createdAt": "string", - "organizationId": "string", - "env": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `projectId` -- **Optional Fields**: `name`, `description`, `createdAt`, `organizationId`, `env` - -### `project-duplicate` - -- **Description**: Duplicates an existing project in Dokploy with optional service selection -- **Input Schema**: - ```json - { - "sourceProjectId": "string", - "name": "string", - "description": "string", - "includeServices": "boolean", - "selectedServices": [ - { - "id": "string", - "type": "application|postgres|mariadb|mongo|mysql|redis|compose" - } - ] - } - ``` -- **Annotations**: Creation tool (non-destructive) -- **Required Fields**: `sourceProjectId`, `name` -- **Optional Fields**: `description`, `includeServices`, `selectedServices` - -### `project-remove` - -- **Description**: Removes/deletes an existing project in Dokploy -- **Input Schema**: - ```json - { - "projectId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `projectId` - -## 🚀 Application Management Tools - -### Core Application Operations - -#### `application-one` - -- **Description**: Gets a specific application by its ID in Dokploy -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `applicationId` - -#### `application-create` - -- **Description**: Creates a new application in Dokploy -- **Input Schema**: - ```json - { - "name": "string", - "appName": "string", - "description": "string|null", - "projectId": "string", - "serverId": "string|null" - } - ``` -- **Annotations**: Non-destructive, Non-idempotent -- **Required Fields**: `name`, `projectId` -- **Optional Fields**: `appName`, `description`, `serverId` - -#### `application-update` - -- **Description**: Updates an existing application in Dokploy -- **Input Schema**: Complex schema with 60+ fields including deployment settings, resource limits, networking, and monitoring configurations -- **Annotations**: Destructive -- **Required Fields**: `applicationId` -- **Optional Fields**: All application configuration fields (build settings, environment variables, resource limits, etc.) - -#### `application-delete` - -- **Description**: Deletes an application from Dokploy -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId` - -#### `application-move` - -- **Description**: Moves an application to a different project -- **Input Schema**: - ```json - { - "applicationId": "string", - "targetProjectId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId`, `targetProjectId` - -### Deployment & Lifecycle Operations - -#### `application-deploy` - -- **Description**: Deploys an application in Dokploy -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Non-destructive, Non-idempotent -- **Required Fields**: `applicationId` - -#### `application-redeploy` - -- **Description**: Redeploys an application in Dokploy -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Non-destructive, Non-idempotent -- **Required Fields**: `applicationId` - -#### `application-start` - -- **Description**: Starts an application in Dokploy -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Non-destructive, Non-idempotent -- **Required Fields**: `applicationId` - -#### `application-stop` - -- **Description**: Stops an application in Dokploy -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Destructive, Non-idempotent -- **Required Fields**: `applicationId` - -#### `application-cancelDeployment` - -- **Description**: Cancels an ongoing deployment for an application -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Destructive, Non-idempotent -- **Required Fields**: `applicationId` - -#### `application-reload` - -- **Description**: Reloads an application in Dokploy -- **Input Schema**: - ```json - { - "applicationId": "string", - "appName": "string" - } - ``` -- **Annotations**: Non-destructive, Non-idempotent -- **Required Fields**: `applicationId`, `appName` - -#### `application-markRunning` - -- **Description**: Marks an application as running in Dokploy -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Destructive, Non-idempotent -- **Required Fields**: `applicationId` - -### Configuration Management - -#### `application-saveBuildType` - -- **Description**: Saves build type configuration for an application -- **Input Schema**: - ```json - { - "applicationId": "string", - "buildType": "dockerfile|heroku|nixpacks|buildpacks|docker", - "dockerContextPath": "string|null", - "dockerBuildStage": "string|null", - "herokuVersion": "string|null" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId`, `buildType` -- **Optional Fields**: `dockerContextPath`, `dockerBuildStage`, `herokuVersion` - -#### `application-saveEnvironment` - -- **Description**: Saves environment configuration for an application -- **Input Schema**: - ```json - { - "applicationId": "string", - "env": "string|null", - "buildArgs": "string|null" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId` -- **Optional Fields**: `env`, `buildArgs` - -### Git Provider Configurations - -#### `application-saveGithubProvider` - -- **Description**: Saves GitHub provider configuration for an application -- **Input Schema**: - ```json - { - "applicationId": "string", - "repository": "string|null", - "branch": "string|null", - "owner": "string|null", - "buildPath": "string|null", - "githubId": "string|null", - "watchPaths": ["string"]|null, - "enableSubmodules": "boolean", - "triggerType": "push|tag" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId`, `owner`, `githubId`, `enableSubmodules` -- **Optional Fields**: `repository`, `branch`, `buildPath`, `watchPaths`, `triggerType` - -#### `application-saveGitlabProvider` - -- **Description**: Saves GitLab provider configuration for an application -- **Input Schema**: - ```json - { - "applicationId": "string", - "gitlabBranch": "string|null", - "gitlabBuildPath": "string|null", - "gitlabOwner": "string|null", - "gitlabRepository": "string|null", - "gitlabId": "string|null", - "gitlabProjectId": "number|null", - "gitlabPathNamespace": "string|null", - "watchPaths": ["string"]|null, - "enableSubmodules": "boolean" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId`, `gitlabBranch`, `gitlabBuildPath`, `gitlabOwner`, `gitlabRepository`, `gitlabId`, `gitlabProjectId`, `gitlabPathNamespace`, `enableSubmodules` -- **Optional Fields**: `watchPaths` - -#### `application-saveBitbucketProvider` - -- **Description**: Saves Bitbucket provider configuration for an application -- **Input Schema**: - ```json - { - "applicationId": "string", - "bitbucketBranch": "string|null", - "bitbucketBuildPath": "string|null", - "bitbucketOwner": "string|null", - "bitbucketRepository": "string|null", - "bitbucketId": "string|null", - "watchPaths": ["string"]|null, - "enableSubmodules": "boolean" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId`, `bitbucketBranch`, `bitbucketBuildPath`, `bitbucketOwner`, `bitbucketRepository`, `bitbucketId`, `enableSubmodules` -- **Optional Fields**: `watchPaths` - -#### `application-saveGiteaProvider` - -- **Description**: Saves Gitea provider configuration for an application -- **Input Schema**: - ```json - { - "applicationId": "string", - "giteaBranch": "string|null", - "giteaBuildPath": "string|null", - "giteaOwner": "string|null", - "giteaRepository": "string|null", - "giteaId": "string|null", - "watchPaths": ["string"]|null, - "enableSubmodules": "boolean" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId`, `giteaBranch`, `giteaBuildPath`, `giteaOwner`, `giteaRepository`, `giteaId`, `enableSubmodules` -- **Optional Fields**: `watchPaths` - -#### `application-saveGitProvider` - -- **Description**: Saves Git provider configuration for an application -- **Input Schema**: - ```json - { - "applicationId": "string", - "customGitUrl": "string|null", - "customGitBranch": "string|null", - "customGitBuildPath": "string|null", - "customGitSSHKeyId": "string|null", - "watchPaths": ["string"]|null, - "enableSubmodules": "boolean" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId`, `enableSubmodules` -- **Optional Fields**: `customGitUrl`, `customGitBranch`, `customGitBuildPath`, `customGitSSHKeyId`, `watchPaths` - -#### `application-saveDockerProvider` - -- **Description**: Saves Docker provider configuration for an application -- **Input Schema**: - ```json - { - "applicationId": "string", - "dockerImage": "string|null" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId`, `dockerImage` - -#### `application-disconnectGitProvider` - -- **Description**: Disconnects Git provider configuration from an application -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId` - -### Monitoring & Configuration - -#### `application-readAppMonitoring` - -- **Description**: Reads monitoring data for an application -- **Input Schema**: - ```json - { - "appName": "string" - } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `appName` - -#### `application-readTraefikConfig` - -- **Description**: Reads Traefik configuration for an application -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `applicationId` - -#### `application-updateTraefikConfig` - -- **Description**: Updates Traefik configuration for an application -- **Input Schema**: - ```json - { - "applicationId": "string", - "traefikConfig": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId`, `traefikConfig` - -### Utility Operations - -#### `application-refreshToken` - -- **Description**: Refreshes the token for an application -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Non-destructive -- **Required Fields**: `applicationId` - -#### `application-cleanQueues` - -- **Description**: Cleans deployment queues for an application -- **Input Schema**: - ```json - { - "applicationId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `applicationId` - -## 🌐 Domain Management Tools - -These tools manage domains for applications, compose services, and preview deployments, including SSL/TLS, routing, validation, and automatic suggestions. - -### `domain-byApplicationId` - -- **Description**: Retrieves all domains associated with a specific application in Dokploy -- **Input Schema**: - ```json - { - "applicationId": "string" +```json +{ + "action": "string", + "params": { + // Action-specific parameters } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `applicationId` +} +``` -### `domain-byComposeId` +The tool validates the action and routes to the appropriate underlying API endpoint with full parameter support. -- **Description**: Retrieves all domains associated with a specific compose stack/service in Dokploy -- **Input Schema**: - ```json - { - "composeId": "string" - } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `composeId` +--- -### `domain-one` +## 🗂️ dokploy_project -- **Description**: Retrieves a specific domain configuration by its ID in Dokploy -- **Input Schema**: - ```json - { - "domainId": "string" - } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `domainId` - -### `domain-create` - -- **Description**: Creates a new domain configuration (application, compose, or preview) with SSL options -- **Input Schema**: - ```json - { - "host": "string", - "path": "string|null", - "port": "number|null", - "https": "boolean", - "applicationId": "string|null", - "certificateType": "letsencrypt|none|custom", - "customCertResolver": "string|null", - "composeId": "string|null", - "serviceName": "string|null", - "domainType": "compose|application|preview|null", - "previewDeploymentId": "string|null", - "internalPath": "string|null", - "stripPath": "boolean" - } - ``` -- **Annotations**: Non-destructive, Non-idempotent -- **Required Fields**: `host`, `https`, `certificateType`, `stripPath` -- **Optional Fields**: `path`, `port`, `applicationId`, `customCertResolver`, `composeId`, `serviceName`, `domainType`, `previewDeploymentId`, `internalPath` - -### `domain-update` - -- **Description**: Updates an existing domain configuration (host, SSL, routing, service associations) -- **Input Schema**: - ```json - { - "domainId": "string", - "host": "string", - "path": "string|null", - "port": "number|null", - "https": "boolean", - "certificateType": "letsencrypt|none|custom", - "customCertResolver": "string|null", - "serviceName": "string|null", - "domainType": "compose|application|preview|null", - "internalPath": "string|null", - "stripPath": "boolean" - } - ``` -- **Annotations**: Non-destructive, Idempotent -- **Required Fields**: `domainId`, `host`, `https`, `certificateType`, `stripPath` -- **Optional Fields**: `path`, `port`, `customCertResolver`, `serviceName`, `domainType`, `internalPath` - -### `domain-delete` - -- **Description**: Deletes a domain configuration by ID -- **Input Schema**: - ```json - { - "domainId": "string" - } - ``` -- **Annotations**: Destructive, Non-idempotent -- **Required Fields**: `domainId` - -### `domain-validateDomain` - -- **Description**: Validates if a domain is correctly configured, optionally against a specific server IP -- **Input Schema**: - ```json - { - "domain": "string", - "serverIp": "string(optional)" - } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `domain` -- **Optional Fields**: `serverIp` - -### `domain-generateDomain` - -- **Description**: Generates a suggested domain for an application name, optionally scoped to a server -- **Input Schema**: - ```json - { - "appName": "string", - "serverId": "string(optional)" - } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `appName` -- **Optional Fields**: `serverId` - -### `domain-canGenerateTraefikMeDomains` - -- **Description**: Checks whether Traefik.me domains can be generated for a specific server -- **Input Schema**: - ```json - { - "serverId": "string" - } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `serverId` - -## 🐘 PostgreSQL Database Management Tools - -### Core Database Operations - -#### `postgres-create` - -- **Description**: Creates a new PostgreSQL database in Dokploy -- **Input Schema**: - ```json - { - "name": "string", - "appName": "string", - "databaseName": "string", - "databaseUser": "string", - "databasePassword": "string", - "dockerImage": "string", - "projectId": "string", - "description": "string|null", - "serverId": "string|null" - } - ``` -- **Annotations**: Creation tool (non-destructive) -- **Required Fields**: `name`, `appName`, `databaseName`, `databaseUser`, `databasePassword`, `projectId` -- **Optional Fields**: `dockerImage`, `description`, `serverId` - -#### `postgres-one` - -- **Description**: Gets a specific PostgreSQL database by its ID in Dokploy -- **Input Schema**: - ```json - { - "postgresId": "string" - } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `postgresId` +Consolidated tool for managing Dokploy projects. -#### `postgres-update` +### Supported Actions -- **Description**: Updates an existing PostgreSQL database in Dokploy -- **Input Schema**: Complex schema with database configuration fields including name, credentials, resource limits, and Docker settings -- **Annotations**: Destructive -- **Required Fields**: `postgresId` -- **Optional Fields**: All database configuration fields (name, credentials, memory/CPU limits, etc.) +| Action | Description | Key Parameters | +|--------|-------------|----------------| +| `list` | Lists all projects | None | +| `create` | Creates a new project | `name`, `description?`, `env?` | +| `get` | Gets a specific project | `projectId` | +| `update` | Updates an existing project | `projectId`, `name?`, `description?`, `env?` | +| `remove` | Removes/deletes a project | `projectId` | +| `duplicate` | Duplicates an existing project | `sourceProjectId`, `name`, `includeServices?`, `selectedServices?` | -#### `postgres-remove` +### Example Usage -- **Description**: Removes/deletes a PostgreSQL database from Dokploy -- **Input Schema**: - ```json - { - "postgresId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `postgresId` - -#### `postgres-move` - -- **Description**: Moves a PostgreSQL database to a different project -- **Input Schema**: - ```json - { - "postgresId": "string", - "targetProjectId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `postgresId`, `targetProjectId` - -### Lifecycle Management +#### List all projects +```json +{ + "action": "list", + "params": {} +} +``` -#### `postgres-deploy` +#### Create a project +```json +{ + "action": "create", + "params": { + "name": "My New Project", + "description": "Project description", + "env": "VARIABLE=value" + } +} +``` -- **Description**: Deploys a PostgreSQL database in Dokploy -- **Input Schema**: - ```json - { - "postgresId": "string" +#### Get a specific project +```json +{ + "action": "get", + "params": { + "projectId": "project-123" } - ``` -- **Annotations**: Destructive -- **Required Fields**: `postgresId` +} +``` -#### `postgres-start` +--- + +## 🚀 dokploy_application + +Consolidated tool for managing Dokploy applications and domains. This is the primary tool for application lifecycle management. + +### Application Actions + +| Action | Description | Key Parameters | +|--------|-------------|----------------| +| `create` | Creates a new application | `name`, `appName?`, `environmentId`, `description?`, `serverId?` | +| `delete` | Deletes an application | `applicationId` | +| `deploy` | Deploys an application | `applicationId`, `title?`, `description?` | +| `start` | Starts an application | `applicationId` | +| `stop` | Stops an application | `applicationId` | +| `update` | Updates application configuration | `applicationId`, [extensive configuration options] | +| `get` | Gets application details | `applicationId` | +| `redeploy` | Redeploys an application | `applicationId`, `title?`, `description?` | +| `reload` | Reloads an application | `applicationId` | +| `move` | Moves application to another environment | `applicationId`, `environmentId` | +| `cancelDeployment` | Cancels ongoing deployment | `applicationId` | +| `cleanQueues` | Cleans deployment queues | `applicationId` | +| `disconnectGitProvider` | Disconnects git provider | `applicationId` | +| `markRunning` | Marks application as running | `applicationId` | +| `readAppMonitoring` | Reads monitoring data | `applicationId` | +| `readTraefikConfig` | Reads Traefik configuration | `applicationId` | +| `refreshToken` | Refreshes access token | `applicationId` | + +### Git Provider Actions + +| Action | Description | Key Parameters | +|--------|-------------|----------------| +| `saveBitbucketProvider` | Configure Bitbucket provider | `applicationId`, `bitbucketId`, `repository`, `owner`, `branch`, `buildPath` | +| `saveGithubProvider` | Configure GitHub provider | `applicationId`, `githubId`, `repository`, `owner`, `branch`, `buildPath` | +| `saveGitlabProvider` | Configure GitLab provider | `applicationId`, `gitlabId`, `repository`, `owner`, `branch`, `buildPath` | +| `saveGiteaProvider` | Configure Gitea provider | `applicationId`, `giteaId`, `repository`, `owner`, `branch`, `buildPath` | +| `saveGitProvider` | Configure generic Git provider | `applicationId`, `customGitUrl`, `customGitBranch?`, `customGitBuildPath?` | + +### Configuration Actions + +| Action | Description | Key Parameters | +|--------|-------------|----------------| +| `saveBuildType` | Saves build configuration | `applicationId`, `buildType`, `dockerfile?`, `dockerImage?` | +| `saveDockerProvider` | Saves Docker provider settings | `applicationId`, `dockerImage`, `registryId?`, `username?`, `password?` | +| `saveEnvironment` | Saves environment variables | `applicationId`, `env?`, `buildArgs?` | +| `updateTraefikConfig` | Updates Traefik configuration | `applicationId`, [Traefik config options] | + +### Domain Actions + +| Action | Description | Key Parameters | +|--------|-------------|----------------| +| `domainCreate` | Creates a new domain | `applicationId?`, `composeId?`, `host`, `path?`, `port?`, `https?` | +| `domainDelete` | Deletes a domain | `domainId` | +| `domainUpdate` | Updates domain configuration | `domainId`, `host?`, `path?`, `port?`, `https?` | +| `domainGet` | Gets domain details | `domainId` | +| `domainByApplicationId` | Lists domains for application | `applicationId` | +| `domainByComposeId` | Lists domains for compose | `composeId` | +| `domainGenerateDomain` | Generates a domain | `applicationId?`, `composeId?` | +| `domainCanGenerateTraefikMeDomains` | Checks if Traefik.me domains can be generated | None | +| `domainValidate` | Validates a domain | `domainId` | + +### Example Usage + +#### Create an application +```json +{ + "action": "create", + "params": { + "name": "My App", + "appName": "my-app", + "environmentId": "env-123", + "description": "My application" + } +} +``` -- **Description**: Starts a PostgreSQL database in Dokploy -- **Input Schema**: - ```json - { - "postgresId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `postgresId` +#### Deploy an application +```json +{ + "action": "deploy", + "params": { + "applicationId": "app-123", + "title": "Production deployment", + "description": "Deploying v1.0.0" + } +} +``` -#### `postgres-stop` +#### Create a domain for an application +```json +{ + "action": "domainCreate", + "params": { + "applicationId": "app-123", + "host": "example.com", + "port": 3000, + "https": true + } +} +``` -- **Description**: Stops a PostgreSQL database in Dokploy -- **Input Schema**: - ```json - { - "postgresId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `postgresId` - -#### `postgres-reload` - -- **Description**: Reloads a PostgreSQL database in Dokploy -- **Input Schema**: - ```json - { - "postgresId": "string", - "appName": "string" +#### Save environment variables +```json +{ + "action": "saveEnvironment", + "params": { + "applicationId": "app-123", + "env": "NODE_ENV=production\nAPI_KEY=secret" } - ``` -- **Annotations**: Destructive -- **Required Fields**: `postgresId`, `appName` - -#### `postgres-rebuild` +} +``` -- **Description**: Rebuilds a PostgreSQL database in Dokploy -- **Input Schema**: - ```json - { - "postgresId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `postgresId` +--- -### Configuration Management +## 🗄️ dokploy_postgres -#### `postgres-changeStatus` +Consolidated tool for managing PostgreSQL databases in Dokploy. -- **Description**: Changes the status of a PostgreSQL database -- **Input Schema**: - ```json - { - "postgresId": "string", - "applicationStatus": "idle|running|done|error" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `postgresId`, `applicationStatus` - -#### `postgres-saveExternalPort` - -- **Description**: Saves external port configuration for a PostgreSQL database -- **Input Schema**: - ```json - { - "postgresId": "string", - "externalPort": "number|null" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `postgresId`, `externalPort` - -#### `postgres-saveEnvironment` - -- **Description**: Saves environment variables for a PostgreSQL database -- **Input Schema**: - ```json - { - "postgresId": "string", - "env": "string|null" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `postgresId` -- **Optional Fields**: `env` - -## 🐬 MySQL Database Management Tools - -Dokploy includes comprehensive MySQL database management capabilities. These tools mirror the PostgreSQL functionality but are tailored for MySQL databases with MySQL-specific features like root password management. - -### Core Database Operations - -#### `mysql-create` - -- **Description**: Creates a new MySQL database in Dokploy -- **Input Schema**: - ```json - { - "name": "string", - "appName": "string", - "databaseName": "string", - "databaseUser": "string", - "databasePassword": "string", - "databaseRootPassword": "string", - "dockerImage": "string", - "projectId": "string", - "description": "string|null", - "serverId": "string|null" - } - ``` -- **Annotations**: Creation tool (non-destructive) -- **Required Fields**: `name`, `appName`, `databaseName`, `databaseUser`, `databasePassword`, `databaseRootPassword`, `projectId` -- **Optional Fields**: `dockerImage` (defaults to "mysql:8"), `description`, `serverId` - -#### `mysql-one` - -- **Description**: Gets a specific MySQL database by its ID in Dokploy -- **Input Schema**: - ```json - { - "mysqlId": "string" - } - ``` -- **Annotations**: Read-only, Idempotent -- **Required Fields**: `mysqlId` +### Supported Actions -#### `mysql-update` +| Action | Description | Key Parameters | +|--------|-------------|----------------| +| `create` | Creates a new PostgreSQL database | `name`, `appName`, `databaseName`, `databaseUser`, `databasePassword`, `environmentId`, `dockerImage?`, `serverId?` | +| `remove` | Removes a PostgreSQL database | `postgresId` | +| `deploy` | Deploys a PostgreSQL database | `postgresId` | +| `start` | Starts a PostgreSQL database | `postgresId` | +| `stop` | Stops a PostgreSQL database | `postgresId` | +| `update` | Updates PostgreSQL configuration | `postgresId`, [configuration options] | +| `get` | Gets PostgreSQL database details | `postgresId` | +| `rebuild` | Rebuilds a PostgreSQL database | `postgresId` | +| `reload` | Reloads a PostgreSQL database | `postgresId` | +| `move` | Moves PostgreSQL to another environment | `postgresId`, `environmentId` | +| `changeStatus` | Changes database status | `postgresId`, `applicationStatus` | +| `saveEnvironment` | Saves environment variables | `postgresId`, `env?` | +| `saveExternalPort` | Saves external port configuration | `postgresId`, `externalPort` | -- **Description**: Updates an existing MySQL database in Dokploy -- **Input Schema**: Complex schema with database configuration fields including name, credentials, resource limits, and Docker settings -- **Annotations**: Destructive -- **Required Fields**: `mysqlId` -- **Optional Fields**: All database configuration fields (name, credentials, memory/CPU limits, etc.) +### Example Usage -#### `mysql-remove` +#### Create a PostgreSQL database +```json +{ + "action": "create", + "params": { + "name": "Production DB", + "appName": "prod-db", + "databaseName": "myapp", + "databaseUser": "dbuser", + "databasePassword": "securepassword", + "environmentId": "env-123", + "dockerImage": "postgres:15" + } +} +``` -- **Description**: Removes/deletes a MySQL database from Dokploy -- **Input Schema**: - ```json - { - "mysqlId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `mysqlId` - -#### `mysql-move` - -- **Description**: Moves a MySQL database to a different project -- **Input Schema**: - ```json - { - "mysqlId": "string", - "targetProjectId": "string" +#### Start a PostgreSQL database +```json +{ + "action": "start", + "params": { + "postgresId": "pg-123" } - ``` -- **Annotations**: Destructive -- **Required Fields**: `mysqlId`, `targetProjectId` - -### Lifecycle Management - -#### `mysql-deploy` +} +``` -- **Description**: Deploys a MySQL database in Dokploy -- **Input Schema**: - ```json - { - "mysqlId": "string" +#### Save external port +```json +{ + "action": "saveExternalPort", + "params": { + "postgresId": "pg-123", + "externalPort": 5432 } - ``` -- **Annotations**: Destructive -- **Required Fields**: `mysqlId` - -#### `mysql-start` +} +``` -- **Description**: Starts a MySQL database in Dokploy -- **Input Schema**: - ```json - { - "mysqlId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `mysqlId` +--- -#### `mysql-stop` +## 🗄️ dokploy_mysql -- **Description**: Stops a MySQL database in Dokploy -- **Input Schema**: - ```json - { - "mysqlId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `mysqlId` - -#### `mysql-reload` - -- **Description**: Reloads a MySQL database in Dokploy -- **Input Schema**: - ```json - { - "mysqlId": "string", - "appName": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `mysqlId`, `appName` +Consolidated tool for managing MySQL databases in Dokploy. -#### `mysql-rebuild` +### Supported Actions -- **Description**: Rebuilds a MySQL database in Dokploy -- **Input Schema**: - ```json - { - "mysqlId": "string" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `mysqlId` +| Action | Description | Key Parameters | +|--------|-------------|----------------| +| `create` | Creates a new MySQL database | `name`, `appName`, `databaseName`, `databaseUser`, `databasePassword`, `databaseRootPassword`, `environmentId`, `dockerImage?`, `serverId?` | +| `remove` | Removes a MySQL database | `mysqlId` | +| `deploy` | Deploys a MySQL database | `mysqlId` | +| `start` | Starts a MySQL database | `mysqlId` | +| `stop` | Stops a MySQL database | `mysqlId` | +| `update` | Updates MySQL configuration | `mysqlId`, [configuration options] | +| `get` | Gets MySQL database details | `mysqlId` | +| `rebuild` | Rebuilds a MySQL database | `mysqlId` | +| `reload` | Reloads a MySQL database | `mysqlId` | +| `move` | Moves MySQL to another environment | `mysqlId`, `environmentId` | +| `changeStatus` | Changes database status | `mysqlId`, `applicationStatus` | +| `saveEnvironment` | Saves environment variables | `mysqlId`, `env?` | +| `saveExternalPort` | Saves external port configuration | `mysqlId`, `externalPort` | -### Configuration Management +### Example Usage -#### `mysql-changeStatus` +#### Create a MySQL database +```json +{ + "action": "create", + "params": { + "name": "Production MySQL", + "appName": "prod-mysql", + "databaseName": "myapp", + "databaseUser": "dbuser", + "databasePassword": "securepassword", + "databaseRootPassword": "rootpassword", + "environmentId": "env-123", + "dockerImage": "mysql:8" + } +} +``` -- **Description**: Changes the status of a MySQL database -- **Input Schema**: - ```json - { - "mysqlId": "string", - "applicationStatus": "idle|running|done|error" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `mysqlId`, `applicationStatus` - -#### `mysql-saveExternalPort` - -- **Description**: Saves external port configuration for a MySQL database -- **Input Schema**: - ```json - { - "mysqlId": "string", - "externalPort": "number|null" - } - ``` -- **Annotations**: Destructive -- **Required Fields**: `mysqlId`, `externalPort` - -#### `mysql-saveEnvironment` - -- **Description**: Saves environment variables for a MySQL database -- **Input Schema**: - ```json - { - "mysqlId": "string", - "env": "string|null" +#### Deploy a MySQL database +```json +{ + "action": "deploy", + "params": { + "mysqlId": "mysql-123" } - ``` -- **Annotations**: Destructive -- **Required Fields**: `mysqlId` -- **Optional Fields**: `env` +} +``` -## 🏷️ Tool Annotations +--- -All tools include semantic annotations to help MCP clients understand their behavior: +## 🔐 Security Considerations -- **Read-Only** (`readOnlyHint: true`): Safe operations that only retrieve data - - Examples: `project-all`, `project-one`, `application-one`, `application-readTraefikConfig`, `postgres-one`, `mysql-one` +- All database passwords should follow strong password policies +- Environment variables may contain sensitive data - handle with care +- Use HTTPS for domains when possible +- Store API keys and credentials securely -- **Destructive** (`destructiveHint: true`): Operations that modify or delete resources irreversibly - - Examples: `project-update`, `project-remove`, `application-delete`, `application-stop`, `application-cancelDeployment` +## 📝 Notes -- **Non-Destructive** (`destructiveHint: false`): Operations that create resources or perform safe actions - - Examples: All create operations, deploy, start, reload operations +- The `params` object is optional for some actions (like `list`) but required for most operations +- All ID fields (applicationId, postgresId, mysqlId, projectId, etc.) are required when specified +- Optional parameters are marked with `?` in the parameter tables +- For detailed parameter schemas, refer to the individual tool implementations in the codebase -- **Idempotent** (`idempotentHint: true`): Operations safe to repeat without side effects - - Examples: All read-only operations +## 🔄 Migration from Individual Tools -- **External API** (`openWorldHint: true`): All tools interact with external Dokploy API +If you were using the previous individual tools (e.g., `application-deploy`, `postgres-create`), you can migrate by: -## 🔧 Quick Start Examples +1. Changing the tool name to the consolidated version (e.g., `dokploy_application`, `dokploy_postgres`) +2. Moving the tool name's action suffix to the `action` parameter (e.g., `deploy`) +3. Moving all other parameters into the `params` object -### Project & Application Workflow +**Before:** ```json -// Create project → Create application → Configure Git → Deploy -{"tool": "project-create", "input": {"name": "my-project"}} -{"tool": "application-create", "input": {"name": "my-app", "projectId": "..."}} -{"tool": "application-saveGithubProvider", "input": {"applicationId": "...", "repository": "owner/repo", "branch": "main"}} -{"tool": "application-deploy", "input": {"applicationId": "..."}} +{ + "tool": "application-deploy", + "applicationId": "app-123", + "title": "Deploy v1.0" +} ``` -### Database Workflow +**After:** ```json -// Create → Deploy → Configure -{"tool": "postgres-create", "input": {"name": "my-db", "databaseName": "app", "databaseUser": "user", "databasePassword": "pass", "projectId": "..."}} -{"tool": "postgres-deploy", "input": {"postgresId": "..."}} -{"tool": "postgres-saveExternalPort", "input": {"postgresId": "...", "externalPort": 5432}} +{ + "tool": "dokploy_application", + "action": "deploy", + "params": { + "applicationId": "app-123", + "title": "Deploy v1.0" + } +} ``` - -## 📝 Important Notes - -- Nullable fields accept `null` but must be provided if marked required -- Provider tools use prefixed fields: `gitlabBranch`, `giteaOwner`, `bitbucketRepository` -- Resource limits use string format: `"512m"`, `"1g"`, `"0.5"` -- MySQL requires both `databasePassword` and `databaseRootPassword` -- Default images: PostgreSQL `postgres:latest`, MySQL `mysql:8` -- All tools include comprehensive error handling and Zod validation diff --git a/src/mcp/tools/consolidated/dokployApplication.ts b/src/mcp/tools/consolidated/dokployApplication.ts new file mode 100644 index 0000000..a168f00 --- /dev/null +++ b/src/mcp/tools/consolidated/dokployApplication.ts @@ -0,0 +1,164 @@ +import { z } from "zod"; +import { ResponseFormatter } from "../../../utils/responseFormatter.js"; +import { createTool } from "../toolFactory.js"; + +// Import all individual application tool schemas for reuse +import { applicationCancelDeployment } from "../application/applicationCancelDeployment.js"; +import { applicationCleanQueues } from "../application/applicationCleanQueues.js"; +import { applicationCreate } from "../application/applicationCreate.js"; +import { applicationDelete } from "../application/applicationDelete.js"; +import { applicationDeploy } from "../application/applicationDeploy.js"; +import { applicationDisconnectGitProvider } from "../application/applicationDisconnectGitProvider.js"; +import { applicationMarkRunning } from "../application/applicationMarkRunning.js"; +import { applicationMove } from "../application/applicationMove.js"; +import { applicationOne } from "../application/applicationOne.js"; +import { applicationReadAppMonitoring } from "../application/applicationReadAppMonitoring.js"; +import { applicationReadTraefikConfig } from "../application/applicationReadTraefikConfig.js"; +import { applicationRedeploy } from "../application/applicationRedeploy.js"; +import { applicationRefreshToken } from "../application/applicationRefreshToken.js"; +import { applicationReload } from "../application/applicationReload.js"; +import { applicationSaveBitbucketProvider } from "../application/applicationSaveBitbucketProvider.js"; +import { applicationSaveBuildType } from "../application/applicationSaveBuildType.js"; +import { applicationSaveDockerProvider } from "../application/applicationSaveDockerProvider.js"; +import { applicationSaveEnvironment } from "../application/applicationSaveEnvironment.js"; +import { applicationSaveGitProvider } from "../application/applicationSaveGitProvider.js"; +import { applicationSaveGiteaProvider } from "../application/applicationSaveGiteaProvider.js"; +import { applicationSaveGithubProvider } from "../application/applicationSaveGithubProvider.js"; +import { applicationSaveGitlabProvider } from "../application/applicationSaveGitlabProvider.js"; +import { applicationStart } from "../application/applicationStart.js"; +import { applicationStop } from "../application/applicationStop.js"; +import { applicationUpdate } from "../application/applicationUpdate.js"; +import { applicationUpdateTraefikConfig } from "../application/applicationUpdateTraefikConfig.js"; + +// Import all individual domain tool schemas for reuse +import { domainByApplicationId } from "../domain/domainByApplicationId.js"; +import { domainByComposeId } from "../domain/domainByComposeId.js"; +import { domainCanGenerateTraefikMeDomains } from "../domain/domainCanGenerateTraefikMeDomains.js"; +import { domainCreate } from "../domain/domainCreate.js"; +import { domainDelete } from "../domain/domainDelete.js"; +import { domainGenerateDomain } from "../domain/domainGenerateDomain.js"; +import { domainOne } from "../domain/domainOne.js"; +import { domainUpdate } from "../domain/domainUpdate.js"; +import { domainValidateDomain } from "../domain/domainValidateDomain.js"; + +export const dokployApplication = createTool({ + name: "dokploy_application", + description: + "Consolidated tool for managing Dokploy applications and domains. Supports multiple actions for applications: create, delete, deploy, start, stop, update, get, redeploy, reload, move, cancelDeployment, cleanQueues, disconnectGitProvider, markRunning, readAppMonitoring, readTraefikConfig, refreshToken, saveBitbucketProvider, saveBuildType, saveDockerProvider, saveEnvironment, saveGitProvider, saveGiteaProvider, saveGithubProvider, saveGitlabProvider, updateTraefikConfig. Supports domain actions: domainCreate, domainDelete, domainUpdate, domainGet, domainByApplicationId, domainByComposeId, domainGenerateDomain, domainCanGenerateTraefikMeDomains, domainValidate.", + schema: z.object({ + action: z + .enum([ + "create", + "delete", + "deploy", + "start", + "stop", + "update", + "get", + "redeploy", + "reload", + "move", + "cancelDeployment", + "cleanQueues", + "disconnectGitProvider", + "markRunning", + "readAppMonitoring", + "readTraefikConfig", + "refreshToken", + "saveBitbucketProvider", + "saveBuildType", + "saveDockerProvider", + "saveEnvironment", + "saveGitProvider", + "saveGiteaProvider", + "saveGithubProvider", + "saveGitlabProvider", + "updateTraefikConfig", + "domainCreate", + "domainDelete", + "domainUpdate", + "domainGet", + "domainByApplicationId", + "domainByComposeId", + "domainGenerateDomain", + "domainCanGenerateTraefikMeDomains", + "domainValidate", + ]) + .describe( + "The action to perform. Application actions: create, delete, deploy, start, stop, update, get, redeploy, reload, move, cancelDeployment, cleanQueues, disconnectGitProvider, markRunning, readAppMonitoring, readTraefikConfig, refreshToken, saveBitbucketProvider, saveBuildType, saveDockerProvider, saveEnvironment, saveGitProvider, saveGiteaProvider, saveGithubProvider, saveGitlabProvider, updateTraefikConfig. Domain actions: domainCreate, domainDelete, domainUpdate, domainGet, domainByApplicationId, domainByComposeId, domainGenerateDomain, domainCanGenerateTraefikMeDomains, domainValidate" + ), + // Make parameters optional so they can be passed based on the action + params: z + .record(z.any()) + .optional() + .describe( + "Parameters for the action. The required parameters vary by action. See individual tool documentation for details." + ), + }), + annotations: { + title: "Manage Dokploy Application", + destructiveHint: false, // Will be dynamically set based on action + idempotentHint: false, + openWorldHint: true, + }, + handler: async (input) => { + const { action, params = {} } = input; + + // Map actions to their corresponding tool handlers + const actionMap: Record = { + create: applicationCreate, + delete: applicationDelete, + deploy: applicationDeploy, + start: applicationStart, + stop: applicationStop, + update: applicationUpdate, + get: applicationOne, + redeploy: applicationRedeploy, + reload: applicationReload, + move: applicationMove, + cancelDeployment: applicationCancelDeployment, + cleanQueues: applicationCleanQueues, + disconnectGitProvider: applicationDisconnectGitProvider, + markRunning: applicationMarkRunning, + readAppMonitoring: applicationReadAppMonitoring, + readTraefikConfig: applicationReadTraefikConfig, + refreshToken: applicationRefreshToken, + saveBitbucketProvider: applicationSaveBitbucketProvider, + saveBuildType: applicationSaveBuildType, + saveDockerProvider: applicationSaveDockerProvider, + saveEnvironment: applicationSaveEnvironment, + saveGitProvider: applicationSaveGitProvider, + saveGiteaProvider: applicationSaveGiteaProvider, + saveGithubProvider: applicationSaveGithubProvider, + saveGitlabProvider: applicationSaveGitlabProvider, + updateTraefikConfig: applicationUpdateTraefikConfig, + domainCreate: domainCreate, + domainDelete: domainDelete, + domainUpdate: domainUpdate, + domainGet: domainOne, + domainByApplicationId: domainByApplicationId, + domainByComposeId: domainByComposeId, + domainGenerateDomain: domainGenerateDomain, + domainCanGenerateTraefikMeDomains: domainCanGenerateTraefikMeDomains, + domainValidate: domainValidateDomain, + }; + + const tool = actionMap[action]; + if (!tool) { + return ResponseFormatter.error( + "Invalid action", + `Action "${action}" is not supported` + ); + } + + // Call the corresponding tool handler with the provided params + try { + return await tool.handler(params); + } catch (error) { + return ResponseFormatter.error( + `Failed to execute action "${action}"`, + error instanceof Error ? error.message : "Unknown error" + ); + } + }, +}); diff --git a/src/mcp/tools/consolidated/dokployMysql.ts b/src/mcp/tools/consolidated/dokployMysql.ts new file mode 100644 index 0000000..5f59d31 --- /dev/null +++ b/src/mcp/tools/consolidated/dokployMysql.ts @@ -0,0 +1,96 @@ +import { z } from "zod"; +import { ResponseFormatter } from "../../../utils/responseFormatter.js"; +import { createTool } from "../toolFactory.js"; + +// Import all individual MySQL tool schemas for reuse +import { mysqlChangeStatus } from "../mysql/mysqlChangeStatus.js"; +import { mysqlCreate } from "../mysql/mysqlCreate.js"; +import { mysqlDeploy } from "../mysql/mysqlDeploy.js"; +import { mysqlMove } from "../mysql/mysqlMove.js"; +import { mysqlOne } from "../mysql/mysqlOne.js"; +import { mysqlRebuild } from "../mysql/mysqlRebuild.js"; +import { mysqlReload } from "../mysql/mysqlReload.js"; +import { mysqlRemove } from "../mysql/mysqlRemove.js"; +import { mysqlSaveEnvironment } from "../mysql/mysqlSaveEnvironment.js"; +import { mysqlSaveExternalPort } from "../mysql/mysqlSaveExternalPort.js"; +import { mysqlStart } from "../mysql/mysqlStart.js"; +import { mysqlStop } from "../mysql/mysqlStop.js"; +import { mysqlUpdate } from "../mysql/mysqlUpdate.js"; + +export const dokployMysql = createTool({ + name: "dokploy_mysql", + description: + "Consolidated tool for managing Dokploy MySQL databases. Supports multiple actions: create, remove, deploy, start, stop, update, get, rebuild, reload, move, changeStatus, saveEnvironment, saveExternalPort.", + schema: z.object({ + action: z + .enum([ + "create", + "remove", + "deploy", + "start", + "stop", + "update", + "get", + "rebuild", + "reload", + "move", + "changeStatus", + "saveEnvironment", + "saveExternalPort", + ]) + .describe( + "The action to perform on the MySQL database: create, remove, deploy, start, stop, update, get, rebuild, reload, move, changeStatus, saveEnvironment, saveExternalPort" + ), + params: z + .record(z.any()) + .optional() + .describe( + "Parameters for the action. The required parameters vary by action. See individual tool documentation for details." + ), + }), + annotations: { + title: "Manage Dokploy MySQL Database", + destructiveHint: false, // Will be dynamically set based on action + idempotentHint: false, + openWorldHint: true, + }, + handler: async (input) => { + const { action, params = {} } = input; + + // Map actions to their corresponding tool handlers + const actionMap: Record = { + create: mysqlCreate, + remove: mysqlRemove, + deploy: mysqlDeploy, + start: mysqlStart, + stop: mysqlStop, + update: mysqlUpdate, + get: mysqlOne, + rebuild: mysqlRebuild, + reload: mysqlReload, + move: mysqlMove, + changeStatus: mysqlChangeStatus, + saveEnvironment: mysqlSaveEnvironment, + saveExternalPort: mysqlSaveExternalPort, + }; + + const tool = actionMap[action]; + + if (!tool) { + return ResponseFormatter.error( + "Invalid action", + `Action "${action}" is not supported for MySQL database` + ); + } + + // Call the corresponding tool handler with the provided params + try { + return await tool.handler(params); + } catch (error) { + return ResponseFormatter.error( + `Failed to execute MySQL action "${action}"`, + error instanceof Error ? error.message : "Unknown error" + ); + } + }, +}); diff --git a/src/mcp/tools/consolidated/dokployPostgres.ts b/src/mcp/tools/consolidated/dokployPostgres.ts new file mode 100644 index 0000000..b1a95dc --- /dev/null +++ b/src/mcp/tools/consolidated/dokployPostgres.ts @@ -0,0 +1,96 @@ +import { z } from "zod"; +import { ResponseFormatter } from "../../../utils/responseFormatter.js"; +import { createTool } from "../toolFactory.js"; + +// Import all individual PostgreSQL tool schemas for reuse +import { postgresChangeStatus } from "../postgres/postgresChangeStatus.js"; +import { postgresCreate } from "../postgres/postgresCreate.js"; +import { postgresDeploy } from "../postgres/postgresDeploy.js"; +import { postgresMove } from "../postgres/postgresMove.js"; +import { postgresOne } from "../postgres/postgresOne.js"; +import { postgresRebuild } from "../postgres/postgresRebuild.js"; +import { postgresReload } from "../postgres/postgresReload.js"; +import { postgresRemove } from "../postgres/postgresRemove.js"; +import { postgresSaveEnvironment } from "../postgres/postgresSaveEnvironment.js"; +import { postgresSaveExternalPort } from "../postgres/postgresSaveExternalPort.js"; +import { postgresStart } from "../postgres/postgresStart.js"; +import { postgresStop } from "../postgres/postgresStop.js"; +import { postgresUpdate } from "../postgres/postgresUpdate.js"; + +export const dokployPostgres = createTool({ + name: "dokploy_postgres", + description: + "Consolidated tool for managing Dokploy PostgreSQL databases. Supports multiple actions: create, remove, deploy, start, stop, update, get, rebuild, reload, move, changeStatus, saveEnvironment, saveExternalPort.", + schema: z.object({ + action: z + .enum([ + "create", + "remove", + "deploy", + "start", + "stop", + "update", + "get", + "rebuild", + "reload", + "move", + "changeStatus", + "saveEnvironment", + "saveExternalPort", + ]) + .describe( + "The action to perform on the PostgreSQL database: create, remove, deploy, start, stop, update, get, rebuild, reload, move, changeStatus, saveEnvironment, saveExternalPort" + ), + params: z + .record(z.any()) + .optional() + .describe( + "Parameters for the action. The required parameters vary by action. See individual tool documentation for details." + ), + }), + annotations: { + title: "Manage Dokploy PostgreSQL Database", + destructiveHint: false, // Will be dynamically set based on action + idempotentHint: false, + openWorldHint: true, + }, + handler: async (input) => { + const { action, params = {} } = input; + + // Map actions to their corresponding tool handlers + const actionMap: Record = { + create: postgresCreate, + remove: postgresRemove, + deploy: postgresDeploy, + start: postgresStart, + stop: postgresStop, + update: postgresUpdate, + get: postgresOne, + rebuild: postgresRebuild, + reload: postgresReload, + move: postgresMove, + changeStatus: postgresChangeStatus, + saveEnvironment: postgresSaveEnvironment, + saveExternalPort: postgresSaveExternalPort, + }; + + const tool = actionMap[action]; + + if (!tool) { + return ResponseFormatter.error( + "Invalid action", + `Action "${action}" is not supported for PostgreSQL database` + ); + } + + // Call the corresponding tool handler with the provided params + try { + return await tool.handler(params); + } catch (error) { + return ResponseFormatter.error( + `Failed to execute PostgreSQL action "${action}"`, + error instanceof Error ? error.message : "Unknown error" + ); + } + }, +}); diff --git a/src/mcp/tools/consolidated/dokployProject.ts b/src/mcp/tools/consolidated/dokployProject.ts new file mode 100644 index 0000000..260097e --- /dev/null +++ b/src/mcp/tools/consolidated/dokployProject.ts @@ -0,0 +1,67 @@ +import { z } from "zod"; +import { ResponseFormatter } from "../../../utils/responseFormatter.js"; +import { createTool } from "../toolFactory.js"; + +// Import all individual tool schemas for reuse +import { projectAll } from "../project/projectAll.js"; +import { projectCreate } from "../project/projectCreate.js"; +import { projectDuplicate } from "../project/projectDuplicate.js"; +import { projectOne } from "../project/projectOne.js"; +import { projectRemove } from "../project/projectRemove.js"; +import { projectUpdate } from "../project/projectUpdate.js"; + +export const dokployProject = createTool({ + name: "dokploy_project", + description: + "Consolidated tool for managing Dokploy projects. Supports multiple actions: list, create, get, update, remove, duplicate.", + schema: z.object({ + action: z + .enum(["list", "create", "get", "update", "remove", "duplicate"]) + .describe( + "The action to perform on the project: list (all projects), create, get (specific project), update, remove, duplicate" + ), + params: z + .record(z.any()) + .optional() + .describe( + "Parameters for the action. The required parameters vary by action. See individual tool documentation for details." + ), + }), + annotations: { + title: "Manage Dokploy Project", + destructiveHint: false, // Will be dynamically set based on action + idempotentHint: false, + openWorldHint: true, + }, + handler: async (input) => { + const { action, params = {} } = input; + + // Map actions to their corresponding tool handlers + const actionMap: Record = { + list: projectAll, + create: projectCreate, + get: projectOne, + update: projectUpdate, + remove: projectRemove, + duplicate: projectDuplicate, + }; + + const tool = actionMap[action]; + if (!tool) { + return ResponseFormatter.error( + "Invalid action", + `Action "${action}" is not supported for project management` + ); + } + + // Call the corresponding tool handler with the provided params + try { + return await tool.handler(params); + } catch (error) { + return ResponseFormatter.error( + `Failed to execute project action "${action}"`, + error instanceof Error ? error.message : "Unknown error" + ); + } + }, +}); diff --git a/src/mcp/tools/consolidated/index.ts b/src/mcp/tools/consolidated/index.ts new file mode 100644 index 0000000..0f16af9 --- /dev/null +++ b/src/mcp/tools/consolidated/index.ts @@ -0,0 +1,4 @@ +export { dokployApplication } from "./dokployApplication.js"; +export { dokployMysql } from "./dokployMysql.js"; +export { dokployPostgres } from "./dokployPostgres.js"; +export { dokployProject } from "./dokployProject.js"; diff --git a/src/mcp/tools/index.ts b/src/mcp/tools/index.ts index 5a9e1ac..b92e562 100644 --- a/src/mcp/tools/index.ts +++ b/src/mcp/tools/index.ts @@ -1,13 +1,3 @@ -import * as applicationTools from "./application/index.js"; -import * as domainTools from "./domain/index.js"; -import * as mysqlTools from "./mysql/index.js"; -import * as postgresTools from "./postgres/index.js"; -import * as projectTools from "./project/index.js"; +import * as consolidatedTools from "./consolidated/index.js"; -export const allTools = [ - ...Object.values(projectTools), - ...Object.values(applicationTools), - ...Object.values(domainTools), - ...Object.values(mysqlTools), - ...Object.values(postgresTools), -]; +export const allTools = [...Object.values(consolidatedTools)];