wanglx858/difymcp-strandsagent-demo
If you are the rightful owner of difymcp-strandsagent-demo and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project integrates Dify workflow as an MCP service into the Strands Agent platform to create an intelligent patient intake and triage chatbot.
Patient Intake Chatbot with Dify MCP Server and Strands Agent 🤖🩺
本项目将 Dify 工作流 作为 MCP 接入到 Strands Agent,构建一个患者接收分诊的智能 Agent。
基于 Strands Web UI 开发,使用 Python MCP SDK 实现 Dify workflow 的 MCP Server。
目录 📚
项目简介 📝
该项目通过将 Dify 工作流封装为 MCP 服务,并集成到 Strands Agent 平台,实现患者接收与分诊的智能对话交互。
通过 Strands Web UI 进行交互界面展示,支持配置多种模型和工具,方便快速部署和扩展。
本项目整合自两个开源仓库,基于 AWS MCP Server 示例和 Strands Web UI 项目进行集成开发,用于 Dify MCP Agent 的演示场景。
📎 代码来源与致谢
本项目基于以下两个开源项目整合而成:
感谢原作者的开源贡献!本项目遵循与原项目相同的开源协议,详见 。
前置条件 ✅
- Python 3.10 或更高版本
- 已配置 AWS 凭证,支持 Bedrock 和 Transcribe 服务
- Streamlit >= 1.30.0
- Strands Agents SDK >= 0.1.1
- MCP >= 0.1.0
快速开始 🚀
- 克隆项目仓库:
git clone https://github.com/wanglx858/difymcp-strandsagent-demo.git
cd difymcp-strandsagent-demo
MCP 服务器安装与运行 ⚙️
- 进入 MCP 服务器目录:
cd aws-mcp-servers-samples
- 安装依赖:
curl -LsSf https://astral.sh/uv/install.sh | sh
pip install -r dify_mcp_servers/requirements.txt
- 配置 Dify API Key:
可在dify的探索应用里找到公开模版应用程序
Patient Intake Chatbot
打开 dify_mcp_server.py
,找到如下代码并替换为你的 API Key:
DIFY_API_BASE = "https://api.dify.ai/v1" # Dify 控制台可获取
DEFAULT_API_KEY = "你的API_KEY" # 请填写你的 Dify API Key
- 启动 MCP 服务器:
uv init
uv venv
source .venv/bin/activate
uv add "mcp[cli]" httpx
uv run dify_mcp_servers/dify_mcp_server.py
Strands Web UI 安装与配置 🖥️
- 进入 Strands Web UI 目录:
cd strands-web-ui
- 安装依赖:
pip install -r requirements.txt
pip install -e .
- 安装strands-agents-tools
pip install strands-agents-tools
导入 MCP 服务 🔌
编辑 config/mcp_config.json
,添加或修改如下配置:
"patient_intake_chatbot": {
"command": "uv",
"args": [
"--directory",
"/你的项目路径/aws-mcp-servers-samples/dify_mcp_servers",
"run",
"dify_mcp_server.py"
],
"description": "A chatbot for patient intake.",
"status": 1
}
⚠️ 请将路径修改为你的
dify_mcp_server.py
文件所在的绝对路径。
AWS 配置 ☁️
确保 AWS 凭证已正确配置以使用 Bedrock 和 Transcribe 服务。
aws configure
或者通过环境变量配置:
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_DEFAULT_REGION=us-east-1
首次运行 ▶️
- 启动应用:
streamlit run app.py
- 在浏览器访问:
http://localhost:8501
- 在侧边栏中配置你的模型和参数。
# PROMPT
You are a patient receiving chatbot assistant, and you need to call the patient_intake_chatbot tool to collect patient information and match it with the appropriate triage path or healthcare provider based on the patient’s symptoms, urgency, and medical history.
-
在工具配置区启用所需功能。
-
开始与患者接收分诊 Agent 聊天!💬
如果有任何问题,欢迎提 Issue 或联系维护者。📩
祝你使用顺利!🚀✨