How to Use the Dify MCP in CrewAI
Coordinate cooperative agent teams using CrewAI to execute complex Dify workflows autonomously.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Dify MCP to CrewAI
Create your Vinkius account to connect Dify to CrewAI and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.
Coordinate Multi-Agent Teams via CrewAI and Dify
The `chat` tool allows your specialized CrewAI agents to interact with Dify's managed LLM runtimes. In a multi-agent setup, your Researcher agent can gather context, while your Writer agent uses this tool to generate the final response. This splits the cognitive load across multiple specialized roles instead of relying on a single prompt. CrewAI's shared memory system keeps track of the conversation state across these handoffs. Each agent knows what the previous agent accomplished. This ensures the output remains coherent even when multiple models contribute to the final answer.
Extract Chat History for Crew Context
The `list_messages` and `list_conversations` tools inject historic context directly into the CrewAI short-term memory system. Before a crew starts a new task, a coordinator agent runs these tools to read what was previously discussed. This prevents the crew from repeating research or asking duplicate questions. You don't need to manually pass history arrays between Python classes. The MCP Server exposes the history natively, allowing your crew to self-correct based on past interactions. This keeps your autonomous operations running smoothly over long-lived sessions.
Ingest Files for Team Analysis
The `upload_file` tool uploads documents directly to the platform so your entire crew can access the same source files. When a user uploads a PDF, a routing agent triggers this tool to store the document in the shared space. From there, any agent in the crew can query the file content during execution. This eliminates the need to write custom file-parsing scripts for each agent. The platform handles the document processing, while your CrewAI team focuses on analyzing the extracted data. This design keeps your Python codebase lean and focused on agent logic.
Set up Dify MCP in CrewAI
Prerequisites
- Python 3.10+ installed
-
crewaipackage (pip install crewai) - Active Vinkius subscription with a valid endpoint token
- 1
Install CrewAI
Run
pip install crewaito install the framework. MCP support is built-in via themcpsparameter. - 2
Add the MCP URL to your agent
Pass your Vinkius endpoint directly to the
mcpslist. Replace[YOUR_TOKEN_HERE]with your token from cloud.vinkius.com. CrewAI handles tool discovery and caching automatically. - 3
Kick off your crew
Create a
Crewwith your agent and tasks. Callcrew.kickoff()— the agent will automatically invoke Dify tools as needed.
from crewai import Agent, Task, Crew
agent = Agent(
role="Dify Analyst",
goal="Access and analyze Dify data via MCP.",
backstory="Expert analyst with direct Dify access.",
mcps=[
"https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
],
)
task = Task(
description="List recent Dify transactions",
agent=agent,
expected_output="A summary of recent activity",
)
crew = Crew(agents=[agent], tasks=[task])
result = crew.kickoff()
print(result) Prerequisites
- Python 3.10+ installed
-
crewai+crewai-toolspackages - Active Vinkius subscription with a valid endpoint token
- 1
Install dependencies
Run
pip install crewai crewai-tools. TheMCPServerAdapterhandles lifecycle management and tool conversion. - 2
Connect with MCPServerAdapter
Use
MCPServerAdapteras a context manager withSseServerParameterspointing to your Vinkius endpoint. The adapter automatically manages connection lifecycle. - 3
Assign tools and run
Pass the returned
mcp_toolsto your agent'stoolsparameter. The adapter converts MCP tools to nativeBaseToolobjects compatible with all CrewAI agents.
from crewai import Agent, Task, Crew
from crewai_tools import MCPServerAdapter
from mcp import SseServerParameters
server_params = SseServerParameters(
url="https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
)
with MCPServerAdapter(server_params) as mcp_tools:
agent = Agent(
role="Dify Analyst",
goal="Access and analyze Dify data via MCP.",
backstory="Expert analyst with direct Dify access.",
tools=mcp_tools,
)
task = Task(
description="List recent Dify transactions",
agent=agent,
expected_output="A summary of recent activity",
)
crew = Crew(agents=[agent], tasks=[task])
result = crew.kickoff()
print(result) Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by Dify. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.
Why Choose Vinkius
Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.
Real-time monitoring
Live
visibility into every interaction
Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.
Built-in savings
60%
lower AI costs
Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.
Single dashboard
One
place for every integration
Every tool your AI connects to, managed from a single screen. One account, complete control.
Common questions about Dify MCP in CrewAI
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Dify MCP today
We host it, we monitor it, we maintain it. You just paste one token.