3P

3dify-project/dify-mcp-client

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

172 stars 34 forks 质量 61 趋势 0Apache-2.0

3dify-project/dify-mcp-client 是从 https://github.com/3dify-project/dify-mcp-client. 导入的 MCP 服务器候选

概览

3dify-project/dify-mcp-client 是从 https://github.com/3dify-project/dify-mcp-client. 导入的 MCP 服务器候选

概述(AI 翻译)

MCP Client 作为支持 Computer Using Agent(UI-TARS-SDK)的代理策略插件。

[!重要] Dify 不是 MCP Server,而是 MCP Host。

它是如何运作的

每个MCP client(反应代理)节点都可以连接MCP servers。

  1. Tool、Resource、Prompt列表转换为Dify工具。
  2. 你选择的大型语言模型可以看到他们的name、description、argument type
  3. LLM调用基于ReAct循环的工具(Reason → Act → Observe)。

[!注] 该仓库中的大部分代码包含以下文件。

Dify 官方插件 / 代理策略

https://github.com/langgenius/dify-official-plugins/tree/main/agent-strategies/cot_agent

✅ 我做的事

  • 复制 ReAct.py 并重命名为 mcpReAct.py
  • 通过编辑 mcpReAct.yaml 和 class mcpReActParams() 添加了 config_json GUI 输入字段。

###mcpReAct.py 里,我补充了

  • MCP 新增的 12 个功能
  • __init__() 用于初始化 AsyncExitStack 和 event loop
  • _handle_invoke_action()中MCP的一些代码
  • 在[[T21]中设置和清理MCP]

[!重要] ReAct while 循环就是这样

🔄 更新历史

  • 添加SSE MCP客户端(v0.0.2)
  • 支持多SSE服务器(v0.0.3)

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

dify-mcp-client

MCP Client as Agent Strategy Plugin with Computer Using Agent (UI-TARS-SDK) support.

[!IMPORTANT] Dify is not MCP Server but MCP Host.

How it works

Each MCP client (ReAct Agent) node can connect MCP servers.

  1. Tool, Resource, Prompt lists are converted into Dify Tools.
  2. Your selected LLM can see their name, description, argument type
  3. The LLM calls Tools based on the ReAct loop (Reason → Act → Observe).

[!NOTE] Most of the code in this repository contains the following files.

Dify Official Plugins / Agent Strategies

https://github.com/langgenius/dify-official-plugins/tree/main/agent-strategies/cot_agent

✅ What I did

  • Copied ReAct.py and renamed file as mcpReAct.py
  • Added config_json GUI input field by editing mcpReAct.yaml and class mcpReActParams()

in mcpReAct.py, I added

  • New 12 functions for MCP
  • __init__() for initializing AsyncExitStack and event loop
  • Some codes in _handle_invoke_action() for MCP
  • MCP setup and cleanup in _invoke()

[!IMPORTANT] ReAct while loop is as they are

🔄 Update history

  • Add SSE MCP client (v0.0.2)
  • Support multi SSE servers (v0.0.3)
  • Update python module and simplify its dependency (v0.0.4)
    • mcp(v1.1.2→v1.6.0+)
    • dify_plugin(0.0.1b72→v0.1.0)
  • Add UI-TARS SDK integration for GUI automation capabilities (v0.0.5)
  • Support Streamable HTTP MCP client
  • Feat SSE param: /sse?key=value (v0.0.6)

🤖 UI-TARS Integration

This plugin includes UI-TARS SDK integration for GUI automation capabilities.

[!WARNING] UI-TARS-SDK integration is supported only Dify Plugin’s local debug deployment. https://github.com/3dify-project/dify-mcp-client#-how-to-develop-and-deploy-plugin

Normal difypkg install doesn’t work. Because UI-TARS require OS native API, yet Dify plugin env is Linux docker container.

I’m thinking alternative solusion via Streamable HTTP MCP.

Key Features

  • On-demand GUI automation: UI-TARS is called only when needed, reducing token consumption
  • Life-time control: Set maximum loop count per task to prevent runaway automation

Known Limitations

  • Single Monitor Support: UI-TARS currently recognizes the primary monitor only. Multi-monitor setups are not supported.
  • Mac Retina Display Issue: On macOS with Retina displays, UI-TARS requires the display resolution to be set to “Default” instead of the highest quality setting. Otherwise wrong (w,h) point is clicked. https://github.com/bytedance/UI-TARS-desktop/issues/591

Life-time Parameter

The life_time parameter controls the maximum number of GUI actions UI-TARS can perform:

  • Default: 10 iterations
  • User-configurable maximum via ui_tars_max_life_time_count
  • Your selected LLM can dynamically adjust within the user-defined limit based on task complexity

[!NOTE]

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →