Get the FREE Ultimate OpenClaw Setup Guide →

dify

MCP server from TomokiIshimine/dify-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 tomokiishimine-dify-mcp-server npx @tonlab/dify-mcp-server \
  --env DIFY_API_KEY="your-api-key-here" \
  --env DIFY_BASE_URL="https://your-dify-endpoint"

How to use

This MCP server provides a bridge between Claude (via the MCP protocol) and Dify Workflow as a tool. It exposes Dify Workflow capabilities to Claude so you can invoke Dify actions, retrieve workflow parameters dynamically, and compose complex prompts using the tool interface Claude provides. The server supports multiple Dify API keys (NEW), allowing you to create separate tools for each API key or endpoint and manage access granularly. When configured, Claude can bidirectionally communicate with Dify through the MCP channel to run workflows, fetch results, and adapt prompts based on tool outputs.

How to install

Prerequisites:

  • Node.js 16 or higher
  • npm 7 or higher
  • Access to a Dify Workflow instance and a valid API key

Installation steps:

  1. Install Node.js and npm from https://nodejs.org if you haven't already.

  2. Install the MCP server via npx (no global install required):

    npx @tonlab/dify-mcp-server

  3. Alternatively, install locally in a project:

    mkdir dify-mcp && cd dify-mcp npm init -y npm i @tonlab/dify-mcp-server

  4. Create or update your Claude integration config to include the MCP server reference. Example config (Windows):

    { "mcpServers": { "dify-workflow": { "command": "npx", "args": ["@tonlab/dify-mcp-server"], "env": { "DIFY_BASE_URL": "https://your-dify-endpoint", "DIFY_API_KEY": "your-api-key-here" } } } }

  5. If you plan to use multiple API keys (NEW), set DIFY_BASE_URL and DIFY_API_KEYS instead:

    { "mcpServers": { "dify": { "command": "npx", "args": ["@tonlab/dify-mcp-server"], "env": { "DIFY_BASE_URL": "https://api.dify.ai/v1", "DIFY_API_KEYS": "app-FirstAPIKeyHere,app-SecondAPIKeyHere,app-ThirdAPIKeyHere" } } } }

  6. Start Claude and ensure the MCP server appears in the Claude Desktop/CLI configuration. Test by invoking a Dify workflow through the tool in Claude.

Additional notes

Tips and common considerations:

  • If using multiple API keys, each key becomes a separate tool in Claude with a distinct number appended to the tool name.
  • Ensure DIFY_BASE_URL points to your Dify instance and DIFY_API_KEY (or DIFY_API_KEYS) are valid and have the necessary permissions for workflow execution.
  • For security, avoid placing API keys in version-controlled config files; consider using environment variable management or secret stores.
  • The server is designed to be used with Claude Desktop App integrations; adjust the tool naming in Claude to reflect the key set (e.g., dify-1, dify-2, ...).
  • If you encounter connectivity issues, verify network access to the Dify endpoint and confirm the API key scopes.
  • The MCP server supports bidirectional communication; you can pass prompts to Dify, get results back, and iterate in your Claude workflow.

Related MCP Servers

Sponsor this space

Reach thousands of developers