How to Use the Dify.AI SDK MCP in OpenAI Agents SDK
Run production-ready Dify workflows and chat apps inside your OpenAI Agents SDK pipelines with strict guardrails and zero-config tool discovery.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Dify.AI SDK MCP to OpenAI Agents SDK
Create your Vinkius account to connect Dify.AI SDK to OpenAI Agents SDK and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.
Run workflows with OpenAI guardrails
This MCP Server exposes the `run_workflow` tool to trigger your Dify backend pipelines directly from your Python runtime. When your agent invokes this tool, the OpenAI Agents SDK intercepts the payload, applies your local validation rules, and executes the target workflow. You get execution outputs without exposing raw API keys to the agent context. Here's how it works under the hood. The agent discovers the tool signature automatically, parses the required inputs via `get_workflow_parameters`, and schedules the task. If the input data fails your defined safety checks, the SDK halts execution before hitting the Dify endpoint, saving API credits and protecting your internal systems.
Manage user sessions via OpenAI agent handoffs
The `get_conversations` tool fetches existing session histories so your agents can resume past chats. You can use specialized OpenAI agents for different parts of a conversation, passing the Dify thread ID between them during handoffs. This keeps your context window clean because only the active agent processes the current message history. Your agent updates thread names on the fly using `rename_conversation` to keep things organized for the end user. If a user goes off-topic, a router agent hands the session over to a generic support agent. The new agent calls `get_conversation_messages` to catch up instantly, maintaining a continuous user experience.
Trace Dify MCP Server calls in your dashboard
The `chat_message` tool sends user queries directly to your Dify chatbots. When using this MCP Server, every single tool call, payload, and response latency gets logged directly in your OpenAI developer dashboard. You see the exact inputs sent to `upload_file` alongside your agent's decision-making steps. Debugging complex multi-agent systems becomes straightforward with this visibility. If a model generates a bad response, you can trace the issue back to the `get_app_meta` call that retrieved the application's configuration. You don't have to guess which agent triggered which workflow.
Set up Dify.AI SDK MCP in OpenAI Agents SDK
Prerequisites
- Python 3.10+ installed
-
openai-agentspackage (pip install openai-agents) - Active Vinkius subscription with a valid endpoint token
- 1
Install the SDK
Run
pip install openai-agentsto install the OpenAI Agents SDK. The MCP integration is built-in — no extra dependencies needed. - 2
Connect via SSE transport
Use
MCPServerSsewith your Vinkius endpoint URL. Replace[YOUR_TOKEN_HERE]with your token from cloud.vinkius.com. The SDK auto-discovers all Dify.AI SDK tools at runtime. - 3
Create your Agent
Pass the MCP to
Agent(mcp_servers=[server]). The agent receives Dify.AI SDK tools as native definitions — JSON schemas resolve automatically. - 4
Run the agent
Call
Runner.run(agent, prompt)to execute. The agent invokes the appropriate Dify.AI SDK tools and returns structured results. Copy the full example on the right to get started.
import asyncio
from agents import Agent, Runner
from agents.mcp import MCPServerSse
async def main():
async with MCPServerSse(
url="https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
) as server:
agent = Agent(
name="Dify.AI SDK Agent",
instructions="You have access to Dify.AI SDK tools.",
mcp_servers=[server],
)
result = await Runner.run(agent, "List recent transactions")
print(result.final_output)
asyncio.run(main()) Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by Dify.AI. 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.AI SDK MCP in OpenAI Agents SDK
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Dify.AI SDK MCP today
We host it, we monitor it, we maintain it. You just paste one token.