AI邮件安全代理,凭证隔离四层防护
简介
专为AI Agent设计的邮件安全代理,通过4层内容过滤和凭证隔离,让Agent安全读写邮件而不接触敏感信息或遭受提示注入攻击。
原始描述
Secure email proxy for AI agents. Search, read, and draft emails via MCP with server-side credential isolation, PII redaction, prompt injection detection, an...
通过你的 Agent 添加
点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。
或者手动安装
包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。
技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。
中文使用说明 来自收录源
核心用法
AgentCloak 是一款专为 AI Agent 设计的邮件安全代理中间件,解决传统邮件技能将完整邮箱凭证和内容暴露给 Agent 的安全隐患。它通过 MCP 协议为 Agent 提供 search_emails、read_email、create_draft 等工具,支持 Gmail 风格查询语法,覆盖搜索、阅读、线程管理和草稿撰写全流程。
部署方式灵活:提供托管版(agentcloak.up.railway.app)和自托管版两种选择。托管版最快5分钟完成配置;自托管版需 Node.js 20+ 和 pnpm 10+,数据完全本地处理。
邮件连接支持:IMAP(通用任何邮箱)、Gmail OAuth(邀请制)、Gmail Apps Script(免Google Cloud配置)。
显著优点
- 四层深度防护:Blocklist(金融/安全发件人拦截)、HTML 净化(去Unicode隐藏字符)、PII 脱敏(SSN、银行卡、API密钥等)、提示注入检测(19种已知攻击模式标记)
- 最小权限原则:Agent 仅能搜索、阅读、创建草稿,无法发送、删除、修改任何邮件
- 凭证彻底隔离:Agent 只持有 API Key,真实邮箱密码/OAuth 令牌由服务端加密存储,Agent 不可见
- 草稿强制审核:所有草稿需人工复核后才可发送,杜绝误发风险
- 开源可审计:源码公开,支持完全私有化部署
潜在局限
- 功能受限:不支持附件内容读取(仅元数据)、无发送/删除/修改能力
- 搜索语法单一:仅支持 Gmail 查询语法,IMAP 用户需适应
- 托管版信任依赖:使用托管服务需信任运营方处理邮件凭证和内容
- Gmail OAuth 限制:目前为邀请制,非全量开放
- Beta 阶段:托管版稳定性待验证
适合人群
- 需要让 AI Agent 处理邮件但担心数据泄露的安全敏感型用户
- 企业/团队场景需合规隔离邮箱凭证的开发者
- 处理含金融账单、验证码等敏感信息邮箱的个人高阶用户
- 希望自托管实现完全数据主权的技术用户
常规风险
| 风险场景 | 说明 |
|---|---|
| 托管版运营风险 | 邮件凭证和内容流经第三方服务器,存在潜在泄露或服务终止风险 |
| 过滤绕过 | 新型提示注入或编码攻击可能未被19种模式覆盖 |
| 误拦截 | 过度严格的 Blocklist 可能误伤正常邮件 |
| API Key 泄露 | 若 Agent 环境被入侵,攻击者可读取邮件内容(虽无法获取邮箱凭证) |
| 自托管运维 | 需自行保障服务端安全更新和可用性 |
建议高安全需求用户选择自托管方案,并定期审查过滤规则配置。
技能正文
name: agentcloak description: "Secure email proxy for AI agents. Search, read, and draft emails via MCP with server-side credential isolation, PII redaction, prompt injection detection, and content filtering. Unlike raw Gmail/IMAP skills, your agent never sees passwords or unfiltered content. Self-host or use the hosted version." homepage: https://github.com/ryanfren/AgentCloak user-invocable: true metadata: clawdbot: emoji: "\U0001F6E1\uFE0F" requires: bins: - mcporter env: - AGENTCLOAK_API_KEY primaryEnv: AGENTCLOAK_API_KEY
AgentCloak
Secure email proxy for AI agents. AgentCloak sits between your agent and your email, so the agent gets useful email access without seeing credentials, sensitive financial data, PII, or prompt injection attacks.
Every other email skill on ClawHub gives your agent raw, unfiltered access to your inbox. AgentCloak is the only one with a built-in security pipeline.
What makes this different
- Credential isolation — your email password/OAuth tokens stay server-side; the agent only has an API key
- 4-stage content filter — blocklist, HTML sanitizer, PII redaction, prompt injection detection
- Read + draft only — agents can search, read, list, and draft emails but cannot send, delete, or modify anything
- Draft safety — drafts are never sent automatically; you review them first
- Self-host or hosted — run your own instance or use the hosted version
Setup
Option A: Hosted version (quickest)
- Sign up at https://agentcloak.up.railway.app
- Connect your email (IMAP works with any provider, Gmail OAuth available by invite)
- Create an API key in the dashboard
- Configure:
export AGENTCLOAK_API_KEY=ac_your_key_here
mcporter config add agentcloak \
--baseUrl "https://agentcloak.up.railway.app/mcp" \
--header "Authorization: Bearer $AGENTCLOAK_API_KEY"
Option B: Self-hosted
- Clone and run:
git clone https://github.com/ryanfren/AgentCloak.git
cd agentcloak
pnpm install && pnpm build && pnpm dev
- Open http://localhost:3000, create an account, connect email, create API key
- Configure:
export AGENTCLOAK_URL=http://localhost:3000
export AGENTCLOAK_API_KEY=ac_your_key_here
mcporter config add agentcloak \
--baseUrl "${AGENTCLOAK_URL}/mcp" \
--header "Authorization: Bearer $AGENTCLOAK_API_KEY"
Requirements for self-hosting: Node.js 20+, pnpm 10+
Available tools
| Tool | Description | Key parameters |
|---|---|---|
search_emails |
Search emails with Gmail-style queries | query, max_results (1-200), page_token |
read_email |
Read full email content by ID | message_id |
list_threads |
List conversation threads | query, max_results, page_token |
get_thread |
Read all messages in a thread | thread_id |
create_draft |
Create a draft (not sent) | to, subject, body, in_reply_to_thread_id |
list_drafts |
List existing drafts | max_results |
list_labels |
List all labels with unread counts | (none) |
get_provider_info |
Get provider type and capabilities | (none) |
Usage examples
# Search for unread emails
mcporter call agentcloak.search_emails query:"is:unread" max_results:10
# Read a specific email
mcporter call agentcloak.read_email message_id:"abc123"
# Get a full conversation thread
mcporter call agentcloak.get_thread thread_id:"thread456"
# Draft a reply (not sent until you review it)
mcporter call agentcloak.create_draft subject:"Re: Meeting" body:"Sounds good, see you Thursday." in_reply_to_thread_id:"thread456"
# List labels and unread counts
mcporter call agentcloak.list_labels
Security pipeline
Every email passes through a 4-stage filter before the agent sees it. Each stage is independently configurable from the dashboard.
Stage 1: Blocklist
Blocks emails from sensitive senders outright. Three toggleable categories:
- Financial — 40+ domains (Chase, PayPal, Venmo, Coinbase, etc.)
- Security senders — patterns like security@, fraud@, alerts@, .gov addresses
- Security subjects — password resets, 2FA codes, verification links, login alerts
Plus custom blocklists: add your own domains, sender patterns, or subject patterns.
Stage 2: HTML sanitizer
Converts HTML email to plaintext and strips dangerous Unicode (zero-width characters, bidirectional overrides, tag characters, variation selectors) that could be used to hide prompt injection.
Stage 3: PII redaction
Redacts sensitive patterns with placeholders:
- SSNs, credit card numbers, bank account/routing numbers
- API keys (
sk_,pk_, AWS keys), bearer tokens, PEM private keys - Optionally: email addresses, large dollar amounts
Stage 4: Prompt injection detection
Scans for 19 known injection patterns (instruction overrides, role reassignments, system tag injections, data exfiltration attempts). Flags detected content with a [AGENTCLOAK WARNING] prefix so the agent knows the email may be adversarial. Does not block — lets the agent make an informed decision.
Security and privacy
What data leaves your machine:
| Scenario | Data flow |
|---|---|
| Self-hosted | Nothing leaves your machine. All processing is local. |
| Hosted version | Your email credentials are stored server-side (encrypted). Email content passes through the hosted server's filter pipeline. No data is shared with third parties. |
- API keys are hashed (SHA-256) before storage — the server cannot recover your key after creation
- Email credentials are stored server-side; the agent never sees them
- All filtering happens server-side before content reaches the agent
- The agent can only read and draft — it cannot send, delete, or modify emails
- Source code is open: https://github.com/ryanfren/AgentCloak
Trust statement: By using the hosted version, you trust the AgentCloak server with access to your email account credentials and content. If this is not acceptable, self-host your own instance for full control.
Email providers
AgentCloak supports three connection methods:
- IMAP — works with any email provider (Gmail, Outlook, ProtonMail Bridge, Fastmail, etc.)
- Gmail OAuth — direct API access (currently invite-only during beta)
- Gmail Apps Script — manual setup via script.google.com, no Google Cloud project needed
Limitations
- Read and draft only — no send, delete, or modify
- Gmail search syntax only (even for IMAP connections, queries are translated)
- Attachment content is not accessible (metadata can optionally be shown)
- Gmail OAuth is invite-only during beta; IMAP and Apps Script are open to all
- Hosted version is in beta
Links
- Homepage: https://agentcloak.up.railway.app
- Source: https://github.com/ryanfren/AgentCloak
- License: BSL 1.1
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。