fix(mcp): require confirm_name for delete_workspace and send X-Confirm-Name header #10

Closed
agent-dev-a wants to merge 1 commits from fix/mcp7-delete-workspace-confirm-name into main
Member

Closes #7.

The tenant's destructive-action gate refuses workspace deletion unless the caller echoes the workspace's exact name in the X-Confirm-Name header. The previous delete_workspace tool only sent ?confirm=true, so agents could not complete deletion even after human approval.

Changes

  • apiCall now accepts an optional headers map and merges it with Content-Type.
  • handleDeleteWorkspace requires confirm_name and sends it as X-Confirm-Name, while preserving ?confirm=true.
  • Registers deprovision_workspace as an alias for delete_workspace.
  • Tool schema, CLAUDE.md, and tests updated; refusal and alias are tested.

Test plan

  • npm test passes (144 passed, 1 skipped).
  • npm run build passes.

SOP-Checklist

  • Comprehensive testing performed: unit tests added for header sent, confirm_name refusal, and alias wiring; full suite green.
  • Local-postgres E2E run: N/A — pure MCP-server TypeScript change, no DB surface.
  • Staging-smoke verified or pending: N/A — tool call; exercised when an agent next deletes a workspace via MCP.
  • Root-cause not symptom: addresses the missing confirmation-header parameter, not a surface symptom of the tenant gate.
  • Five-Axis review walked: correctness (header matches tenant contract), readability (clear parameter name), architecture (headers passthrough keeps apiCall reusable), security (forces caller to echo workspace name, composing with approvals), performance (one extra header, no extra round-trips).
  • No backwards-compat shim / dead code added: no shim; old confirm boolean was already insufficient and is replaced by the explicit name check.
  • Memory consulted: followed existing apiCall/toMcpResult patterns and the destructive-action confirmation contract from molecule-mcp-server#58.

🤖 Generated with Claude Code

Closes #7. The tenant's destructive-action gate refuses workspace deletion unless the caller echoes the workspace's exact name in the `X-Confirm-Name` header. The previous `delete_workspace` tool only sent `?confirm=true`, so agents could not complete deletion even after human approval. ### Changes - `apiCall` now accepts an optional `headers` map and merges it with `Content-Type`. - `handleDeleteWorkspace` requires `confirm_name` and sends it as `X-Confirm-Name`, while preserving `?confirm=true`. - Registers `deprovision_workspace` as an alias for `delete_workspace`. - Tool schema, `CLAUDE.md`, and tests updated; refusal and alias are tested. ### Test plan - `npm test` passes (144 passed, 1 skipped). - `npm run build` passes. ## SOP-Checklist - [x] **Comprehensive testing performed**: unit tests added for header sent, confirm_name refusal, and alias wiring; full suite green. - [x] **Local-postgres E2E run**: N/A — pure MCP-server TypeScript change, no DB surface. - [x] **Staging-smoke verified or pending**: N/A — tool call; exercised when an agent next deletes a workspace via MCP. - [x] **Root-cause not symptom**: addresses the missing confirmation-header parameter, not a surface symptom of the tenant gate. - [x] **Five-Axis review walked**: correctness (header matches tenant contract), readability (clear parameter name), architecture (headers passthrough keeps apiCall reusable), security (forces caller to echo workspace name, composing with approvals), performance (one extra header, no extra round-trips). - [x] **No backwards-compat shim / dead code added**: no shim; old `confirm` boolean was already insufficient and is replaced by the explicit name check. - [x] **Memory consulted**: followed existing apiCall/toMcpResult patterns and the destructive-action confirmation contract from molecule-mcp-server#58. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
agent-dev-a added 1 commit 2026-06-20 18:38:37 +00:00
fix(mcp): require confirm_name for delete_workspace and send X-Confirm-Name header
CI / detect changed packages (pull_request) Successful in 5s
CI / channels/claude (test) (pull_request) Has been skipped
sop-checklist-gate / gate (pull_request_target) Failing after 7s
CI / server (build + test) (pull_request) Successful in 18s
CI / all-required (pull_request) Successful in 1s
502903497b
Closes #7.

- apiCall now accepts an optional headers map and merges it with Content-Type.
- delete_workspace requires confirm_name and sends it as X-Confirm-Name,
  preserving the existing ?confirm=true query param.
- Registers deprovision_workspace as an alias for delete_workspace.
- Updates CLAUDE.md tool list and test coverage for header, refusal, alias.

Co-Authored-By: Claude <noreply@anthropic.com>
agent-dev-a closed this pull request 2026-06-20 18:47:51 +00:00
Some optional checks failed
CI / detect changed packages (pull_request) Successful in 5s
CI / channels/claude (test) (pull_request) Has been skipped
sop-checklist-gate / gate (pull_request_target) Failing after 7s
CI / server (build + test) (pull_request) Successful in 18s
CI / all-required (pull_request) Successful in 1s
Required
Details

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-mcp#10