# Dify.AI SDK MCP for AI Agents AI Agent Connect

> Dify.AI SDK MCP lets you connect your AI agents to Dify.AI to run complex workflows, chat with specialized bots, and manage conversation histories. It's for teams who already use Dify and want to give their agents more power without rebuilding the logic from scratch.

## Overview
- **Category:** developer-apis
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_esFwQvD1BTqmueeHwIOlGHPDJ8Oq0FzvLe2J4jkV/ai-agent-connect
- **Tags:** dify, llm-ops, agent-orchestration, workflow, chatbot

## Description

You've spent time building logic inside Dify.AI, and now you want your AI agents to actually use those tools instead of just talking about them. This Connector acts as the bridge. Instead of writing custom API glue for every single interaction, your agent can now reach into your Dify environment to trigger specific workflows, send messages to your published chatbots, or grab past conversation data. It changes how you think about agentic behavior, moving from what your agent can say to what it can actually do. If you're already part of the Vinkius ecosystem, this is the missing link to turn your static prompts into dynamic actions. You can handle multi-step tasks, manage user sessions, and even feed back into your model training loop. It's about making your Dify apps accessible to the agents that need them most. You get to keep your complex logic in Dify while your agent handles the interaction layer.

## Tools

### rename_conversation
Update the title of an existing Dify conversation for better organization.

### send_completion
Send a text completion request to a Dify app and get the full generated text back.

### stop_chat_generation
Interrupt a streaming chat response if the agent needs to stop early.

### submit_feedback
Send a like or dislike rating for a specific message to help with model tuning.

### get_suggested_questions
Fetch the next set of suggested questions for a chat response to keep the user engaged.

### upload_file
Upload a file from a URL so Dify can perform multi-modal analysis on it.

### chat_message
Send a new message to a Dify Application to continue a conversation.

### get_app_meta
Fetch the configuration metadata for a specific Dify application.

### get_conversation_messages
Retrieve all historical messages from a specific Dify conversation ID.

### delete_conversation
Remove a specific conversation from your Dify history to keep your data clean.

### get_conversations
List the most recent conversations associated with a user.

### get_workflow_info
Get the basic details and configuration of a Dify workflow.

### get_workflow_parameters
See exactly which parameters a Dify workflow requires before you run it.

### run_workflow
Execute a Dify Workflow application with your specific JSON inputs.

## Prompt Examples

**Prompt:** 
```
Can you check my last 3 conversations in Dify and tell me what they were about?
```

**Response:** 
```
I've pulled your recent history from Dify. Here are the last 3 conversations:

| Date | Conversation Title | Summary |
| :--- | :--- | :--- |
| Oct 24 | **Data Cleanup** | Discussed removing null values from the sales sheet. |
| Oct 23 | **Onboarding** | Walked through the new user dashboard. |
| Oct 22 | **API Troubleshooting** | Resolved the 403 error on the auth endpoint.
```

**Prompt:** 
```
Run the 'Weekly Report' workflow for me using the data from the latest upload.
```

**Response:** 
```
I'm starting the **Weekly Report** workflow now. I've attached the latest file you uploaded to the Dify session. 

**Status:**
- 🟢 Workflow Triggered
- 🔵 Processing Data...

I'll let you know as soon as the final summary is ready.
```

**Prompt:** 
```
I didn't like the last answer the bot gave. Can you log that?
```

**Response:** 
```
I've logged your 'dislike' feedback for that last response. This will be sent directly to your Dify dashboard to help improve the model's future accuracy.
```

## Capabilities

### Execute Dify workflows
Your agent triggers multi-step logic in Dify using dynamic JSON parameters.

### Chat with Dify bots
Send messages to your published Dify chatbots and track the ongoing conversation.

### Manage conversation history
Rename, fetch, or delete specific chat sessions from your Dify account.

### Submit model feedback
Programmatically send like or dislike ratings to improve your model tuning.

### Handle multi-modal files
Upload files via URL so your agent can process them with Dify's capabilities.

## Use Cases

### Automated Data Processing
A user asks the agent to process a CSV. The agent uses run_workflow to trigger a Dify script that cleans the data and returns a summary.

### Customer Support Routing
An agent receives a query and uses chat_message to send it to a specific Dify chatbot trained on company documentation.

### RLHF Feedback Loop
A product team wants to collect user ratings. The agent uses submit_feedback to log every 'thumbs up' or 'thumbs down' into the Dify dashboard.

### Session History Retrieval
A user wants to know what they talked about last week. The agent calls get_conversations and get_conversation_messages to summarize the history.

## Benefits

- Execute complex multi-step logic by calling run_workflow directly from your agent's instructions.
- Keep your chat history organized by using rename_conversation and get_conversations to manage user sessions.
- Improve your model's accuracy over time by using submit_feedback to automate your RLHF data collection.
- Give your agent multi-modal capabilities by using upload_file to feed Dify images or documents.
- Reduce manual setup by using get_workflow_parameters to understand exactly what data your agent needs to provide.
- Provide a better user experience by fetching next steps with get_suggested_questions after a bot responds.

## How It Works

The bottom line is your agent gets a direct remote control for everything you've built in Dify.

1. Publish your chatbot or workflow app on the Dify platform.
2. Generate an API key from your app's Access section and set your Base URL.
3. Connect this Connector to your client to start executing Dify actions.

## Frequently Asked Questions

**How does the Dify.AI SDK MCP help with multi-agent systems?**
It allows you to treat Dify workflows as tools. Your main agent can call specific workflows to handle heavy lifting, like data processing or complex calculations, while it stays focused on the conversation.

**Can I use the Dify.AI SDK MCP to manage my chat history?**
Yes. You can use it to list recent conversations, rename them for better organization, or even delete them if they are no longer needed.

**Does the Dify.AI SDK MCP support uploading files for my agents?**
It does. You can provide a URL for a file, and the Connector will upload it to Dify so the platform can perform multi-modal analysis on it.

**Can I use this to improve my model's performance?**
Definitely. By using the feedback tools, your agent can submit 'like' or 'dislike' ratings directly to Dify, which is a key part of the RLHF process for model tuning.

**Is it hard to set up the Dify.AI SDK MCP?**
Not at all. If you have a Dify account and an API key for your app, you just need to provide those credentials to your AI client to get started.

**Can my agent trigger Dify workflows with custom data?**
Yes, it can. Your agent can send dynamic JSON parameters to any Dify workflow, allowing for highly customized and automated actions.

**Does this work with self-hosted Dify?**
Yes, simply replace the Base URL credential with your own domain (e.g. `https://dify.mycompany.com/v1`).