MCP Connector

Integrate Dify Workflows with MCP Tools

A minimal MCP server that exposes existing Dify workflows as callable MCP tools, one tool per configured App Secret Key.

Works with dify

Maintainer of this project? Claim this page to edit the listing.


91
Spark score
out of 100
Updated Apr 2025
Version 1.0.0
Models
universal

Add to Favorites

Why it matters

Seamlessly connect your Dify cloud platform workflows with MCP tools. This asset enables invoking Dify's powerful AI capabilities through your existing MCP infrastructure, streamlining complex automation and data processing tasks.

Outcomes

What it gets done

01

Invoke Dify workflows via MCP commands.

02

Configure Dify API access using environment variables or config files.

03

Manage multiple Dify application secret keys for diverse workflow integrations.

04

Leverage Dify's AI features within your MCP ecosystem.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-dify | bash

Capabilities

Tools your agent gets

invoke_dify_workflow

Invoke a Dify workflow through MCP tools using application secret keys.

Overview

Dify MCP Server

This MCP server bridges existing Dify workflows into MCP tool calls, exposing one tool per configured Dify App Secret Key. It supports environment-variable or config.yaml-based configuration and installs via uvx without needing a local clone. Use it when Dify workflows already exist and need to be invoked as MCP tools from an AI client. It does not build workflows itself - that stays inside Dify.

What it does

A simple MCP server that bridges Dify workflows into the Model Context Protocol: each configured Dify App Secret Key (SK) corresponds to a Dify workflow, and the server exposes it as an MCP tool that any compatible client can invoke, achieving workflow invocation purely through MCP tool calls. As of 2025/4/15 it added support for passing the base_url and app_sks directly via environment variables, making it more convenient to use on cloud-hosted platforms without a config file.

When to use - and when NOT to

Use it when Dify workflows already exist (self-hosted or on cloud.dify.ai) and need to be callable as MCP tools from an AI client such as Claude Desktop or another MCP-compatible tool. It does not build or edit Dify workflows themselves - that still happens inside Dify - it only bridges already-built workflows into MCP so they can be invoked from a chat interface.

Capabilities

Its core and only real capability is invoking a Dify workflow through an MCP tool call, with one tool exposed per configured App SK - so a single server instance can front multiple Dify workflows simultaneously if multiple SKs are supplied.

How to install

Configuration works two ways: environment variables (DIFY_BASE_URL and a comma-separated DIFY_APP_SKS), recommended for cloud platforms, or a config.yaml file with dify_base_url and a dify_app_sks list, referenced at runtime via the CONFIG_PATH environment variable. Install via Smithery or manually; if uv/uvx isn't installed yet:

curl -Ls https://astral.sh/uv/install.sh | sh

The recommended client setup uses uvx with no local clone needed:

{
  "mcpServers": {
    "dify-mcp-server": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/YanxingLiu/dify-mcp-server", "dify_mcp_server"],
      "env": { "DIFY_BASE_URL": "https://cloud.dify.ai/v1", "DIFY_APP_SKS": "app-sk1,app-sk2", }
    }
  }
}

Alternatively, clone the repository locally and run it with uv instead, pointing --directory at the cloned path and CONFIG_PATH at a local config.yaml. A quick way to create that file is a short shell one-liner: make a ~/.config/dify-mcp-server directory, then heredoc a config.yaml into it with the base URL and a list of App SKs, one per Dify workflow being exposed.

Who it's for

Dify users who want to call their existing Dify workflows as MCP tools from any MCP-compatible client, without writing a custom integration bridge themselves - particularly teams already running multiple Dify workflows behind separate App SKs who want them all reachable from one MCP server. Once configured, the workflow is meant to be plug-and-play: connect the server to any MCP-supporting client and start invoking Dify tools directly, with no further glue code required.

Source README

Model Context Protocol (MCP) Server for dify workflows

A simple implementation of an MCP server for using dify. It achieves the invocation of the Dify workflow by calling the tools of MCP.

📰 News

  • [2025/4/15] zNow supports directly using environment variables to pass base_url and app_sks, making it more convenient to use with cloud-hosted platforms.

🔨Installation

The server can be installed via Smithery or manually.

Step1: prepare config.yaml or enviroments

You can configure the server using either environment variables or a config.yaml file.

Method 1: Using Environment Variables (Recommended for Cloud Platforms)

Set the following environment variables:

export DIFY_BASE_URL="https://cloud.dify.ai/v1"
export DIFY_APP_SKS="app-sk1,app-sk2" # Comma-separated list of your Dify App SKs
  • DIFY_BASE_URL: The base URL for your Dify API.
  • DIFY_APP_SKS: A comma-separated list of your Dify App Secret Keys (SKs). Each SK typically corresponds to a different Dify workflow you want to make available via MCP.
Method 2: Using config.yaml

Create a config.yaml file to store your Dify base URL and App SKs.

Example config.yaml:

dify_base_url: "https://cloud.dify.ai/v1"
dify_app_sks:
  - "app-sk1" # SK for workflow 1
  - "app-sk2" # SK for workflow 2
  # Add more SKs as needed
  • dify_base_url: The base URL for your Dify API.
  • dify_app_sks: A list of your Dify App Secret Keys (SKs). Each SK typically corresponds to a different Dify workflow.

You can create this file quickly using the following command (adjust the path and values as needed):

# Create a directory if it doesn't exist
mkdir -p ~/.config/dify-mcp-server

# Create the config file
cat > ~/.config/dify-mcp-server/config.yaml <<EOF
dify_base_url: "https://cloud.dify.ai/v1"
dify_app_sks:
  - "app-your-sk-1"
  - "app-your-sk-2"
EOF

echo "Configuration file created at ~/.config/dify-mcp-server/config.yaml"

When running the server (as shown in Step 2), you will need to provide the path to this config.yaml file via the CONFIG_PATH environment variable if you choose this method.

Step2: Installation on your client

❓ If you haven't installed uv or uvx yet, you can do it quickly with the following command:

curl -Ls https://astral.sh/uv/install.sh | sh
✅ Method 1: Use uvx (no need to clone code, recommended)
{
"mcpServers": {
  "dify-mcp-server": {
    "command": "uvx",
      "args": [
        "--from","git+https://github.com/YanxingLiu/dify-mcp-server","dify_mcp_server"
      ],
    "env": {
       "DIFY_BASE_URL": "https://cloud.dify.ai/v1",
       "DIFY_APP_SKS": "app-sk1,app-sk2",
    }
  }
}
}

or

{
"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"
    }
  }
}
}
✅ Method 2: Use uv (local clone + uv start)

You can also run the dify mcp server manually in your clients. The config of client should like the following format:

{
"mcpServers": {
  "mcp-server-rag-web-browser": {
    "command": "uv",
      "args": [
        "--directory", "${DIFY_MCP_SERVER_PATH}",
        "run", "dify_mcp_server"
      ],
    "env": {
       "CONFIG_PATH": "$CONFIG_PATH"
    }
  }
}
}

or

{
"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": {
       "DIFY_BASE_URL": "https://cloud.dify.ai/v1",
       "DIFY_APP_SKS": "app-sk1,app-sk2",
    }
  }
}
}

Enjoy it

At last, you can use dify tools in any client who supports mcp.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.