htmlgen-mcp 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of htmlgen-mcp might be problematic. Click here for more details.

@@ -0,0 +1,65 @@
1
+ """HTML 验证与移动端检查工具"""
2
+ from __future__ import annotations
3
+
4
+ import re
5
+
6
+
7
+ def validate_html(file_path: str):
8
+ """简单的HTML语法验证"""
9
+ try:
10
+ with open(file_path, "r", encoding="utf-8") as f:
11
+ content = f.read()
12
+
13
+ # 基础检查
14
+ issues = []
15
+ if "<!DOCTYPE html>" not in content:
16
+ issues.append("缺少DOCTYPE声明")
17
+ if "<html" not in content:
18
+ issues.append("缺少html标签")
19
+ if "<head>" not in content:
20
+ issues.append("缺少head标签")
21
+ if "<body>" not in content:
22
+ issues.append("缺少body标签")
23
+ if 'charset="UTF-8"' not in content and 'charset=utf-8' not in content:
24
+ issues.append("建议添加UTF-8字符编码")
25
+
26
+ if issues:
27
+ return f"HTML验证发现问题: {', '.join(issues)}"
28
+ else:
29
+ return "HTML结构验证通过"
30
+ except Exception as e:
31
+ return f"HTML验证失败: {str(e)}"
32
+
33
+
34
+ def check_mobile_friendly(file_path: str):
35
+ """检查移动端友好性"""
36
+ try:
37
+ with open(file_path, "r", encoding="utf-8") as f:
38
+ content = f.read()
39
+
40
+ checks = []
41
+
42
+ # 检查viewport meta标签
43
+ if 'name="viewport"' in content:
44
+ checks.append("✓ 包含viewport meta标签")
45
+ else:
46
+ checks.append("✗ 缺少viewport meta标签")
47
+
48
+ # 检查响应式CSS
49
+ if "@media" in content or "bootstrap" in content.lower():
50
+ checks.append("✓ 包含响应式设计")
51
+ else:
52
+ checks.append("! 可能缺少响应式设计")
53
+
54
+ # 检查图片优化
55
+ if 'style="max-width: 100%"' in content or 'class="img-fluid"' in content:
56
+ checks.append("✓ 图片已优化")
57
+ else:
58
+ checks.append("! 建议为图片添加响应式类")
59
+
60
+ return "移动端友好性检查:\n" + "\n".join(checks)
61
+
62
+ except Exception as e:
63
+ return f"移动端检查失败: {str(e)}"
64
+
65
+ __all__ = ["validate_html", "check_mobile_friendly"]
@@ -0,0 +1,171 @@
1
+ Metadata-Version: 2.4
2
+ Name: htmlgen-mcp
3
+ Version: 0.2.0
4
+ Summary: AI-powered HTML website generator with auto-upload functionality via Model Context Protocol
5
+ Author-email: HTML Generator Team <contact@htmlgen-mcp.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/your-username/htmlgen-mcp
8
+ Project-URL: Repository, https://github.com/your-username/htmlgen-mcp
9
+ Project-URL: Issues, https://github.com/your-username/htmlgen-mcp/issues
10
+ Project-URL: Documentation, https://github.com/your-username/htmlgen-mcp/blob/main/README.md
11
+ Keywords: mcp,html,website,generator,ai,auto-upload,web-development
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
20
+ Classifier: Topic :: Software Development :: Code Generators
21
+ Classifier: Topic :: Text Processing :: Markup :: HTML
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ Requires-Dist: click>=8.2.1
26
+ Requires-Dist: fastmcp>=2.12.3
27
+ Requires-Dist: openai>=1.91.0
28
+ Requires-Dist: python-dotenv>=1.1.1
29
+ Requires-Dist: requests>=2.31.0
30
+ Requires-Dist: cos-python-sdk-v5>=1.9.30
31
+ Requires-Dist: mcp>=0.1.0
32
+ Requires-Dist: aiohttp>=3.8.0
33
+ Requires-Dist: uvloop>=0.19; platform_system != "Windows"
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
36
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
37
+ Requires-Dist: black>=23.0.0; extra == "dev"
38
+ Requires-Dist: isort>=5.12.0; extra == "dev"
39
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
40
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
41
+
42
+ # HTML Generator MCP
43
+
44
+ 一个基于 Model Context Protocol (MCP) 的智能网页生成服务,支持AI驱动的网站创建、实时进度追踪和自动部署功能。
45
+
46
+ ## ✨ 主要特性
47
+
48
+ - 🤖 **AI驱动生成**: 使用大语言模型智能分析需求,生成个性化网站
49
+ - 📊 **实时进度追踪**: 支持任务状态监控和进度查询
50
+ - 🚀 **自动部署上传**: 构建完成后自动打包上传到云端
51
+ - 🎨 **现代化设计**: 响应式布局,支持移动端适配
52
+ - 🔧 **灵活配置**: 支持多种模型和自定义配置
53
+
54
+ ## 🚀 快速开始
55
+
56
+ ### 安装
57
+
58
+ ```bash
59
+ pip install agent-mcp
60
+ ```
61
+
62
+ ### 基本使用
63
+
64
+ 1. **创建网站计划**
65
+ ```python
66
+ import asyncio
67
+ from MCP.web_agent_server import create_simple_site
68
+
69
+ async def main():
70
+ result = await create_simple_site(
71
+ description="创建一个现代化的咖啡店网站",
72
+ site_title="星巴克咖啡",
73
+ context_content="地址:北京市朝阳区,营业时间:7:00-22:00"
74
+ )
75
+ print(f"计划ID: {result['plan_id']}")
76
+
77
+ asyncio.run(main())
78
+ ```
79
+
80
+ 2. **执行构建(含自动上传)**
81
+ ```python
82
+ from MCP.web_agent_server import execute_plan
83
+
84
+ result = await execute_plan(
85
+ plan_id="your_plan_id",
86
+ project_root="/path/to/project",
87
+ auto_upload=True, # 🎯 构建完成后自动上传
88
+ save_output=True
89
+ )
90
+ ```
91
+
92
+ 3. **查询进度**
93
+ ```python
94
+ from MCP.web_agent_server import get_progress
95
+
96
+ progress = await get_progress(job_id=result["job_id"])
97
+ print(f"状态: {progress['job']['status']}")
98
+
99
+ # 如果启用了自动上传
100
+ if progress['job'].get('upload_status') == 'success':
101
+ print(f"网站地址: {progress['job']['website_url']}")
102
+ ```
103
+
104
+ ## 🛠️ MCP 工具
105
+
106
+ - `create_simple_site()` - 生成网站计划
107
+ - `execute_plan()` - 执行网站构建
108
+ - `get_progress()` - 查询构建进度
109
+ - `upload_project_to_mcp_server()` - 手动上传项目
110
+ - `deploy_folder_or_zip()` - 部署到EdgeOne Pages
111
+
112
+ ## 🔧 环境配置
113
+
114
+ 创建 `.env` 文件:
115
+
116
+ ```env
117
+ # AI模型配置
118
+ OPENAI_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
119
+ OPENAI_API_KEY=your_api_key
120
+ WEB_AGENT_MODEL=qwen3-coder-plus-2025-09-23
121
+
122
+ # 项目路径(可选)
123
+ WEB_AGENT_PROJECT_ROOT=/path/to/projects
124
+
125
+ # EdgeOne Pages 部署(可选)
126
+ EDGEONE_PAGES_API_TOKEN=your_token
127
+ EDGEONE_PAGES_PROJECT_NAME=your_project
128
+ ```
129
+
130
+ ## 🎯 自动上传功能
131
+
132
+ 构建完成时自动上传到云端,无需手动操作:
133
+
134
+ ```python
135
+ # 启动带自动上传的构建
136
+ result = await execute_plan(
137
+ plan_id="plan_id",
138
+ project_root="./my-website",
139
+ auto_upload=True # 关键参数
140
+ )
141
+
142
+ # 监听进度变化
143
+ while True:
144
+ progress = await get_progress(job_id=result["job_id"])
145
+
146
+ status = progress['job']['status']
147
+ if status == 'completed':
148
+ upload_status = progress['job'].get('upload_status')
149
+ if upload_status == 'success':
150
+ print(f"🎉 网站已上线: {progress['job']['website_url']}")
151
+ break
152
+ elif upload_status == 'failed':
153
+ print("❌ 上传失败")
154
+ break
155
+
156
+ await asyncio.sleep(2)
157
+ ```
158
+
159
+ ## 📋 进度状态
160
+
161
+ - **构建阶段**: `running` → `completed`
162
+ - **上传阶段**: `uploading` → `success`/`failed`
163
+ - **最终结果**: `website_url` (成功时)
164
+
165
+ ## 🤝 贡献
166
+
167
+ 欢迎提交 Issue 和 Pull Request!
168
+
169
+ ## 📄 许可证
170
+
171
+ MIT License
@@ -0,0 +1,26 @@
1
+ MCP/__init__.py,sha256=LhgsU856arC-2Nnyf4RBiGr2WQy-JIEQmr_3R1Pqh6Q,112
2
+ MCP/web_agent_server.py,sha256=6JTK0663PuFjewVuozzyATZst764ljfkC63r5GN-g-4,46600
3
+ agents/__init__.py,sha256=Xydfjzw9s9O6I5Ixx6EmsTdXu26136NDPUAqt9B1hzE,121
4
+ agents/smart_web_agent.py,sha256=h57Ctjf51XImjjoixGgqJlzlbDr2H-iJo4sfbeMLN4Y,95246
5
+ agents/web_tools/__init__.py,sha256=dZWrDpM0Tzy4DMNt4_DSzF_9Bc3T5gVk_Kx-Rgu4l7Y,2178
6
+ agents/web_tools/bootstrap.py,sha256=QOoR38GhrK2JHow2P86fHgV9r6UFGDikwT0w6Qq4yh0,1909
7
+ agents/web_tools/browser.py,sha256=0Z84BtvBSXplpIDySw_ICH6RZPe9PtSYP8WGm4GJp0M,870
8
+ agents/web_tools/colors.py,sha256=GyoDWJiJPMTXRrYiJ8c0-ur25jDOZuq5nNSPDA38yEI,5242
9
+ agents/web_tools/css.py,sha256=GLEq3jy5CwpW-vrNOzU9EDPVLGdEDFwdpGQXDWuwM_4,37467
10
+ agents/web_tools/edgeone_deploy.py,sha256=DAc0ISqu8swGG9MEU2o8ONc7PDGsQ2MOakcSi2phxfk,20113
11
+ agents/web_tools/html_templates.py,sha256=kbs0slN5kIXstlMbqgLBQxMOVQtlap2lwLYg-3GBR4s,79659
12
+ agents/web_tools/images.py,sha256=miFp8-77SLlvBDBBbR6LYDfYGVzO0GmcZz06CQC16Gc,27617
13
+ agents/web_tools/images_fixed.py,sha256=2L1m4TKTx253Eigb_OSg89mOIjfzwBXfeyDJ7hsh3tw,7567
14
+ agents/web_tools/js.py,sha256=NaeABI0WWX23sdtZ2CZHJVBbOyRDbsKPwNqVz76n2SU,9388
15
+ agents/web_tools/navigation.py,sha256=d_o6K9-gowa54qRZebdPUAFGmIWiGtUqbdEV1vJtnYU,17940
16
+ agents/web_tools/project.py,sha256=JUxPDdJSdjdAu8eoMCsxMUOayQ_Tdt33wUFjCL93b-c,910
17
+ agents/web_tools/simple_builder.py,sha256=nfxrr0F_wlaq4k7_No3_33stnBlxhyjFFGQBxxPtGTM,10658
18
+ agents/web_tools/simple_css.py,sha256=kj9X3sHHhj1wGwBVL20j6w2qIHXRdxfBXoldnabxKsk,8278
19
+ agents/web_tools/simple_js.py,sha256=xMiuF-u-h_IIkUONZIa4Xf8vKB5mcXxwQf5b_BIcpoE,12174
20
+ agents/web_tools/simple_templates.py,sha256=-Rs-SsWpGZT2hiwa3jZNVDHOMZOo1vV2pWbmBdR30os,6471
21
+ agents/web_tools/validation.py,sha256=bNA6aWXrCSi7sPqQw5bBR3XF69gRf85D5jSMi996CtI,2069
22
+ htmlgen_mcp-0.2.0.dist-info/METADATA,sha256=eHUtcNs_rlkO33oR6dzZp00WjZKYXQILDE5ZmsIhxxg,5187
23
+ htmlgen_mcp-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ htmlgen_mcp-0.2.0.dist-info/entry_points.txt,sha256=s0OEXk5yTVjxB5NsiyEfARAZJy9WeAzcpiavfWn12iY,58
25
+ htmlgen_mcp-0.2.0.dist-info/top_level.txt,sha256=GA_Am9z1-WYGbmb39C4zeGWS1ewFwWaSK4QE9IbJ9TM,11
26
+ htmlgen_mcp-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ htmlgen-mcp = MCP.web_agent_server:main
@@ -0,0 +1,2 @@
1
+ MCP
2
+ agents