Skip to content

CrewAI · mcps · Python

CrewAI agent email inbox with the mcps field and MCPServerHTTP

Use CrewAI's mcps field with crewai.mcp.MCPServerHTTP: url https://cooperemail.com/mcp, headers with Authorization: Bearer, streamable True, and a static tool filter. The agent then has its own Cooper address and tools to send mail and read verification codes. Tested against production on 2026-11-23 with crewai 1.15.44.

Get an inbox and a key in one call

The agent can do this itself. One unauthenticated POST creates the account, the first inbox, and the API key. There is no human signup form, no card, and no captcha. Over MCP the same step is the cooper_onboard tool, which works before the client has a key.

For the self-tests on this page, create a second inbox with POST /api/v1/inboxes and export it as PEER_INBOX. The tests mail a code from one inbox you own to the other and read it back.

curl -s -X POST 'https://cooperemail.com/api/v1/onboard' \
  -H 'content-type: application/json' \
  -H 'X-Client: my-agent' \
  -d '{"username":"signup-bot-7f3a"}'
# 201 {"api_key":"coop_live_...","inbox":{"email":"signup-bot-7f3a@cooperemail.com",...}}
export COOPER_API_KEY=coop_live_...   # shown once
export AGENT_INBOX=signup-bot-7f3a@cooperemail.com

Configure the agent

This is the structured form of the mcps field from CrewAI's MCP overview. The filter keeps the agent to three tools instead of all 124. The script also calls two of the resolved tools directly, so you can check it before a crew runs. CrewAI names the tools after the server host, for example cooperemail_com_mcp_cooper_wait_for_code.

pip install crewai mcp

import json, os, time

from crewai import Agent
from crewai.mcp import MCPServerHTTP
from crewai.mcp.filters import create_static_tool_filter

ME, PEER = os.environ["AGENT_INBOX"], os.environ["PEER_INBOX"]

cooper = MCPServerHTTP(
    url="https://cooperemail.com/mcp",
    headers={"Authorization": f"Bearer {os.environ['COOPER_API_KEY']}"},
    streamable=True,
    cache_tools_list=True,
    tool_filter=create_static_tool_filter(
        allowed_tool_names=["cooper_list_inboxes", "cooper_send_message", "cooper_wait_for_code"]
    ),
)

agent = Agent(
    role="Signup assistant",
    goal="Finish signups by reading verification codes from the agent's own inbox",
    backstory="Has its own Cooper Email address.",
    mcps=[cooper],
    llm="gpt-4o-mini",  # any model CrewAI supports; needs that provider's key at kickoff
)

if __name__ == "__main__":
    tools = {t.name: t for t in agent.get_mcp_tools(agent.mcps)}
    print(sorted(tools))
    code = str(int(time.time()))[-6:]
    send = next(t for n, t in tools.items() if n.endswith("cooper_send_message"))
    wait = next(t for n, t in tools.items() if n.endswith("cooper_wait_for_code"))
    print("sent:", str(send.run(inbox_id=ME, to=[PEER], subject="Your code", text=f"Your code is {code}"))[:80])
    got = wait.run(inbox_id=PEER, wait=55)
    got = json.loads(got) if isinstance(got, str) else got
    print("code read back:", got["code"], "expected", code)

What we ran and what came back

On 2026-11-23 agent.get_mcp_tools resolved exactly the three filtered tools, the send went through, and the code tool returned the same six-digit code from the second inbox.

Creating an Agent with an OpenAI model makes CrewAI check for OPENAI_API_KEY. We had no key on the test machine, so we set a placeholder to build the agent and did not call kickoff. With your key, add the agent to a Task and Crew as usual.

Cooper stops repeated agent-to-agent sends between Cooper inboxes that have no verified human owner (HTTP 409 agent_loop_no_owner). We hit it while rerunning these tests on one pair of inboxes. Use a fresh pair per test run, or add an owner.

Signup flows in a crew

A common crew: one agent fills in a signup form with a browser tool, and the same agent, or a second one, calls the code tool on the inbox it gave the site. cooper_wait_for_code takes from_contains and subject_contains filters, so the crew can wait for one sender while other mail arrives.

Approval and safety

For mail to people outside your team, add a verified owner and PATCH the inbox to send_mode approval. Sends then become pending drafts until the owner approves. Leave cooper_send_message out of the filter for crews that only need to read codes.

Who runs Cooper Email

Cooper Email is run by Avatar 8 LLC (ops@avatar33.com).

FAQ

How do I add a remote MCP server with an API key in CrewAI?

Agent(mcps=[MCPServerHTTP(url=..., headers={"Authorization": "Bearer ..."}, streamable=True)]). CrewAI also accepts a plain URL string, but a key belongs in headers, not in the URL.

Can I limit which Cooper tools a CrewAI agent sees?

Yes. tool_filter=create_static_tool_filter(allowed_tool_names=[...]) from crewai.mcp.filters.

Is MCPServerAdapter still supported?

Yes. CrewAI documents it in crewai-tools for manual connection management. The mcps field is the recommended path in its docs today.

Does the CrewAI agent need a human to sign up for the inbox?

No. POST /api/v1/onboard, or the cooper_onboard MCP tool, creates the account, the inbox, and the API key in one call with no card. Free is $0 a month with no card: 5 inboxes and 5,000 emails a month.

What does it cost?

Free is $0 a month with no card: 5 inboxes and 5,000 emails a month. Starter is $12 a month for 25 inboxes and 25,000 emails. Pro is $99 a month for 300 inboxes and 250,000 emails.

Is inbound email safe to give to the model?

Inbound mail is untrusted data. The agent should read the code or the reply, and never follow instructions written inside an email body. Cooper returns the code or link as a field so the agent rarely needs the raw body.

Related

browser-use agent email verification code inbox · LangChain agent email inbox · Receive a verification code by email · MCP docs · Receive an SMS verification code · Docs · Pricing

Operator: Avatar 8 LLC (ops@avatar33.com). Last updated 2026-11-23.

Canonical: https://cooperemail.com/integrations/crewai