e2a MCP Server는 ADK
에이전트를 AI 에이전트용으로 구축된 인증 이메일 게이트웨이인
e2a에 연결합니다. 이 통합을 사용하면 에이전트가
자체 이메일 받은편지함을 갖고 자연어로 메시지를 보내고, 받고, 답장할 수
있습니다. 또한 SPF/DKIM으로 검증된 수신 메일과 발신 메시지에 대한 선택적
human-in-the-loop 승인을 제공합니다.
fromgoogle.adk.agentsimportAgentfromgoogle.adk.tools.mcp_toolimportMcpToolsetfromgoogle.adk.tools.mcp_tool.mcp_session_managerimportStdioConnectionParamsfrommcpimportStdioServerParametersE2A_API_KEY="YOUR_E2A_API_KEY"E2A_AGENT_EMAIL="your-bot@your-domain.com"# optional default inboxroot_agent=Agent(model="gemini-flash-latest",name="e2a_agent",instruction=("You manage email through the e2a tools. Call whoami once ""to find your inbox address. Use list_messages and ""get_message to read; use reply_to_message (not ""send_email) when replying to an existing thread so ""threading headers are preserved."),tools=[McpToolset(connection_params=StdioConnectionParams(server_params=StdioServerParameters(command="npx",args=["-y","@e2a/mcp-server"],env={"E2A_API_KEY":E2A_API_KEY,"E2A_AGENT_EMAIL":E2A_AGENT_EMAIL,},),timeout=30,),)],)
fromgoogle.adk.agentsimportAgentfromgoogle.adk.tools.mcp_toolimportMcpToolsetfromgoogle.adk.tools.mcp_tool.mcp_session_managerimport(StreamableHTTPConnectionParams,)E2A_API_KEY="YOUR_E2A_API_KEY"root_agent=Agent(model="gemini-flash-latest",name="e2a_agent",instruction=("You manage email through the e2a tools. Call whoami once ""to find your inbox address. Use list_messages and ""get_message to read; use reply_to_message (not ""send_email) when replying to an existing thread so ""threading headers are preserved."),tools=[McpToolset(connection_params=StreamableHTTPConnectionParams(url="https://mcp.e2a.dev/mcp",headers={"Authorization":f"Bearer {E2A_API_KEY}"},timeout=30,),)],)
import{LlmAgent,MCPToolset}from"@google/adk";constE2A_API_KEY="YOUR_E2A_API_KEY";constE2A_AGENT_EMAIL="your-bot@your-domain.com";// optional default inboxconstrootAgent=newLlmAgent({model:"gemini-flash-latest",name:"e2a_agent",instruction:"You manage email through the e2a tools. Call whoami once "+"to find your inbox address. Use list_messages and "+"get_message to read; use reply_to_message (not "+"send_email) when replying to an existing thread so "+"threading headers are preserved.",tools:[newMCPToolset({type:"StdioConnectionParams",serverParams:{command:"npx",args:["-y","@e2a/mcp-server"],env:{E2A_API_KEY:E2A_API_KEY,E2A_AGENT_EMAIL:E2A_AGENT_EMAIL,},},}),],});export{rootAgent};
import{LlmAgent,MCPToolset}from"@google/adk";constE2A_API_KEY="YOUR_E2A_API_KEY";constrootAgent=newLlmAgent({model:"gemini-flash-latest",name:"e2a_agent",instruction:"You manage email through the e2a tools. Call whoami once "+"to find your inbox address. Use list_messages and "+"get_message to read; use reply_to_message (not "+"send_email) when replying to an existing thread so "+"threading headers are preserved.",tools:[newMCPToolset({type:"StreamableHTTPConnectionParams",url:"https://mcp.e2a.dev/mcp",transportOptions:{requestInit:{headers:{Authorization:`Bearer ${E2A_API_KEY}`,},},},}),],});export{rootAgent};