dify-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@dify-mcpcreate a new workflow for a customer support chatbot"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
dify-mcp
The most complete MCP server + CLI for Dify
138 tools. 16 namespaces. One registry. Let any AI agent build, test, and ship Dify workflows autonomously — everything a human can do in the UI, now scriptable.
Works with Claude Code · Codex · Gemini CLI · Cursor · Cline · Windsurf · Roo Code · Continue · Aider · Zed — and any other MCP-compatible or shell-capable agent.
What is this?
Dify is a powerful open-source LLM app platform — but its workflow builder is a visual drag-and-drop editor. What if you want an AI agent to programmatically create workflows, wire up nodes, test them, iterate, and publish — without a browser?
dify-mcp is the bridge. It exposes the entire Dify console API as a unified tool registry with two surfaces: a CLI any shell-capable agent can drive, and an MCP server (stdio or Streamable HTTP) any MCP-compatible host can attach. Same 138 tools, same JSON contract, same safety guarantees.
┌──────────────────────────────────────────────────────────┐
│ dify-mcp │
│ │
│ ┌──────────┐ ┌────────────────────┐ ┌─────────┐ │
│ │ CLI │───▶│ 138-tool │───▶│ Dify │ │
│ │ difywf │ │ registry │ │ API │ │
│ └──────────┘ │ │ └─────────┘ │
│ ┌──────────┐ │ app · workflow │ ▲ │
│ │ MCP │───▶│ provider · rag │─────────┘ │
│ │ stdio │ │ agent · snippet │ │
│ └──────────┘ │ stats · audio ... │ │
│ └────────────────────┘ │
└──────────────────────────────────────────────────────────┘Related MCP server: Dify MCP Server
Works with your favorite agents
dify-mcp is agent-agnostic by design — no SDK lock-in, no proprietary protocol. If your agent can run a shell command, it can use the CLI. If it speaks MCP, it can attach the server. Most popular agents do both:
Agent | MCP | CLI | Quick setup |
✅ | ✅ |
| |
✅ | ✅ |
| |
✅ | ✅ |
| |
✅ | ✅ |
| |
✅ | ✅ | Same JSON shape as Cursor | |
✅ | ✅ | MCP server config in Windsurf settings | |
✅ | ✅ | MCP server config in Roo Code settings | |
✅ | ✅ |
| |
✅ | ✅ |
| |
- | ✅ | Run |
Don't see your agent? If it supports MCP or can run shell commands, it works. The connect section below has copy-paste configs for each host.
Why you'll star this
Complete coverage. Not a subset. Not a wrapper around the public API alone. This talks to the internal console API — the same surface the Dify web UI uses. Create apps, author graphs node-by-node, validate, test-run, publish, manage versions, triggers, providers, plugins, RAG pipelines, snippets, agent configs, comments, annotations, audio, stats. If the UI can do it, so can your agent.
Agent-agnostic by design. No SDK lock-in. The CLI works with any agent that can run a shell command. The MCP server works with any MCP host. Both return structured JSON —
{ ok, data }or{ ok: false, error: { code, message, retryable } }— so agents never scrape human-readable text.Cookie auth, handled. Dify's console uses cookie + CSRF double-submit, not Bearer tokens. dify-mcp captures, stores, and auto-refreshes the session — including the server-side refresh-token rotation that silently invalidates naive clients.
Safe by default. Destructive operations require explicit
confirm=true/--yes. Graphs are validated offline before sync. Every mutation is audit-logged.--dry-runshows diffs without saving.Zero build step. Runs directly on Node 23.6+ native TypeScript. No compiler, no bundler, no transpiler. Clone, install, go.
Live verified
Every tool category has been tested against cloud.dify.ai with real credentials:
✅ Full authoring loop: create app → sync draft → run draft → publish → list versions
✅ All 16 namespaces exercised: apps, workflows, providers, plugins, triggers, snippets, RAG, agents, stats, comments, annotations, audio, files, runs, workspace
✅ MCP transport:
tools/callover stdio and Streamable HTTP with live cookie auth✅ 42 unit tests · typecheck clean · MCP smoke (138 tools)
Quickstart
Prerequisites: Node >= 23.6 (native TypeScript type stripping — no build step).
git clone https://github.com/alexjiaguo/dify-mcp.git
cd dify-mcp
npm install
npm link # puts `difywf` on your PATH (optional)Authenticate
The Dify console uses cookie + CSRF auth. The easiest path:
# 1. Export cookies from your browser (cookie-editor extension → Export → JSON)
# 2. Save as cookies.json, then:
difywf auth import-cookies --base-url https://cloud.dify.ai --file cookies.json
# Or self-hosted with email/password (no browser needed):
difywf auth login-console --base-url https://your-dify --email you@x --password '***'
difywf auth status # confirm: shows base URL + cookie names (values masked)Build a workflow
difywf agent guide # self-onboarding playbook for agents
difywf app list # see your apps
difywf app create --mode workflow --name "my-agent-workflow"
difywf wf node defaults <app-id> llm # get the schema for an LLM node
difywf wf validate --graph graph.json # offline: structure, refs, cycles
difywf wf draft sync <app-id> --graph graph.json --dry-run # preview diff
difywf wf draft sync <app-id> --graph graph.json # save draft
difywf wf test <app-id> --input query="hello" # test-run the draft
difywf wf publish <app-id> --yes # ship itConnect your agent (MCP)
Same binary, same 138 tools. Copy-paste the config for your host:
claude mcp add dify -- difywf mcp serve[mcp_servers.dify]
command = "difywf"
args = ["mcp", "serve"]{
"mcpServers": {
"dify": {
"command": "difywf",
"args": ["mcp", "serve"]
}
}
}{
"mcpServers": {
"dify": {
"command": "difywf",
"args": ["mcp", "serve"]
}
}
}Add an MCP server in Windsurf settings (Cmd+, -> MCP Servers) with command difywf
and args ["mcp", "serve"].
{
"context_servers": {
"dify": {
"command": "difywf",
"args": ["mcp", "serve"]
}
}
}Aider doesn't support MCP, but it can run shell commands. Just use the CLI directly:
/run difywf app list
/run difywf wf draft sync <app-id> --graph graph.jsonFor remote or containerized hosts that can't spawn a local process, run the MCP server over the stateless Streamable HTTP transport:
difywf mcp serve --http --port 8080
# or via env: DIFYWF_MCP_TRANSPORT=http DIFYWF_MCP_PORT=8080 difywf mcp servePoint any Streamable-HTTP-capable client at http://<host>:8080/mcp. Each POST is
a self-contained JSON-RPC message (initialize / tools/list / tools/call); no
session is required. GET and DELETE are rejected with 405.
No
difywfon PATH? Use the absolute path:node /path/to/dify-mcp/bin/difywf.js mcp serve.
Tools
138 tools across 16 namespaces. Run difywf --help for the full live list, or
difywf agent guide for the agent-oriented playbook.
Namespace | Tools | What it does |
| 13 | List, create, update, delete, export, import, copy, rename, convert apps |
| 22 | Get/sync drafts, validate, run, publish, node defaults, variables, versions, HITL |
| 3 | List providers, list models, set credentials |
| 1 | List installed plugins |
| 4 | Create, enable, list, webhook triggers; run triggers |
| 4 | List, get, switch workspaces; list members |
| 1 | Upload files for use in runs |
| 4 | List, get, node executions, export run traces |
| 5 | Daily conversations/terminals, token costs, app interactions, online users |
| 3 | List, add, resolve workflow comments |
| 12 | List, add, delete, reply, settings, export, batch import, hit histories |
| 3 | Transcribe (STT), synthesize (TTS), list voices |
| 20 | Full RAG pipeline lifecycle: datasets, templates, draft, sync, run, publish, versions |
| 22 | Customized snippet lifecycle: create, import, draft, sync, run, publish, versions |
| 16 | Agent config skills/files, drive files/skills, sandbox read/upload |
| 2 | Run and stop installed apps |
| 2 | Status, login, import cookies |
Safety
Mechanism | How it works |
Confirm gates | Destructive ops ( |
Offline validation |
|
Dry-run |
|
Audit log | Every mutation appends to |
Auto-refresh | Cookie sessions auto-refresh on 401 via the refresh-token cookie, with server-side rotation persisted. |
Error/exit codes: USAGE_ERROR(2), AUTH_REQUIRED(3), CONFIRM_REQUIRED(4),
VALIDATION_FAILED(5), RBAC_DENIED(6), NOT_FOUND(7), DSL_VERSION_MISMATCH(8),
RATE_LIMITED(9), SERVER_ERROR(10), NETWORK_ERROR(11). Check error.retryable
before retrying.
Develop
npm run typecheck # tsc --noEmit
npm test # 42 unit tests
npm run smoke:mcp # MCP stdio smoke (138 tools, JSON-RPC handshake)
npm run smoke:mcp:http # MCP Streamable HTTP smoke (stateless POST /mcp)No build step. Source runs directly via Node's type stripping.
License
Apache-2.0 — see LICENSE.
If this saves you time, a ⭐ is the best thank-you.
Built for agents, by agents.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceA TypeScript implementation of a Model Context Protocol (MCP) server that exposes Dify workflows as tools for AI systems to interact with.17
- Alicense-qualityDmaintenanceA TypeScript-based server that connects MCP Clients to Dify applications, dynamically exposing Dify applications as tools that can be used directly within the MCP Client.95MIT
- -licenseBquality-maintenanceMCP server for Akamai APIs. 198 tools covering Property Manager, Edge DNS, CPS, WAF, and reporting. Built with TypeScript, featuring modular architecture, comprehensive testing, and multi-account support. Make Akamai accessible to AI assistants.1910
- Flicense-qualityDmaintenanceA comprehensive MCP server providing over 390 tools across 66 providers, including major SaaS platforms like GitHub, Slack, and Stripe. It enables AI assistants to interact directly with a wide array of public APIs and utility services through a single interface.
Related MCP Connectors
Free public MCP for AI agents — 193 tools, 44 workflows. No API key.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/alexjiaguo/dify-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server