dify
Model Context Protocol (MCP) Server for dify workflows
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:
- Install the uv/uvx toolchain if you haven't:
- Quick install for uv/uvx (curl or the provided script in the README): curl -Ls https://astral.sh/uv/install.sh | sh
- 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"
- 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
- 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
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP