Deploy and Connect a 1Panel MCP Server to Dify with Docker
This step‑by‑step guide explains how to deploy a 1Panel MCP Server using Docker, enable SSE mode, and integrate it into Dify via the Agent strategy plugin, covering required configurations, common pitfalls, and testing procedures.
Before You Begin
This guide is practical; it explains how to call a 1Panel MCP Server from Dify. It does not cover the detailed composition of MCP, only the parts needed for the integration.
The example uses 1Panel MCP Server because it is simple to operate, but any MCP server that supports SSE can be used, even stdio‑based servers via tools like mcp-proxy.
What Is an MCP Server?
Model Context Protocol (MCP) is an open communication protocol led by Anthropic in 2024, designed to enable seamless integration between large language models (LLMs) and external data sources or tools. An MCP server implements the protocol on the server side, allowing AI models to interact safely with local and remote resources.
MCP follows a client‑server architecture:
Client : typically an AI application (e.g., Claude Desktop) that initiates requests.
Server : a lightweight program that exposes specific data sources or tool functions through a standardized protocol.
Main server capabilities include:
Resource exposure (files, database records, etc.)
Tool provision (executable functions)
Dynamic notifications (push updates on changes)
Session management (connection init, capability negotiation, termination)
You Need...
This guide assumes Dify v1.2.0, basic English reading ability for technical docs, and Docker deployment skills.
Deploying the MCP Server
MCP Modes
MCP servers can be invoked via stdio (command‑line) or SSE (Server‑Sent Events). Dify currently supports only SSE, implemented through a third‑party plugin.
If your MCP server lacks SSE support, you can use mcp‑proxy to convert stdio to SSE.
How to Deploy 1Panel MCP Server
Official repository: 1Panel MCP Server . The repository shows how to enable SSE mode.
Use the following docker-compose.yaml to start the server:
services:
core:
command: ./mcp-1panel -transport sse -addr "http://localhost:8000"
environment:
- PANEL_HOST=http://<1Panel-Access-Address>:<Port>
- PANEL_ACCESS_TOKEN=<1Panel-Access-Token>
- TZ=Asia/Shanghai
image: 1panel/1panel-mcp-server:latest
ports:
- 8000:8000
restart: unless-stoppedWhen the container logs show 2025/04/10 03:00:23 SSE server listening on :8000, the deployment is successful.
Calling the Server from Dify
First, install the "Agent Strategy (supports MCP tools)" plugin from the Dify plugin marketplace.
In Dify Studio, create a new Chatflow, add an Agent node, and select the Function Calling option.
Specify at least one tool in the tool list (e.g., a simple "get current time" tool), then configure the MCP service as follows:
{
"mcp-1panel-anything-you-want": {
"url": "http://<Your-MCP-Server-Addr>:<Port>/sse"
}
}If you have multiple MCP servers, you can list them similarly, but avoid using identical commands on different servers to prevent confusion. A better practice is to wrap each function in a separate Dify workflow and expose the workflow as a tool.
For the Command field, the plugin auto‑discovers MCP commands via SSE, so you can enter a placeholder like "." to avoid Dify errors.
In the Query field, bind the system variable {sys.query} or a concrete command such as "Get 1Panel server overview".
If you encounter an error stating "Maximum iteration count cannot be empty", simply re‑enter a valid iteration count.
After configuration, test the workflow; the response should appear without issues.
Additional Tips
1Panel MCP Server Call Errors
Ensure the PANEL_HOST=http://<1Panel-Access-Address>:<Port> line in docker-compose.yaml has no surrounding quotes, and that the 1Panel API whitelist permits the MCP server. For quick testing, set the whitelist to 0.0.0.0/0, but remember to restrict it after testing.
Dify Returns No Reply
Check that the final "Direct Reply" node outputs the text from the Agent node.
Architect's Alchemy Furnace
A comprehensive platform that combines Java development and architecture design, guaranteeing 100% original content. We explore the essence and philosophy of architecture and provide professional technical articles for aspiring architects.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
