Clay Backend Plugin

A Claude Code plugin that fills Clay's aggregation gap. Clay analyzes data one row at a time — this plugin stores those results, adds semantic search, and lets Claude find patterns across all your records.
"Insufficient discovery in 8 of 10 calls this week. Budget qualification is the #1 gap — and it's getting worse."
"3 of the last 5 company enrichments flagged a funding round, but none of those leads got routed to enterprise AEs."
"Support ticket sentiment went negative across 4 accounts this month — all tied to the same onboarding gap."
These insights are impossible inside Clay. They require looking across rows. This plugin makes them automatic.
Quick Start
In Claude Code:
/plugin marketplace add garavitgabriel/clay-backend-plugin
/plugin install clay-backend-plugin@garavitgabriel
Tell Claude: "I have a Clay export to analyze" — the plugin guides you through import, then you ask questions.
How It Works
Clay (per-record AI analysis)
↓ webhook (automatic) or CSV export (manual)
Clay Backend Plugin
├── Webhook server receives data as Clay processes each row
├── Stores records locally (SQLite)
├── Generates embeddings for semantic search
└── Claude queries via MCP tools → synthesizes insights directly
No Docker. No external database. No server to manage.
Getting Data In
Option 1: Live Webhooks (Recommended)
Clay sends data automatically as each row is processed.
You: "How do I connect Clay?"
Claude: → Shows webhook URL + exact JSON body template for Clay's HTTP API column
In Clay, add an HTTP API enrichment column to your table:
| Setting | Value |
|---|
| Method | POST |
| URL | http://localhost:8742/webhook |
| Body | See below |
{
"record_id": "{{Row ID}}",
"analysis_type": "call_analysis",
"data": {
"summary": "{{AI Summary}}",
"score": "{{Score}}",
"rep": "{{Rep Name}}"
},
"entity_id": "{{Deal ID}}",
"entity_name": "{{Company Name}}"
}
Each time Clay processes a row, the result flows into the plugin automatically.
Connecting Clay Cloud to your local machine:
Clay runs in the cloud, so it can't reach localhost directly. You need a tunnel. Either works:
# Option A: cloudflared — no account, no signup, one command
brew install cloudflared
cloudflared tunnel --url http://127.0.0.1:8742
# Option B: ngrok — free account required
brew install ngrok
ngrok config add-authtoken <your-token> # free account at ngrok.com
ngrok http 8742
Both print a public HTTPS URL. Use it plus /webhook in Clay (e.g. https://abc123.trycloudflare.com/webhook).
Note that on the free tier of either tool the URL changes every time the tunnel restarts, and you'll have to update the Clay column. Hosted mode gives you a permanent URL instead.
Verify before wiring Clay. Two curls save a lot of guessing — do these while the tunnel is running, before you touch the Clay column:
# 1. Does the tunnel reach your machine at all?
curl https://<your-tunnel-host>/health
# -> {"status":"ok","service":"clay-backend-webhook","db_path":"/Users/you/.clay-backend/clay.db"}
# 2. Does an authenticated write land?
curl -X POST https://<your-tunnel-host>/webhook \
-H "Authorization: Bearer $WEBHOOK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"record_id":"smoke-1","analysis_type":"smoke_test","data":{"hello":"world"}}'
# -> {"ingested":1,"updated":0,"errors":[],"total_for_type":{"smoke_test":1}}
If step 1 fails, the problem is the tunnel. If step 2 returns 401, the problem is the API key. If both pass, anything that breaks afterward is the Clay column config — a much smaller search space. Clean up with "delete the smoke_test records" in Claude Code.
Stuck? Run clay-backend-doctor (see Diagnostics).
Security: Set WEBHOOK_API_KEY in the plugin config when exposing via a tunnel. The webhook endpoint will require Authorization: Bearer <key> on all requests. Ask Claude "what's the webhook URL?" — it will show the exact header to add in Clay.
The webhook server binds to 127.0.0.1 (this machine only) by default — tunnels connect to localhost, so nothing more is needed. Set WEBHOOK_HOST=0.0.0.0 (or clay-webhook-daemon --host 0.0.0.0) only if another device on your network must reach it directly, and set WEBHOOK_API_KEY if you do.
Clay integration pattern (what actually works in production)