at main
3 folders
6 files
feat(mcp): public MCP server with authenticated alert management
POST /mcp speaks stateless Streamable HTTP JSON-RPC. Read tools work with no
credentials; presenting a valid MCP access token additionally exposes alert
management, so tools/list is conditional on the Authorization header.
- search_auctions / get_auction serve from the KV snapshot, so MCP traffic
reads zero D1 rows. cloud_availability proxies the worker.
- list_alerts / create_alert / delete_alert are gated on a Better Auth MCP
session. Migration 0017 adds the OAuth provider tables (camelCase, unlike the
rest of the schema: MCPOptions has no field-mapping escape hatch and nothing
in the app queries them).
- Alert tools take the same flat schema as search_auctions and build the
ServerFilter server-side, in defaultFilter's key order — idx_price_alert_
user_id_filter is UNIQUE on the serialised string, so key order is
load-bearing.
Encodings were taken from MATCH_ALERTS_SQL rather than the UI, and verified
against production: RAM is log2(GB), disk sizes are units of 500 GB, and
price_alert.price is GROSS whole euros with vat_rate as a percentage — not
cents and not a decimal rate, as the spec had assumed.
Also fixes baseURL, which was pinned to the production origin. Better Auth's
isAuthPath() rejects a mismatched origin, so every /api/auth/* route 404'd on
localhost and would have on any preview deployment.