/ 目录 / 演练场 / 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