D

Dify对话服务

@yuru-sha/mcp-server-dify
0 Stars 948 次浏览 yuru-sha 更新于 2026-08-23

启用大型语言模型与Dify AI的聊天补全API进行交互,包括对话上下文支持和餐厅推荐工具。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "dify": {
      "args": [
        "-y",
        "@modelcontextprotocol/server-dify",
        "https://your-dify-api-endpoint",
        "your-dify-api-key"
      ],
      "command": "npx"
    }
  }
}

该服务需要配置环境变量:BUDGET、DIFY_API_ENDPOINT、DIFY_API_KEY、LOCATION、conversation_id、query

服务介绍

mcp-server-dify

CI Status

用于Dify AI的模型上下文协议服务器。此服务器通过标准化协议使LLMs能够与Dify AI的聊天完成功能进行交互。

特性

  • 与Dify AI聊天完成API集成
  • 餐厅推荐工具(meshi-doko)
  • 支持对话上下文
  • 支持流式响应
  • 使用TypeScript实现

安装

使用Docker

# Build the Docker image
make docker

# Run with Docker
docker run -i --rm mcp/dify https://your-dify-api-endpoint your-dify-api-key

使用方法

与Claude Desktop一起使用

在您的claude_desktop_config.json中添加以下配置:

{
  "mcpServers": {
    "dify": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-dify",
        "https://your-dify-api-endpoint",
        "your-dify-api-key"
      ]
    }
  }
}

your-dify-api-endpointyour-dify-api-key替换为您实际的Dify API凭据。

工具

meshi-doko

一个与Dify AI接口的餐厅推荐工具:

参数:

  • LOCATION (字符串):餐厅位置
  • BUDGET (字符串):预算限制
  • query (字符串):发送给Dify AI的查询
  • conversation_id (字符串, 可选):用于维护聊天上下文

开发

# Initial setup
make setup

# Build the project
make build

# Format code
make format

# Run linter
make lint

许可证

本项目根据MIT许可证发布。

安全

该服务器使用您提供的API密钥与Dify AI互动。请确保:

  • 保持您的API凭证安全
  • 对API端点使用HTTPS
  • 永远不要将API密钥提交到版本控制系统

贡献

欢迎贡献!请随时提交Pull Request。

相关 MCP 服务