feat: add maintenance window MCP tools for proactive deploy suppression#21
Merged
Conversation
Five new tools so AI coding assistants can suppress alerts around risky operations: - list_maintenance_windows — inspect active / upcoming windows - get_maintenance_window — fetch one window with full details - create_maintenance_window — schedule downtime BEFORE a deploy - update_maintenance_window — extend ``endsAt`` when a deploy runs long - cancel_maintenance_window — clear suppression after success The tools wrap ``/api/v1/maintenance-windows`` directly through the SDK's low-level helpers because the parallel ``client.maintenance_windows`` SDK PR hasn't shipped yet. Once it does, every tool body collapses to a one-liner against the resource without changing the public tool surface. Bumps the locked ``devhelm`` SDK to 0.6.3 to pick up the generated ``CreateMaintenanceWindowRequest`` / ``MaintenanceWindowDto`` / ``UpdateMaintenanceWindowRequest`` Pydantic models. The pyproject pin (``devhelm>=0.6.0``) is unchanged; this is a lock-only bump. Co-authored-by: Cursor <cursoragent@cursor.com>
Adds 25 tests across five concerns: - registration: every new tool surfaces in ``mcp.list_tools`` with a non-empty description (LLM docs) - HTTP contract: each tool builds the right path / method / body via patched ``api_get`` / ``api_post`` / ``api_put`` / ``api_delete``, including the camelCase aliases on the wire (``startsAt``, ``endsAt``, ``monitorId``) and the ``filter`` / ``monitorId`` query keys for the list endpoint - schema hygiene: regression that ``api_token`` never leaks into the LLM-facing ``inputSchema`` (P2.Bug7 contract) and that the ``CreateMaintenanceWindowRequest`` / ``UpdateMaintenanceWindowRequest`` body schemas don't expose ``managedBy`` — pinning now means a future SDK regen that bolts the field on can't silently surface it - error surfacing: upstream ``DevhelmApiError`` propagates to the client as ``isError=True`` with the formatted ApiError envelope (P1.Bug3 contract) - expected-tools list: keeps ``test_tools.py`` in sync so the count assertion reflects the new five tools Total suite is now 135 tests (110 baseline + 25 new), all green on Python 3.11 and 3.13. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds five maintenance-window MCP tools so AI coding assistants (Cursor, Claude Desktop, Windsurf, etc.) can proactively suppress alerts during risky operations and clear them once the work succeeds.
This closes one of the highest-value gaps in the launch-story tool surface: an agent that runs a deploy script today either pages on-call when monitors briefly fail mid-rollout (noisy) or leaves the user to remember to silence things by hand (error-prone). With these tools the agent can do it itself.
The tools
list_maintenance_windowsmonitor_idandstatus(active/upcoming) filtersget_maintenance_windowcreate_maintenance_windowupdate_maintenance_windowendsAtback when a deploy runs long (full PUT)cancel_maintenance_windowTime fields use ISO 8601 / RFC 3339 with explicit timezone (UTC preferred, e.g.
2026-05-15T14:00:00Z). SettingmonitorId=nullon create produces an org-wide window that suppresses every monitor.Sample agent workflow
The docstrings spell this out for the LLM, but the canonical flow is:
create_maintenance_windowwithstartsAt = now,endsAt = now + 30min,reason = "v0.7.3 deploy".cancel_maintenance_window(window_id)so any post-deploy regression pages on-call immediately.update_maintenance_windowwith a laterendsAtinstead of letting the window expire and pages flooding the channel.Implementation notes
client.maintenance_windowslater. Until that ships, the tools call/api/v1/maintenance-windowsthrough the SDK's existing low-level helpers (api_get/api_post/api_put/api_delete) plus the generatedCreateMaintenanceWindowRequest/MaintenanceWindowDto/UpdateMaintenanceWindowRequestPydantic models. Once the SDK ships the resource, every tool body collapses to a one-liner; the public tool surface stays unchanged.devhelmto 0.6.3 (latest on PyPI) to pick up the generated maintenance-window models. The pyproject pin (devhelm>=0.6.0) is unchanged — this is a lock-only bump.managedByon this resource: unlikeMonitor, the maintenance-window API doesn't carry amanagedBycolumn. Surface attribution still happens viaX-DevHelm-Surface: mcpon every request, so dashboard filters by surface continue to work; we just don't have a per-row attribution channel here. The schema-hygiene test pins the absence so a future SDK regen that bolts the field on can't silently expose it to the LLM.api_tokenhidden from the LLM: every tool keeps theapi_tokenkwarg for path-style/{api_key}/mcpclients but the field is stripped from theinputSchemaby the existing_strip_internal_schema_fieldslifespan hook (P2.Bug7). The tests pin this for all five new tools.Test plan
uv sync— pulls devhelm 0.6.3 from PyPIuv run ruff check src/ tests/— cleanuv run ruff format --check src/ tests/— cleanuv run mypy src/— clean (Python 3.11 and 3.13)uv run pytest tests/ -x— 135 passed (110 baseline + 25 new) on Python 3.11 and 3.13startsAt,endsAt,monitorId) andfilter/monitorIdquery keysapi_tokennot in anyinputSchema;managedBynot oncreate/updatebody schemasDevhelmApiErrorpropagates asisError=Truewith the formatted ApiError envelope (P1.Bug3)Out of scope
pyproject.toml/serverInfo.versionbumps — release engineering owns those.client.maintenance_windows.create(...)— that's a follow-up for v0.7.3 polish once the SDK PR merges and a newdevhelmrelease ships.Made with Cursor