Skip to main content
Glama
FudanMailBox MCP

FudanMailBox MCP

by BuddyKang

FudanMailBox MCP

A small, privacy-conscious MCP server for Fudan Cloud Mail (@m.fudan.edu.cn) and compatible Tencent Enterprise Mail accounts.

It uses standard IMAP over SSL for mailbox operations and SMTP over SSL for sending. Credentials are read from operating-system environment variables and are never stored in this repository.

Community project. Not an official Fudan University or Tencent project.

Features

Mailbox

  • List folders and special-use folders (Inbox, Drafts, Sent, Trash, Junk when advertised)

  • Folder total/unread counts

  • List newest mail without marking it read

  • Search by text, sender, recipient, subject, date range, unread/starred

  • Read plain-text content, optional HTML, headers, attachment inventory

  • Download attachments

  • Mark read/unread and starred/unstarred

  • Move, archive, trash, or permanently delete messages

  • Create, rename, and delete folders

Drafts

  • Save server-side drafts through IMAP

  • Replace/update an existing draft

  • Drafts support To/Cc/Bcc, plain text, optional HTML, and attachments

Sending

  • Send To/Cc/Bcc mail

  • Plain-text and optional HTML body

  • File attachments

  • Reply / reply-all

  • Forward, optionally including original attachments

  • Configurable approved sender aliases

  • dry_run=true by default for send/reply/forward so an agent can show a preview first

  • Optional copy to the server Sent folder

Contacts

The public v0.1 implementation deliberately does not reverse-engineer Tencent Webmail contacts.

Instead it provides a local private contact book, stored outside this Git repository:

  • list/search contacts

  • add/update/delete contacts

  • import recent correspondents from message headers

Native Tencent/Fudan contact and calendar sync is intentionally left for a future Exchange-compatible module.

Related MCP server: qqconnect

Not implemented in v0.1

These are not standard IMAP/SMTP features:

  • Native Tencent/Fudan webmail contact synchronization

  • Exchange calendar synchronization / meeting invitations

  • Webmail-only mail recall

  • Delivery-status query

  • 2 GB webmail large-attachment transfer

  • Webmail notes, to-do, microdisk/docs/file-transfer features

Requirements

  • Python 3.11+

  • Fudan Cloud Mail account

  • Client protocol enabled in webmail settings

  • Client-specific password if secure login is enabled

Default servers:

  • IMAP: imap.exmail.qq.com:993 with SSL

  • SMTP: smtp.exmail.qq.com:465 with SSL

Installation

git clone https://github.com/BuddyKang/FudanMailBox_MCP.git
cd FudanMailBox_MCP

py -3.11 -m venv .venv
.\.venv\Scripts\python.exe -m pip install --upgrade pip
.\.venv\Scripts\python.exe -m pip install -e ".[dev]"

Run directly:

.\.venv\Scripts\python.exe -m fudanmailbox_mcp

Windows credential setup

Do not paste the client-specific password into config.json, README.md, .env, source code, Git, or an issue.

Set Windows user environment variables:

[Environment]::SetEnvironmentVariable(
  "FUDAN_MAIL_USER",
  "YOUR_STUDENT_ID@m.fudan.edu.cn",
  "User"
)

[Environment]::SetEnvironmentVariable(
  "FUDAN_MAIL_APP_PASSWORD",
  "YOUR_CLIENT_SPECIFIC_PASSWORD",
  "User"
)

Optional approved From aliases:

[Environment]::SetEnvironmentVariable(
  "FUDAN_MAIL_FROM_ALIASES",
  "alias1@m.fudan.edu.cn,alias2@m.fudan.edu.cn",
  "User"
)

After changing environment variables, fully restart DSH / Super-MCP so the child MCP process inherits them.

Windows GUI path:

Search "Edit environment variables for your account" -> Environment Variables -> User variables

Create:

  • FUDAN_MAIL_USER

  • FUDAN_MAIL_APP_PASSWORD

Super-MCP example

{
  "mcpServers": {
    "fudanmailbox": {
      "command": "C:\\path\\to\\FudanMailBox_MCP\\.venv\\Scripts\\python.exe",
      "args": ["-m", "fudanmailbox_mcp"]
    }
  }
}

No credentials are written into this config. The process inherits Windows user environment variables.

Read-only operations can usually be allowed.

Treat these as consequential:

  • send_message / reply_message / forward_message: preview first, then send

  • delete_message(permanent=true): require explicit confirmation

  • delete_folder: require explicit confirmation

  • update_draft: require confirmation before replacing the old draft

  • delete_contact: require explicit confirmation

The server also has conservative defaults such as dry_run=true for outbound mail and confirmation gates for destructive actions.

Main MCP tools

  • capabilities

  • account_status

  • test_connection

  • list_folders

  • folder_status

  • list_messages

  • search_messages

  • get_message

  • download_attachment

  • set_message_flags

  • move_message

  • archive_message

  • delete_message

  • create_folder

  • rename_folder

  • delete_folder

  • save_draft

  • update_draft

  • send_message

  • reply_message

  • forward_message

  • list_sender_aliases

  • list_contacts

  • search_contacts

  • upsert_contact

  • delete_contact

  • import_correspondents

Environment variables

Variable

Default

Purpose

FUDAN_MAIL_USER

required

Full mailbox address

FUDAN_MAIL_APP_PASSWORD

required

Client-specific password

FUDAN_MAIL_IMAP_HOST

imap.exmail.qq.com

IMAP host

FUDAN_MAIL_IMAP_PORT

993

IMAP SSL port

FUDAN_MAIL_SMTP_HOST

smtp.exmail.qq.com

SMTP host

FUDAN_MAIL_SMTP_PORT

465

SMTP SSL port

FUDAN_MAIL_FROM_ALIASES

empty

Comma-separated approved From aliases

FUDAN_MAIL_SAVE_SENT_COPY

true

Append a copy to Sent after SMTP delivery

FUDAN_MAIL_MAX_ATTACHMENT_MB

50

Attachment cap enforced by MCP

FUDAN_MAIL_CONTACTS_PATH

%APPDATA%\FudanMailBox_MCP\contacts.json

Local contact store

FUDAN_MAIL_DOWNLOAD_DIR

~/Downloads/FudanMailBox_MCP

Attachment download folder

FUDAN_MAIL_ARCHIVE_FOLDER

unset

Explicit archive folder if server advertises none

Security

See SECURITY.md. Never commit credentials, exported session cookies, saved webmail HTML containing live session identifiers, private contact databases, or downloaded mail/attachments.

License

MIT

Available Tools

27 tools
account_statusB

Return non-secret configuration readiness. Never returns a password/token.

Inputs: no named parameters. Returns: object

archive_messageB

Move a message to the configured or server-advertised archive folder.

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

capabilitiesA

Describe supported features and known server/webmail-only limitations.

Inputs: no named parameters. Returns: object

create_folderC

Create an IMAP folder.

Inputs: name (required). Returns: object

delete_contactA

Delete a local contact. Requires confirm=true.

Inputs: contact_id (required), confirm. Returns: object

delete_folderA

Delete an IMAP folder. Requires confirm=true.

Inputs: name (required), confirm. Returns: object

delete_messageA

Move to Trash by default. Permanent deletion requires permanent=true and confirm=true.

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

download_attachmentC

Download one attachment by index to a local directory.

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

folder_statusC

Get total and unread counts for one folder.

Inputs: folder. Returns: object

forward_messageC

Forward an existing message. Defaults to dry_run=true.

Inputs: to (required), uid (required), folder, dry_run, +2 more. Returns: object

get_messageB

Read one message, returning headers/body/attachments without marking it read.

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

import_correspondentsC

Import recent sender addresses, and optionally recipients, into local contacts.

Inputs: limit, folder, include_recipients. Returns: object

list_contactsA

List the MCP local private contact book (not Tencent server-side contacts).

Inputs: no named parameters. Returns: result

list_foldersA

List IMAP folders and special-use roles such as Drafts, Sent, Trash, Junk.

Inputs: no named parameters. Returns: result

list_messagesB

List newest messages in a folder without marking them read.

Inputs: limit, folder, unread_only, starred_only. Returns: result

list_sender_aliasesB

List sender addresses explicitly allowed by environment configuration.

Inputs: no named parameters. Returns: object

move_messageC

Move a message between folders.

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

rename_folderC

Rename an IMAP folder.

Inputs: new_name (required), old_name (required). Returns: object

reply_messageC

Reply/reply-all to an existing message. Defaults to dry_run=true.

Inputs: uid (required), body (required), folder, dry_run, +2 more. Returns: object

save_draftC

Save a server-side draft without sending it.

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

search_contactsC

Search the MCP local private contact book.

Inputs: query (required). Returns: result

search_messagesC

Search one folder. since/before use ISO dates such as 2026-10-01.

Inputs: text, limit, since, before, +6 more. Returns: result

send_messageB

Compose/send mail. Defaults to dry_run=true; send only after user approves preview.

Inputs: to (required), body (required), subject (required), cc, +5 more. Returns: object

set_message_flagsC

Set read/unread and/or starred/unstarred flags.

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

test_connectionA

Test authenticated IMAP and SMTP connectivity without reading or sending mail.

Inputs: no named parameters. Returns: object

update_draftB

Replace an existing draft. Requires confirm_replace=true.

Inputs: to (required), uid (required), body (required), folder (required), +7 more. Returns: object

upsert_contactC

Add or update a local contact by email address.

Inputs: email (required), name, tags, notes, +2 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 27 tools

    Disambiguation4/5

    Most tools clearly target distinct resources and actions: folders, messages, drafts, contacts, sending, and account diagnostics. Minor ambiguity exists between save_draft and update_draft (create vs. replace draft), and account_status vs. capabilities/test_connection are all informational though with different scopes.

    Naming Consistency4/5

    The set uses consistent snake_case with verb_noun patterns for most tools. A few noun-only names (capabilities, account_status, folder_status) break the pattern, but overall naming remains predictable and readable.

    Tool Count2/5

    27 tools exceeds the 25-tool threshold considered too many, creating a heavy selection surface for an agent. While the mailbox domain is broad, some account diagnostic tools could be consolidated to reduce cognitive load.

    Completeness5/5

    The surface covers folder CRUD, message list/search/read/flags/move/archive/delete, attachment download, draft save/update, send/reply/forward, contact CRUD/import, and account diagnostics. This provides near-complete lifecycle coverage for a webmail client with only very minor gaps.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents to securely interact with Gmail and QQ Mail, including IMAP search/read/organization, attachments, and preview-confirmed sending.
      41
      2
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables Grok Bot or Grok Build to connect to Chinese email accounts such as QQ, 163, 126, and Tencent exmail over IMAP, allowing email search, reading, draft management, and approved sending through natural language.
      15
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP-compatible agents to access QQ Mail and any IMAP/SMTP mailbox, providing tools to list, search, read, send, reply to, flag, move, delete, and download email over standard IMAP/SMTP using a provider authorization code.
      51 npm
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables agents to read, search, organize, draft, and optionally send email from a cPanel mail account over IMAP and SMTP, with configurable safeguards for sending and permanent deletion.
      16
      MIT