Overseas access: www.kdjingpai.com
Ctrl + D Favorites

Diving into the Dify and MCP ecosystems: a comprehensive guide to plugin usage and principles

2025-07-14 36

In large-scale Language Model (LLM) application development, a central challenge is how to make the model securely and efficiently interact with external tools and data sources. The Model Context Protocol (MCP) was created for this purpose, aiming to establish a standard set of communication specifications between LLMs and the outside world. In this paper, we will first analyze the MCP and then delves into the core principles of the open source LLM application development platform Dify In the midst of this, how to utilize the richness of its MCP Plugin ecosystem to build powerful AI apps.

Understanding Cornerstones: MCP and FastMCP

in-depth Dify Before the plugin, we first need to understand MCP What it is, and FastMCP How it simplifies its implementation.

MCP Service Implementation Principle

MCP is a protocol based on a client-server architecture that enables large language models to discover and invoke external tools through a standardized message format. Its core architecture consists of three parts:

  • MCP Host: AI applications for users such as Claude Desktop maybe Cursor IDE, is responsible for receiving user commands and coordinating the LLM.
  • MCP Client: embedded in Host The middleware in the MCP Server Establishing connections and communications.
  • MCP Server: A lightweight service that provides specific functionality that connects to real-world data and tools such as databases and APIs.

Communication level.MCP protocols are based on JSON-RPC 2.0 encapsulates messages and supports a variety of transport modes such as for local process communication Stdioand for remote communications HTTP with SSE cap (a poem) Streamable HTTP. Currently.Streamable HTTP It is the recommended mainstream transmission method because of its flexibility and good compatibility with modern network protocols.

Functionally.MCP The server provides three main types of capabilities:

  • Tools: Functions that can be called, such as file operations or API requests.
  • Resources: Data in the form of class files, such as database records, identified by URIs.
  • Prompts: Preset interaction templates for normalizing LLM output.

FastMCP: Pythonic's MCP Framework

FastMCP It is an efficient MCP Protocol Python implementation framework. It combines the underlying JSON-RPC Details, Schema constructs and communication management are highly abstracted and encapsulated. Developers don't need to concern themselves with complex protocol details, and with simple Python decorators, they can quickly build MCP Services.

For example, using the @mcp.tool Decorators make it easy to define a tool:

@mcp.tool
def multiply(a: float, b: float) -> float:
"""This tool multiplies two numbers."""
return a * b

FastMCP It also supports advanced features such as service portfolios and middleware, greatly simplifying the development of AI toolchains.

MCP Plugin Ecology in Dify

Dify is an open source LLM application development platform that deeply integrates the MCP protocol, which provides a series of plug-ins to connect and build the MCP Services. These plugins can be broadly categorized into server-side, client-side, and Agent strategy in three categories.

plug-in (software component) present (sb for a job etc) typology GitHub Repositories
Agent Policies (supports MCP tools) furnish Function Calling cap (a poem) ReAct Strategies that support MCP Tool discovery and invocation. infrastructural dify-plugin-agent-mcp_sse
MCP SSE / StreamableHTTP act as MCP Client, through the HTTP with SSE maybe Streamable HTTP Discovery and invocation tools. infrastructural
MCP Agent Policy support only Function Calling strategic Agentfor invoking the MCP Tools. infrastructural
MCP server commander-in-chief (military) Dify The workflow or dialog flow is published as a MCP Server. infrastructural dify-plugin-mcp_server
MCP Compatible Dify Tools commander-in-chief (military) Dify The API of the built-in tools is converted to MCP compatible API. infrastructural dify-plugin-mcp_compat_dify_tools
MCP tools configured at the time of use an MCP client, whose service address is dynamically configured at the time of use. infrastructural
Nacos MCP surname Cong Nacos Registry discovery and call MCP Services. appliance nacos-dify-plugins
AntV Visualization Chart on the basis of AntV Chart Generation MCP Services. appliance mcp-server-chart
HelloDB Database query helper that encapsulates database capabilities into MCP Services. appliance HelloDB Wiki
DataFocus illusion-providing controlled Text2SQL cap (a poem) ChatBI Plug-ins. appliance

Core Plugin User's Guide

Plugin Type I: Publishing Dify Applications as MCP Services

The goal of this type of plugin is to take the information you have in the Dify The capabilities created well in (e.g., workflows, dialog flows, or individual tools) are exposed as standardized MCP Services for other MCP Client Call.

  • MCP server: This plugin allows you to convert a complete Dify A workflow or dialog flow is encapsulated into a MCP Server. Once the endpoint is configured, the external application can call it as if it were a native MCP service as much as it does with your Dify Application Interaction.


  • MCP Compatible Dify Tools: If you don't want to expose the entire workflow and just want to put the Dify of some native tool (e.g., getting the current time) is released as the MCP service, this plugin is the best option.


Plugin Type II: Calling External MCP Services in Dify

This type of plugin plays MCP The client role allows you to Dify The application is able to call external MCP Services.

  • MCP SSE / StreamableHTTP: It's a standard MCP Client Tools. All you need to do is provide the MCP service's address, it automatically discovers all the tools provided by that service in the Dify directly in the workflow.

  • MCP tools configured at the time of use: Similar functionality to the previous plugin, but it offers more flexibility by allowing dynamic configuration on each call to the MCP Service Address.

Plugin Type III: Agent Strategy

Agent be Dify The brain in the workflow that determines how multi-step tasks are planned and executed.MCP The strategy plugin empowers the Agent invocations MCP The capacity of the tool.

  • Agent Policies (supports MCP tools): This is the most versatile Agent Strategy plugin. It also supports Function Calling cap (a poem) ReAct Two models.
    • Function Calling: The model directly determines which tool is called and executed.
    • ReActThe : model engages in a think-act-observe cycle and is better suited to complex tasks that require multi-step reasoning.

  • MCP Agent Policy: This is a much lighter Agent policy, which only supports the Function Calling Mode. If your task logic is relatively simple and can be accomplished by calling the tool directly, then this plugin is the more efficient choice.

Technical Details: The SSE vs. Streamable HTTP Decision

MCP The protocol supports a variety of transmission methods, among which HTTP with SSE cap (a poem) Streamable HTTP are the two main options for remote communication.

comparative dimension HTTP with SSE (Server-Sent Events) Streamable HTTP (Normal HTTP/Fetch that can be streamed)
protocol layer Encapsulates event frame syntax based on HTTP/1.1 long connections. Standard HTTP, relies on chunked transfer encoding, no fixed frame format.
communications direction One-way (server → client). Available in both directions.
Browser API EventSource object with built-in auto-reconnect. fetch() + ReadableStreamThe reconnection requires self-written logic.
Frame/Message Format Text format, supporting event grouping and IDs. Free format, transferable NDJSON, binary slicing, etc.
Heartbeat and Reconnect Internal support. Needs to be realized on its own.
typical scenario Real-time notifications, log pushes. AI token Streaming returns, large file downloads.
Pros and cons in a nutshell Simple to implement, but one-way/plain text only. Flexible and efficient, but need to handle error recovery on your own.

Selection Recommendations: Preferred unless compatibility with older implementations is required Streamable HTTP. It is more flexible and makes better use of HTTP/2 cap (a poem) HTTP/3 The multiplexing advantages of the modern MCP The preferred transmission solution for applications.

MCP ecosystem: services and platforms

MCP The value is in its ecology. In addition to DifyThere are also many platforms and services for MCP Support was provided.

Aliyun and ModelScope

Aliyun and its ModelScope The community offers a wealth of MCP Resources, including:

  • ModeScope MCP Plaza: Aggregate a large number of high-quality MCP resources to expand the boundaries of the model's capabilities.
  • ModelScope MCP Laboratory: Provides an online environment for exploring the relationship between open source models and MCP Server of free combinations.
  • PYREX MCP Service: The AliCloud Hundred Refinement Platform provides full-cycle MCP Custodial and Marketing Services.

Third-party MCP hosting platform

If you don't want to deploy and maintain your own MCP server, consider using a third-party hosting platform.

Platform name present (sb for a job etc) link (on a website)
Composio Specialization for developers MCP Hosted platform with hundreds of pre-integrated tools and enterprise-grade features. https://mcp.composio.dev/
Zapier MCP commander-in-chief (military) MCP Access to its vast ecosystem of 7,000+ apps is ideal for quickly connecting to all types of office and enterprise software. https://zapier.com/mcp
MCP.so community-driven MCP Aggregation platform with lots of examples and Playground for learning and experimenting. https://mcp.so/playground

These three are positioned differently:Composio Emphasis on professional hosting and production grade applications;Zapier MCP focuses on connecting its vast ecosystem of apps for low-code automation, while the MCP.so Then it's a great community resource for learning and prototyping.

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

inbox

Contact Us

Top

en_USEnglish