A community-driven registry for Claude, Cursor, Windsurf, Cline & more. Not affiliated with Anthropic.
Are you the author? Sign in to claim
MCP server for IMAP email access - enables Claude and other LLM applications to read emails via the IMAP protocol
A Model Context Protocol (MCP) server that enables Claude and other LLM applications to read emails via the IMAP protocol. This server provides secure, read-only access to email accounts from popular providers like Gmail, Outlook, Yahoo, and custom IMAP servers.
git clone <repository-url>
cd mcp-imap-server
npm install
npm run build
Create a .env file in the project root:
# Required: IMAP server configuration
IMAP_HOST=imap.gmail.com
IMAP_PORT=993
IMAP_USER=your-email@gmail.com
IMAP_PASSWORD=your-app-password
IMAP_TLS=true
# Optional: Connection settings
IMAP_AUTH_TIMEOUT=3000
IMAP_CONN_TIMEOUT=10000
IMAP_KEEPALIVE_INTERVAL=10000
IMAP_IDLE_INTERVAL=300000
IMAP_FORCE_NOOP=false
IMAP_HOST=imap.gmail.com
IMAP_PORT=993
IMAP_TLS=true
IMAP_HOST=outlook.office365.com
IMAP_PORT=993
IMAP_TLS=true
IMAP_HOST=imap.mail.yahoo.com
IMAP_PORT=993
IMAP_TLS=true
IMAP_HOST=imap.mail.me.com
IMAP_PORT=993
IMAP_TLS=true
# Development mode
npm run dev
# Production mode
npm run build
npm start
The server exposes the following tools to MCP clients:
search_emailsSearch for emails based on various criteria.
Parameters:
sender (optional): Filter by sender email address or namesubject (optional): Filter by subject line (partial match)dateFrom (optional): Start date for date range filter (ISO format: YYYY-MM-DD)dateTo (optional): End date for date range filter (ISO format: YYYY-MM-DD)content (optional): Search within email content/body textunread (optional): Filter by read status (true for unread only, false for read only)folder (optional): Folder to search in (defaults to INBOX)limit (optional): Maximum number of emails to return (1-100)Example:
{
"name": "search_emails",
"arguments": {
"sender": "notifications@github.com",
"unread": true,
"limit": 10
}
}
get_emailRetrieve the full content of a specific email by its message ID.
Parameters:
messageId (required): The message ID or UID of the email to retrievefolder (optional): Folder containing the email (defaults to INBOX)Example:
{
"name": "get_email",
"arguments": {
"messageId": "12345",
"folder": "INBOX"
}
}
list_foldersList all available email folders/mailboxes in the account.
Parameters:
includeSpecial (optional): Include special folders like Sent, Drafts, etc.Example:
{
"name": "list_folders",
"arguments": {
"includeSpecial": true
}
}
get_recent_emailsGet the most recent emails from a specific folder.
Parameters:
folder (optional): Folder to get emails from (defaults to INBOX)limit (optional): Number of recent emails to retrieve (1-50, default: 10)unreadOnly (optional): Only return unread emailsExample:
{
"name": "get_recent_emails",
"arguments": {
"folder": "INBOX",
"limit": 5,
"unreadOnly": true
}
}
mark_as_readMark an email as read or unread.
Parameters:
messageId (required): The message ID or UID of the email to markfolder (optional): Folder containing the email (defaults to INBOX)read (optional): Mark as read (true) or unread (false). Default: trueExample:
{
"name": "mark_as_read",
"arguments": {
"messageId": "12345",
"read": true
}
}
IMAP_PASSWORDIMAP_PASSWORDConsult your email provider's documentation for IMAP access and app password setup.
src/
├── config/ # Configuration management
├── services/ # IMAP connection and management
├── tools/ # MCP tool implementations
├── types/ # TypeScript type definitions
└── index.ts # Main server entry point
npm run build # Build TypeScript to JavaScript
npm run dev # Run in development mode with auto-reload
npm start # Run the built server
npm test # Run tests
npm run lint # Lint the code
npm run typecheck # Type check without building
npm run clean # Clean build directory
src/types/index.tssrc/tools/index.tssrc/index.tsThe server includes comprehensive error handling for:
Authentication Failed
Connection Timeout
TLS/SSL Errors
IMAP_TLS=true for secure connectionsSet NODE_ENV=development to enable debug logging:
NODE_ENV=development npm run dev
MIT License - see LICENSE file for details.
For issues and questions:
A Jetbrains IDE IntelliJ plugin aimed to provide coding agents the ability to leverage intelliJ's indexing of the codeba
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots