Dify MCP Server logo

Dify MCP Server

by zhuzhoulin

A TypeScript-based MCP server that connects the MCP Client to Dify applications. This server dynamically exposes Dify applications as tools that can be used directly within the MCP Client.

View on GitHub

Last updated: N/A

What is Dify MCP Server?

This server implements the Model Context Protocol to bridge between MCP Client and Dify applications. It dynamically fetches application specifications from Dify APIs and exposes them as MCP tools. The server allows users to interact with multiple Dify applications through a unified interface within the MCP Client.

How to use Dify MCP Server?

  1. Clone the repository. 2. Install dependencies using npm install. 3. Build the project using npm run build. 4. Configure the server within your MCP settings, providing API keys, base URL, and timeout settings as environment variables. 5. The Dify applications will then be available as tools within the MCP Client.

Key features of Dify MCP Server

  • Dynamic Dify Integration

  • Connects to multiple Dify applications using API keys

  • Automatically fetches application metadata and parameters

  • Dynamically generates tool interfaces based on Dify application specifications

  • Supports various input types including text, paragraphs, and select dropdowns

  • Robust error handling with request retries

  • Support for both blocking and streaming response modes

  • JSON BigInt handling for large numeric values

  • API keys configured through environment variables

  • Configurable base URL and timeout settings

Use cases of Dify MCP Server

  • Integrating Dify applications into Windsurf IDE

  • Exposing Dify applications as tools within an MCP Client

  • Interacting with multiple Dify applications through a unified interface

  • Automating workflows by leveraging Dify applications as tools

FAQ from Dify MCP Server

How do I configure the API keys?

API keys should be provided as a comma-separated list in the AGENT_API_KEYS environment variable.

What is the purpose of the BASE_URL environment variable?

The BASE_URL environment variable specifies the base URL for the Dify API.

What is the default timeout value?

The default timeout value is 60000 milliseconds.

How are Dify applications exposed as tools?

Each Dify application is exposed as a separate tool with a name format of dify_app_info_{application_name}.

What do I do if I encounter issues?

Verify your API keys are correct and have the necessary permissions. Check that the BASE_URL is accessible from your environment. Review server logs for detailed error messages. Ensure the Dify applications are properly configured and accessible.