Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

dify-mcp

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dify-mcp

Dify MCP Server

latest
npmnpm
Version
1.0.7
Version published
Weekly downloads
18
157.14%
Maintainers
1
Weekly downloads
 
Created
Source

Dify MCP Server

这是一个符合 MCP (Model Context Protocol) 规范的 Dify Agent 服务器。

功能特点

  • 符合 MCP 协议规范
  • 提供标准的 MCP 接口
  • 支持与 Dify Agent 的集成
  • 包含健康检查接口
  • 支持用户标识

安装步骤

  • 克隆项目
git clone [项目地址]
cd dify-mcp
  • 安装依赖
pip install -r requirements.txt
  • 配置环境变量
cp .env.example .env

然后编辑 .env 文件,填入你的 Dify API 密钥和 URL。

运行服务

python main.py

服务将在 http://localhost:8000 启动

MCP 接口

MCP 请求接口

  • 路径: /mcp
  • 方法: POST
  • 请求体:
{
    "query": "对话内容",
    "user": "可选的用户ID"
}

Schema 接口

  • 路径: /schema
  • 方法: GET
  • 返回服务器的参数定义

健康检查

  • 路径: /health
  • 方法: GET

MCP 配置示例

mcp_settings.json 中的配置示例:

{
  "dify-chat": {
    "command": "python",
    "args": ["main.py"],
    "schema": {
      "parameters": {
        "query": {
          "type": "string",
          "description": "Dify 对话内容"
        },
        "user": {
          "type": "string",
          "description": "用户 ID"
        }
      },
      "required": ["query"]
    }
  }
}

注意事项

  • 确保已正确配置 Dify API 密钥
  • 建议在生产环境中使用 HTTPS
  • 可以根据需要调整端口号
  • 确保服务器符合 MCP 协议规范

FAQs

Package last updated on 27 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts