connect
Establish a secure IMAP connection to your mail server for reading, searching, and organizing email messages through the IMAP MCP Server.
Instructions
Establish IMAP connection to mail server
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"host": "<host>"
},
"name": "connect"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | Yes | IMAP server hostname | |
| port | No | IMAP port (default: 993) | |
| secure | No | Use SSL/TLS (default: true) |
Implementation Reference
- src/imap_mcp/imap_client.py:51-54 (handler)The `connect` method in `ImapClientWrapper` establishes the IMAP connection using `imapclient.IMAPClient`.
def connect(self, host: str, port: int = 993, secure: bool = True) -> bool: """Establish IMAP connection.""" self.client = IMAPClient(host, port=port, ssl=secure) return True - src/imap_mcp/server.py:475-480 (registration)The `connect` tool is registered and handled in `server.py` within `handle_tool_call` by calling `imap_client.connect`.
if name == "connect": return imap_client.connect( host=args["host"], port=args.get("port", 993), secure=args.get("secure", True), )