auto_connect
Automatically establish IMAP email connections using stored configuration credentials to access email accounts for reading, searching, and organizing messages.
Instructions
Connect using config.json credentials (no parameters needed)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/imap_mcp/imap_client.py:79-100 (handler)The core logic for auto_connect which loads configuration, connects, authenticates, and initializes the watcher.
def auto_connect(self, config_path: str = "config.json") -> bool: """Connect using config.json credentials.""" self.load_config(config_path) self.config["_config_path"] = config_path # Store for watcher imap_config = self.config.get("imap", {}) creds = self.config.get("credentials", {}) self.connect( host=imap_config.get("host"), port=imap_config.get("port", 993), secure=imap_config.get("secure", True), ) self.authenticate(creds.get("username"), creds.get("password")) self._load_auto_archive_config() # Auto-start watcher if cache is enabled if self.config.get("cache", {}).get("enabled", True): self.watcher = get_watcher(config_path) self.watcher.start() self.watching = True return True - src/imap_mcp/server.py:488-489 (registration)Registration/Dispatch of the auto_connect MCP tool in the server request handler.
elif name == "auto_connect": return imap_client.auto_connect()