Update a custom MCP

Updated at:

Updates the name, description, or configuration of a custom MCP. Changing the configuration redeploys the service.

Endpoint

POST/api/v1/mcp/servers/{mcpCode}

Supports custom MCP only. Changing only the name or description does not redeploy the service. Submitting mcp_type and mcp_config together replaces the configuration and redeploys the service.

Path parameters

mcpCodestringRequired

MCP code

Request body

server_namestringOptional

New name. Cannot be blank

descriptionstringOptional

New description. Cannot be blank

mcp_typestringOptional

New service type. Must be submitted with mcp_config

mcp_configobjectOptional

New configuration. Must be submitted with mcp_type. Replaces the existing configuration entirely

Response fields

Returns a CreateResponse. Unassigned fields are omitted. When only the name or description is changed, status fields are not returned.

mcp_codestring

MCP code

server_namestring

Updated name

server_statusstring

Redeployment status. Returned only when the configuration changes

server_status_textstring

Status text. Returned only when the configuration changes

activate_fail_reasonstring

Deployment failure reason. Returned only when deployment fails

Examples

Change the name and description

Request example

curl -X POST "https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/mcp/servers/mcp-a1b2c3d4e5f6g7h8" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "server_name": "weather-mcp-v2",
    "description": "Weather query MCP (new version)"
  }'

Response example

{
  "success": true,
  "error_code": null,
  "error_msg": null,
  "data": {
    "mcp_code": "mcp-a1b2c3d4e5f6g7h8",
    "server_name": "weather-mcp-v2"
  },
  "request_id": "6f1c2a8e-3b0d-4c55-9a0e-2f7d1c9b8a11"
}

Change the configuration

curl -X POST "https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/mcp/servers/mcp-a1b2c3d4e5f6g7h8" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mcp_type": "SSE",
    "mcp_config": {
      "url": "https://mcp.example.com/sse"
    }
  }'
{
  "success": true,
  "error_code": null,
  "error_msg": null,
  "data": {
    "mcp_code": "mcp-a1b2c3d4e5f6g7h8",
    "server_name": "weather-mcp-v2",
    "server_status": "ACTIVATED",
    "server_status_text": "已启用"
  },
  "request_id": "6f1c2a8e-3b0d-4c55-9a0e-2f7d1c9b8a11"
}

Error codes

HTTP statuserror_codeDescription
400InvalidParameterThe request body is empty, or mcp_type and mcp_config are not submitted together
400OperationNotSupportedThe service is an official MCP, or the service is running or deploying
404McpServerNotFoundThe MCP service does not exist or does not belong to the current workspace
409McpServerBusyAnother operation is running on the MCP service