hyperd.watch.create
Subscribe to liquidation alerts for DeFi positions. Receive HMAC-SHA256 signed webhook notifications when health factor reaches a specified severity band.
Instructions
Subscribe to a continuous watch on a wallet/position. Returns watch_id and webhook_secret (shown ONCE — store it; we cannot recover it). HMAC-SHA256 signed alerts POSTed to your webhook_url when threshold conditions are met. v1.0 supports liquidation watches across Aave V3 / Compound v3 / Spark / Morpho. $3.00 USDC prepays for duration_days (default 30, max 90).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Watch type. v1.0 only supports 'liquidation'. | |
| target_addresses | Yes | Wallet to watch (length-1 in v1.0; multi-target reserved for v1.1 Pro tier). | |
| target_chain | No | Chain to watch. Default 'base'. | |
| webhook_url | Yes | HTTPS endpoint to POST alerts to. Must be publicly reachable; private/loopback IPs rejected. | |
| fire_on_band_or_worse | No | Fire when health-factor band reaches this severity OR worse. Default 'warning'. | |
| duration_days | No | Watch lifetime in days. Default 30, max 90. |
Implementation Reference
- src/server.ts:446-469 (registration)The tool 'hyperd.watch.create' is registered via server.tool() with a description, Zod schema for inputs (type, target_addresses, target_chain, webhook_url, fire_on_band_or_worse, duration_days), and a handler that calls paidWithBody('POST', '/api/watch/create', args).
// hyperd.watch.create — subscribe to a continuous watch ($3.00 prepaid) server.tool( "hyperd.watch.create", "Subscribe to a continuous watch on a wallet/position. Returns watch_id and webhook_secret (shown ONCE — store it; we cannot recover it). HMAC-SHA256 signed alerts POSTed to your webhook_url when threshold conditions are met. v1.0 supports liquidation watches across Aave V3 / Compound v3 / Spark / Morpho. $3.00 USDC prepays for duration_days (default 30, max 90).", { type: z.literal("liquidation").describe("Watch type. v1.0 only supports 'liquidation'."), target_addresses: z .array(z.string()) .min(1) .max(1) .describe("Wallet to watch (length-1 in v1.0; multi-target reserved for v1.1 Pro tier)."), target_chain: z .enum(["base", "ethereum", "polygon", "arbitrum", "optimism", "avalanche", "bnb"]) .optional() .describe("Chain to watch. Default 'base'."), webhook_url: z.string().describe("HTTPS endpoint to POST alerts to. Must be publicly reachable; private/loopback IPs rejected."), fire_on_band_or_worse: z .enum(["safe", "caution", "warning", "critical"]) .optional() .describe("Fire when health-factor band reaches this severity OR worse. Default 'warning'."), duration_days: z.number().int().min(1).max(90).optional().describe("Watch lifetime in days. Default 30, max 90."), }, async (args) => asText(await paidWithBody("POST", "/api/watch/create", args)), ); - src/server.ts:468-468 (handler)The tool handler: async (args) => asText(await paidWithBody('POST', '/api/watch/create', args)). It sends the user arguments to the backend API endpoint /api/watch/create via a POST request with x402 payment.
async (args) => asText(await paidWithBody("POST", "/api/watch/create", args)), - src/server.ts:451-466 (schema)Zod schema defining input validation for hyperd.watch.create: type (literal 'liquidation'), target_addresses (array of 1 string), target_chain (optional enum), webhook_url (string), fire_on_band_or_worse (optional enum), duration_days (optional int 1-90).
type: z.literal("liquidation").describe("Watch type. v1.0 only supports 'liquidation'."), target_addresses: z .array(z.string()) .min(1) .max(1) .describe("Wallet to watch (length-1 in v1.0; multi-target reserved for v1.1 Pro tier)."), target_chain: z .enum(["base", "ethereum", "polygon", "arbitrum", "optimism", "avalanche", "bnb"]) .optional() .describe("Chain to watch. Default 'base'."), webhook_url: z.string().describe("HTTPS endpoint to POST alerts to. Must be publicly reachable; private/loopback IPs rejected."), fire_on_band_or_worse: z .enum(["safe", "caution", "warning", "critical"]) .optional() .describe("Fire when health-factor band reaches this severity OR worse. Default 'warning'."), duration_days: z.number().int().min(1).max(90).optional().describe("Watch lifetime in days. Default 30, max 90."), - src/server.ts:98-112 (helper)The paidWithBody helper function handles POST/DELETE requests with x402 payment dance (wallet auth required). Used by hyperd.watch.create to POST to /api/watch/create.
async function paidWithBody( method: "POST" | "DELETE", path: string, body: unknown, query: Record<string, string | number | boolean | undefined> = {}, ): Promise<unknown> { if (!httpClient) { throw new Error(WALLET_NOT_CONFIGURED_MSG); } const url = new URL(`${API_BASE}${path}`); for (const [k, v] of Object.entries(query)) { if (v !== undefined && v !== "" && v !== null) url.searchParams.set(k, String(v)); } return paidRequest(method, url, body); } - src/server.ts:155-157 (helper)The asText helper wraps response data into MCP text content format. Used by the hyperd.watch.create handler to return the result.
function asText(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }