dify-mcp-server
by: YanxingLiu
Model Context Protocol (MCP) Server for dify workflows
📌Overview
Purpose: The Model Context Protocol (MCP) Server enables seamless integration and invocation of Dify workflows by utilizing MCP tools.
Overview: The MCP Server serves as a lightweight implementation designed to facilitate the execution of Dify workflows effortlessly. It provides users with straightforward installation options and a structured configuration setup, allowing for streamlined operation across compatible clients.
Key Features:
-
Easy Installation: Users can install the Dify MCP Server automatically using Smithery or manually, ensuring flexibility in deployment methods.
-
Custom Configuration: A config.yaml file is required that allows users to define their Dify base URL and application secret keys (SKs), making it adaptable to various workflows.
Model Context Protocol (MCP) Server for Dify Workflows
A simple implementation of an MCP server for using Dify. It enables the invocation of Dify workflows by calling the tools of MCP.
Installation
The server can be installed via Smithery or manually. The config.yaml
file is required for both methods.
Prepare config.yaml
Before using the MCP server, you need to prepare a config.yaml
file to save your dify_base_url
and dify_app_sks
. Here is an example configuration:
dify_base_url: "https://cloud.dify.ai/v1"
dify_app_sks:
- "app-sk1"
- "app-sk2"
Different SKs correspond to different Dify workflows.
Installing via Smithery
Smithery is a tool to automatically install the Dify MCP server. To install the Dify MCP Server for Claude Desktop via Smithery, use the following command:
npx -y @smithery/cli install dify-mcp-server --client claude
Manual Installation
You can also run the Dify MCP server manually on your clients. Below is the format for the client configuration:
"mcpServers": {
"mcp-server-rag-web-browser": {
"command": "uv",
"args": [
"--directory", "${DIFY_MCP_SERVER_PATH}",
"run", "dify_mcp_server"
],
"env": {
"CONFIG_PATH": "$CONFIG_PATH"
}
}
}
Example Config:
"mcpServers": {
"dify-mcp-server": {
"command": "uv",
"args": [
"--directory", "/Users/lyx/Downloads/dify-mcp-server",
"run", "dify_mcp_server"
],
"env": {
"CONFIG_PATH": "/Users/lyx/Downloads/config.yaml"
}
}
}
Alternatively, using uvx:
"mcpServers": {
"dify-mcp-server": {
"command": "uvx",
"args": [
"--from","git+https://github.com/YanxingLiu/dify-mcp-server","dify_mcp_server"
],
"env": {
"CONFIG_PATH": "/Users/lyx/Downloads/config.yaml"
}
}
}
Usage
You can now use Dify tools in any client that supports MCP.