Get the FREE Ultimate OpenClaw Setup Guide →

dify

Model Context Protocol (MCP) Server for dify workflows

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio yanxingliu-dify-mcp-server uvx --from git+https://github.com/YanxingLiu/dify-mcp-server dify_mcp_server \
  --env DIFY_APP_SKS="app-sk1,app-sk2" \
  --env DIFY_BASE_URL="https://cloud.dify.ai/v1"

How to use

This MCP server enables you to expose Dify workflows to MCP-capable clients. It uses the Dify base URL and a list of Dify App Secret Keys (SKs) to route requests to the appropriate workflows. Clients can connect to this MCP server and call the available tools through MCP messages, which will trigger corresponding Dify workflows via their APIs. The server supports configuring credentials and endpoints either through environment variables or a config.yaml file, making it convenient to deploy in cloud-hosted environments or local setups.

How to install

Prerequisites:

  • A supported runtime for the MCP server (this project uses the UV-based runner as shown in the README).
  • internet access to fetch dependencies or the GitHub repository.
  • Access credentials for your Dify instance (base URL and App SKs).

installation steps:

  1. Install the uv/uvx toolchain if you haven't:
  2. Prepare configuration:
    • Via environment variables (recommended for cloud platforms): export DIFY_BASE_URL="https://cloud.dify.ai/v1" export DIFY_APP_SKS="app-sk1,app-sk2"
    • Or create a config.yaml with: dify_base_url: "https://cloud.dify.ai/v1" dify_app_sks:
      • "app-sk1"
      • "app-sk2"
  3. Run the MCP server via UVX (as shown in the README example): The example demonstrates pulling the server from GitHub and running it as a module named dify_mcp_server: uvx --from git+https://github.com/YanxingLiu/dify-mcp-server dify_mcp_server
  4. If you prefer using UV directly (local clone):
    • Clone the repository and start the server using the provided run command in your environment, ensuring CONFIG_PATH points to your config.yaml if used.
    • Example command (from README): uv --directory /path/to/dify-mcp-server run dify_mcp_server

By following these steps, you will have an MCP server named "dify-mcp-server" running and ready to route MCP requests to your Dify workflows.

Additional notes

Tips and common issues:

  • If you switch from environment variables to a config.yaml, remember to supply the CONFIG_PATH environment variable to point to the file.
  • Ensure DIFY_BASE_URL is reachable from your deployment environment (firewalls or VPCs may require adjustments).
  • When listing app SKs (DIFY_APP_SKS), separate multiple SKs with commas and avoid spaces unless specified by your setup.
  • If you encounter authentication errors, verify that the App SKs are valid and have the needed permissions for the workflows you want to invoke.
  • This MCP server is designed to work with clients that support MCP, enabling you to invoke Dify workflows through MCP-compatible tooling.

Related MCP Servers

Sponsor this space

Reach thousands of developers