静态Web应用部署服务

MCP Web Deployer是一个通过Docker和Nginx允许LLM代理本地部署静态Web应用的服务。

  • by kratosvil
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 kratosvil/mcp-web-deployer

使用说明

MCP Web部署器

MCP服务器,允许LLM代理使用Docker和Nginx在本地部署静态web应用程序。

MCP服务器,允许Claude AI通过Docker容器部署静态网站


它的作用

你用通俗易懂的语言告诉克劳德你想要什么。Claude生成HTML,部署Nginx容器,你的网站就上线了——所有这些都是通过 模型上下文协议.

"Create a landing page with a hero section and deploy it"
  User ──► Claude AI ──► MCP Server ──► Docker ──► Live Site
  (prompt)   (generates)   (deploys)    (nginx)   (localhost:8080)

特性

  • 自然语言到网站 --描述你想要什么,克劳德来构建它
  • 一个命令部署 --带有只读卷挂载的Nginx容器
  • 即时更新 --编辑文件,刷新浏览器,更改是实时的
  • 5个MCP工具 --创建、部署、停止、状态、列表
  • 异步Python --异步的非阻塞I/O
  • 缺省安全 --容器隔离,无外部端口暴露

快速开始

先决条件

安装

git clone https://github.com/kratosvil/mcp-web-deployer.git
cd mcp-web-deployer
python -m venv venv

# Windows
.\venv\Scripts\Activate.ps1

# Linux/macOS
source venv/bin/activate

pip install -r requirements.txt

配置Claude桌面版

添加到您的Claude Desktop配置文件中:

操作系统 路径
窗户 %APPDATA%\Claude\claude_desktop_config.json
Linux ~/.config/Claude/claude_desktop_config.json
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "web-deployer": {
      "command": "/absolute/path/to/venv/bin/python",
      "args": ["/absolute/path/to/src/server.py"]
    }
  }
}

重新启动Claude Desktop,然后尝试:

"Create an index.html with a welcome message and deploy the server"

打开 http://localhost:8080 查看您的网站。

MCP工具

工具 说明
create_html 在中创建HTML文件 www/ 包含自定义内容
deploy_server 启动Nginx容器服务 www/ 在给定的端口上
stop_server 停止并删除Docker容器
server_status 检查服务器是否正在运行,显示端口和正常运行时间
list_html_files 列出所有HTML文件及其大小和修改日期

建筑

Claude Desktop
     │
     │  MCP Protocol (JSON-RPC 2.0 via stdio)
     ▼
┌─────────────────────┐
│  MCP Server         │
│  (Python asyncio)   │
│                     │
│  5 registered tools │
└──────┬──────┬───────┘
       │      │
       ▼      ▼
   File I/O   Docker Engine
   (www/)     (nginx:alpine)
                  │
                  ▼
              localhost:8080
  • 协议:JSON-RPC 2.0通过标准输入
  • 容器: nginx:alpine (~23MB,1秒内开始)
  • 体积: www/ 以只读方式装载 /usr/share/nginx/html
  • 端口:仅绑定到localhost(无法从网络访问)

测试

# Run all 27 tests
pytest tests/ -v

# Run specific test groups
pytest tests/ -v -k "CreateHtml"
pytest tests/ -v -k "Deploy"
pytest tests/ -v -k "Status"

测试使用模拟的Docker调用——运行测试套件不需要运行Docker实例。

项目结构

mcp-web-deployer/
├── src/
│   └── server.py          # MCP server (5 tools, async)
├── tests/
│   └── test_server.py     # 27 tests with pytest
├── www/                   # HTML files served by Nginx
├── examples/
│   └── welcome.html       # Demo page
├── docs/
│   ├── ARCHITECTURE.md    # Technical deep-dive
│   ├── INSTALLATION.md    # Multi-platform setup guide
│   └── USAGE.md           # Usage guide with examples
├── scripts/
│   ├── setup.ps1          # Windows setup automation
│   └── start.ps1          # Windows startup script
├── requirements.txt
└── config.example.json

技术栈

层 技术
客户端 克劳德桌面
协议 MCP(标准输入,JSON-RPC 2.0)
后端 Python 3.8+/异步
容器 Docker/nginx:alpine
测试 pytest/pytest异步

文档

  • 建筑 --系统设计、数据流、安全模型
  • 安装 --Windows、Linux、macOS的分步设置
  • 用法 --工具参考、示例、工作流程、故障排除

许可证

麻省理工学院