MailgentMailgent
Examples

Inbox Monitor

A read-only agent that monitors an inbox and alerts on important emails

A lightweight agent that watches for important emails and sends alerts — without replying.

Use Cases

  • Monitor a shared inbox for urgent requests
  • Alert on emails from VIP senders
  • Track SLA response times
  • Log all incoming emails to a database

Scopes Needed

Only mail:read — this agent never sends emails.

MCP Setup

{
  "mcpServers": {
    "mailgent-monitor": {
      "url": "https://api.mailgent.dev/mcp",
      "headers": {
        "Authorization": "Bearer mgent-readonly-key"
      }
    }
  }
}

With only mail:read scope, the agent sees:

  • mail.list_messages
  • mail.get_message
  • mail.list_threads
  • mail.get_thread

The mail.send, mail.reply, and mail.update_labels tools are not available.

API Flow

import requests

headers = {"Authorization": "Bearer mgent-readonly-key"}

def check_inbox():
    res = requests.get(
        f"{BASE}/messages?labels=unread&limit=50",
        headers=headers
    )
    messages = res.json()["messages"]

    for msg in messages:
        sender = msg["from"][0]
        subject = msg["subject"]

        # Check if VIP sender
        if is_vip(sender):
            alert(f"VIP email from {sender}: {subject}")

        # Check for urgent keywords
        text = msg["extractedText"] or msg["text"] or ""
        if any(word in text.lower() for word in ["urgent", "asap", "emergency"]):
            alert(f"Urgent email: {subject}")

        # Log to your system
        log_email(msg)

Why Read-Only?

The principle of least privilege — a monitoring agent should never accidentally send an email or modify labels. Create a separate identity with only mail:read scope for monitoring.

On this page