fix: param-key mapping, phantom ops, and delete/update maps — close #12-#15

- #12: Remove tag from DELETE_PARAM_KEY (DeleteTag uses {id}, not {tag})
- #13: Remove 5 phantom execute ops (RunServerRefreshContainers/RunCommand/Scripts/Copy/Move)
- #14: Remove user_group from UPDATE_REQUEST_MAP (UpdateUserGroup doesn't exist)
- #15: Server-scoped execute ops pass {server} not {id}; RunSync passes {sync} not {id}
This commit is contained in:
2026-09-08 11:17:46 +00:00
parent e5f1200577
commit 417c8ca13d
6 changed files with 28 additions and 28 deletions
+1
View File
@@ -2,3 +2,4 @@ dist/
node_modules/
.DS_Store
*.log
tsconfig.tsbuildinfo
-6
View File
@@ -101,7 +101,6 @@ Full reference of Komodo RPC endpoints (OpenAPI v2.3.3) and which MCP tool handl
| `write/UpdateBuilder` | builder |
| `write/UpdateSwarm` | swarm |
| `write/UpdateVariableValue` | variable |
| `write/UpdateUserGroup` | user_group |
| `write/UpdateGitProviderAccount` | git_provider_account |
---
@@ -198,14 +197,9 @@ Full reference of Komodo RPC endpoints (OpenAPI v2.3.3) and which MCP tool handl
### Server Operations
| Operation | Komodo RPC |
|-----------|------------|
| `run_server_refresh_containers` | `execute/RunServerRefreshContainers` |
| `run_server_prune_images` | `execute/PruneImages` |
| `run_server_prune_containers` | `execute/PruneContainers` |
| `run_server_prune_networks` | `execute/PruneNetworks` |
| `run_server_run_command` | `execute/RunServerRunCommand` |
| `run_server_scripts` | `execute/RunServerScripts` |
| `run_server_copy` | `execute/RunServerCopy` |
| `run_server_move` | `execute/RunServerMove` |
| `rotate_all_server_keys` | `execute/RotateAllServerKeys` |
### Docker Prune & Cleanup
+1 -1
View File
@@ -59,7 +59,7 @@ function createServerInstance(): McpServer {
server.registerTool("komodo_execute", {
description:
"Execute a Komodo operation. Operations include: build/deploy (run_build, deploy, deploy_stack, destroy_stack, pull_stack), repo (build_repo, clone_repo, pull_repo), procedure/action (run_procedure, run_action, run_sync), stack lifecycle (start/stop/restart/pause/unpause), container lifecycle, deployment lifecycle, server ops (refresh_containers, prune_images/containers/networks, run_command, scripts, copy, move), swarm ops (remove nodes/services/configs/secrets/stacks, create/rotate config/secret), batch ops, and admin (backup_core_database, rotate_core_keys, global_auto_update, send_alert, test_alerter).",
"Execute a Komodo operation. Operations include: build/deploy (run_build, deploy, deploy_stack, destroy_stack, pull_stack), repo (build_repo, clone_repo, pull_repo), procedure/action (run_procedure, run_action, run_sync), stack lifecycle (start/stop/restart/pause/unpause), container lifecycle, deployment lifecycle, server ops (prune_images/containers/networks, rotate_all_server_keys), swarm ops (remove nodes/services/configs/secrets/stacks, create/rotate config/secret), batch ops, and admin (backup_core_database, rotate_core_keys, global_auto_update, send_alert, test_alerter). Server-scoped ops (prune_*, delete_*) require the server name in the id field.",
inputSchema: executeInputSchema,
}, async (args) => handleExecute(args, client));
-1
View File
@@ -5,7 +5,6 @@ import { ResourceType, DELETE_REQUEST_MAP } from "../types.js";
// Some DELETE endpoints expect a different param key instead of { id }.
// Verified live against Core v2.3.3 error messages.
const DELETE_PARAM_KEY: Record<string, string> = {
tag: "tag",
variable: "name",
user_group: "user_group",
};
+26 -3
View File
@@ -2,11 +2,26 @@ import { z } from "zod";
import { KomodoClient } from "../komodo-client.js";
import { ExecuteOperation, EXECUTE_REQUEST_MAP } from "../types.js";
// Operations that need {server: <value>} instead of {id: <value>}
const SERVER_SCOPED_OPS = new Set([
"run_server_prune_images",
"run_server_prune_containers",
"run_server_prune_networks",
"rotate_all_server_keys",
"prune_buildx",
"prune_docker_builders",
"prune_system",
"prune_volumes",
"delete_image",
"delete_network",
"delete_volume",
]);
export const executeInputSchema = {
operation: ExecuteOperation.describe(
"Execute operation (run_build, deploy_stack, deploy_stack_service, deploy, deploy_stack_if_changed, destroy_stack, destroy_container, destroy_deployment, pull_stack, pull_deployment, build_repo, clone_repo, pull_repo, cancel_repo_build, clear_repo_cache, run_procedure, run_action, run_sync, cancel_action, cancel_build, cancel_procedure, start_stack, stop_stack, restart_stack, pause_stack, unpause_stack, start_container, stop_container, restart_container, pause_container, unpause_container, start_all_containers, stop_all_containers, restart_all_containers, pause_all_containers, unpause_all_containers, start_deployment, stop_deployment, restart_deployment, pause_deployment, unpause_deployment, run_server_refresh_containers, run_server_prune_images, run_server_prune_containers, run_server_prune_networks, run_server_run_command, run_server_scripts, run_server_copy, run_server_move, rotate_all_server_keys, prune_buildx, prune_docker_builders, prune_system, prune_volumes, delete_image, delete_network, delete_volume, remove_swarm_nodes, remove_swarm_services, remove_swarm_configs, remove_swarm_secrets, remove_swarm_stacks, create_swarm_config, create_swarm_secret, rotate_swarm_config, rotate_swarm_secret, update_swarm_node, batch_run_build, batch_deploy_stack, batch_deploy_stack_if_changed, batch_deploy, batch_pull_stack, batch_pull_repo, batch_build_repo, batch_clone_repo, batch_run_procedure, batch_run_action, batch_destroy_deployment, batch_destroy_stack, backup_core_database, rotate_core_keys, global_auto_update, send_alert, test_alerter)",
"Execute operation. Server-scoped ops (prune_*, delete_*) require the server name in the id field. RunSync requires the sync name/id in the id field.",
),
id: z.string().optional().describe("Resource ID or name for the operation"),
id: z.string().optional().describe("Resource ID, name, or server name (depends on operation)"),
params: z
.record(z.string(), z.unknown())
.optional()
@@ -29,7 +44,15 @@ export async function handleExecute(
}
const requestParams: Record<string, unknown> = { ...params };
if (id) requestParams.id = id;
if (id) {
if (SERVER_SCOPED_OPS.has(operation)) {
requestParams.server = id;
} else if (operation === "run_sync") {
requestParams.sync = id;
} else {
requestParams.id = id;
}
}
const result = await client.rpc(mapping.route, mapping.name, requestParams);
-17
View File
@@ -70,14 +70,9 @@ export const ExecuteOperation = z.enum([
"pause_deployment",
"unpause_deployment",
// Server operations
"run_server_refresh_containers",
"run_server_prune_images",
"run_server_prune_containers",
"run_server_prune_networks",
"run_server_run_command",
"run_server_scripts",
"run_server_copy",
"run_server_move",
"rotate_all_server_keys",
// Docker prune & cleanup
"prune_buildx",
@@ -211,7 +206,6 @@ export const UPDATE_REQUEST_MAP: Partial<Record<ResourceType, string>> = {
builder: "UpdateBuilder",
swarm: "UpdateSwarm",
variable: "UpdateVariableValue",
user_group: "UpdateUserGroup",
git_provider_account: "UpdateGitProviderAccount",
};
@@ -287,20 +281,9 @@ export const EXECUTE_REQUEST_MAP: Record<
pause_deployment: { route: "execute", name: "PauseDeployment" },
unpause_deployment: { route: "execute", name: "UnpauseDeployment" },
// Server operations
run_server_refresh_containers: {
route: "execute",
name: "RunServerRefreshContainers",
},
run_server_prune_images: { route: "execute", name: "PruneImages" },
run_server_prune_containers: { route: "execute", name: "PruneContainers" },
run_server_prune_networks: { route: "execute", name: "PruneNetworks" },
run_server_run_command: {
route: "execute",
name: "RunServerRunCommand",
},
run_server_scripts: { route: "execute", name: "RunServerScripts" },
run_server_copy: { route: "execute", name: "RunServerCopy" },
run_server_move: { route: "execute", name: "RunServerMove" },
rotate_all_server_keys: {
route: "execute",
name: "RotateAllServerKeys",