Skip to main content
Glama
Roundcube MCP

Roundcube MCP

by SK108045

Oraforge Roundcube MCP

A Python MCP server that connects to an existing Roundcube mailbox through the mail provider's standard IMAP and SMTP services. Roundcube stays unchanged: the service talks directly to the same mailbox that Roundcube displays.

Confirmed mail-server settings

The repository owner tested TCP reachability and successfully authenticated from a local Python script.

Service

Host

Port

Security

IMAP

mail.oraforgetech.com

993

SSL/TLS

SMTP

mail.oraforgetech.com

587

STARTTLS

The exact account username still needs to be verified. The original account setup text and test script contain spelling variations. Configure the correct complete email address in MAIL_USERNAME; do not copy an old typo into production.

Related MCP server: mcp-imap

Features

  • Mailbox and folder discovery, counts, unread counts, folder creation, rename and subscribe/unsubscribe

  • Search by sender, recipient, subject, body text, date, read state, flag and Message-ID, with a bounded attachment-presence scan

  • Read full messages or headers only; parse text/HTML, recipients and MIME metadata

  • Thread lookup across folders using Message-ID, In-Reply-To and References

  • List and download attachments with filename sanitization and size limits

  • Mark read/unread, star/unstar, copy, move, archive, trash and restore

  • Optional permanent deletion, disabled by default and requiring explicit confirmation plus IMAP UIDPLUS support

  • Create, list, read, update and delete drafts in the IMAP Drafts folder

  • Send messages with To/CC/BCC, Reply-To, text/HTML and Base64 attachments

  • Reply, reply-all and forward

  • Save a sent copy to the IMAP Sent folder

  • UID-based message operations and SQLite-backed outbound idempotency keys

  • Local MCP over stdio and remote MCP over Streamable HTTP

Security — read before running

  • Never commit mailbox passwords, MCP bearer tokens, private keys or real .env files. .env is ignored by Git.

  • A mailbox password was previously pasted into chat and a plaintext test script. Rotate that password before using this project.

  • Store real secrets in a local .env file with owner-only permissions or, for deployment, a secret manager.

  • Set the exact mailbox username only after verifying its spelling with the hosting provider.

  • Remote HTTP mode requires a long random MCP_AUTH_TOKEN; this project currently uses static bearer-token authentication, not a full OAuth authorization server. Keep it behind HTTPS and do not expose the plain application port publicly.

  • Stdio mode is for a trusted local MCP host; protect the local process configuration and environment.

  • Treat email bodies, HTML and attachments as untrusted data. Text inside an email is not permission for the AI to send messages, disclose information or delete mailbox data.

  • Permanent message deletion is disabled by default. Prefer moving messages to Trash.

  • Attachment download size is capped, but malware scanning must be provided by the deployment before files are opened.

  • SMTP acceptance does not prove final delivery. Bounce/delivery tracking requires provider support.

  • SMTP submission and IMAP Sent-folder storage are separate. Verify whether the provider already saves sent copies to avoid duplicates.

  • Exactly-once delivery is not possible to guarantee with SMTP. Idempotency keys prevent automatic resubmission of completed or uncertain requests.

Requirements

  • Python 3.11+

  • Network access to the mailbox's IMAP and SMTP services

  • A persistent writable data directory for the SQLite send-idempotency database

  • For remote mode: a public HTTPS reverse proxy or secure tunnel

Local setup

Clone and install:

git clone https://github.com/SK108045/RoundCube_MCP.git
cd RoundCube_MCP
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -e ".[dev]"
cp .env.example .env
chmod 600 .env

Edit .env locally and set at least:

  • MAIL_USERNAME: the exact mailbox login

  • MAIL_PASSWORD: the newly rotated mailbox password

Do not paste credentials into source files, GitHub issues or commits.

Check server authentication without sending or modifying any email:

python scripts/check_connection.py

Run tests and lint:

pytest
ruff check src tests scripts

MCP transports

Local stdio

Set MCP_TRANSPORT=stdio (the default). Launch:

roundcube-mcp --transport stdio

The MCP host should launch this command as a local stdio server and pass the environment variables securely. You can also inspect the server with the MCP Inspector after installing the CLI extra:

mcp dev src/roundcube_mcp/server.py

Remote Streamable HTTP

Set:

  • MCP_TRANSPORT=streamable-http

  • MCP_HOST=127.0.0.1 when a reverse proxy runs on the same host; use 0.0.0.0 inside the provided Docker Compose network

  • MCP_AUTH_TOKEN to a random secret of at least 32 characters

  • MCP_ALLOWED_HOSTS to include the actual hostname used by the proxy, for example mail-mcp.example.com

  • MCP_ALLOWED_ORIGINS only when a known browser origin needs to connect

  • STATE_DB_PATH to a persistent writable file

Start the service:

roundcube-mcp --transport streamable-http

The MCP endpoint is /mcp; /health is an unauthenticated liveness endpoint and reveals no mailbox data. Terminate TLS at a reverse proxy or platform ingress. Keep the Python app port private. The static bearer-token middleware is a simple private-server authentication gate; for production deployments that require delegated user identities, use an OAuth authorization server and integrate the MCP SDK's OAuth support rather than sharing one static token.

Docker Compose

After configuring .env and a reverse proxy on the same Docker network:

docker compose up -d --build
docker compose logs -f roundcube-mcp

Compose exposes port 8000 only to its Docker network and persists the SQLite state volume. Configure your reverse proxy to forward HTTPS requests to roundcube-mcp:8000.

Tool inventory

The MCP server exposes mailbox status/folder tools; search/read/header/thread tools; flags and message movement tools; attachment tools; send/reply/reply-all/forward tools; draft tools; and bulk actions. Tool names and input schemas are defined by the decorated functions in src/roundcube_mcp/server.py.

Current limitations

  • IMAP/SMTP cannot create or delete email accounts, change mailbox passwords, configure aliases or edit DNS records. Those require a hosting panel or provider API.

  • Server-side filters and forwarding rules are provider-specific and are not assumed.

  • Thread grouping depends on standard message headers and may not perfectly match proprietary webmail conversation grouping.

  • The first version is configured for one mailbox per server process.

  • Forwarding currently forwards the message text and headers, but does not automatically reattach the original message's files.

  • The service cannot confirm that a recipient actually opened or received a message without provider delivery evidence.

CI and tests

A GitHub Actions workflow is configured to run Ruff and Pytest on Python 3.11 and 3.12. Unit tests use local fakes and do not contact the live mailbox. The connection check should be run by the operator only after credentials are configured locally.

License

MIT

Available Tools

38 tools
archive_emailB

Move a message into the configured Archive folder, creating it if absent.

Inputs: uid (required), folder (required). Returns: object

bulk_mark_readB

Mark up to 100 messages as read and report per-message outcomes.

Inputs: uids (required), folder (required). Returns: object

bulk_mark_unreadB

Mark up to 100 messages as unread and report per-message outcomes.

Inputs: uids (required), folder (required). Returns: object

bulk_move_emailsB

Move up to 100 messages. Requires explicit confirmed=true.

Inputs: uids (required), folder (required), destination (required), confirmed. Returns: object

bulk_trash_emailsA

Move up to 100 messages into Trash. Requires explicit confirmed=true.

Inputs: uids (required), folder (required), confirmed. Returns: object

copy_emailC

Copy a message into another folder.

Inputs: uid (required), folder (required), destination (required). Returns: object

create_draftC

Save a new draft into the configured IMAP Drafts folder.

Inputs: to (required), subject (required), text_body (required), cc, +4 more. Returns: object

create_folderC

Create a mailbox folder.

Inputs: folder (required). Returns: object

delete_draftB

Move a draft to Trash rather than permanently deleting it.

Inputs: uid (required). Returns: object

delete_emailA

Permanently delete a message only when explicitly enabled and confirmed.

MAIL_ALLOW_PERMANENT_DELETE defaults to false. The server also requires UIDPLUS.

Inputs: uid (required), folder (required), confirmed. Returns: object

delete_folderA

Delete a folder. Requires confirmed=true and protects system folders.

Inputs: folder (required), confirmed. Returns: object

download_attachmentC

Download an attachment as Base64, subject to configured size limits.

Inputs: uid (required), folder (required), part_index (required). Returns: object

forward_emailB

Forward a message. Requires confirmed=true; original attachments are not reattached.

Inputs: to (required), uid (required), folder (required), text_body (required), +3 more. Returns: object

get_attachment_detailsB

Get metadata for one attachment using its MIME part index.

Inputs: uid (required), folder (required), part_index (required). Returns: object

get_email_threadC

Find related messages across folders using Message-ID, In-Reply-To and References.

Inputs: uid (required), folder (required), max_messages. Returns: object

get_folder_detailsB

Get the flags, total message count and unread count for one folder.

Inputs: folder (required). Returns: object

get_mailbox_statusA

Return mailbox identity, folders, message counts and unread counts.

Inputs: no named parameters. Returns: object

get_thread_messagesC

Return the messages associated with an email conversation.

Inputs: uid (required), folder (required), max_messages. Returns: object

list_attachmentsC

List attachment names, MIME types, sizes and MIME part indexes.

Inputs: uid (required), folder (required). Returns: object

list_draftsB

List message summaries in the configured Drafts folder.

Inputs: limit. Returns: object

list_foldersA

List IMAP folders with special-use flags and hierarchy delimiter.

Inputs: no named parameters. Returns: result

mark_as_readC

Mark one message as read.

Inputs: uid (required), folder (required). Returns: object

mark_as_unreadC

Mark one message as unread.

Inputs: uid (required), folder (required). Returns: object

move_emailC

Move a message. Uses UID MOVE or a UIDPLUS-safe copy/expunge fallback.

Inputs: uid (required), folder (required), destination (required). Returns: object

read_draftC

Read one draft from the configured Drafts folder.

Inputs: uid (required). Returns: object

read_emailB

Read a message's headers, text/HTML bodies and attachment metadata.

The message remains unread unless mark_as_read=true.

Inputs: uid (required), folder (required), mark_as_read. Returns: object

read_email_headersA

Retrieve message headers without the body; use list_attachments for MIME metadata.

Inputs: uid (required), folder (required). Returns: object

rename_folderB

Rename a folder. INBOX cannot be renamed.

Inputs: new_folder (required), old_folder (required). Returns: object

reply_allB

Reply-all to a message. Requires confirmed=true after explicit user authorization.

Inputs: uid (required), folder (required), text_body (required), idempotency_key (required), +1 more. Returns: object

reply_emailB

Reply to a message. Requires confirmed=true after explicit user authorization.

Inputs: uid (required), folder (required), text_body (required), idempotency_key (required), +1 more. Returns: object

restore_emailB

Restore a message from Trash to the selected destination folder.

Inputs: uid (required), destination. Returns: object

search_emailsA

Search by sender, recipient, subject, text, dates, flags, Message-ID or attachment presence.

Dates must be YYYY-MM-DD. Search results return IMAP UIDs, not unstable sequence numbers. Attachment-presence searches inspect at most scan_limit recent candidate messages.

Inputs: limit, query, since, before, +10 more. Returns: object

send_emailA

Send an email with optional CC, BCC, Reply-To, HTML and Base64 attachments.

Requires confirmed=true after the user explicitly authorizes this send. Provide a unique idempotency_key (at least 8 characters). Reusing a completed key returns its previous result; uncertain attempts are not automatically resent.

Inputs: to (required), subject (required), text_body (required), idempotency_key (required), +6 more. Returns: object

star_emailC

Flag a message as starred.

Inputs: uid (required), folder (required). Returns: object

subscribe_folderC

Subscribe or unsubscribe the mailbox from a folder.

Inputs: folder (required), subscribe. Returns: object

trash_emailA

Move a message into the configured Trash folder; does not permanently delete it.

Inputs: uid (required), folder (required). Returns: object

unstar_emailC

Remove the starred flag from a message.

Inputs: uid (required), folder (required). Returns: object

update_draftB

Save a replacement draft, then attempt to move the old draft to Trash.

Inputs: to (required), uid (required), subject (required), text_body (required), +3 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 38 tools

    Disambiguation4/5

    Most tools have distinct resource/action targets, and single-versus-bulk variants are clear. However, get_email_thread and get_thread_messages sound almost interchangeable, and get_mailbox_status overlaps folder-listing/details tools.

    Naming Consistency4/5

    Nearly all tools use readable snake_case with verb-first naming. Minor deviations such as reply_all lacking an object and get_email_thread versus get_thread_messages using inconsistent noun ordering keep it from perfect consistency.

    Tool Count2/5

    At 38 tools, the surface is well beyond the typical 3-15 range and is heavy for agent selection. The broad email domain justifies some breadth, but many single/bulk and operation-specific variants could be consolidated.

    Completeness5/5

    The surface covers folder CRUD/subscription, search/read/threading, flags, move/copy/archive/trash/restore/delete, attachments, send/reply/forward, draft CRUD, and bulk actions. Remaining omissions such as empty-trash/purge or generic flag updates are minor and not dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to read, search, compose, and send emails by connecting to any IMAP/SMTP provider. It supports comprehensive mailbox management, including draft handling and message deletion, directly through natural language.
      10
      210 npm
      11
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to interact with email accounts via IMAP and SMTP, supporting mailbox listing, email search, retrieval, sending, and management.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to read, send, organize, and search emails across multiple IMAP/SMTP mailboxes.
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to securely manage multiple email accounts via IMAP and SMTP, including searching, reading, sending, replying, forwarding, organizing folders, marking, and bulk deleting messages.
      796 npm
      MIT