Email verification for AI agents with MCP and a REST API

How to let Claude, Cursor, Codex, Gemini CLI or your own agent check email addresses before it writes or sends anything. Setup for the fig-mcp server, the CLI and the API, plus rules to put in the agent's instructions.

By the Fig team. . 6 min read.

AI agents now research prospects, build lead lists and draft outreach. They are fast at it and confident about everything, including email addresses. An agent that finds "Jordan Price, VP Sales at Northwind" will happily write jordan.price@northwind.com because it fits the pattern, and then send to it or hand it to a sequencer. If the mailbox does not exist, the bounce lands on your domain.

The fix is to give the agent a way to check, and a rule that it must.

Why agents need a verification tool

A language model cannot know whether a mailbox exists. It can only predict what an address probably looks like. Even when an agent reads an address from a web page, it cannot tell whether that page is current. Mailbox existence is a fact that lives on the recipient's mail server, and the only way to learn it is to ask that server.

That is what an email verifier does. It looks up the domain's mail server, opens an SMTP conversation, asks whether the server will accept mail for the address, and hangs up before any message is sent. The guide to how verification works covers each step.

Giving an agent this tool turns a guess into a checked fact before anything is written to your CRM or sent.

Three ways to connect an agent

MethodBest forWhat the agent sees
MCP server (fig-mcp)Claude, Cursor, Codex, Gemini CLI and other MCP clientsThree tools it can call by name
CLI (fig-verify)Agents that run shell commands, scripts, CIA command with JSON output
REST APIYour own agents, workflows, any languageHTTPS endpoints with a bearer key

All three use the same account, the same key and the same credit balance.

Option 1: the MCP server

The Model Context Protocol is an open standard for connecting AI applications to tools and data. An MCP server runs next to the assistant and offers it tools; the assistant decides when to call them.

fig-mcp gives the assistant three tools:

  • verify_email(email): checks one address and returns status, reason and flags
  • verify_emails(emails): checks up to 1,000 addresses in one job and waits for the results
  • get_credits(): returns the credits left on the account

Sign in once

Run this once on the computer. It opens your browser, you approve, and a key is saved locally:

npx fig-verify login

fig-mcp reads that saved key, so the configs below need no key at all. On a server or in CI, set FIG_API_KEY in the environment instead.

Claude Code

claude mcp add fig -- npx -y fig-mcp

Claude Desktop, Cursor and Gemini CLI

Add the server to the client's MCP config: claude_desktop_config.json for Claude Desktop, .cursor/mcp.json for Cursor, ~/.gemini/settings.json for Gemini CLI.

{
  "mcpServers": {
    "fig": {
      "command": "npx",
      "args": ["-y", "fig-mcp"]
    }
  }
}

Codex

In ~/.codex/config.toml:

[mcp_servers.fig]
command = "npx"
args = ["-y", "fig-mcp"]

Restart the client, then ask it something like "check whether these three addresses exist". It will call the tool and show you the statuses.

Option 2: the CLI

Coding agents that can run shell commands can use the CLI directly. It is also the simplest option for scripts and scheduled jobs.

npx fig-verify verify alex.morgan@example.com --json
npx fig-verify verify-file leads.csv --column email --out leads_checked.csv
npx fig-verify credits

Exit codes are stable, so an agent or a script can branch on them: 0 for success, 2 for a usage error, 3 for a key problem and 4 for not enough credits.

Option 3: the REST API

For your own agent framework, call the API from a tool definition. One address:

curl -s https://fig.email/v1/verify \
  -H "Authorization: Bearer $FIG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "alex.morgan@example.com"}'

The response is a result object with status (valid, invalid, risky or unknown), a plain reason, and the flags is_catch_all, is_disposable, is_role and mx_found. For lists, POST /v1/bulk takes up to 1,000 addresses and returns a job id to poll. The API reference and the OpenAPI spec describe every field, and llms.txt gives the same reference as plain text for models to read.

Keep the key in an environment variable on the server side. Never put it in browser code or in a prompt.

Rules to put in the agent's instructions

A tool only helps if the agent uses it at the right moment. Add rules like these to the system prompt, the project instructions or the agent's skill file:

  1. Before adding any email address to a CRM, a sequence or a draft, verify it with verify_email. For more than a handful, use verify_emails.
  2. Only use addresses with status valid.
  3. Treat risky with reason catch all as unconfirmed. Do not send to it unless the user approves. See the catch all guide for why.
  4. Never send to invalid. Remove it and, if the task allows, look for another address for that person.
  5. For unknown, try again later; do not treat it as valid.
  6. Never invent an address and present it as fact. If no verified address exists, say so.
  7. Before a job of more than 1,000 addresses, call get_credits and tell the user how many checks the job needs.

These rules match how a careful person would use the results. The results guide explains each status in more detail.

Keeping costs and access under control

  • One key per agent. Create a separate key for each agent or workflow on the keys page so you can revoke one without touching the others.
  • Small balances. Credit packs never expire, so you can keep a modest balance and top up as needed. A 1,000 check pack costs $2; see pricing for the rest.
  • Free repeats. Agents often check the same address more than once. Fig returns the cached result free for 30 days, so repeats cost nothing.
  • Refunded unknowns. If the mail server gives no clear answer, the credit comes back automatically.
  • Rate limits. Each key has a per minute limit, and the API returns 429 with Retry-After when it is reached. fig-mcp retries for you.

A worked example

You ask Claude: "Find the heads of marketing at these 20 companies and draft a short intro email to each."

Without a verification tool, Claude writes 20 drafts addressed to 20 plausible guesses.

With fig-mcp and the rules above, Claude finds the names, builds candidate addresses, calls verify_emails once for all of them, and comes back with drafts for the valid ones, a short list of catch all contacts for you to decide on, and a note of which names had no deliverable address. Invalid addresses never reach a draft, so they cannot bounce.

Troubleshooting

The assistant does not show the Fig tools. Restart the client after editing its config; most load MCP servers only at start. Check that Node 20 or newer is installed, because npx runs the server with your local Node. In Claude Code, claude mcp list shows whether the server started.

The tools return an unauthorized error. The saved login is missing or the key was revoked. Run npx fig-verify login again on the same computer, or set FIG_API_KEY in the server's env block. Keys are created and revoked on the keys page of your account.

A bulk check takes a long time. verify_emails starts one job and waits for every result, which can take a few minutes for 1,000 addresses because each mail server answers at its own speed. For larger lists, split them into batches of 1,000, or upload the file in the portal and let the agent read the results file afterwards.

The agent still writes unverified addresses. The tool exists, but the instructions do not require it. Put the rules from the section above into the system prompt or project instructions, and make the first rule specific: verify before writing any address anywhere.

Results come back unknown. Some servers slow down or block checks from addresses they have not seen before. Ask the agent to retry unknown results after a few hours instead of treating them as valid. The credits for unknown results are refunded.

The agent hits rate limits. Each key has a per minute request limit. The API reference lists the current limits. Use verify_emails for groups of addresses instead of many single calls; one bulk call counts as one request.

Get started

The first 100 checks are free, with no card. Sign up, run npx fig-verify login, add fig-mcp to your assistant, and ask it to check an address. The developer quickstart has the same steps with your own key filled in.

Questions

What is an MCP server for email verification?

It is a small program that exposes email checking as tools an AI assistant can call, using the Model Context Protocol. With fig-mcp installed, the assistant gets verify_email, verify_emails and get_credits, and calls them when a task involves email addresses.

Which AI tools can use fig-mcp?

Any client that supports MCP servers over stdio, including Claude Code, Claude Desktop, Cursor, Codex CLI, Gemini CLI, GitHub Copilot in VS Code and Windsurf. Agents that cannot run MCP servers, such as a custom GPT, can call the REST API with a bearer key instead.

Does the agent send email when it verifies an address?

No. Fig asks the recipient's mail server whether the mailbox exists and ends the conversation before any message is transmitted.

How do I stop an agent from spending all my credits?

Give the agent its own API key, keep a modest pack balance on that account, and tell it in its instructions to check get_credits before large jobs. Fig never charges for duplicates or bad syntax and refunds unknown results.

Is my API key exposed to the model?

With fig-mcp, the key stays on your computer, read from the saved login or an environment variable. The model only sees the tool results.