From a Captured Webhook to a Test in Cursor or Claude
Capture a webhook with OpenWebhook MCP, then have Cursor or Claude write a test from the raw headers and body. Do not JSON.parse before verifying.
You have a real webhook. You want a failing test that asserts the headers and the raw body, then a passing one after the handler is correct. Cursor and Claude can write that test if they see the request. OpenWebhook MCP puts the request in the chat.
Client setup stays on Cursor and Claude. The tool list is on OpenWebhook MCP tools. This page is the capture → test loop.
Capture
Add the server (npx -y openwebhook mcp). No token for the first run. Ask:
Call url.inspect, then watch.start with no slug, then watch.wait. Give me the ingest URL. After the request arrives, return method, path, headers, and the raw body.
The agent prints something like:
https://hooks.openwebhook.co/YOUR_UUID
Send the webhook, or probe it:
curl -X POST \
'https://hooks.openwebhook.co/YOUR_UUID/stripe' \
-H 'content-type: application/json' \
-H 'stripe-signature: t=1716400000,v1=test' \
--data-binary '{"id":"evt_1","type":"checkout.session.completed"}'
watch.wait returns the same fields the inspector shows. Prefer this over pasting a screenshot.
You can also capture in the browser and paste Copy cURL into the chat. MCP is faster when the agent should keep watching.
Write the test from the raw request
Tell the agent to generate a test that:
- Posts the raw body string, not an object that will be serialized again.
- Sets every signature and timestamp header from the capture.
- Does not
JSON.parseand re-stringify before HMAC verification. - Asserts the handler status (
200/400) and that a duplicateidis ignored.
A useful prompt:
Using that captured request, write a test for my webhook route. Keep the body as the exact UTF-8 string. Replay stripe-signature as captured. Fail if the handler parses JSON before verifying the signature.
If the handler is on 127.0.0.1, listen without an account and point the test at that port.
Install options (Cursor mcp.json, claude mcp add, or the Smithery bundle) stay on the setup pages. Use them only to start the server.