关于 HOA-mcp-server
HOA-mcp-server 是用于从 HOA 文件中检索相关信息的 MCP 服务。README 重点介绍在 Dify 中配置 Agent 调用该服务,包括模型设置和导入预设 chatflow。
主要功能
- 01从 HOA 文件检索信息
- 02配置 Dify 自定义工具
- 03导入预设 Dify chatflow
- 04设置登录凭据
适用场景
- 01通过 Agent 查找 HOA 文件信息
- 02将 HOA MCP 服务接入 Dify chatflow
MCP 相关
向 MCP 客户端提供文件检索能力。README 介绍了将其作为自定义工具接入 Dify。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
还没有获取到工具列表
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
HOA MCP Agent 教程
本指南将逐步介绍如何在 Dify 中设置并运行 Receipt MCP Agent,并使用“llm_en_v_1_3_1”模型。
前提条件
开始之前,请确保满足以下条件:
- 已通过 Docker 安装并运行 Dify(未在 localhost 上运行)
- 可以访问 LLM 端点
- 端点可访问模型“llm_en_v_1_3_1”
第 1 步:向 Dify 添加 LLM 模型
- 点击界面右上角的用户图标
- 从下拉菜单中选择“Settings”
- 转到“Model Provider”选项卡
- 如果尚未安装,请安装“OpenAI-API-compatible”模型
- 在“OpenAI-API-compatible”模型中,点击“Add Model”并按以下内容进行配置:
- Model Type:LLM
- Model Name:llm_en_v_1_3_1
- API Key:留空
- API endpoint URL:
http://<your-server-ip>:5001/openai/v1 - Model context size:4096
第 2 步:设置 MCP Agent
- 在 Dify 界面顶部,转到“Tool”选项卡
- 点击“Custom”选项卡
- 点击“Create Custom Tool”
- 将“Name”字段设为“Call MCP Tool”
- 确保 MCP 服务正在运行。可在终端中输入以下内容启动:
python server.py - 将“Schema”字段设为以下配置:
{
"openapi": "3.0.0",
"info": {
"title": "Call MCP Tool",
"version": "1.0.0",
"description": "Call various MCP tools via MCP Server"
},
"servers": [
{
"url": "http://host.docker.internal:8000"
}
],
"paths": {
"/mcp/execute": {
"post": {
"summary": "Call MCP Tool",
"description": "Call MCP Tool",
"operationId": "callTool",
"parameters": [
{
"name": "Accept",
"in": "header",
"required": true,
"description": "Client must accept both application/json and text/event-stream",
"schema": {
"type": "string",
"example": "application/json, text/event-stream"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"jsonrpc": {
"type": "string"
},
"id": {
"type": "integer"
},
"method": {
"type": "string",
"enum": [
"tools/list", "tools/call"
],
"description": "Method to execute"
},
"params": {
"type": "object",
"description": "Parameters for the method"
}
},
"required": [
"method"
]
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result": {
"type": "string",
"description": "Result of the operation"
}
}
}
},
"text/event-stream": {
"schema": {
"type": "string",
"description": "Server-sent events stream"
}
}
}
},
"400": {
"description": "Bad Request"
},
"406": {
"description": "Not Acceptable - Client must accept both application/json and text/event-stream",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Client must accept both application/json and text/event-stream content types"
}
}
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message"
}
}
}
}
}
}
}
}
}
}
}
- 完成后点击“Save”
第 3 步:通过 Dify 集成 LLM 和 MCP Agent
创建临时聊天流
- 在主界面中找到“Create App”框
- 点击“Create from Blank”
- 选择“Chatflow”
- 将聊天流命名为“temp”
添加“Call Tool”块
- 右键点击“Answer”块
- 选择“Change Block”
- 在“Tools”选项卡下,选择“Call MCP Tool”
- 将“Call Tool”块连接到 LLM 块
导出临时聊天流
- 点击左上角的聊天流名称
- 点击“Export DSL”
- 将“temp.yml”移至项目文件夹
导入 HOA MCP Agent yml
- 在项目文件夹中运行:
python generate_yml.py - 在主界面中找到“Create App”框
- 点击“Import DSL file”
- 在项目文件夹中选择“HOA MCP Agent.yml”文件
- 在“Log In”块的“params”部分中,将参数“host_ip”、“email”和“password”替换为你的凭据
配置说明
- 请确保将
<your-server-ip>替换为实际的服务器 IP 地址 - 确保在最后一步正确配置所有必需的凭据
- 使用 Agent 前必须先启动 MCP 服务
故障排查
- 如果遇到连接问题,请确认 Docker 未在 localhost 上运行
- 确保可通过指定的 URL 访问 MCP 服务
- 检查所有必需端口是否已开放且可访问
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。