dify-mcp-client

This repository provides an MCP Client plugin for Dify, enabling ReAct Agent strategies to connect to MCP servers, convert tools, and utilize LLMs within a ReAct loop. This repository provides

109
6

dify-mcp-client

MCP Client as Agent Strategy Plugin. Dify acts as the MCP Host, not the MCP Server.

How it works

Each MCP client (ReAct Agent) connects to MCP servers, converting Tool, Resource, and Prompt lists into Dify Tools. The selected LLM uses these tools based on the ReAct loop. This plugin modifies the ReAct agent strategy to integrate with MCP servers. It includes new functions for MCP, initializes AsyncExitStack and the event loop, handles action invocation, and sets up/cleans up MCP. It supports multi SSE servers.

Caution and Limitation

This plugin lacks a human-in-the-loop mechanism by default, so use reliable MCP servers. Decrease max iterations to 1 and use the Agent node repeatedly in Chatflow. Select Dify tools like "current time" to avoid blank Tools fields.

How to use this plugin

Install the plugin from GitHub or a .difypkg file. Configure the config_json with server URLs. A Chatflow example is provided for testing. Convert stdio MCP servers into SSE MCP servers via code edits or mcp-proxy.

Repository

3D
3dify-project

3dify-project/dify-mcp-client

Created

March 10, 2025

Updated

March 28, 2025

Language

Python

Category

AI