Skip to main content
Glama
Soundhannes

IMAP MCP Server

by Soundhannes

disconnect

Close the IMAP connection to free resources and end email session management.

Instructions

Close IMAP connection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The actual implementation of the disconnect logic in the IMAP client.
    def disconnect(self) -> bool:
        """Close IMAP connection."""
        # Stop watcher if running
        if self.watcher and self.watching:
            self.watcher.stop()
            self.watching = False
    
        if self.client:
            try:
                self.client.logout()
            except Exception:
                pass
            self.client = None
            self.current_mailbox = None
        return True
  • Tool registration for 'disconnect'.
    make_tool(
        "disconnect",
        "Close IMAP connection",
        {},
    ),
  • MCP server handler for the 'disconnect' tool calling the imap_client method.
    elif name == "disconnect":
        return imap_client.disconnect()

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