Skip to content

AgentMail MCP tool for ADK

Supported in ADKPythonTypeScript

The AgentMail MCP Server connects your ADK agent to AgentMail, an email inbox API built for AI agents. This integration gives your agent its own email inboxes to send, receive, reply to, and forward messages using natural language.

Use cases

  • Give Agents Their Own Inboxes: Create dedicated email addresses for your agents so they can send and receive emails independently, just like a human team member.

  • Automate Email Workflows: Let your agent handle email conversations end to end, including sending initial outreach, reading replies, and following up on threads.

  • Manage Conversations Across Inboxes: List and search across threads and messages, forward emails, and retrieve attachments to keep your agent informed and responsive.

Prerequisites

Use with agent

from google.adk.agents import Agent
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StdioConnectionParams
from mcp import StdioServerParameters

AGENTMAIL_API_KEY = "YOUR_AGENTMAIL_API_KEY"

root_agent = Agent(
    model="gemini-2.5-pro",
    name="agentmail_agent",
    instruction="Help users manage email inboxes and send messages",
    tools=[
        McpToolset(
            connection_params=StdioConnectionParams(
                server_params=StdioServerParameters(
                    command="npx",
                    args=[
                        "-y",
                        "agentmail-mcp",
                    ],
                    env={
                        "AGENTMAIL_API_KEY": AGENTMAIL_API_KEY,
                    }
                ),
                timeout=30,
            ),
        )
    ],
)
import { LlmAgent, MCPToolset } from "@google/adk";

const AGENTMAIL_API_KEY = "YOUR_AGENTMAIL_API_KEY";

const rootAgent = new LlmAgent({
    model: "gemini-2.5-pro",
    name: "agentmail_agent",
    instruction: "Help users manage email inboxes and send messages",
    tools: [
        new MCPToolset({
            type: "StdioConnectionParams",
            serverParams: {
                command: "npx",
                args: ["-y", "agentmail-mcp"],
                env: {
                    AGENTMAIL_API_KEY: AGENTMAIL_API_KEY,
                },
            },
        }),
    ],
});

export { rootAgent };

Available tools

Inbox management

Tool Description
list_inboxes List all inboxes
get_inbox Get details for a specific inbox
create_inbox Create a new inbox with a username and domain
delete_inbox Delete an inbox

Thread management

Tool Description
list_threads List threads in an inbox
get_thread Get a specific thread with its messages
get_attachment Download an attachment from a message

Message operations

Tool Description
send_message Send a new email from an inbox
reply_to_message Reply to an existing message
forward_message Forward a message to another recipient
update_message Update message properties such as read status

Additional resources