Skip to main content
Glama
Soundhannes

IMAP MCP Server

by Soundhannes

idle_watch

Monitor a single IMAP mailbox for new email arrivals in real-time using the IDLE protocol, with configurable timeout settings.

Instructions

Start watching mailbox for new emails (IMAP IDLE) - single mailbox, temporary

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mailboxNoMailbox to watch (default: INBOX)
timeoutNoWatch timeout in seconds (default: 300)

Implementation Reference

  • The core implementation of the idle_watch tool, which uses IMAP IDLE to monitor a mailbox for a specified timeout.
    def idle_watch(
        self, mailbox: str = "INBOX", timeout: int = 300
    ) -> dict:
        """Start watching mailbox for new emails (IMAP IDLE) - single mailbox, temporary."""
        self._ensure_connected()
        self.select_mailbox(mailbox)
    
        self.client.idle()
        responses = self.client.idle_check(timeout=timeout)
        self.client.idle_done()
    
        return {
            "mailbox": mailbox,
            "responses": [str(r) for r in responses],
        }
    
    # === Auto-Archive ===
  • Tool registration definition for idle_watch, including its schema (input parameters).
    make_tool(
        "idle_watch",
        "Start watching mailbox for new emails (IMAP IDLE) - single mailbox, temporary",
        {
            "mailbox": {"type": "string", "description": "Mailbox to watch (default: INBOX)"},
            "timeout": {"type": "number", "description": "Watch timeout in seconds (default: 300)"},
        },
    ),
  • The server-side dispatch logic that routes the MCP tool call to the imap_client.idle_watch method.
    elif name == "idle_watch":
        return imap_client.idle_watch(
            mailbox=args.get("mailbox", "INBOX"),
            timeout=args.get("timeout", 300),
        )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Soundhannes/IMAP-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server