Guides

Add lead capture to a site with Claude Code

Sign in to 1DB once from your terminal, then ask Claude Code to connect any site’s forms: it adds the site, writes the keys, wires the form and sends a test lead.

Updated

If you build sites with Claude Code, connecting their forms to 1DB is a sentence: “set up 1db for northfieldpallets.com.” This guide covers the one-time setup, what the agent does when you ask, and the last step it can’t do for you.

Set up once per computer

In your own terminal (not in a project script or CI), run:

npx @1db/cli setup

It opens your browser to sign in and approve access for one of your 1DB organizations, then adds 1DB’s MCP server to Claude Code for every project on this computer. Restart Claude Code and it has 1DB’s tools. You need Node 18 or newer.

The token this creates lives in ~/.config/1db/config.json, readable only by you. It never goes into a project. Projects only ever get a site’s ingest key, which can send leads and nothing else.

Ask for a site

Open the site’s project in Claude Code and ask:

set up 1db for northfieldpallets.com

The agent then:

Test leads are real leads tagged with the source 1db-test. They show in the dashboard and run your email alerts, webhooks, HubSpot sync and forwarding, so you see the whole path work.

Ask for more

The same tools cover what usually comes next. Some things to ask:

What a token may do depends on the scopes you approved at sign-in: managing sites and forms, reading leads, changing where leads are sent, and deleting. Anything outside them is refused, and deletes always need the site or form’s slug typed back as confirmation.

The step that’s yours: going live

.env.local only exists on your machine. Before the live site can send leads:

npx @1db/cli leads northfieldpallets.com

A site that already sends leads

Don’t ask the agent to rewrite it. From the project folder, run:

npx @1db/cli check --send

It compares the project’s DB_* values with 1DB, sends one test lead with them, and lists only what’s wrong, so you, or the agent, fix just that.

Without Claude Code

Every tool is also a CLI command (npx @1db/cli help lists them) and an HTTP endpoint under /v1/agent/. Other MCP clients can use the server at https://www.1-db.com/api/mcp with the token as a bearer header. The AI agents docs have the full reference.