MCP.so
Sign In

Dify Connect MCP

@difybase

About Dify Connect MCP

Overview

What is Dify Connect MCP?

Dify Connect MCP is a Model Context Protocol (MCP) server that integrates with the Dify API. It runs on Node.js (v16+) and allows developers to send queries to Dify chat applications and retrieve responses from Dify knowledge bases.

How to use Dify Connect MCP?

Install dependencies with npm install, then compile TypeScript code using ./build.sh. Set required environment variables (DIFY_SECRET_KEY, optionally DIFY_BASE_URL, etc.) in a .env file by copying .env.example and editing it. Start the server with ./start-mcp.sh. To use with Cline, add the following to your MCP server settings file: {"mcpServers":{"dify-connect-mcp":{"command":"/bin/bash","args":["<repository-path>/run-mcp.sh"],"disabled":false,"autoApprove":[]}}}. The .env file is automatically loaded by the script, so no API key needs to be written directly in the settings.

Key features of Dify Connect MCP

  • dify-chat: Send queries to Dify chat apps and receive responses
  • knowledge-base-query: Query Dify knowledge bases and retrieve answers
  • Secure credential management via .env file (no hard‑coded API keys)
  • Supports development and production environments (NODE_ENV)
  • Configurable log levels (LOG_LEVEL: debug/info/warn/error)

Use cases of Dify Connect MCP

  • Build a chat assistant that answers user questions through the Dify API
  • Retrieve product information or documentation from a Dify knowledge base
  • Integrate Dify AI capabilities into MCP‑compatible tools (e.g., Cline) without exposing API keys in configuration files
  • Automate queries to Dify applications for testing or internal tooling

FAQ from Dify Connect MCP

What does Dify Connect MCP do?

It provides two MCP tools (dify-chat and knowledge-base-query) that let you send queries to Dify chat apps and knowledge bases, returning the responses to your MCP client.

How do I install and configure Dify Connect MCP?

Clone the repository, run npm install, then ./build.sh. Copy .env.example to .env and set your DIFY_SECRET_KEY. Optional: adjust DIFY_BASE_URL (defaults to https://api.dify.ai/v1), NODE_ENV, and LOG_LEVEL. Start with ./start-mcp.sh.

What environment variables are required?

DIFY_SECRET_KEY is mandatory. DIFY_BASE_URL defaults to https://api.dify.ai/v1. NODE_ENV can be development or production. LOG_LEVEL can be debug, info, warn, or error.

How do I use Dify Connect MCP with Cline?

Add the JSON configuration shown in the README to your MCP server settings file. Point the args to the run-mcp.sh script in the repository path. The script automatically reads the .env file, so you don’t need to put your API key in the MCP settings.

Does Dify Connect MCP work with other MCP clients?

The README only provides configuration instructions for Cline. Compatibility with other MCP clients is not documented.

Comments

More Other MCP clients