
1panel
mcp-1panel 是为 1Panel 实现的 Model Context Protocol (MCP) 服务器。
概述
1Panel MCP 服务器
1Panel MCP 服务器 是为 1Panel 实现的 Model Context Protocol (MCP) 服务器。
安装方法
方法 1:从发布页面下载(推荐)
-
访问 发布页面 并下载与您的系统对应的可执行文件。
-
示例安装(适用于 amd64):
bash
chmod +x mcp-1panel-linux-amd64
mv mcp-1panel-linux-amd64 /usr/local/bin/mcp-1panel
方法 2:从源代码构建
确保本地已安装 Go 1.23 或更高版本。然后运行:
- 克隆仓库:
bash
git clone https://github.com/1Panel-dev/mcp-1panel.git
cd mcp-1panel
- 构建可执行文件:
bash
make build
将 ./build/mcp-1panel 移动到包含在系统 PATH 中的目录。
方法 3:通过 go install 安装
确保本地已安装 Go 1.23 或更高版本。然后运行:
bash
go install github.com/1Panel-dev/mcp-1panel@latest
方法 4:通过 Docker 安装
确保 Docker 已正确安装并配置在您的机器上。
官方镜像支持以下架构:
- amd64
- arm64
- arm/v7
- s390x
- ppc64le
使用方法
1Panel MCP 服务器支持两种运行模式:stdio
和 sse
。
stdio 模式
使用本地二进制文件
在 Cursor 或 Windsurf 的配置文件中添加:
json
{
"mcpServers": {
"mcp-1panel": {
"command": "mcp-1panel",
"env": {
"PANEL_ACCESS_TOKEN": "<your 1Panel access token>",
"PANEL_HOST": "such as http://localhost:8080"
}
}
}
}
在 Docker 中运行
json
{
"mcpServers": {
"mcp-1panel": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"PANEL_HOST",
"-e",
"PANEL_ACCESS_TOKEN",
"1panel/1panel-mcp-server"
],
"env": {
"PANEL_HOST": "such as http://localhost:8080",
"PANEL_ACCESS_TOKEN": "<your 1Panel access token>"
}
}
}
}
sse 模式
- 启动 MCP 服务器:
bash
mcp-1panel -host http://localhost:8080 -token <your 1Panel access token> -transport sse -addr http://localhost:8000
- 在 Cursor 或 Windsurf 中配置:
json
{
"mcpServers": {
"mcp-1panel": {
"url": "http://localhost:8000/sse"
}
}
}
命令行选项
-token
: 1Panel 访问令牌-host
: 1Panel 访问地址-transport
: 传输类型(stdio 或 sse,默认:stdio)-addr
: 启动 SSE 服务器地址(默认:http://localhost:8000)
可用工具
服务器提供了各种与 1Panel 交互的工具:
工具 | 类别 | 描述 |
---|---|---|
get_dashboard_info | 系统 | 列出仪表板状态 |
get_system_info | 系统 | 获取系统信息 |
list_websites | 网站 | 列出所有网站 |
create_website | 网站 | 创建一个网站 |
list_ssls | 证书 | 列出所有证书 |
create_ssl | 证书 | 创建一个证书 |
list_installed_apps | 应用程序 | 列出已安装的应用 |
install_openresty | 应用程序 | 安装 OpenResty |
install_mysql | 应用程序 | 安装 MySQL |
list_databases | 数据库 | 列出所有数据库 |
create_database | 数据库 | 创建一个数据库 |