Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions en/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
* [Node](plugins/schema-definition/reverse-invocation-of-the-dify-service/node.md)
* [Best Practice](plugins/best-practice/README.md)
* [Develop a Slack Bot Plugin](plugins/best-practice/develop-a-slack-bot-plugin.md)
* [Dify MCP Plugin Guide: Automated Email Sending](plugins/best-practice/how-to-use-mcp-zapier.md)
* [Publish Plugins](plugins/publish-plugins/README.md)
* [Publish to Dify Marketplace](plugins/publish-plugins/publish-to-dify-marketplace/README.md)
* [Plugin Developer Guidelines](plugins/publish-plugins/publish-to-dify-marketplace/plugin-developer-guidelines.md)
Expand Down
127 changes: 127 additions & 0 deletions en/plugins/best-practice/how-to-use-mcp-zapier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Dify MCP Plugin Guide: One-Click Connection to Zapier and Automated Email Sending

**This article will help you:**

Install the MCP SSE plugin for your Dify workspace, remotely call the Zapier MCP service to enable automated email sending.

## Project Background

Anthropic introduced the Model Context Protocol (MCP) in late 2024. As an emerging open protocol, MCP builds a bidirectional communication channel between LLMs and external applications, functioning like a "USB-C" interface for AI, helping models discover, understand, and safely call various external tools or APIs.

This means: Developers no longer need to write complex custom interfaces to connect with each external service. Users can experience AI's ability to easily call a vast array of third-party applications, whether processing daily office tasks, analyzing data, or executing marketing automation. AI is moving from "intelligent conversation" to "efficient action."

In the Dify community, MCP has garnered significant attention. Community developers have contributed multiple MCP plugins to the plugin marketplace, allowing you to easily connect external MCP services to Dify Agent applications or workflows.

This article will use the MCP SSE plugin as an example to detail how to use MCP plugins within Dify to connect to Zapier and complete an automated email sending process.

## Prerequisites

- Dify Cloud version / Dify Community version ≥ v1.0.0
- Zapier account

## Initializing Zapier MCP Service in Dify

Zapier's MCP Server packages its existing 7000+ applications and 30,000+ actions into a single MCP Server URL. You can select and configure the tools and actions you need in the Zapier backend, such as sending emails, creating records in CRM, sending notifications in Slack, etc. Simply enter the MCP Server URL into the Dify MCP plugin configuration, and the LLM can automatically call these tools to complete various tasks during conversations or processes.

### Step 1: Request a Zapier MCP Server URL

1. Visit the [Zapier MCP Settings page](https://actions.zapier.com/settings/mcp/).
2. Obtain the MCP Server URL, which will be entered into the Dify plugin configuration later.

![](https://assets-docs.dify.ai/2025/04/15bba178b0adddcd3e1961807dfe14f0.png)

3. Click "Edit MCP Actions" below the URL to enter the tools and actions addition page.

4. Click "Add a new action", search for `Gmail: Send Email`. You can also choose to add different email operations based on your actual needs.

![](https://assets-docs.dify.ai/2025/04/718e214166ca6eed6771d44f3b6ab718.png)

5. Taking "Send Email" as an example:

Click "Connect" under the Gmail account, then log in and authorize your Gmail inbox.

For email fields such as recipient (To), subject, and body, you can select "Have AI guess a value for this field", and the specific content will be dynamically determined by the Agent based on the actual conversation and scenario.

![](https://assets-docs.dify.ai/2025/04/637ce6b46ab706f4512a2dceb25a8162.png)

6. After completing the setup, you can continue to add different Actions to enrich the Agent's available toolkit.

### Step 2: Install the MCP SSE Plugin

1. Go to the Dify plugin marketplace, search for the MCP SSE plugin and click install.

![](https://assets-docs.dify.ai/2025/04/20174032b8feb624a52ac36d65e7c0fa.png)

> To ensure service stability, we recommend using plugin version v0.0.4; you can adjust the version on the plugin details page in your workspace.
> ![](https://assets-docs.dify.ai/2025/04/b076d40ea120dea544df49bc52199ad6.png)


2. Click the To Authorize button on the plugin page, and paste the Zapier MCP Server URL obtained earlier into the plugin. Reference address format:

```json
{
"server_name": {
"url": "https://actions.zapier.com/mcp/*******/sse",
"headers": {},
"timeout": 5,
"sse_read_timeout": 300
}
}
```

![](https://assets-docs.dify.ai/2025/04/5ba078e8804c1bee5bcec167d260a92a.png)

### Step 3: Create a Dify Agent Application and Enable MCP SSE Service

1. Create an Agent-type application

From the navigation, select "Studio", choose "Create from Blank" in the application list and select the Agent application type, then complete the creation by entering an application name.

![](https://assets-docs.dify.ai/2025/04/aaef5e115211c2b04382552e537877fa.png)

2. Add MCP tools

Add both `Fetch MCP Tools` and `Call MCP Tool` in the application toolbar.

![](https://assets-docs.dify.ai/2025/04/4e570e4e42720b3e202d409fa93f983a.png)

3. Configure LLM

Using MCP may consume a large number of tokens, so it is recommended to use a more cost-effective LLM. This article will use the `deepseek-chat` model as an example. You can apply for an API Key from [DeepSeek Platform](https://platform.deepseek.com/usage) and enter it in "Settings" → "Model Providers" → "DeepSeek".

> If you don't find the DeepSeek model in your model providers, please go to the Dify plugin marketplace to install the DeepSeek plugin.

## Use Case 1: Using MCP Service to Automatically Send a Single Email

After configuration, you can automatically generate email drafts and send them to specified recipients simply by chatting with the Agent.

![](https://assets-docs.dify.ai/2025/04/fc76cc8e7dd7476199e9810fa5403f3b.png)

Ask the LLM to complete the email sending task in the chat box. After the MCP finishes running, the email will be automatically sent to the recipient.

![](https://assets-docs.dify.ai/2025/04/dc80a8fb00800e8938f3918fc908bc1b.png)

## Use Case 2: Configuring MCP Agent Strategy in Workflow

In addition to adding the MCP SSE plugin as a tool to the Agent, you can also use the MCP Agent Strategy plugin in Workflow. After installation, configure it in the corresponding Agent node as follows:

![](https://assets-docs.dify.ai/2025/04/0a340d4cc4a549e6b7420b39cfd805d6.png)

Use the following JSON structure as a template, replacing the `url` value with the MCP Server address, then copy and paste the complete modified JSON into the `MCP SERVER URL` configuration box:

```json
{
"server_name": {
"url": "https://actions.zapier.com/mcp/*******/sse",
"headers": {},
"timeout": 5,
"sse_read_timeout": 300
}
}
```

![](https://assets-docs.dify.ai/2025/04/883c70b8a714c0c7e7a25f5f712c59e0.png)

Once configured, when the Workflow runs to that Agent node, it can execute tasks using the configured Zapier MCP Server according to the Prompt instructions. As shown below, calling Gmail to send an email:

![](https://assets-docs.dify.ai/2025/04/a201fb50200737881e4ddc0b31518336.png)
1 change: 1 addition & 0 deletions zh_CN/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
* [Node](plugins/schema-definition/reverse-invocation-of-the-dify-service/node.md)
* [最佳实践](plugins/best-practice/README.md)
* [开发 Slack Bot 插件](plugins/best-practice/develop-a-slack-bot-plugin.md)
* [Dify MCP 插件指南:一键连接 Zapier 并自动发送邮件](plugins/best-practice/how-to-use-mcp-zapier.md)
* [发布插件](plugins/publish-plugins/README.md)
* [发布至 Dify Marketplace](plugins/publish-plugins/publish-to-dify-marketplace/README.md)
* [插件开发者准则](plugins/publish-plugins/publish-to-dify-marketplace/plugin-developer-guidelines.md)
Expand Down
127 changes: 127 additions & 0 deletions zh_CN/plugins/best-practice/how-to-use-mcp-zapier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Dify MCP 插件指南:一键连接 Zapier 并自动发送邮件

**本文将帮助你:**

为 Dify 工作空间安装 MCP SSE 插件,远程调用 Zapier MCP 服务以实现自动发送邮件。

## 项目背景

Anthropic 于 2024 年底推出了模型上下文协议(MCP)。作为一项新兴的开放协议,MCP 为 LLM 与外部应用之间构建了双向通信通道,就像是 AI 的“USB-C”接口,帮助模型发现、理解并安全调用各种外部工具或 API。

这意味着:开发者不再需要为对接每一个外部服务而编写复杂的定制接口。用户可以体验到 AI 轻松调用海量第三方应用的能力,无论是处理日常办公任务、分析数据,还是执行营销自动化,AI 正从“智能对话”迈向“高效行动”。

在 Dify 社区里,MCP 同样备受关注。社区开发者在插件市场贡献了多个 MCP 插件,你可以轻松地通过插件将外部 MCP 服务接入至 Dify Agent 应用或工作流中。

本文将以 MCP SSE 插件为例,详细介绍如何在 Dify 内使用 MCP 插件连接 Zapier 并完成自动邮件发送流程。

## 前置准备

- Dify 云端版 / Dify 社区版 ≥ v1.0.0
- Zapier 账号

## 在 Dify 中初始化 Zapier MCP 服务

Zapier 的 MCP Server 将其已有的 7000+ 应用和 30,000+ 操作(Action)统一封装到了一个 MCP Server URL 中。你可以在 Zapier 后台,自主选择和配置需要的工具及操作,比如发邮件、在 CRM 中创建记录、在 Slack 中发送通知等。只需将 MCP Server URL 填入 Dify MCP 插件的配置,就能让 LLM 在对话或流程中,自动调用这些工具完成各类任务。

### 步骤一:申请 Zapier MCP Server URL

1. 访问 [Zapier MCP 设置页面](https://actions.zapier.com/settings/mcp/)。
2. 获取 MCP Server URL,稍后填写至 Dify 的插件配置。

![](https://assets-docs.dify.ai/2025/04/15bba178b0adddcd3e1961807dfe14f0.png)

3. 点击 URL 下方的 “Edit MCP Actions”,进入工具和操作的添加页面。

4. 点击 “Add a new action”,搜索 `Gmail: Send Email`。你也可以根据实际需求选择添加不同的邮件操作。

![](https://assets-docs.dify.ai/2025/04/718e214166ca6eed6771d44f3b6ab718.png)

5. 以“发送邮件”为例:

在 Gmail 账户下方点击 “Connect”,然后登录并授权你的 Gmail 邮箱。

对于邮件的收件人 (To)、主题 (Subject) 和正文 (Body) 等字段,可以选择 “Have AI guess a value for this field” ,具体内容将由 Agent 根据实际对话和场景动态决定。

![](https://assets-docs.dify.ai/2025/04/637ce6b46ab706f4512a2dceb25a8162.png)

6. 设置完成后,你还可以继续添加不同的 Action,丰富 Agent 可用的工具集。

### 步骤二:安装 MCP SSE 插件

1. 前往 Dify 插件市场,搜索 MCP SSE 插件并点击安装。

![](https://assets-docs.dify.ai/2025/04/20174032b8feb624a52ac36d65e7c0fa.png)

> 为确保服务稳定,建议使用 v0.0.4 插件版本;你可以在工作空间内的插件详情页调整版本。
> ![](https://assets-docs.dify.ai/2025/04/b076d40ea120dea544df49bc52199ad6.png)


2. 点击插件页的 To Authorize 按钮,将上文中获取的 Zapier MCP Server URL 粘贴至插件内。地址格式参考:

```json
{
"server_name": {
"url": "https://actions.zapier.com/mcp/*******/sse",
"headers": {},
"timeout": 5,
"sse_read_timeout": 300
}
}
```

![](https://assets-docs.dify.ai/2025/04/5ba078e8804c1bee5bcec167d260a92a.png)

### 步骤三:创建 Dify Agent 应用并启用 MCP SSE 服务

1. 创建 Agent 类型应用

从导航选择 「工作室」,在应用列表内选择 「从空白创建」 并选择 Agent 应用类型,填写应用名称后完成创建。

![](https://assets-docs.dify.ai/2025/04/aaef5e115211c2b04382552e537877fa.png)

2. 添加 MCP 工具

在应用工具栏中分别添加 `Fetch MCP Tools` 和 `Call MCP Tool`。

![](https://assets-docs.dify.ai/2025/04/4e570e4e42720b3e202d409fa93f983a.png)

3. 配置 LLM

使用 MCP 时可能会消耗大量 Tokens,因此建议使用更具性价比的 LLM。本文将以 `deepseek-chat` 模型为例。你可以前往 [DeepSeek Platform](https://platform.deepseek.com/usage) 申请 API Key 并将其填写至 「设置」 → 「模型供应商」 → 「DeepSeek」内。

> 若你并未在模型供应商内检索到 DeepSeek 模型,请前往 Dify 插件市场安装 DeepSeek 插件。

## 使用场景一:使用 MCP 服务自动发送单条邮件

配置完成后,只需通过与 Agent 对话,即可自动生成邮件草稿,并发送给指定收件人。

![](https://assets-docs.dify.ai/2025/04/fc76cc8e7dd7476199e9810fa5403f3b.png)

在对话框内要求 LLM 完成邮件发送任务。等待 MCP 运行完成后,邮件将自动发送至收件人。

![](https://assets-docs.dify.ai/2025/04/dc80a8fb00800e8938f3918fc908bc1b.png)

## 使用场景二:在 Workflow 中配置 MCP Agent Strategy

除了将 MCP SSE 插件作为工具添加到 Agent 外,你还可以在 Workflow 中使用 MCP Agent Strategy 插件。安装完成后,在对应的 Agent 节点内进行配置,具体操作如下:

![](https://assets-docs.dify.ai/2025/04/0a340d4cc4a549e6b7420b39cfd805d6.png)

将以下 JSON 结构作为模板,其中 `url` 值替换为 MCP Server 地址,然后将修改后的完整 JSON,复制粘贴到 `MCP SERVER URL` 配置框内:

```json
{
"server_name": {
"url": "https://actions.zapier.com/mcp/*******/sse",
"headers": {},
"timeout": 5,
"sse_read_timeout": 300
}
}
```

![](https://assets-docs.dify.ai/2025/04/883c70b8a714c0c7e7a25f5f712c59e0.png)

配置完成后,当 Workflow 运行到该 Agent 节点时,就能够根据 Prompt 指令,利用配置好的 Zapier MCP Server 来执行任务。如下图所示,调用 Gmail 发送邮件:

![](https://assets-docs.dify.ai/2025/04/a201fb50200737881e4ddc0b31518336.png)