Get the FREE Ultimate OpenClaw Setup Guide →

imap

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

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio dominik1001-imap-mcp npx imap-mcp \
  --env IMAP_HOST="<IMAP host>" \
  --env IMAP_PORT="<IMAP port>" \
  --env IMAP_USE_SSL="<true or false>" \
  --env IMAP_PASSWORD="<IMAP password>" \
  --env IMAP_USERNAME="<IMAP username>"

How to use

The imap MCP server exposes IMAP operations as tools for AI assistants. By starting the server, you enable tools such as create-draft that can interact with your IMAP-compatible email account to create draft messages in your drafts folder. The server is configured to read credentials from environment variables to securely connect to your IMAP server. You can run the server using the provided npx command, and then call the available tools through any MCP-enabled assistant (like Claude) to draft emails without exposing raw credentials. The primary tool described is create-draft, which accepts recipient, subject, body, and an optional from address, and saves the resulting message as a draft on your IMAP server.

How to install

Prerequisites:

  • Node.js (and npm) installed on your machine
  • Access to the imap-mcp package on npm

Install and run:

  1. Install dependencies (if you have a local clone): npm install

  2. Compile TypeScript to JavaScript (if developing locally): npx tsc

  3. Run the MCP server (per the README, using npx): npx imap-mcp

  4. Alternatively, using the MCP configuration by creating the mcp.json as shown in the README and starting your own script to launch the server via the configured command.

Note: Ensure your environment variables for IMAP_HOST, IMAP_PORT, IMAP_USERNAME, IMAP_PASSWORD, and IMAP_USE_SSL are set before starting the server.

Additional notes

Environment variables are used to securely manage credentials. Ensure IMAP_USE_SSL correctly reflects your server (true/false). If you encounter authentication errors, verify that the IMAP server allows external connections and that the credentials are correct. The create-draft tool will attempt to place drafts in the typical drafts folders (INBOX.Drafts or Drafts) depending on the server. If your server uses a non-standard folder structure, you may need to adjust expectations or implement folder-mapping logic. Regularly update dependencies to keep the MCP server secure and compatible with IMAP servers.

Related MCP Servers

Sponsor this space

Reach thousands of developers ↗