dify-management-mcp-server
v1.0.0
Published
MCP server for Dify application and workflow management with full lifecycle support
Maintainers
Readme
Dify Management MCP Server
Complete MCP server for Dify application and workflow management with full lifecycle support.
Features
Application Management
- ✅ List applications with pagination and filtering
- ✅ Create new applications (chat, workflow, agent, completion)
- ✅ Get application details
- ✅ Update application settings
- ✅ Delete applications
- ✅ Copy/duplicate applications
- ✅ Export applications to YAML
- ✅ Import applications from YAML/URL
Workflow Management
- ✅ Get draft workflow
- ✅ Sync/update workflow graph and features
- ✅ Publish workflows
- ✅ List all published workflow versions
- ✅ Get specific workflow version
- ✅ Delete workflow versions
Workflow Execution
- ✅ Run draft workflow for testing
- ✅ Run individual nodes for debugging
Installation
Option 1: Use with npx (Recommended)
Add to your MCP configuration:
```json { "mcpServers": { "dify-management": { "command": "npx", "args": ["-y", "dify-management-mcp-server"], "env": { "DIFY_CONSOLE_URL": "https://your-dify-instance.com", "DIFY_CONSOLE_TOKEN": "your_console_token" } } } } ```
Option 2: Build from source
```bash
Clone or download the project
cd dify-management-mcp-server
Install dependencies
npm install
Build TypeScript
npm run build
The built files will be in the dist/ directory
```
Configuration
Environment Variables
DIFY_CONSOLE_URL(required): Your Dify instance URL (e.g.,https://uatai.haierfinancial.com)DIFY_CONSOLE_TOKEN(required): Console authentication token
Getting Console Token
Method 1: From Browser Cookie
- Log in to your Dify instance in a web browser
- Open browser developer tools (F12)
- Go to Application → Cookies
- Find the
console_tokencookie - Copy its value
Method 2: From Browser Local Storage
- Log in to your Dify instance
- Open developer tools → Application → Local Storage
- Look for authentication tokens
- Use format:
Bearer <your_token>
Available Tools
App Management
dify_list_apps
List all applications with optional filtering.
Parameters:
page(number): Page number (default: 1)limit(number): Items per page (default: 20, max: 100)mode(string): Filter by app mode (chat,workflow,agent-chat, etc.)name(string): Filter by app name
Example: ```json { "name": "dify_list_apps", "arguments": { "mode": "workflow", "limit": 10 } } ```
dify_create_app
Create a new application.
Parameters:
name(string): Application namemode(string): Application mode (chat,workflow,agent-chat,completion)description(string, optional): Application descriptionicon(string, optional): Icon emoji
Example: ```json { "name": "dify_create_app", "arguments": { "name": "My Workflow", "mode": "workflow", "description": "Automated workflow for data processing" } } ```
dify_export_app
Export application to YAML format.
Parameters:
app_id(string): Application IDinclude_secret(boolean): Include API secrets (default: false)
dify_import_app
Import application from YAML.
Parameters:
mode(string): Import mode (yaml_contentoryaml_url)yaml_content(string): YAML content (foryaml_contentmode)yaml_url(string): YAML file URL (foryaml_urlmode)name(string, optional): Application namedescription(string, optional): Application description
Workflow Management
dify_get_draft_workflow
Get the draft version of a workflow.
Parameters:
app_id(string): Application ID
dify_sync_workflow
Update the draft workflow.
Parameters:
app_id(string): Application IDgraph(object): Workflow graph with nodes and edgesfeatures(object): Workflow features
dify_publish_workflow
Publish the draft workflow.
Parameters:
app_id(string): Application ID
dify_run_draft_workflow
Test run the draft workflow.
Parameters:
app_id(string): Application IDinputs(object): Input parameters
Usage Examples
Example 1: List all workflow apps
``` Ask Claude: "List all my Dify workflow applications" ```
Claude will use dify_list_apps with mode: "workflow".
Example 2: Create a new workflow
``` Ask Claude: "Create a new Dify workflow named 'Data Processor'" ```
Claude will use dify_create_app with the workflow mode.
Example 3: Export and backup an app
``` Ask Claude: "Export my 'Invoice Processing' Dify app to YAML" ```
Claude will:
- Find the app using
dify_list_apps - Export it using
dify_export_app
Example 4: Duplicate a workflow
``` Ask Claude: "Copy the 'Data Processor' workflow and name it 'Data Processor v2'" ```
Claude will use dify_copy_app with the new name.
Architecture
``` dify-management-mcp-server/ ├── src/ │ ├── index.ts # MCP server main entry │ ├── client.ts # Dify Console API client │ ├── tools.ts # Tool definitions │ └── types.ts # TypeScript types ├── dist/ # Compiled JavaScript ├── package.json ├── tsconfig.json └── README.md ```
API Reference
This server uses the Dify Console API which requires admin authentication. All endpoints are under /console/api/.
Base URL
{DIFY_CONSOLE_URL}/console/api
Authentication
- Cookie:
console_token=<token> - Or Authorization header:
Bearer <token>
Troubleshooting
"Missing required environment variables"
- Ensure
DIFY_CONSOLE_URLandDIFY_CONSOLE_TOKENare set - For existing Dify setups, you can use
DIFY_API_URLandDIFY_API_KEYas alternatives
"Unauthorized" or "Invalid token"
- Token may have expired
- Re-obtain the console token from browser
- Ensure the token has proper permissions
"Application not found"
- Verify the app_id is correct
- Check if you have access to the application
Development
Building
```bash npm run build ```
Development mode (watch)
```bash npm run dev ```
License
MIT
Contributing
Contributions welcome! This is an open-source project to help the Dify community.
Support
For issues and feature requests, please open an issue on GitHub.
Note: This MCP server provides full administrative access to your Dify instance. Keep your console token secure and only use it in trusted environments.
