Skip to main content
Glama

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

sota-agentic-gateway

máy bạn (uv run --script)

11 công cụ cục bộ (+ saas_* nếu điền api_url + api_key), 5 skill

IMAP App Password / API key

sota-agentic-gateway-remote

API SaaS https://<api>/mcp

14 công cụ saas_*, skill sota-saas

OAuth trong /mcp

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

AGW_WORKDIR

Thư mục làm việc (templates/, knowledge/, output/, drafts/). Mặc định ~/SOTA-Agentic-Gateway

AGW_IMAP_HOST · AGW_IMAP_PORT · AGW_IMAP_USER · AGW_IMAP_PASSWORD

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

AGW_SMTP_HOST · AGW_SMTP_PORT · AGW_SMTP_USER · AGW_SMTP_PASSWORD · AGW_MAIL_FROM

Gửi (mặc định 587 STARTTLS; user / mật khẩu mặc định = IMAP)

AGW_INTERNAL_DOMAINS

Domain nội bộ (phân cách dấu phẩy) — dùng cho cảnh báo giả mạo

AGW_SEND_MODE

elicit (mặc định: hỏi xác nhận trong client) · cli (chỉ gửi bằng lệnh terminal) · disabled

AGW_API_URL · AGW_API_KEY

Nối workspace SaaS (API key agw_…, vai trò MEMBER là đủ) → thêm công cụ saas_*

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>/mcp

Trong gói

Gói

Nội dung

agw_mcp

MCP server cục bộ (stdio) — lệnh sota-agw-mcp

agw_core

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

agw_remote_mcp

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 tools
draft_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)A
DestructiveIdempotent

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àoB
Read-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…)A
Read-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ìnhA
Read-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

mail_attachment_textTrích chữ file đính kèmB
Read-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 đâyB
Read-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 emailA
Read-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àngA
Read-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

    A3.7/5.0

    Scored across 11 tools

    Disambiguation4/5

    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.

    Naming Consistency4/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI-powered email management through Gmail, including search, send, drafts, labels, and an intelligent agent with human approval workflow and optional customer database integration.
      -
    • A
      license
      A
      quality
      C
      maintenance
      Gives 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.
      14
      61 npm
      MIT
    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables 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.
      -