dify-plugin-tools-mcp-stream
Orchestrate and govern numerous MCP service endpoints utilizing HTTP, specifically supporting Server-Sent Events (SSE) or generic Streamable HTTP connections. This tool streamlines the incorporation of diverse external functionalities into applications via a uniform interface.
Author

junjiem
Quick Info
Actions
Tags
Dify 1.0 Plugin for MCP via HTTP (SSE/Streamable Transport)
Developer: Junjie.M
Classification: Tool
Source Repository: https://github.com/junjiem/dify-plugin-tools-mcp_sse
Issue Tracker: issues
Overview
Facilitates the discovery and invocation of tools adhering to the Message Catalog Protocol (MCP) by leveraging either HTTP with SSE or Streamable HTTP data transmission methods.
通过 HTTP with SSE 或 Streamable HTTP 传输方式使用 MCP 协议来发现和调用工具。
Configuration allows management of several distinct MCP server instances. An illustrative configuration structure:
MCP服务配置,支持多个MCP服务。 如下示例:
{ "server_name1": { "transport": "sse", "url": "http://127.0.0.1:8000/sse", "headers": {}, "timeout": 50, "sse_read_timeout": 50 }, "server_name2": { "transport": "sse", "url": "http://127.0.0.1:8001/sse" }, "server_name3": { "transport": "streamable_http", "url": "http://127.0.0.1:8002/mcp", "headers": {}, "timeout": 50 }, "server_name4": { "transport": "streamable_http", "url": "http://127.0.0.1:8003/mcp" } }
OR
{ "mcpServers": { "server_name1": { "transport": "sse", "url": "http://127.0.0.1:8000/sse", "headers": {}, "timeout": 50, "sse_read_timeout": 50 }, "server_name2": { "transport": "sse", "url": "http://127.0.0.1:8001/sse" }, "server_name3": { "transport": "streamable_http", "url": "http://127.0.0.1:8002/mcp", "headers": {}, "timeout": 50 }, "server_name4": { "transport": "streamable_http", "url": "http://127.0.0.1:8003/mcp" } } }
Configuration Note: The designation for the transmission method is specified by the "transport" key, accepting values of
sseorstreamable_http. The default setting issse.注: "transport" 参数为
sse或streamable_http,默认为sse。
Hosted MCP Endpoints 托管的MCP服务器
If local deployment of an SSE-enabled MCP Server is inconvenient for initial testing, users can opt to connect to publicly available, managed MCP services.
如果你想尝试 MCP,但是不知道如何部署 SSE 传输的 MCP Server,可以尝试连接托管的 MCP 服务器。
Case Study 1 示例1
Refer to the Cursor configuration settings provided below:
参考 Cursor 设置,如下图:
Configuration snippet for MCP Servers:
MCP 服务配置,如下示例:
{ "tavily": { "url": "https://mcp.composio.dev/tavily/xxxx-xxxx-xxxx-xxxx" } }
Case Study 2 示例2
Acquire the MCP Server URL and input it into the Dify plugin configuration interface.
复制 MCP Server URL,在 Dify 插件配置中使用。
Configuration snippet for MCP Servers:
MCP 服务配置,如下示例:
{ "zapier-mcp": { "url": "https://actions.zapier.com/mcp/sk-xxxxxxxxxx/sse" } }
Select "Edit MCP Actions" to navigate to the interface for adding new tools and operations.
点击 “Edit MCP Actions” ,进入工具和操作的添加页面。
Select "Add a new action" to integrate the necessary MCP service instance.
点击 “Add a new action”,添加需要的MCP服务实例。
You are also able to incrementally add more actions to expand the capabilities of the Agent's toolset.
你还可以继续添加不同的 Action,丰富 Agent 可用的工具集。
Case Study 3 示例3
Streamable HTTP
Configuration snippet for MCP Servers:
MCP 服务配置,如下示例:
{ "tavily-mcp": { "transport": "streamable_http", "url": "https://router.mcp.so/mcp/xxxxxxxxxxx" } }
SSE
Configuration snippet for MCP Servers:
MCP 服务配置,如下示例:
{ "tavily-mcp": { "url": "https://router.mcp.so/sse/xxxxxxxxxxx" } }
Plugin Deployment via GitHub 通过 GitHub 安装插件
Installation can be performed directly using the GitHub repository locator. Navigate to the Dify platform's plugin administration area, choose GitHub installation, input the repository URL, and finalize the setup by selecting the appropriate version tag and package file.
可以通过 GitHub 仓库地址安装该插件。访问 Dify 平台的插件管理页,选择通过 GitHub 安装插件,输入仓库地址后,选择版本号和包文件完成安装。
Frequently Asked Questions (FAQ)
1. Error Resolution During Plugin Installation 安装插件时遇到异常应如何处理?
Symptom: Encountering the error: "plugin verification has been enabled, and the plugin you want to install has a bad signature".
Remedy: Append the directive FORCE_VERIFYING_SIGNATURE=false to your application's .env configuration file.
This modification instructs the Dify environment to permit the installation of any unlisted (and consequently, unverified) plugins from external sources, though this introduces potential security considerations.
问题描述:安装插件时遇到异常信息:plugin verification has been enabled, and the plugin you want to install has a bad signature,应该如何处理?
解决办法:在 .env 配置文件的末尾添加 FORCE_VERIFYING_SIGNATURE=false 字段即可解决该问题。
添加该字段后,Dify 平台将允许安装所有未在 Dify Marketplace 上架(审核)的插件,可能存在安全隐患。
2. Procedure for Offline Installation 如何安装离线版本
A utility script is available to fetch Dify plugin bundles from the Dify Marketplace and GitHub, subsequently repackaging them into a self-contained offline package (dependencies included, no internet connection required).
从Dify市场和Github下载Dify插件包并重新打【真】离线包(包含依赖,不需要再联网)的脚本工具。
Source Repository for Repackaging: https://github.com/junjiem/dify-plugin-repackaging
3. Authorization Setting Persistence Failure Without Error Notification 设置授权保存无效且无错误消息
Symptom: Defined timeout values are being overridden or ignored because they exceed the default Nginx keepalive timeout setting (65 seconds) within the Dify environment.
Resolution Options:
- Option A: Update the NGINX_KEEPALIVE_TIMEOUT variable in your .env file, setting a higher value (e.g., NGINX_KEEPALIVE_TIMEOUT=650).
- Option B: Adjust the per-server timeout settings within the MCP Servers config, for instance: {...., "timeout": 50, "sse_read_timeout": 50}.
问题描述:设置的超时时间超过了Dify中默认的Nginx保持连接的超时时间65秒。
解决办法:
- 方案1:修改 .env 文件中的 NGINX_KEEPALIVE_TIMEOUT 值,如:NGINX_KEEPALIVE_TIMEOUT=650。
- 方案2:修改 MCP 服务配置,例如:{...., "timeout": 50, "sse_read_timeout": 50}。
WIKIPEDIA: XMLHttpRequest (XHR) is an API in the form of a JavaScript object whose methods transmit HTTP requests from a web browser to a web server. The methods allow a browser-based application to send requests to the server after page loading is complete, and receive information back. XMLHttpRequest is a component of Ajax programming. Prior to Ajax, hyperlinks and form submissions were the primary mechanisms for interacting with the server, often replacing the current page with another one.
== History == The concept behind XMLHttpRequest was conceived in 2000 by the developers of Microsoft Outlook. The concept was then implemented within the Internet Explorer 5 browser (1999). However, the original syntax did not use the XMLHttpRequest identifier. Instead, the developers used the identifiers ActiveXObject("Msxml2.XMLHTTP") and ActiveXObject("Microsoft.XMLHTTP"). As of Internet Explorer 7 (2006), all browsers support the XMLHttpRequest identifier. The XMLHttpRequest identifier is now the de facto standard in all the major browsers, including Mozilla's Gecko layout engine (2002), Safari 1.2 (2004) and Opera 8.0 (2005).
=== Standards === The World Wide Web Consortium (W3C) published a Working Draft specification for the XMLHttpRequest object on April 5, 2006. On February 25, 2008, the W3C published the Working Draft Level 2 specification. Level 2 added methods to monitor event progress, allow cross-site requests, and handle byte streams. At the end of 2011, the Level 2 specification was absorbed into the original specification. At the end of 2012, the WHATWG took over development and maintains a living document using Web IDL.
== Usage == Generally, sending a request with XMLHttpRequest has several programming steps.
Create an XMLHttpRequest object by calling a constructor: Call the "open" method to specify the request type, identify the relevant resource, and select synchronous or asynchronous operation: For an asynchronous request, set a listener that will be notified when the request's state changes: Initiate the request by calling the "send" method: Respond to state changes in the event listener. If the server sends response data, by default it is captured in the "responseText" property. When the object stops processing the response, it changes to state 4, the "done" state. Aside from these general steps, XMLHttpRequest has many options to control how the request is sent and how the response is processed. Custom header fields can be added to the request to indicate how the server should fulfill it, and data can be uploaded to the server by providing it in the "send" call. The response can be parsed from the JSON format into a readily usable JavaScript object, or processed gradually as it arrives rather than waiting for the entire text. The request can be aborted prematurely or set to fail if not completed in a specified amount of time.
== Cross-domain requests ==
In the early development of the World Wide Web, it was found possible to brea
