Overview
The Dify Model Context Protocol (MCP) Server is a simple implementation designed to facilitate the invocation of Dify workflows by using various tools of the MCP protocol.
To use the Dify MCP Server, you need to prepare a configuration file named config.yaml that includes your Dify base URL and secret keys, and then run the MCP server on your client with the appropriate command and environment variables.
- Easy setup with a configuration file for integration. - Supports multiple Dify workflows through different secret keys. - Enables interaction with Dify tools seamlessly across various clients.
- Integrating multiple Dify workflows in a single application.
- Automating workflow executions based on specific triggers.
- Facilitating API calls to Dify tools from different development environments.
Add to your AI client
Use these steps to connect dify-server MCP 服务器 in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"dify-mcp-server-ai-fe": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-dify-mcp-server-ai-fe"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"dify-mcp-server-ai-fe": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-dify-mcp-server-ai-fe"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"dify-mcp-server-ai-fe": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-dify-mcp-server-ai-fe"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"dify-mcp-server-ai-fe": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-dify-mcp-server-ai-fe"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"dify-mcp-server-ai-fe": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-dify-mcp-server-ai-fe"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"dify-mcp-server-ai-fe": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-dify-mcp-server-ai-fe"
]
}
}
}FAQ
What is the purpose of the `config.yaml` file?
The `config.yaml` file stores your `dify_base_url` and the secret keys required to access different Dify workflows.
How do I run the MCP server?
You need to use the provided command in the configuration and ensure that you have the necessary environment variables set up properly.
Can I use multiple client applications with the Dify MCP Server?
Yes! The MCP Server can be utilized across any client that supports the MCP protocol.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":526,"uuid":"6d30175e-648e-4ee3-9a6b-c2e173c1212a","name":"dify-mcp-server","title":"dify-server MCP 服务器","description":"A Model Context Protocol server for Dify","avatar_url":"https://avatars.githubusercontent.com/u/190235558?v=4","created_at":"2024-12-30T02:53:28.133Z","updated_at":"2025-01-05T03:00:19.251Z","status":"created","author_name":"AI-FE","author_avatar_url":"https://avatars.githubusercontent.com/u/190235558?v=4","tags":"[]","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/AI-FE/dify-mcp-server","target":"_self","content":"$29","summary":"$2a","img_url":null,"type":null,"metadata":null,"user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]