|
| 1 | +# 1Panel MCP Server |
| 2 | + |
| 3 | +1Panel MCP 服务器是一个用于 1Panel 的模型上下文协议(Model Context Protocol,MCP)服务器实现。 |
| 4 | + |
| 5 | +## 安装 |
| 6 | + |
| 7 | +### 前提条件 |
| 8 | + |
| 9 | +- Go 1.23.0 或更高版本 |
| 10 | +- 已有 1Panel |
| 11 | + |
| 12 | +### 从源代码构建 |
| 13 | + |
| 14 | +1. 克隆仓库: |
| 15 | + |
| 16 | +```bash |
| 17 | +git https://github.com/1Panel-dev/mcp-1panel.git |
| 18 | +cd mcp-1panel |
| 19 | +``` |
| 20 | + |
| 21 | +2. 构建项目: |
| 22 | + |
| 23 | +```bash |
| 24 | +make build |
| 25 | +``` |
| 26 | + |
| 27 | +> 将 ./build/mcp-1panel 移动至系统环境变量 |
| 28 | +
|
| 29 | +### 使用 go install 安装 |
| 30 | + |
| 31 | +```bash |
| 32 | +go install github.com/1Panel-dev/mcp-1panel@latest |
| 33 | +``` |
| 34 | + |
| 35 | +## 使用方法 |
| 36 | + |
| 37 | +**Cursor**、**Windsurf** 配置示例: |
| 38 | + |
| 39 | +```json |
| 40 | +{ |
| 41 | + "mcpServers": { |
| 42 | + "mcp-1panel": { |
| 43 | + "command": "mcp-1panel", |
| 44 | + "env": { |
| 45 | + "PANEL_ACCESS_TOKEN": "<your 1Panel access token>", |
| 46 | + "PANEL_HOST": "such as http://localhost:8080" |
| 47 | + } |
| 48 | + } |
| 49 | + } |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +> 还可以使用Claude、Windsurf、Cline等MCP客户端。 |
| 54 | +
|
| 55 | +### 命令行选项 |
| 56 | + |
| 57 | +- `-token`:1Panel 访问令牌 |
| 58 | +- `-host`:1Panel 访问地址 |
| 59 | +- `-transport`:传输类型(stdio 或 sse,默认:stdio) |
| 60 | +- `-sse-port`:启动 SSE 服务器端口(默认:8000) |
| 61 | + |
| 62 | +### 环境变量 |
| 63 | + |
| 64 | +您也可以使用环境变量配置服务器: |
| 65 | + |
| 66 | +- `PANEL_HOST`:1Panel 访问地址 |
| 67 | +- `PANEL_ACCESS_TOKEN`:1Panel 访问令牌 |
| 68 | + |
| 69 | +## 可用工具 |
| 70 | + |
| 71 | +服务器提供了各种与 1Panel 交互的工具: |
| 72 | + |
| 73 | +| 工具 | 类别 | 描述 | |
| 74 | +|-----------------------------|------|------------------| |
| 75 | +| **get_dashboard_info** | 系统 | 列出概览页状态 | |
| 76 | +| **get_system_info** | 系统 | 获取系统信息 | |
| 77 | +| **list_websites** | 网站 | 列出所有网站 | |
| 78 | +| **create_website** | 网站 | 创建网站 | |
| 79 | +| **list_ssls** | 证书 | 列出所有证书 | |
| 80 | +| **create_ssl** | 证书 | 创建证书 | |
| 81 | +| **list_installed_apps** | 应用 | 列出所有已安装应用 | |
| 82 | +| **install_openresty** | 应用 | 安装 OpenResty | |
| 83 | +| **install_mysql** | 应用 | 安装 MySQL | |
| 84 | +| **list_databases** | 数据库 | 列出所有数据库 | |
| 85 | +| **create_database** | 数据库 | 创建数据库 | |
0 commit comments