Skip to content

project-duplicate tool calls wrong API endpoint and never creates a new environment #22

@sarafandee

Description

@sarafandee

The project-duplicate tool does not actually create a new environment. It returns a success response with the source environment data, but no new environment is created in Dokploy.

Root cause:

Two issues in src/mcp/tools/project/projectDuplicate.ts:

Wrong endpoint — The handler calls /project.duplicate but the correct Dokploy API endpoint for duplicating an environment is /environment.duplicate
Wrong parameter name — The input schema uses sourceEnvironmentId but the /environment.duplicate endpoint expects environmentId

// Current (broken) — line 60 of projectDuplicate.js
const response = await apiClient.post("/project.duplicate", input);
The /project.duplicate endpoint silently accepts the request and returns existing environment data without creating anything.

To reproduce:

// Call via MCP tool
project-duplicate({
sourceEnvironmentId: "",
name: "staging",
description: "Staging environment",
duplicateInSameProject: true,
includeServices: false
})
// Returns: source environment data
// Result: no new environment created
Workaround:

Calling the Dokploy API directly works correctly:

curl -s -X POST "http:///api/environment.duplicate"
-H "x-api-key: $DOKPLOY_API_KEY"
-H "Content-Type: application/json"
-d '{
"environmentId": "",
"name": "staging",
"description": "Staging environment",
"duplicateInSameProject": true,
"includeServices": false
}'
Suggested fix:

In projectDuplicate.ts:

Change the endpoint from /project.duplicate to /environment.duplicate
Map sourceEnvironmentId to environmentId before sending to the API (or rename the input field)
Version: @ahdev/dokploy-mcp v1.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions