Alibaba Mail MCP service

Updated at:
Note
  • This feature is available only for the AI Premium Edition. For information about the differences between editions, see Version Introduction.

  • The effectiveness of Alibaba Mail MCP calls depends on the baseline capabilities of the AI agent. We recommend optimizing the prompts and knowledge base for your AI agent.

1. What is the MCP service?

MCP stands for Model Context Protocol. It aims to provide a unified, standard interface for large language models and AI agents. Similar to a USB port, it allows an AI agent to connect to and operate external tools for complex tasks.

Alibaba Mail supports the MCP protocol. You can use this protocol to authorize an AI agent to operate your mailbox. By chatting with the AI agent, you can send emails and retrieve email information.

2. Capabilities

You can view detailed descriptions, parameters, and other information about the tools using the MCP tool query interface.

Function

Tool name

Description

Batch Update Emails

batch_update_emails

Marks multiple emails as read or unread, or adds or removes labels. You can process up to 100 emails at a time and perform one type of operation per call.

Create Calendar Event

create_calendar_event

Creates an appointment or meeting in a specified calendar. This tool supports recurring events and can send email notifications to attendees.

Create Email Attachment Upload Session

create_email_attachment_upload_url

Creates an attachment upload session for an email draft and returns a temporary upload URL. The attachment is associated with the draft only after the client uploads the file.

Create Email Draft

create_email_draft

Creates an email draft in the Drafts folder and saves information such as the subject, body, and recipients. The draft is not automatically sent after creation.

Forward (Draft)

create_email_forward_draft

Creates a forward draft based on an original email. You can set the body and recipients for the forwarded message. The draft is not automatically sent after creation.

Reply All (Draft)

create_email_reply_all_draft

Creates a reply-all draft based on an original email. The reply includes the sender, original recipients, and CC recipients. The draft is not automatically sent after creation.

Reply (Draft)

create_email_reply_draft

Creates a reply draft based on an original email to reply to the sender. If the original email has a Reply-To header, the reply is sent to that address. The draft is not automatically sent after creation.

Create Mail Folder

create_mail_folder

Creates a mail folder. You can specify its location by using the parent folder ID.

Batch Delete Emails

delete_emails

Deletes multiple emails by their IDs. You can delete up to 100 emails at a time.

Delete Mail Folder

delete_mail_folder

Deletes a mail folder by its folder ID. Only empty folders can be deleted.

Get Calendar Event Details

get_calendar_event

Retrieves the details of a calendar event based on the user's email, calendar ID, and event ID.

Get Email Details

get_email

Retrieves the details of an email by its ID. By default, it returns basic fields. You can use $select to retrieve extended information such as the body and recipients.

Get Email Attachment Download URL

get_email_attachment_download_url

Retrieves a temporary URL for a client to download a specified email attachment.

Get Conversation

get_email_conversation

Retrieves an overview of an email conversation, including the subject, summary, number of emails, and read status. It does not currently return the details of individual emails within the conversation.

List Calendar Events within a Time Range

list_calendar_view

Queries for calendar events within a specified time range in a given calendar and expands recurring events into individual occurrences. Supports cursor-based pagination.

List Calendars

list_calendars

Lists all calendars a user can access, including their own and any shared calendars they have accepted.

List Email Attachments

list_email_attachments

Queries for all attachments of an email by its ID to retrieve information such as attachment IDs.

List Conversations

list_email_conversations

Lists email conversations in a folder with pagination. Supports time range and time sorting. Returns a maximum of 100 entries at a time.

List Mail Folders

list_mail_folders

Queries for subfolders under a top-level folder or a specified parent folder. You can choose to recursively return all levels.

Batch Move Emails

move_emails

Moves multiple emails to a destination folder. You can move up to 100 emails at a time. The destination folder cannot be the Drafts folder.

Search Emails

search_emails

Searches for emails by criteria such as subject, body, sender, recipient, and time. Supports combined queries and pagination. Returns a maximum of 100 emails per page.

Search Users by Keyword

search_users

Searches for users in the same domain by keywords such as name, nickname, Pinyin, employee ID, or office location to retrieve information like their email address.

Send Email

send_email

Creates and immediately sends a new email based on information such as the subject, HTML body, and recipients. The sending process is completed in a single call.

Send Email Draft

send_email_draft

Sends an email from the Drafts folder by its draft ID. You can specify whether to save the sent email to the Sent folder.

Update Email Draft

update_email_draft

Modifies the subject, body, recipients, and other information of an existing draft. This operation is only supported for email drafts in the Drafts folder.

Update Mail Folder Name

update_mail_folder

Renames a mail folder using its folder ID.

3. Usage

  1. Log on to the Alibaba Mail domain admin platform with the administrator account (postmaster).

    Standard edition

    https://qiye.aliyun.com/

    Domestic edition

    https://mail.xc.aliyun.com/

  1. Enable the MCP service.

    1. Go to Settings > Feature Switches.

    2. Find and enable the "Allow MCP Service" option, and then save.

    3. After you enable this feature, members within the specified scope can use the Alibaba Mail MCP service to authorize external AI agents to access and operate their personal mailboxes.

    image

  • Configure the MCP service

Step 1: Go to Mailbox Settings > AI Intelligence > MCP Service. Click Generate Token, enter a purpose for the token, and set an expiration time.

image

Step 2: Copy the token or JSON configuration.

image

  • Configure the MCP client

    Configure the MCP parameters for Alibaba Mail in your AI agent.

Example 1: Qwen Office

Go to the official website to register and download Qwen Office. After installation, click Extensions > Connectors > Add, and then paste the JSON configuration.

image

Paste the JSON configuration and click Import.

image

The configuration is complete.

image

Example 2: DingTalk AI Assistant

Refer to the "Use the MCP skill in the AI Assistant skill template" section in DingTalk MCP Skill Quick Start. Paste the JSON configuration of the Alibaba Mail MCP service into the DingTalk MCP plug-in.

image.png

After the configuration is complete and the plug-in passes the test, save the AI Assistant.

Start a conversation to check if the Alibaba Mail MCP service is working. For example, you can ask, "Show me the emails I need to handle today."

image.png

Example 3: Alibaba Cloud Model Studio

Go to the Alibaba Cloud Model Studio console. Choose MCP Management > Custom Services and click Create MCP Service.

image

To configure a custom MCP in Alibaba Cloud Model Studio, you must first activate Function Compute.

image

Note

Your MCP service is deployed to Function Compute (FC). FC provisions computing resources and runs your code elastically and reliably. You are charged based on the actual call duration and the number of calls. For more information, see FC Resource Usage.

Enter the Alibaba Mail MCP configuration information and submit it for deployment.

image

Click the service you just created (do not click Edit), go to the Tools tab, and wait for the service to connect. Once connected, the corresponding email interfaces are displayed.

image

In Application Management, add the Alibaba Mail MCP service to your application to start using it.

image

image

Example 4: Qoder CN (formerly Tongyi Lingma) plugin

You can add the service in two ways: add it manually or from a configuration file.

Method 1: Add manually

image

Remote MCP URL:

https://qiye.aliyun.com/mcp/streamable/

Command:

npx -y mcp-remote https://qiye.aliyun.com/mcp/streamable/ --header "Authorization:Bearer edc7195a19091xxxxxxxxxxxxxxxxxxx15c8c75bab"

Method 2: Add from a configuration fileimage

Enter the JSON configuration generated by the Alibaba Mail MCP service.

image

Demonstration

image

Example 5: Wukong

Go to the Wukong Official Website to download and install the Wukong application.

Click Settings in the lower-left corner.image

Click MCP Service, and then click the Add button.

Set Type to Streamable HTTP. Enter a Custom Name, URL (https://qiye.aliyun.com/mcp/streamable/), and HTTP Headers (key: Authorization, value: Bearer acd61799xxxxxxxxxxxxxxxxxxx86). Then, click Add.

Note

The token value after Bearer can be generated from the Alibaba Mail MCP settings as described earlier. The format is "Authorization: Bearer xxx".

image

Wait for the MCP connection to be established.

image

Demonstration

After the connection is successful, you can use the chat window to initiate MCP email operations in Wukong.

image

FAQ

Failed to connect to the Alibaba Mail MCP server.

Error message 1:

failed to initialize MCP client for alimail: [35244] Warning: ignoring invalid header argument: "Authorization: [35244] Using automatically selected callback port: 30785 [35244] [35244] Connecting to remote server: https://qiye.aliyun.com/mcp/streamable/ [35244] Using transport strategy: http-first Could not load OAuth Protected Resource metadata, falling back to /.well-known/oauth-authorization-server Error: Resource server does not implement OAuth 2.0 Protected Resource Metadata.

Error message 2:

Could not load OAuth Protected Resource metadata, falling back to /.well-known/oauth-authorization-server Error: Resource server does not implement OAuth 2.0 Protected Resource Metadata.

This error can occur if the command is constructed incorrectly. Different AI agents may have slightly different format requirements for MCP, such as whether to enclose values in quotation marks.

For example:

Windows Command Prompt: The token must be enclosed in quotation marks.

npx -y mcp-remote@latest https://qiye.aliyun.com/mcp/streamable/ --header "Authorization: Bearer <token>"

image

Qoder CN: The token does not require quotation marks in the UI configuration.

image

Alibaba Cloud Model Studio prompt:image

Make sure that the JSON configuration is correct. Try generating or copying the JSON value from Alibaba Mail again.