R1

ruibaby/1panel-mcp

部署与 DevOps

本页由 AI 翻译,技术细节请以原文为准。 查看原文

36 stars 4 forks 质量 56 趋势 12MIT

一个用于自动部署网站到 1Panel(实验性)的 MCP 服务器

概览

一个用于自动部署网站到 1Panel 的模型上下文协议(MCP)服务器。 目前,该项目仍处于实验性阶段,并不意味着可以直接使用。 https://www.bilibili.com/video/BV1SjQRY3EmM/ - 自动化网站部署到 1Panel 服务器 - 如果网站尚未存在,则创建 - 上传静态网站文件到 1Panel - 完全兼容 MCP 标准协议 要将该服务器与光标IDE结合使用,请添加以下MCP配置: 1. 打开光标 2.创建 .cursor/mcp.json 在光标中,你可以在AI聊天中使用以下命令部署网站: - 域(必填):网站域- buildDir(可选):构建目录路径

概述(AI 翻译)

一个用于自动部署网站到 1Panel 的模型上下文协议(MCP)服务器。

[!重要] 目前该项目仍属实验性项目,并不意味着可以直接使用。

视频演示

特色

  • 自动化网站部署到 1Panel 服务器
  • 创建尚未存在的网站
  • 将静态网站文件上传到 1Panel
  • 完全兼容MCP标准协议

用途

在光标IDE中配置MCP

要将该服务器与光标IDE结合使用,请添加以下MCP配置:

  1. 打开光标
  2. 创建.cursor/mcp.json

使用 MCP 部署网站

在光标中,你可以在AI聊天中使用以下命令部署网站:

或者你也可以使用以下格式:

API 参考

MCP工具:deploy_website

向1Panel部署网站。

参数:

  • domain(必修):网站域名
  • buildDir(可选):构建目录路径

回复:

实现细节

部署流程

  1. 检查构建目录:验证指定的构建目录是否存在
  2. 网站创建:如果1Panel API不存在,创建新的静态网站

本页由 AI 翻译,技术细节请以原文为准。

README

1Panel MCP Server

A Model Context Protocol (MCP) server for automated website deployment to 1Panel.

[!IMPORTANT] Currently, this project is an experimental project and does not mean that it can be used directly.

Video demo

Features

  • Automates website deployment to 1Panel servers
  • Creates websites if they don’t already exist
  • Uploads static website files to 1Panel
  • Fully compatible with the MCP standard protocol

Usage

Configure MCP in Cursor IDE

To use this server with Cursor IDE, add the following MCP configuration:

  1. Open Cursor
  2. Create .cursor/mcp.json
{
  "mcpServers": {
    "1panel-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "1panel-mcp"
      ],
      "env": {
        "ONEPANEL_BASE_URL": "",
        "ONEPANEL_API_KEY": "",
        "ONEPANEL_API_VERSION": "v2" // optional, default is v2
      }
    }
  }
}

Use MCP to Deploy Websites

In Cursor, you can deploy websites using the following command in the AI chat:

Deploy to 1Panel with domain=yourdomain.com

Or you can use the following format:

Deploy website to 1Panel server, domain: yourdomain.com

API Reference

MCP Tool: deploy_website

Deploys a website to 1Panel.

Parameters:

  • domain (required): Website domain
  • buildDir (optional): Build directory path

Response:

Successfully deployed to 1Panel!
Domain: yourdomain.com
URL: http://yourdomain.com
Upload statistics:
- Total files: 25
- Successfully uploaded: 25
- Failed to upload: 0

Implementation Details

Deployment Process

  1. Check Build Directory: Verifies if the specified build directory exists
  2. Website Creation: Creates a new static website through 1Panel API if it doesn’t exist
  3. File Upload: Uploads all files from the build directory to the website
  4. Statistics: Returns detailed statistics about the upload process

Troubleshooting

If you encounter deployment issues, check the following:

  1. Ensure your API Key is valid and has sufficient permissions
  2. Verify that the website directory exists and has write permissions
  3. Check the 1Panel server logs for more detailed error information
  4. If file uploads fail, it may be due to file permission or format issues
在 GitHub 查看完整 README

安装

npx -y 1panel-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "1panel-mcp": { "command": "npx", "args": [ "-y", "1panel-mcp" ], "env": { "ONEPANEL_BASE_URL": "<your 1Panel base URL>", "ONEPANEL_API_KEY": "<your 1Panel API key>", "ONEPANEL_API_VERSION": "v2" // optional, default is v2 } } } }