How It Works

smolagents has shipped MCP support since v1.14.0: MCPClient (and the equivalent ToolCollection.from_mcp) connects to an MCP server, discovers its tools, and hands them to your agent as ordinary smolagents tools. Dead Simple Email runs a hosted MCP server over streamable HTTP, authenticated with your API key in an Authorization header — so the integration is a connection dict, not an adapter package.

We don't ship a dedicated smolagents package, and you won't miss it: MCP covers the full toolset, and for narrow use cases the @tool decorator wraps our Python SDK in a few lines.

Quick Start: MCPClient

terminal
pip install "smolagents[mcp]"
email_agent.py
import os
from smolagents import MCPClient, CodeAgent, InferenceClientModel

server = {
    "url": "https://api.deadsimple.email/mcp",
    "transport": "streamable-http",
    "headers": {"Authorization": f"Bearer {os.environ['DSE_API_KEY']}"},
}

with MCPClient(server) as tools:
    agent = CodeAgent(tools=tools, model=InferenceClientModel())
    agent.run("Create an inbox and send a hello email to team@example.com")

The context manager keeps the MCP connection open for the agent run and closes it cleanly afterwards. All 14 tools load: create_inbox, list_inboxes, delete_inbox, send_email, read_messages, read_message, reply_to_message, forward_message, wait_for_email, get_verification_code, get_verification_link, list_threads, read_thread, and get_usage.

Prefer the ToolCollection idiom? Same dict, same result:

tool_collection.py
from smolagents import ToolCollection, CodeAgent, InferenceClientModel

with ToolCollection.from_mcp(server, trust_remote_code=True) as tc:
    agent = CodeAgent(tools=[*tc.tools], model=InferenceClientModel())
    agent.run("Check the support inbox and summarize unanswered threads.")

Running local and offline-ish? The same server runs over stdio as a subprocess: python -m deadsimple.mcp with DSE_API_KEY set (pip install deadsimple-email[mcp]), connected via StdioServerParameters.

Alternative: A Hand-Written @tool

If your agent only needs one email capability, skip MCP and wrap the SDK directly. smolagents builds the tool schema from the signature and the Args docstring:

custom_tool.py
# pip install smolagents deadsimple-email
from smolagents import tool, CodeAgent, InferenceClientModel
from deadsimple import DeadSimple

client = DeadSimple(api_key="dse_your_api_key")

@tool
def send_email(inbox_id: str, to: str, subject: str, body: str) -> str:
    """Send an email from a Dead Simple Email inbox.

    Args:
        inbox_id: ID of the inbox to send from.
        to: Recipient email address.
        subject: Subject line.
        body: Plain-text body of the email.
    """
    result = client.messages.send(inbox_id, to, subject, text_body=body)
    return f"Sent: {result.message_id}"

agent = CodeAgent(tools=[send_email], model=InferenceClientModel())
agent.run("Email team@example.com from inbox inb_123 to confirm the deploy.")

The same pattern wraps any SDK call — client.inboxes.create(), client.messages.wait_for(), client.messages.get_verification(). Because CodeAgent writes Python to chain its tools, a single run can create an inbox, send outreach, and wait for the reply in one generated snippet.

Frequently Asked Questions

Yes, two ways. smolagents has supported MCP since v1.14.0, so MCPClient pointed at our hosted server loads 14 email tools automatically. Or write a single @tool function wrapping the Python SDK if you only need send or read.

No dedicated smolagents package exists as of August 2026, and none is needed — MCPClient handles discovery and execution of all 14 tools, and the @tool decorator turns any SDK call into a smolagents tool in a few lines.

CodeAgent writes Python to chain tool calls, so multi-step email work — create an inbox, send outreach, wait for the reply, summarize the thread — happens in one generated snippet instead of many separate LLM round-trips.

Yes. Tools loaded via MCPClient or ToolCollection.from_mcp are ordinary smolagents tools, usable by CodeAgent and ToolCallingAgent alike.

Yes. The free tier includes 5 inboxes and 5,000 emails per month, requires no credit card, and does not expire.

Ready to build?

Free tier: 5 inboxes and 5,000 emails a month. No credit card required.

API Reference Get Started Free