difyapp_as_mcp_server
MCP server from Yevanchen/difyapp_as_mcp_server
claude mcp add --transport stdio yevanchen-difyapp_as_mcp_server node server.js \ --env DIFY_APP_ID="your-dify-app-id" \ --env DIFY_API_KEY="your-dify-api-key" \ --env DIFY_INSTANCE_URL="https://your-dify-instance"
How to use
This MCP server exposes your Dify workflows as tools that can be discovered and invoked by MCP-compliant clients such as Claude Desktop or Cursor. The server implements MCP JSON-RPC over a Streamable HTTP transport, manages sessions, and supports stateless request handling with session IDs. Tools are automatically generated from your Dify workflows and exposed with a name, description, input parameter definitions, and return types. To use it, configure the MCP server URL in the client (e.g., https://your-dify-instance/difyapp_as_mcp_server) and enable the server. Once enabled, clients can browse available tools, invoke them with the proper arguments, and receive structured responses according to MCP semantics. The setup is designed to work in Dify plugin environments and emphasizes secure SSE-backed connections and session management.
How to install
Prerequisites:
- Node.js installed (recommended LTS version)
- Access to a Dify instance with at least one published workflow
- Network access to expose a reachable MCP endpoint
Step 1: Prepare environment
- Ensure you have a DIFY_APP_ID and DIFY_API_KEY with permissions to read workflows
- Export required environment variables or configure them in your deployment
Step 2: Install dependencies
- Clone or download the MCP server project for Dify as MCP server
- Install npm dependencies
Code blocks:
Install Node.js dependencies (from project root)
npm install
Run the MCP server (development mode)
npm start
Step 3: Run and configure
- Start the server and verify it listens on the expected host/port
- In your Dify and client configurations, set the MCP server URL to: https://<your-dify-instace>/difyapp_as_mcp_server
Step 4: Verify tools are exposed
- Access the MCP GET/POST endpoints as described in the repo to confirm tool discovery and JSON-RPC routing
Additional notes
Tips and common considerations:
- Ensure the DIFY_APP_ID is correctly configured; incorrect IDs can lead to tool visibility issues.
- The server uses a minimal SSE implementation; expect periodic heartbeats and automatic reconnection on the client side.
- This implementation aims to be stateless; each request should contain necessary session context or be self-contained per the Streamable HTTP model.
- If tools do not appear, verify that workflows are published and that the Dify API keys have sufficient permissions.
- For debugging, check Dify logs and MCP endpoint responses to confirm proper message formats and transport behavior.
- If deploying behind proxies or gateways, ensure proper TLS termination and that the MCP endpoints remain reachable by clients.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP