AI-powered HTML website generator with auto-upload functionality via Model Context Protocol
Project description
HTML Generator MCP
一个基于 Model Context Protocol (MCP) 的智能网页生成服务,支持AI驱动的网站创建、实时进度追踪和自动部署功能。
✨ 主要特性
- 🤖 AI驱动生成: 使用大语言模型智能分析需求,生成个性化网站
- 📊 实时进度追踪: 支持任务状态监控和进度查询
- 🚀 自动部署上传: 构建完成后自动打包上传到云端
- 🎨 现代化设计: 响应式布局,支持移动端适配
- 🔧 灵活配置: 支持多种模型和自定义配置
🚀 快速开始
安装
pip install agent-mcp
基本使用
- 创建网站计划
import asyncio
from MCP.web_agent_server import create_simple_site
async def main():
result = await create_simple_site(
description="创建一个现代化的咖啡店网站",
site_title="星巴克咖啡",
context_content="地址:北京市朝阳区,营业时间:7:00-22:00"
)
print(f"计划ID: {result['plan_id']}")
asyncio.run(main())
- 执行构建(含自动上传)
from MCP.web_agent_server import execute_plan
result = await execute_plan(
plan_id="your_plan_id",
project_root="/path/to/project",
auto_upload=True, # 🎯 构建完成后自动上传
save_output=True
)
- 查询进度
from MCP.web_agent_server import get_progress
progress = await get_progress(job_id=result["job_id"])
print(f"状态: {progress['job']['status']}")
# 如果启用了自动上传
if progress['job'].get('upload_status') == 'success':
print(f"网站地址: {progress['job']['website_url']}")
🛠️ MCP 工具
create_simple_site()- 生成网站计划execute_plan()- 执行网站构建get_progress()- 查询构建进度upload_project_to_mcp_server()- 手动上传项目deploy_folder_or_zip()- 部署到EdgeOne Pages
🔧 环境配置
创建 .env 文件:
# AI模型配置
OPENAI_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
OPENAI_API_KEY=your_api_key
WEB_AGENT_MODEL=qwen3-coder-plus-2025-09-23
# 项目路径(可选)
WEB_AGENT_PROJECT_ROOT=/path/to/projects
# EdgeOne Pages 部署(可选)
EDGEONE_PAGES_API_TOKEN=your_token
EDGEONE_PAGES_PROJECT_NAME=your_project
🎯 自动上传功能
构建完成时自动上传到云端,无需手动操作:
# 启动带自动上传的构建
result = await execute_plan(
plan_id="plan_id",
project_root="./my-website",
auto_upload=True # 关键参数
)
# 监听进度变化
while True:
progress = await get_progress(job_id=result["job_id"])
status = progress['job']['status']
if status == 'completed':
upload_status = progress['job'].get('upload_status')
if upload_status == 'success':
print(f"🎉 网站已上线: {progress['job']['website_url']}")
break
elif upload_status == 'failed':
print("❌ 上传失败")
break
await asyncio.sleep(2)
📋 进度状态
- 构建阶段:
running→completed - 上传阶段:
uploading→success/failed - 最终结果:
website_url(成功时)
🤝 贡献
欢迎提交 Issue 和 Pull Request!
📄 许可证
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
htmlgen_mcp-0.4.1.tar.gz
(150.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
htmlgen_mcp-0.4.1-py3-none-any.whl
(168.1 kB
view details)
File details
Details for the file htmlgen_mcp-0.4.1.tar.gz.
File metadata
- Download URL: htmlgen_mcp-0.4.1.tar.gz
- Upload date:
- Size: 150.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8272157a1c1c017e418704b82e0b5b95516f43cdb2b21691aaf62b31bc248892
|
|
| MD5 |
9c5c1e0671428dd198334212ad9f7b79
|
|
| BLAKE2b-256 |
4d9307018aede970d6358d36c03d7ee779ec5600e7ad93a97ddf85241a746c51
|
File details
Details for the file htmlgen_mcp-0.4.1-py3-none-any.whl.
File metadata
- Download URL: htmlgen_mcp-0.4.1-py3-none-any.whl
- Upload date:
- Size: 168.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44a729c19e53c0cfa9d1ac151971cfd80f6580e4be387663dac8a30af00ab56b
|
|
| MD5 |
e0e0333ea99c5660f6a619a8c2249909
|
|
| BLAKE2b-256 |
94e6aa723efbc770967daef8e954b53553cf9d9be87f4a493ebe29eb1ae3edf4
|