Skip to content

@churnkey/mcp 0.3.0: warehouse routes, payment recoveries, polish#2

Merged
robert-moore merged 1 commit into
mainfrom
rob/mcp-warehouse-0.3.0
May 7, 2026
Merged

@churnkey/mcp 0.3.0: warehouse routes, payment recoveries, polish#2
robert-moore merged 1 commit into
mainfrom
rob/mcp-warehouse-0.3.0

Conversation

@robert-moore
Copy link
Copy Markdown
Contributor

@robert-moore robert-moore commented May 7, 2026

Summary

Updates @churnkey/mcp to point at the new warehouse-backed endpoints, adds payment-recovery analytics tools.

Tool surface (post-merge)

Tool URL Source
list_sessions /v1/data/warehouse/sessions Snowflake (~3hr lag)
aggregate_sessions /v1/data/warehouse/session-aggregation Snowflake (~3hr lag)
list_payment_recoveries /v1/data/warehouse/recoveries Snowflake (~20m lag)
aggregate_payment_recoveries /v1/data/warehouse/recovery-aggregation Snowflake (~20m lag)
dsr_access /v1/data/dsr/access Mongo (real-time)
dsr_delete /v1/data/dsr/delete Mongo (real-time)

Polish

  • Removed client-side rate limiter
  • Simplified client.ts: dropped unused ChurnkeyApiError class, dead data-unwrap branch, redundant 403/404/422 message branches.
  • filters.ts: replaced the 19-line manual notShape with z.object(filterShape). Dropped currency/invoiceMonth from BREAKDOWN_VALUES (would silently no-op against the warehouse). Properly typed buildQuery args.
  • Fixed package.json start script that pointed at dist/index.js (library entry, doesn't run main()).
  • Tool order in recoveries.ts matches sessions.ts for predictability.

Tools

- Add aggregate_payment_recoveries and list_payment_recoveries, backed
  by /v1/data/warehouse/recovery-aggregation and /v1/data/warehouse/
  recoveries. Aggregation returns count, invoice/recovered/pending/lost
  amounts in original currency and USD with breakdowns by time, card
  brand, decline reason, outcome, blueprint, currency, recovered/active.
- Repoint list_sessions and aggregate_sessions to the new warehouse-
  backed routes (/v1/data/warehouse/sessions and /v1/data/warehouse/
  session-aggregation). The legacy /v1/data/sessions and /v1/data/
  session-aggregation routes on the API stay Mongo-backed and unchanged.
  Tool descriptions surface the ~3-hour warehouse lag.
- Drop get_api_usage. API request logs aren't synced to the warehouse;
  the /v1/data/api-usage REST endpoint itself is unchanged.

Polish from a senior-engineer review pass

- Drop the speculative client-side rate limiter (sequential agent loops
  don't need it; the API has its own limits).
- Simplify the HTTP client: drop the unused ChurnkeyApiError class, the
  dead {data: ...} response-unwrapping branch, and the redundant 403/
  404/422 message handlers (each just returned the catch-all default).
- filters.ts: replace the 19-line manual notShape with z.object(filterShape).
  Drop currency/invoiceMonth from BREAKDOWN_VALUES (would silently no-op
  against the warehouse). Type buildQuery args properly.
- session-tools description: drop misleading "case-insensitive" claim
  on customerEmail; rephrase the `active` describe to read directly.
- Rename tool order, drop unused exports, fix package.json "start"
  script which pointed at dist/index.js (the library entry, doesn't
  run main()) instead of dist/bin.js.
@robert-moore robert-moore merged commit 8d9ede5 into main May 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant