qqmail-mcp
v0.1.0
Published
Read-only MCP server for QQMail via IMAP (stdio)
Maintainers
Readme
qqmail-mcp (stdio)
Read-only MCP server for QQMail via IMAP.
Setup
1. Enable IMAP in QQ Mail
- Log in to QQ Mail
- Go to Settings (设置) → Account (账户)
- Find POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV Service section
- Enable IMAP/SMTP Service (IMAP/SMTP服务)
- Click Generate Authorization Code (生成授权码)
- Follow the SMS verification process
- Save the authorization code - this is your IMAP password (NOT your QQ password)
2. Configure Environment
Create .env file in project root:
[email protected]
QQMAIL_PASS=your_authorization_code_here
QQMAIL_IMAP_HOST=imap.qq.com
QQMAIL_IMAP_PORT=993
QQMAIL_IMAP_SECURE=true
QQMAIL_FOLDER=INBOXImportant: Use the authorization code from step 1, not your QQ password.
Build & Run
Install dependencies:
npm installBuild:
npm run buildStart server:
npm startDev mode (with auto-reload):
npm run devTools
qqmail_list_new_messages
List newest messages in a folder (read-only).
Parameters:
folder(string, default: "INBOX"): IMAP folder namelimit(number, default: 20, max: 50): Number of messages to returnsince(string, optional): ISO 8601 datetime filter (e.g., "2026-03-08T00:00:00+08:00")includeSnippet(boolean, default: false): Whether to fetch text previewmaxLen(number, default: 240, max: 1000): Max snippet length when includeSnippet=true
Returns: Array of messages with fields:
id(string): IMAP UIDfrom(string): Sender (name + email)subject(string): Email subjectdate(string): ISO 8601 datetimesnippet(string): Text preview (empty if includeSnippet=false)
Performance Note: Set includeSnippet=false (default) for fast listing. Only enable when you need previews.
qqmail_get_snippet
Get text preview of a message by UID.
Parameters:
folder(string, default: "INBOX"): IMAP folder nameid(string, required): UID from qqmail_list_new_messagesmaxLen(number, default: 240, max: 1000): Max snippet length
Returns: Plain text snippet (prefers text body, falls back to HTML→text).
qqmail_get_message
Get full message by UID (read-only).
Parameters:
folder(string, default: "INBOX"): IMAP folder nameid(string, required): UID from qqmail_list_new_messagesincludeHtml(boolean, default: false): Whether to include HTML body
Returns: Object with fields:
id(string): IMAP UIDfolder(string): Folder namedate(string): ISO 8601 datetimefrom(string): Senderto(string): Recipientssubject(string): Subjecttext(string): Plain text bodyhtml(string, optional): HTML body (if includeHtml=true)headers(object): All email headers
mcporter Examples
List 5 newest messages (fast, no snippets):
mcporter call --stdio "node dist/index.js" qqmail_list_new_messages limit=5List with snippets:
mcporter call --stdio "node dist/index.js" qqmail_list_new_messages limit=5 includeSnippet=trueList with custom snippet length:
mcporter call --stdio "node dist/index.js" qqmail_list_new_messages limit=5 includeSnippet=true maxLen=100List messages since a date (recommend timezone):
mcporter call --stdio "node dist/index.js" qqmail_list_new_messages since="2026-03-08T00:00:00+08:00"Get snippet for a specific message:
mcporter call --stdio "node dist/index.js" qqmail_get_snippet id=12345Get full message:
mcporter call --stdio "node dist/index.js" qqmail_get_message id=12345Get full message with HTML:
mcporter call --stdio "node dist/index.js" qqmail_get_message id=12345 includeHtml=trueCommon Errors & Troubleshooting
"Missing env: QQMAIL_USER" or "Missing env: QQMAIL_PASS"
- Cause: Environment variables not set
- Fix: Create
.envfile with QQMAIL_USER and QQMAIL_PASS
"Authentication failed" or "Invalid credentials"
- Cause: Wrong authorization code or IMAP not enabled
- Fix:
- Verify IMAP is enabled in QQ Mail settings
- Use the authorization code, not your QQ password
- Generate a new authorization code if needed
"Mailbox does not exist" or "Unknown Mailbox"
- Cause: Invalid folder name
- Fix:
- Use "INBOX" for inbox (default)
- Common folders: "Sent Messages", "Drafts", "Trash"
- Folder names are case-sensitive
"since must be ISO 8601 datetime"
- Cause: Invalid date format in
sinceparameter - Fix: Use ISO 8601 format with timezone, e.g., "2026-03-08T00:00:00+08:00"
Connection timeout
- Cause: Network issues or firewall blocking port 993
- Fix:
- Check internet connection
- Verify port 993 (IMAP SSL) is not blocked
- Try from a different network
Notes
- This is a read-only server (no mark_read / move / delete / flag operations)
idvalues are IMAP UIDs (unique within a folder)- For best performance, use
includeSnippet=falsewhen listing messages - Recommend including timezone in
sinceparameter (e.g., +08:00 for Beijing time)
