IMAP MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "IMAP_HOST=${IMAP_HOST}" -e "IMAP_PORT=${IMAP_PORT}" -e "IMAP_USERNAME=${IMAP_USERNAME}" -e "IMAP_PASSWORD=${IMAP_PASSWORD}" -e "IMAP_USE_SSL=${IMAP_USE_SSL}" imap-mcp-9c7b -- npx imap-mcp
Required:IMAP_HOSTIMAP_PORTIMAP_USERNAMEIMAP_PASSWORDIMAP_USE_SSL
README.md

An IMAP Model Context Protocol (MCP) server to expose IMAP operations

imap-mcp

šŸ“§ An IMAP Model Context Protocol (MCP) server to expose IMAP operations as tools for AI assistants.

✨ Features

  • Email Draft Creation: Create draft emails that are saved to your IMAP server's drafts folder
  • IMAP Integration: Connect to any IMAP-compatible email server (Gmail, Outlook, etc.)
  • Secure Authentication: Uses environment variables for secure credential management
  • MCP Compatible: Works with Claude and other AI assistants that support the Model Context Protocol
  • TypeScript: Full TypeScript support with proper type definitions

Setup

{
  "mcpServers": {
    ...,
    "imap": {
      "command": "npx",
      "args": [
        "imap-mcp"
      ],
      "env": {
        "IMAP_HOST": "<IMAP host>",
        "IMAP_PORT": "<IMAP port>",
        "IMAP_USERNAME": "<IMAP username>",
        "IMAP_PASSWORD": "<IMAP password>",
        "IMAP_USE_SSL": "<true or false>"
      }
    }
  }
}

Usage

  1. Compile TypeScript to JavaScript:
npx tsc
  1. Run the MCP server:
node dist/index.js

Available Tools

`create-draft`

Creates a draft email message and saves it to the IMAP server's drafts folder.

Parameters:

  • to (string, required): The recipient's email address
  • subject (string, required): The email subject line
  • body (string, required): The email body content
  • from (string, optional): The sender's email address (defaults to IMAP_USERNAME)

Example:

{
  "to": "recipient@example.com",
  "subject": "Meeting Reminder",
  "body": "Don't forget about our meeting tomorrow at 2 PM.",
  "from": "sender@example.com"
}

The tool will attempt to save the draft to either "INBOX.Drafts" or "Drafts" folder, depending on your email server's folder structure.

License

MIT

Tools (1)

create-draftCreates a draft email message and saves it to the IMAP server's drafts folder.

Environment Variables

IMAP_HOSTrequiredThe hostname of the IMAP server
IMAP_PORTrequiredThe port number for the IMAP server
IMAP_USERNAMErequiredThe username for email authentication
IMAP_PASSWORDrequiredThe password for email authentication
IMAP_USE_SSLrequiredWhether to use SSL for the connection (true or false)

Configuration

claude_desktop_config.json
{"mcpServers": {"imap": {"command": "npx", "args": ["imap-mcp"], "env": {"IMAP_HOST": "<IMAP host>", "IMAP_PORT": "<IMAP port>", "IMAP_USERNAME": "<IMAP username>", "IMAP_PASSWORD": "<IMAP password>", "IMAP_USE_SSL": "<true or false>"}}}}

Try it

→Create a draft email to my manager with the subject 'Project Update' and tell them the project is on track.
→Draft an email to client@example.com regarding the meeting reminder for tomorrow at 2 PM.
→Please draft an email to support@service.com asking about my recent billing inquiry.

Frequently Asked Questions

What are the key features of IMAP MCP?

Create draft emails directly in your IMAP server's drafts folder. Connect to any IMAP-compatible email provider like Gmail or Outlook. Secure credential management via environment variables. Full TypeScript support with type definitions. Native integration with Claude and other MCP-compatible assistants.

What can I use IMAP MCP for?

Automating the creation of recurring email drafts for routine reports. Drafting complex emails using AI-generated content directly within your mail client. Streamlining email workflows by allowing AI to prepare messages for final review.

How do I install IMAP MCP?

Install IMAP MCP by running: npx imap-mcp

What MCP clients work with IMAP MCP?

IMAP MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep IMAP MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare