Home / MCP / Dify MCP Server

Dify MCP Server

Provides an MCP server that runs Dify workflows by invoking configured SKs through a local runtime.

other
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "rag_web_browser": {
            "command": "uv",
            "args": [
                "--directory",
                "${DIFY_MCP_SERVER_PATH",
                "run",
                "dify_mcp_server"
            ],
            "env": {
                "CONFIG_PATH": "$CONFIG_PATH"
            }
        }
    }
}

You run a Model Context Protocol (MCP) server to bridge your workflows with the Dify tools. It lets you invoke Dify workflows from any MCP-enabled client by running a local MCP server that communicates via standard MCP mechanisms.

How to use

You connect an MCP client to the server and start a workflow by calling the configured MCP endpoint. The server uses a prepared config to locate the Dify base URL and the specific Dify SKs (workflows). With a running MCP server you can trigger the Dify workflows from your client, pass inputs, and receive results without embedding Dify logic in every client.

Key usage patterns you can expect: - Start the MCP server on your machine or in your environment using the provided runtime command. - Ensure your client knows the MCP server configuration to reach the correct workflow SKs. - Use your MCP client to invoke the server’s endpoints, providing inputs and handling outputs as the workflow executes.

How to install

Prerequisites: you need Node.js and a runtime capable of running MCP servers (the setup shown uses a local UV-based runner). Ensure you have access to a terminal or shell where you can run commands.

# Install the MCP server for the Dify workflows using the Smithery installer for the Claude client
npx -y @smithery/cli install dify-mcp-server --client claude

Manual installation requires a prepared configuration and a runtime command to start the server. Create and populate a config.yaml with your Dify base URL and the SKs for the workflows you intend to use.

dify_base_url: "https://cloud.dify.ai/v1"
dify_app_sks:
  - "app-sk1"
  - "app-sk2"

Provide the MCP server runtime entry in your client’s configuration. The sample below shows how to run the server via the UV runtime and how to point it to the local config.

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

If you prefer to start with a concrete local path, you can adapt the example to your environment. Replace directory and CONFIG_PATH with your actual paths.

"mcpServers": {
  "mcp-server-rag-web-browser": {
    "command": "uv",
      "args": [
        "--directory", "/Users/lyx/Downloads/dify-mcp-server",
        "run", "dify_mcp_server"
      ],
    "env": {
       "CONFIG_PATH": "/Users/lyx/Downloads/config.yaml"
    }
  }
}

Additional notes

At the end of setup, you can use the MCP-enabled client to interact with your Dify workflows. The server will read the configuration from config.yaml and expose the configured SKs for remote invocation.