Skip to content

fix: use live activity-log and per-device alert endpoints - #43

Merged
asachs01 merged 1 commit into
mainfrom
fix/report-endpoints-404
Jul 15, 2026
Merged

fix: use live activity-log and per-device alert endpoints#43
asachs01 merged 1 commit into
mainfrom
fix/report-endpoints-404

Conversation

@asachs01

Copy link
Copy Markdown
Member

Fixes two hardcoded report endpoints that 404 against the live Datto BCDR API. Root-caused from bug reports datto-bcdr-mcp#54 and datto-bcdr-mcp#55.

#54 — Activity log (path typo)

ActivityResource called /report/v2/activity-log. The live endpoint has no /v2/ segment: /report/activity-log. Confirmed by the reporter via direct portal curl (404 vs 200). One-line path fix in list() and listAll().

#55 — Alerts (no portal-wide endpoint)

AlertsResource called /report/v2/alert, a portal-wide endpoint that does not exist — both /report/v2/alert and /report/alert 404. Datto only exposes alerts per device: GET /bcdr/device/{serialNumber}/alert.

Restructured to match the per-device idiom already used by AssetsResource:

  • listByDevice(serialNumber, params) — one device, single page
  • listAllByDevice(serialNumber, params) — one device, async iterable
  • listAll(params) — fans out over every device and yields each device's alerts, stamping each with its source serialNumber so the flattened stream stays attributable

The old portal-wide list() is removed (it never worked — always 404). listAll() keeps the same call signature, so the datto-bcdr-mcp consumer (client.alerts.listAll()) works unchanged and now returns real data.

Why no test caught this

The MSW mocks were mocking the buggy paths (/report/v2/alert, /report/v2/activity-log), so the suite validated the bug. Handlers now target the real endpoints; added coverage for per-device alerts, the fleet-wide fan-out (incl. serialNumber stamping and empty-device handling), and the non-v2 activity path.

Verification

  • npm test — 33 passed (6 files)
  • npm run typecheck — clean
  • npm run lint — clean
  • npm run build — success

Versioning

Classified fix: → patch release (2.0.2), which stays inside datto-bcdr-mcp's ^2.0.1 range, so the MCP picks it up automatically on its next install.

Two report endpoints hardcoded paths that 404 against the live Datto
BCDR API:

- ActivityResource hit /report/v2/activity-log; the real endpoint has no
  /v2/ segment. Now calls /report/activity-log.

- AlertsResource hit /report/v2/alert, a portal-wide endpoint that does
  not exist (both /report/v2/alert and /report/alert 404). Datto only
  exposes alerts per device at /bcdr/device/{serialNumber}/alert.
  Replaced the portal-wide list() with listByDevice()/listAllByDevice()
  and reworked listAll() to fan out across every device, stamping each
  alert with its source serialNumber.

The MSW mocks were mocking the buggy paths, so no test caught this;
handlers now target the real endpoints.

Refs wyre-technology/datto-bcdr-mcp#54, wyre-technology/datto-bcdr-mcp#55
@asachs01
asachs01 merged commit 1d4c25a into main Jul 15, 2026
1 check passed
@asachs01
asachs01 deleted the fix/report-endpoints-404 branch July 15, 2026 17:28
github-actions Bot pushed a commit that referenced this pull request Jul 15, 2026
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant