home / mcp / dify as mcp server

Dify as MCP Server

Exposes Dify workflows as an MCP server so AI clients can discover and use your tools.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "yevanchen-difyapp_as_mcp_server": {
      "url": "https://您的Dify实例地址/difyapp_as_mcp_server"
    }
  }
}

You can expose Dify workflows as an MCP server so AI clients like Claude Desktop or Cursor can discover and use your tools. This server handles MCP JSON-RPC requests over HTTP and provides safe, scalable session management in a streamable HTTP environment.

How to use

You deploy the MCP server to expose your Dify workflows as MCP tools. Clients connect via an MCP URL and can discover, inspect, and invoke your tools. The server handles tool registration, session IDs, and streamable communications, enabling tools to be used by AI clients without modifying your workflows.

How to install

Prerequisites:
- Node.js 18+ (npm comes with Node.js)
- Access to your Dify instance where you want to expose workflows

1) Ensure you have a Dify deployment with at least one workflow configured
2) Obtain the MCP server package for this project (the MCP server is designed to run alongside Dify)
3) Install dependencies for the MCP server package
4) Start the MCP server and expose the MCP endpoint

Additional configuration and running notes

Configure the MCP server to expose your Dify application as a set of tools. You will specify an application ID to expose and optionally tweak other settings. The MCP endpoint will be available at a remote URL for clients to connect to.

Configuration for clients to connect

Use the following MCP server URL in your client to enable access to your Dify workflows as MCP tools.