/ 目錄 / 演練場 / Dify
● 官方 langgenius ⚡ 即開即用

Dify

作者 langgenius · langgenius/dify

Build agentic workflows in a UI, then expose each one as an MCP tool — Claude calls your Dify-authored apps.

Dify is a popular open-source platform for building LLM apps and agent workflows. Its MCP layer lets Claude treat each Dify app as a callable tool, so workflows authored in Dify show up alongside your other MCP tools.

為什麼要用

核心特性

即時演示

實際使用效果

就緒

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "dify-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@dify/mcp-server"
      ]
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "dify-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@dify/mcp-server"
      ]
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "dify-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@dify/mcp-server"
      ]
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "dify-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@dify/mcp-server"
      ]
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "dify-mcp",
      "command": "npx",
      "args": [
        "-y",
        "@dify/mcp-server"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "dify-mcp": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "@dify/mcp-server"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add dify-mcp -- npx -y @dify/mcp-server

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: Dify

Expose a Dify workflow to Claude as a single tool

👤 Developers ⏱ ~15 min intermediate

何時使用: You built a multi-step workflow in Dify and want Claude to invoke it as one call.

步驟
  1. Author
    Build the workflow in Dify.✓ 已複製
    → Workflow publishes
  2. Expose
    Enable the MCP endpoint for the app.✓ 已複製
    → Tool listed
  3. Call
    Claude calls it like any other MCP tool.✓ 已複製
    → Result returns

結果: Complex Dify workflow callable from Claude in one shot.

組合

與其他 MCP 搭配,撬動十倍槓桿

Use Forge as the gateway in front of multiple Dify instances

Combine dify-mcp with mcp-context-forge: Use Forge as the gateway in front of multiple Dify instances✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
workflow.run (see docs) Run a named Dify workflow 1 call
dataset.query (see docs) Query a Dify-managed dataset 1 call

成本與限制

運行它的成本

API 配額
Plan-dependent on cloud; unlimited self-host
每次呼叫 Token 數
Per workflow
費用
Free OSS self-host; SaaS plans
提示
Self-host for high-volume internal tools

安全

權限、密鑰、影響範圍

最小權限: dify:app:run
憑證儲存: OAuth tokens / API keys in env
資料出站: Dify-configured providers
切勿授予: Expose internal workflows to anonymous callers

故障排查

常見錯誤與修復

Workflow runs hit rate limit

Tune the per-app concurrency in Dify settings

替代方案

Dify 對比其他方案

替代方案何時用它替代權衡
AnythingLLMYou want a chat-first surfaceLess workflow authoring

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills