sota-agw-mcp
Integrates with Gmail mailboxes via IMAP/SMTP, enabling read-only inbox access, email triage, attachment text extraction, reply drafting, and sending only after explicit user confirmation.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@sota-agw-mcp triage my inbox and draft replies to urgent logistics emails"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SOTA Agentic Gateway — MCP server & Claude plugin
Thử nghiệm nội bộ — CHƯA phát hành lên PyPI. Cài từ GitHub như bên dưới. Đừng dùng
uvx sota-agw-mcp(không--from): tên đó chưa đăng ký trên PyPI, lệnh sẽ tra PyPI và có thể cài gói của người khác.
MCP server cho việc tiếp nhận & phản hồi email / tin nhắn trong logistics, chuỗi cung ứng, thương mại: phân loại hộp thư (luật quảng cáo / lừa đảo), trích chữ file đính kèm, điền template DOCX / XLSX tô vàng, tra thư mục tri thức, soạn nháp — và chỉ gửi sau khi bạn xác nhận. Tuỳ chọn nối workspace SaaS SOTA Agentic Gateway (gửi = tạo yêu cầu duyệt).
Không có công cụ nào tự gửi hay tự duyệt. Gửi email cục bộ cần bạn bấm xác nhận trong hộp thoại của client (MCP elicitation); client không có hộp thoại → server trả lệnh terminal (
… -m agw_mcp send <draft_id>) để bạn tự chạy.IMAP chỉ đọc. File chỉ đọc / ghi trong thư mục làm việc
AGW_WORKDIR.Nội dung email / file được coi là dữ liệu bên ngoài — không phải lệnh.
Cài & chạy
Cần uv. Client gọi uvx --from git+https://github.com/thanhtrung665/gateway-agent-mcp sota-agw-mcp (stdio) — uv tự tải từ GitHub.
Muốn cố định phiên bản: thêm @<commit> hoặc @<tag> sau URL.
Claude Code
claude mcp add sota-agw -e AGW_WORKDIR=$HOME/SOTA-Agentic-Gateway -- uvx --from git+https://github.com/thanhtrung665/gateway-agent-mcp sota-agw-mcp
# hoặc cài plugin (có thêm skill + ô cấu hình) — marketplace có 2 plugin, chọn theo chế độ:
claude plugin marketplace add thanhtrung665/gateway-agent-mcp
claude plugin install sota-agentic-gateway@sota-agentic-gateway # cục bộ: IMAP, file, template trên máy (cần uv)
claude plugin install sota-agentic-gateway-remote@sota-agentic-gateway # remote: workspace SaaS qua OAuth, không cài gìPlugin | Chạy ở đâu | Công cụ | Đăng nhập |
| máy bạn ( | 11 công cụ cục bộ (+ | IMAP App Password / API key |
| API SaaS | 14 công cụ | OAuth trong |
Cài cả hai được (vd hộp thư cục bộ + workspace); khi đó để trống api_url / api_key của plugin cục bộ để khỏi trùng
công cụ saas_*.
Prompts (client không có skill vẫn đi đúng quy trình duyệt): cục bộ triage_local, reply_local,
fill_template_local; workspace inbox_saas, reply_saas — trong Claude Code gõ / để thấy.
Claude Desktop (claude_desktop_config.json) · Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"sota-agw": {
"command": "uvx",
"args": ["--from", "git+https://github.com/thanhtrung665/gateway-agent-mcp", "sota-agw-mcp"],
"env": {
"AGW_WORKDIR": "/Users/ban/SOTA-Agentic-Gateway",
"AGW_IMAP_HOST": "imap.gmail.com",
"AGW_IMAP_USER": "ban@congty.vn",
"AGW_IMAP_PASSWORD": "<app password>",
"AGW_SMTP_HOST": "smtp.gmail.com"
}
}
}
}VS Code (.vscode/mcp.json)
{
"servers": {
"sota-agw": { "type": "stdio", "command": "uvx", "args": ["--from", "git+https://github.com/thanhtrung665/gateway-agent-mcp", "sota-agw-mcp"], "env": { "AGW_WORKDIR": "${userHome}/SOTA-Agentic-Gateway" } }
}
}Kiểm cấu hình: uvx --from git+https://github.com/thanhtrung665/gateway-agent-mcp sota-agw-mcp check (in thư mục làm việc, thử đăng nhập IMAP / SaaS — không in mật khẩu).
Related MCP server: Gmail MCP Server
Cấu hình (biến môi trường)
Biến | Ý nghĩa |
| Thư mục làm việc ( |
| Hộp thư (IMAP SSL, mặc định cổng 993). Dùng App Password, không dùng mật khẩu chính |
| Gửi (mặc định 587 STARTTLS; user / mật khẩu mặc định = IMAP) |
| Domain nội bộ (phân cách dấu phẩy) — dùng cho cảnh báo giả mạo |
|
|
| Nối workspace SaaS (API key |
Mật khẩu nằm trong file cấu hình của client dưới dạng chữ thường — dùng App Password riêng, thu hồi được. Bản plugin
Claude Code lưu các ô bí mật an toàn hơn (userConfig sensitive).
Remote MCP (workspace SaaS — không cần cài gì)
Dán https://<api-saas>/mcp vào client hỗ trợ MCP từ xa: client mở trang đăng nhập + đồng ý (OAuth 2.1), hoặc gửi
header Authorization: Bearer agw_…. Mã endpoint là gói agw_remote_mcp trong gói này; máy chủ uỷ quyền nằm ở API SaaS.
claude mcp add --transport http sota-agw-remote https://<api-saas>/mcpTrong gói
Gói | Nội dung |
| MCP server cục bộ (stdio) — lệnh |
| Lõi thuần Python: tách email RFC 822, luật quảng cáo / an ninh, BM25 + RRF, trích chữ PDF / DOCX / XLSX / EML, template tô vàng, định nghĩa công cụ SaaS dùng chung |
| Remote MCP (ASGI, Streamable HTTP stateless) cho API SaaS |
Mã nguồn, Claude plugin và skill: https://github.com/thanhtrung665/gateway-agent-mcp
Phát triển
uv sync
uv run pytest -q # plugin + gói + remote MCP (không cần SaaS, không ra mạng)
uv run ruff check .
python -X utf8 scripts/sync_plugin_core.py # sau khi sửa agw_core/ hoặc agw_mcp/server.py → chép vào plugin
uv build && uv run python scripts/smoke_stdio.py uvx --isolated --from dist/<wheel> sota-agw-mcp
claude plugin validate plugin/sota-agentic-gateway && claude plugin validate plugin/sota-agentic-gateway-remote && claude plugin validate .plugin/sota-agentic-gateway/server/agw_mcp.py là bản chép y hệt agw_mcp/server.py (plugin chạy bằng
uv run --script, phụ thuộc khai ở khối # /// script đầu file — test kiểm khớp pyproject.toml). Repo SaaS cài gói
này qua git dependency ghim commit (sota-agw-mcp[remote] @ git+https://github.com/thanhtrung665/gateway-agent-mcp@<commit>).
Phát hành PyPI (chưa làm — quyết định 2026-11-07: chỉ nội bộ): khi được chốt, tạo pending publisher trên pypi.org /
test.pypi.org rồi tag test-vX.Y.Z (TestPyPI) → vX.Y.Z (PyPI) — workflow publish.yml (Trusted Publishing).
Giấy phép
Thương mại — xem LICENSE.
Available Tools
11 toolsdraft_createSoạn nháp emailA
Lưu nháp email (chưa gửi). to/cc: nhiều địa chỉ ngăn bằng dấu phẩy. attachments: đường dẫn trong workdir. Cho người dùng xem nháp; chỉ gọi draft_send khi người dùng muốn gửi.
Inputs: to (required), body (required), subject (required), cc, +2 more. Returns: object
draft_sendGửi nháp (cần người xác nhận)ADestructiveIdempotent
Gửi nháp qua SMTP. LUÔN hỏi người dùng xác nhận qua hộp thoại của client (hiện đủ người nhận / nội dung / đính kèm). Client không có hộp thoại xác nhận → không gửi; hướng dẫn người dùng gửi bằng lệnh terminal.
Inputs: draft_id (required). Returns: object
email_checkKiểm tra luật cho email dán vàoBRead-only
Chạy luật G01 (quảng cáo) + G02 (an ninh: Reply-To khác domain, đổi tài khoản, domain giả…) cho email người dùng dán vào hội thoại.
Inputs: body (required), sender (required), subject (required), reply_to. Returns: object
file_readĐọc file (.eml/.pdf/.docx/.xlsx…)ARead-only
Đọc file trong thư mục làm việc. .eml → email đã tách + cảnh báo; file khác → chữ đã trích.
Inputs: path (required). Returns: object
gateway_statusTrạng thái cấu hìnhARead-only
Cấu hình hiện tại: thư mục làm việc, hộp thư, chế độ gửi, kết nối SaaS (không lộ mật khẩu / key).
Inputs: no named parameters. Returns: object
knowledge_searchTìm trong thư mục tri thứcARead-only
Tìm (BM25, không phân biệt dấu) trong /knowledge: bảng giá, catalogue, chính sách, hợp đồng…
Inputs: query (required), k. Returns: object
mail_attachment_textTrích chữ file đính kèmBRead-only
Trích chữ từ file đính kèm (PDF có lớp chữ, DOCX, XLSX, CSV, TXT, HTML, EML). save=true → lưu file gốc vào /attachments để dùng tiếp (vd làm đính kèm).
Inputs: uid (required), index (required), save, folder. Returns: object
mail_list_recentLiệt kê email gần đâyBRead-only
Liệt kê email gần đây (mới nhất trước) qua IMAP, không đánh dấu đã đọc. Có cờ nghi quảng cáo (luật G01).
Inputs: limit, folder, since_days, unread_only. Returns: object
mail_readĐọc emailARead-only
Đọc 1 email theo UID: nội dung, file đính kèm, cảnh báo luật (quảng cáo, giả mạo, đổi tài khoản…).
Inputs: uid (required), folder. Returns: object
template_fillĐiền template → file mớiB
Điền giá trị vào các trường tô vàng, lưu file MỚI ở /output (file gốc giữ nguyên). Trả đường dẫn + các trường còn thiếu — cho người dùng xem lại trước khi dùng / gửi.
Inputs: path (required), values (required), output_name. Returns: object
template_inspectXem trường của template tô vàngARead-only
Template DOCX/XLSX: các đoạn tô VÀNG là trường cần điền. Trả danh sách trường + JSON schema giá trị.
Inputs: path (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Most tools have clearly distinct targets: gateway_status, mail_list_recent, mail_read, draft_create, draft_send, template_inspect, template_fill, knowledge_search are all unambiguous. A few boundaries blur: mail_read vs email_check vs file_read all surface email content with rule warnings (.eml handling), and mail_attachment_text vs file_read both extract text from files. Descriptions do differentiate them, so confusion is minor.
All names are snake_case and follow a stable noun_verb pattern (mail_read, draft_send, template_fill, knowledge_search), with gateway_status as the only noun-only outlier. The one true inconsistency is the prefix split between mail_* and email_check for the same conceptual domain. Readable and predictable overall.
11 tools is a well-scoped set: 4 mail read-side, 2 draft/write-side, 2 template, plus status, file read, and knowledge search. Each tool has a distinct role with no filler entries.
The mail lifecycle is covered from listing and reading through attachment extraction, drafting, and sending, plus a template fill pipeline and knowledge lookup. Gaps exist around mailbox management: no mailbox/folder search, no reply/forward, no draft listing or editing, and file_read has no companion file_list/file_write. These are workaroundable but notable.
Maintenance
Related MCP Connectors
Search and triage all your mailboxes; draft replies and campaigns; send only as you allow.
Email inboxes for recurring agent work. Read, search, reply, draft and organize correspondence.
Stateful email for AI agents: read inboxes, reply in-thread, draft with approval.
Governed email for AI agents: a sandbox inbox to read and send from, human approval to go external.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage multiple email accounts with secure credentials, local full-text search, thread-aware replies, and automation.11 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables AI-powered email management through Gmail, including search, send, drafts, labels, and an intelligent agent with human approval workflow and optional customer database integration.-
- AlicenseAqualityCmaintenanceGives AI agents their own email address with inbound parsing, classification, extraction, and prompt injection screening, plus tools to manage mailboxes, send/receive emails, and handle draft approval workflows.1461 npmMIT
- FlicenseNot gradedqualityNot gradedmaintenanceEnables autonomous triage of personal communications and email through deterministic multi-factor urgency scoring, VIP filtering, and context-aware executive auto-drafting. It plugs into any MCP-compliant client to resolve routine communication workflows instantly without frontier LLM round-trips.-