DEV Community

Bounce Layer
Bounce Layer

Posted on AI-assisted

Let your AI agent check an email address before it sends

We build BounceLayer, an email verification service, so this post uses our MCP server. The same idea works with any verification server, and we list the others at the end.

The problem

Agents that send email will happily send to an address that doesn't exist. Each one bounces, and enough bounces push a domain's mail into spam. A person would check the address first. An agent needs a tool for that.

The setup

An MCP server gives the agent a verify_email tool. With Claude Code it is one command:

claude mcp add --transport http bouncelayer https://api.bouncelayer.com/mcp/ \
  --header "X-API-Key: bl_live_YOUR_KEY"
Enter fullscreen mode Exit fullscreen mode

For Cursor or any other MCP client, run the npm package:

{
  "mcpServers": {
    "bouncelayer": {
      "command": "npx",
      "args": ["-y", "@bouncelayer/mcp"],
      "env": { "BOUNCELAYER_API_KEY": "bl_live_YOUR_KEY" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

No key yet

The agent can get its own. The server has a create_agent_account tool that needs no key and returns one with 25 free credits. It also returns a claim link for the person the agent works for. Claiming the account gives 300 free checks a month.

What comes back

Ask the agent to check an address and it gets one of six results:

Result Meaning What the agent should do
valid The mailbox exists Send
invalid It doesn't exist Don't send
catch_all The domain accepts everything Send with care
disposable A throwaway address Don't send
do_not_mail A risky address, such as a shared inbox Leave it out
unknown The mail server gave no answer Try again later (not charged)

Each result also has an explanation in plain English and a did_you_mean suggestion when the domain looks mistyped, so the agent can tell the user why and offer the fix.

A prompt that works

Before you send any email, call verify_email on the recipient. Only send if the result is valid. If it is catch_all, ask me first. If did_you_mean is set, show me the suggestion.

Lists

For more than a few addresses, use submit_bulk_verification and then get_bulk_job to collect the results. Checking a list one address at a time works, but it is slower and uses more of the agent's context.

Other servers

ZeroBounce, Hunter, Bouncer, Clearout, MyEmailVerifier, EmailListVerify and EmailVerify.io also publish MCP servers. If you already pay one of them, use theirs. We compared how each one connects here: https://bouncelayer.com/compare/email-verification-mcp-servers

Docs for ours: https://bouncelayer.com/docs/mcp

Source (MIT): https://github.com/BounceLayer/bouncelayer-mcp

Top comments (0)