Dify as MCP Server
Overview
Dify as MCP Server is a plugin that exposes the Dify application as a Model Context Protocol (MCP) server, allowing direct calls from Claude and other MCP clients.
To use Dify as MCP Server, configure the endpoint in Dify and connect it with an MCP client like Claude Desktop or any HTTP client.
- Supports chat applications (Chatflow) and workflow applications. - Fully compliant with MCP protocol specifications. - Supports HTTP/SSE transmission methods. - Easy to use without additional scripts.
- Integrating AI models with various data sources and tools.
- Enabling chat and workflow applications to communicate with LLMs.
- Providing a standardized way to connect AI applications to different peripherals.
Add to your AI client
Use these steps to connect Dify as MCP Server 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": {
"difyapp-as-mcp-server-yevanchen": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-difyapp-as-mcp-server-yevanchen"
]
}
}
}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": {
"difyapp-as-mcp-server-yevanchen": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-difyapp-as-mcp-server-yevanchen"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"difyapp-as-mcp-server-yevanchen": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-difyapp-as-mcp-server-yevanchen"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"difyapp-as-mcp-server-yevanchen": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-difyapp-as-mcp-server-yevanchen"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"difyapp-as-mcp-server-yevanchen": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-difyapp-as-mcp-server-yevanchen"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"difyapp-as-mcp-server-yevanchen": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-difyapp-as-mcp-server-yevanchen"
]
}
}
}FAQ
What is MCP?
MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs, similar to how USB-C connects devices to peripherals.
How do I configure the endpoint?
Add the plugin in Dify and configure the necessary parameters such as application type and API key.
Can I use any HTTP client to call the MCP server?
Yes! You can use any HTTP client to make requests to the MCP server.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":3002,"uuid":"849cac4d-7b9a-451e-bbcf-f2f9060c7907","name":"difyapp_as_mcp_server","title":"Dify as MCP Server","description":"","avatar_url":"https://avatars.githubusercontent.com/u/152952909?v=4","created_at":"2025-03-16T13:45:51.636Z","updated_at":"2025-03-16T14:39:41.710Z","status":"created","author_name":"Yevanchen","author_avatar_url":"https://avatars.githubusercontent.com/u/152952909?v=4","tags":"[]","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/Yevanchen/difyapp_as_mcp_server","target":"_self","content":"$29","summary":"$2a","img_url":null,"type":null,"metadata":"{\"star\":\"5\",\"license\":\"\",\"language\":\"Python\",\"is_official\":false,\"latest_commit_time\":\"2025-03-19 00:49:51\"}","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"}]]}]