feat: add app playwright-mcp

This commit is contained in:
arch3rPro
2025-08-30 19:33:16 +08:00
parent bd09592e0b
commit 9976c19f48
9 changed files with 541 additions and 5 deletions

View File

@@ -0,0 +1,82 @@
additionalProperties:
formFields:
- default: 8931
edit: true
envKey: PANEL_APP_PORT_HTTP
label:
en: Port
zh: 端口
zh-Hant:
ja: ポート
ms: Port
pt-br: Porta
ru: Порт
ko: 포트
required: true
rule: paramPort
type: number
- default: "chromium"
envKey: BROWSER_TYPE
label:
en: Browser Type
zh: 浏览器类型
zh-Hant: 瀏覽器類型
ja: ブラウザタイプ
ms: Jenis Pelayar
pt-br: Tipo de Navegador
ru: Тип браузера
ko: 브라우저 유형
required: true
type: select
values:
- label: Chromium
value: "chromium"
- label: Firefox
value: "firefox"
- label: WebKit
value: "webkit"
- default: "true"
envKey: HEADLESS_MODE
label:
en: Headless Mode
zh: 无头模式
zh-Hant: 無頭模式
ja: ヘッドレスモード
ms: Mod Tanpa Kepala
pt-br: Modo Headless
ru: Безголовый режим
ko: 헤드리스 모드
required: true
type: select
values:
- label: "True"
value: "true"
- label: "False"
value: "false"
- default: "1280,720"
envKey: VIEWPORT_SIZE
label:
en: Viewport Size (width,height)
zh: 视窗大小 (宽度,高度)
zh-Hant: 視窗大小 (寬度,高度)
ja: ビューポートサイズ (幅,高さ)
ms: Saiz Viewport (lebar,tinggi)
pt-br: Tamanho da Viewport (largura,altura)
ru: Размер области просмотра (ширина,высота)
ko: 뷰포트 크기 (너비,높이)
required: false
rule: paramCommon
type: text
- default: "Mozilla/5.0 (Linux; x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
envKey: USER_AGENT
label:
en: User Agent
zh: 用户代理
zh-Hant: 用戶代理
ja: ユーザーエージェント
ms: Ejen Pengguna
pt-br: Agente do Usuário
ru: Пользовательский агент
ko: 사용자 에이전트
required: false
type: text

View File

@@ -0,0 +1,33 @@
services:
playwright-mcp:
image: mcr.microsoft.com/playwright/mcp:v0.0.35
container_name: ${CONTAINER_NAME}
restart: always
networks:
- 1panel-network
ports:
- "${PANEL_APP_PORT_HTTP}:8931"
volumes:
- ./data:/app/data
- ./data/config:/app/config
working_dir: /app
environment:
- NODE_ENV=production
- PORT=8931
- BROWSER_TYPE=${BROWSER_TYPE:-chromium}
- HEADLESS_MODE=${HEADLESS_MODE:-true}
- VIEWPORT_SIZE=${VIEWPORT_SIZE:-1280,720}
- USER_AGENT=${USER_AGENT}
command: ["--port", "8931", "--host", "0.0.0.0"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8931/mcp"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
labels:
createdBy: "Apps"
networks:
1panel-network:
external: true

View File

@@ -0,0 +1,140 @@
# Playwright MCP
Playwright MCP 是一个基于模型上下文协议 (MCP) 的服务器,它使用 Playwright 提供浏览器自动化功能。该服务器让大语言模型 (LLM) 能够通过结构化的可访问性快照与网页交互,而无需使用截图或视觉调优模型。
![](https://cdn.jsdelivr.net/gh/xiaoY233/PicList@main/public/assets/Playwright-MCP.png)
![](https://img.shields.io/badge/Copyright-arch3rPro-ff9800?style=flat&logo=github&logoColor=white)
## ✨ 核心特性
- **🚀 快速轻量**:使用 Microsoft 官方 MCP 镜像,预配置完整
- **🤖 LLM 友好**:无需视觉模型,完全基于结构化数据操作
- **🎯 确定性工具应用**:避免基于截图方法常见的模糊性
- **🌐 多浏览器支持**:支持 Chromium、Firefox 和 WebKit
- **🔧 高度可配置**:支持多种配置选项和运行模式
- **📦 官方镜像**:使用 `mcr.microsoft.com/playwright/mcp` 官方镜像
## 📋 系统要求
- Node.js 18 或更新版本
- Docker 环境
- 1Panel 控制面板
## 🚀 快速开始
### 1Panel 部署
1. 在 1Panel 应用商店中搜索 "Playwright MCP"
2. 点击安装并配置以下参数:
- **端口**服务访问端口默认8931
- **浏览器类型**:选择 Chromium、Firefox 或 WebKit
- **无头模式**:是否启用无头模式运行
- **视窗大小**:浏览器视窗尺寸(格式:宽度,高度)
- **用户代理**:自定义浏览器用户代理字符串
3. 点击确认安装
### 访问服务
安装完成后,您可以通过以下方式访问:
- **HTTP 端点**`http://your-server-ip:port/mcp`
- **健康检查**`http://your-server-ip:port/mcp`
## ⚙️ 配置说明
### 浏览器类型
- **Chromium**:推荐选择,兼容性最佳
- **Firefox**Gecko 引擎,适合特定测试需求
- **WebKit**Safari 内核,适合 Apple 生态测试
### 运行模式
- **有头模式**:显示浏览器界面,适合调试
- **无头模式**:后台运行,适合生产环境,性能更佳
### 视窗配置
- 格式:`宽度,高度`1920,1080
- 影响页面渲染和响应式布局
- 建议使用常见分辨率
## 🔌 MCP 客户端集成
### VS Code
```json
{
"mcpServers": {
"playwright": {
"url": "http://your-server:8931/mcp"
}
}
}
```
### Claude Desktop
```json
{
"mcpServers": {
"playwright": {
"url": "http://your-server:8931/mcp"
}
}
}
```
## 📊 性能优化
- 启用无头模式可减少资源消耗
- 选择合适的视窗大小避免不必要的渲染
- 定期清理用户数据目录
- 监控容器资源使用情况
## 🐛 故障排除
### 常见问题
1. **服务无法启动**
- 检查端口是否被占用
- 确认 Docker 容器状态
- 查看容器日志
2. **浏览器启动失败**
- 验证浏览器类型配置
- 检查系统资源是否充足
- 确认依赖安装完成
3. **连接问题**
- 检查防火墙设置
- 验证网络配置
- 确认端口映射正确
### 日志查看
```bash
# 查看容器日志
docker logs playwright-mcp
# 实时跟踪日志
docker logs -f playwright-mcp
```
## 🔗 相关链接
- [官方项目](https://github.com/microsoft/playwright-mcp)
- [Playwright 文档](https://playwright.dev/)
- [MCP 协议规范](https://modelcontextprotocol.io/introduction)
- [1Panel 文档](https://1panel.cn/docs/)
## 📄 许可证
本项目遵循原项目的开源许可证。详细信息请参考 [官方仓库](https://github.com/microsoft/playwright-mcp)。
## 🤝 贡献
欢迎提交 Issue 和 Pull Request 来帮助改进这个应用配置。

View File

@@ -0,0 +1,140 @@
# Playwright MCP
A Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages through structured accessibility snapshots, bypassing the need for screenshots or visually-tuned models.
![](https://cdn.jsdelivr.net/gh/xiaoY233/PicList@main/public/assets/Playwright-MCP.png)
![](https://img.shields.io/badge/Copyright-arch3rPro-ff9800?style=flat&logo=github&logoColor=white)
## ✨ Key Features
- **🚀 Fast and Lightweight**: Uses Microsoft official MCP image, pre-configured and ready
- **🤖 LLM-Friendly**: No vision models needed, operates purely on structured data
- **🎯 Deterministic Tool Application**: Avoids ambiguity common with screenshot-based approaches
- **🌐 Multi-Browser Support**: Supports Chromium, Firefox, and WebKit
- **🔧 Highly Configurable**: Supports various configuration options and running modes
- **📦 Official Image**: Uses `mcr.microsoft.com/playwright/mcp` official image
## 📋 System Requirements
- Node.js 18 or newer
- Docker environment
- 1Panel control panel
## 🚀 Quick Start
### 1Panel Deployment
1. Search for "Playwright MCP" in the 1Panel app store
2. Click install and configure the following parameters:
- **Port**: Service access port (default: 8931)
- **Browser Type**: Choose Chromium, Firefox, or WebKit
- **Headless Mode**: Whether to enable headless mode
- **Viewport Size**: Browser viewport dimensions (format: width,height)
- **User Agent**: Custom browser user agent string
3. Click confirm to install
### Accessing the Service
After installation, you can access via:
- **HTTP Endpoint**: `http://your-server-ip:port/mcp`
- **Health Check**: `http://your-server-ip:port/mcp`
## ⚙️ Configuration Guide
### Browser Types
- **Chromium**: Recommended choice, best compatibility
- **Firefox**: Gecko engine, suitable for specific testing needs
- **WebKit**: Safari kernel, suitable for Apple ecosystem testing
### Running Modes
- **Headed Mode**: Shows browser interface, suitable for debugging
- **Headless Mode**: Runs in background, suitable for production, better performance
### Viewport Configuration
- Format: `width,height` (e.g., 1920,1080)
- Affects page rendering and responsive layout
- Recommended to use common resolutions
## 🔌 MCP Client Integration
### VS Code
```json
{
"mcpServers": {
"playwright": {
"url": "http://your-server:8931/mcp"
}
}
}
```
### Claude Desktop
```json
{
"mcpServers": {
"playwright": {
"url": "http://your-server:8931/mcp"
}
}
}
```
## 📊 Performance Optimization
- Enable headless mode to reduce resource consumption
- Choose appropriate viewport size to avoid unnecessary rendering
- Regularly clean user data directory
- Monitor container resource usage
## 🐛 Troubleshooting
### Common Issues
1. **Service Won't Start**
- Check if port is already in use
- Verify Docker container status
- Check container logs
2. **Browser Launch Fails**
- Verify browser type configuration
- Check if system resources are sufficient
- Confirm dependencies are installed
3. **Connection Issues**
- Check firewall settings
- Verify network configuration
- Confirm port mapping is correct
### Log Viewing
```bash
# View container logs
docker logs playwright-mcp
# Follow logs in real-time
docker logs -f playwright-mcp
```
## 🔗 Related Links
- [Official Project](https://github.com/microsoft/playwright-mcp)
- [Playwright Documentation](https://playwright.dev/)
- [MCP Protocol Specification](https://modelcontextprotocol.io/introduction)
- [1Panel Documentation](https://1panel.cn/docs/)
## 📄 License
This project follows the open source license of the original project. For details, please refer to the [official repository](https://github.com/microsoft/playwright-mcp).
## 🤝 Contributing
Welcome to submit Issues and Pull Requests to help improve this application configuration.

View File

@@ -0,0 +1,26 @@
name: Playwright-MCP
tags:
- 开发工具
- AI
- 实用工具
title: Playwright MCP 服务器
description: 基于 Playwright 的模型上下文协议服务器
additionalProperties:
key: playwright-mcp
name: Playwright-MCP
tags:
- DevTool
- AI
- Tool
shortDescZh: 提供浏览器自动化功能的 MCP 服务器
shortDescEn: Playwright MCP server that provides browser automation capabilities
description:
zh: 一个基于 Playwright 的模型上下文协议 (MCP) 服务器,为 LLM 提供浏览器自动化功能。使用结构化可访问性快照与网页交互,无需截图或视觉调优模型。
en: A Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages through structured accessibility snapshots, bypassing the need for screenshots or visually-tuned models.
type: tool
crossVersionUpdate: true
limit: 0
recommend: 0
website: https://github.com/microsoft/playwright-mcp
github: https://github.com/microsoft/playwright-mcp
document: https://github.com/microsoft/playwright-mcp#readme

View File

@@ -0,0 +1,82 @@
additionalProperties:
formFields:
- default: 8931
edit: true
envKey: PANEL_APP_PORT_HTTP
label:
en: Port
zh: 端口
zh-Hant:
ja: ポート
ms: Port
pt-br: Porta
ru: Порт
ko: 포트
required: true
rule: paramPort
type: number
- default: "chromium"
envKey: BROWSER_TYPE
label:
en: Browser Type
zh: 浏览器类型
zh-Hant: 瀏覽器類型
ja: ブラウザタイプ
ms: Jenis Pelayar
pt-br: Tipo de Navegador
ru: Тип браузера
ko: 브라우저 유형
required: true
type: select
values:
- label: Chromium
value: "chromium"
- label: Firefox
value: "firefox"
- label: WebKit
value: "webkit"
- default: "true"
envKey: HEADLESS_MODE
label:
en: Headless Mode
zh: 无头模式
zh-Hant: 無頭模式
ja: ヘッドレスモード
ms: Mod Tanpa Kepala
pt-br: Modo Headless
ru: Безголовый режим
ko: 헤드리스 모드
required: true
type: select
values:
- label: "True"
value: "true"
- label: "False"
value: "false"
- default: "1280,720"
envKey: VIEWPORT_SIZE
label:
en: Viewport Size (width,height)
zh: 视窗大小 (宽度,高度)
zh-Hant: 視窗大小 (寬度,高度)
ja: ビューポートサイズ (幅,高さ)
ms: Saiz Viewport (lebar,tinggi)
pt-br: Tamanho da Viewport (largura,altura)
ru: Размер области просмотра (ширина,высота)
ko: 뷰포트 크기 (너비,높이)
required: false
rule: paramCommon
type: text
- default: "Mozilla/5.0 (Linux; x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
envKey: USER_AGENT
label:
en: User Agent
zh: 用户代理
zh-Hant: 用戶代理
ja: ユーザーエージェント
ms: Ejen Pengguna
pt-br: Agente do Usuário
ru: Пользовательский агент
ko: 사용자 에이전트
required: false
type: text

View File

@@ -0,0 +1,33 @@
services:
playwright-mcp:
image: mcr.microsoft.com/playwright/mcp:latest
container_name: ${CONTAINER_NAME}
restart: always
networks:
- 1panel-network
ports:
- "${PANEL_APP_PORT_HTTP}:8931"
volumes:
- ./data:/app/data
- ./data/config:/app/config
working_dir: /app
environment:
- NODE_ENV=production
- PORT=8931
- BROWSER_TYPE=${BROWSER_TYPE:-chromium}
- HEADLESS_MODE=${HEADLESS_MODE:-true}
- VIEWPORT_SIZE=${VIEWPORT_SIZE:-1280,720}
- USER_AGENT=${USER_AGENT}
command: ["--port", "8931", "--host", "0.0.0.0"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8931/mcp"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
labels:
createdBy: "Apps"
networks:
1panel-network:
external: true

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -33,7 +33,7 @@ services:
networks:
1panel-network:
ipv4_address: ${SUBNET_PREFIX}.235
image: chaitin/safeline-detector:9.1.0
image: chaitin/safeline-detector:9.2.4
volumes:
- ${SAFELINE_DIR}/resources/detector:/resources/detector
- ${SAFELINE_DIR}/logs/detector:/logs/detector
@@ -45,7 +45,7 @@ services:
safeline-tengine:
container_name: ${CONTAINER_NAME}-tengine
restart: always
image: chaitin/safeline-tengine:9.1.0
image: chaitin/safeline-tengine:9.2.4
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/resolv.conf:/etc/resolv.conf:ro
@@ -69,7 +69,7 @@ services:
networks:
1panel-network:
ipv4_address: ${SUBNET_PREFIX}.237
image: chaitin/safeline-luigi:9.1.0
image: chaitin/safeline-luigi:9.2.4
volumes:
- /etc/localtime:/etc/localtime:ro
- ${SAFELINE_DIR}/resources/luigi:/app/data
@@ -90,7 +90,7 @@ services:
networks:
1panel-network:
ipv4_address: ${SUBNET_PREFIX}.238
image: chaitin/safeline-fvm:9.1.0
image: chaitin/safeline-fvm:9.2.4
volumes:
- /etc/localtime:/etc/localtime:ro
logging:
@@ -126,7 +126,7 @@ services:
networks:
1panel-network:
ipv4_address: ${SUBNET_PREFIX}.240
image: chaitin/safeline-chaos:9.1.0
image: chaitin/safeline-chaos:9.2.4
logging:
options:
max-size: 100m