Get the FREE Ultimate OpenClaw Setup Guide →

dify-plugin _server

MCP server from hjlarry/dify-plugin-mcp_server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio hjlarry-dify-plugin-mcp_server node server.js \
  --env ENV="development or production placeholder"

How to use

This MCP server implementation exposes your Dify endpoint plugin as an MCP server, enabling clients to interact with Dify apps through the MCP protocol. It supports the Streamable HTTP protocol for compact, chunked responses and a legacy Server-Sent Events (SSE) protocol for streaming updates. The server also includes an Authorization: Bearer token validator to enforce security on endpoint calls. To use it, deploy the MCP server in your environment and configure your MCP client to point at its endpoint. Once connected, you can route requests from MCP clients to your Dify app by following the endpoint’s input schema, including required fields such as the query for chat-style interactions. If you enable a bearer token, ensure clients attach an Authorization: Bearer <token> header to each request. The server exposes a ping method to quickly verify health status for client integrations that poll server health. Finally, you can configure the endpoint within Dify to convert Dify app inputs into MCP-compatible requests, letting you leverage the MCP ecosystem to orchestrate interactions with your Dify workflows.

How to install

Prerequisites:

  • Node.js (≥14) and npm installed
  • Access to a shell/terminal
  • A Dify app prepared as described in the plugin instructions

Step-by-step:

  1. Clone the repository or install the npm package:
  2. Install dependencies:
    • cd dify-plugin-mcp_server
    • npm install
  3. Configure environment (optional):
    • Set any required environment variables for your network, auth, or Dify integration in a .env file or your hosting environment.
  4. Run the MCP server:
    • node server.js
    • Or using any process manager you prefer (pm2, systemd, docker) with the appropriate environment.
  5. Verify the server is up by pinging the health endpoint (if exposed) or by connecting an MCP client to the configured address.
  6. In your MCP client, point to the server’s endpoint and start interacting with your Dify app through the MCP protocol.

Additional notes

Tips and notes:

  • If you enable Bearer token authentication, ensure clients supply Authorization: Bearer <token> header on all requests.
  • The server supports both Streamable HTTP and SSE protocols; prefer Streamable HTTP for most modern clients and use SSE only if your client environment requires server-sent streaming.
  • The ping method is available for health checks; implement periodic pings in clients to monitor server health.
  • Ensure your Dify app input schema includes the required fields (e.g., a query field for chat flows) to map MCP requests correctly to your app inputs.
  • Run behind a trusted network or add network access controls to protect sensitive end-points since data may include user information from Dify apps.

Related MCP Servers

Sponsor this space

Reach thousands of developers