feat: add mcp-servers/**
This commit is contained in:
8
mcp-servers/playwright/.env.example
Normal file
8
mcp-servers/playwright/.env.example
Normal file
@@ -0,0 +1,8 @@
|
||||
# Docker image version
|
||||
PLAYWRIGHT_VERSION=latest
|
||||
|
||||
# Host port override
|
||||
PLAYWRIGHT_PORT_OVERRIDE=8000
|
||||
|
||||
# Timezone
|
||||
TZ=UTC
|
||||
67
mcp-servers/playwright/README.md
Normal file
67
mcp-servers/playwright/README.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# Playwright MCP Server
|
||||
|
||||
Playwright MCP Server provides browser automation and web scraping capabilities through the Model Context Protocol.
|
||||
|
||||
## Features
|
||||
|
||||
- 🌐 **Browser Automation** - Automate browser operations
|
||||
- 📸 **Screenshot Capture** - Capture web page screenshots
|
||||
- 🔍 **Web Scraping** - Intelligent web content extraction
|
||||
- 📝 **Form Filling** - Automated form filling
|
||||
- 🎭 **Multi-Browser** - Support for Chromium, Firefox, WebKit
|
||||
- 🔐 **Cookie & Session** - Cookie and session management
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
| -------------------------- | -------- | -------------------- |
|
||||
| `PLAYWRIGHT_VERSION` | `latest` | Docker image version |
|
||||
| `PLAYWRIGHT_PORT_OVERRIDE` | `8000` | Service port |
|
||||
| `TZ` | `UTC` | Timezone |
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Configure Environment
|
||||
|
||||
Create a `.env` file:
|
||||
|
||||
```env
|
||||
PLAYWRIGHT_VERSION=latest
|
||||
PLAYWRIGHT_PORT_OVERRIDE=8000
|
||||
TZ=Asia/Shanghai
|
||||
```
|
||||
|
||||
### 2. Start Service
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### 3. Verify Service
|
||||
|
||||
```bash
|
||||
curl http://localhost:8000/health
|
||||
```
|
||||
|
||||
## Resource Requirements
|
||||
|
||||
- Minimum memory: 512MB
|
||||
- Recommended memory: 2GB
|
||||
- Shared memory: 2GB (configured)
|
||||
|
||||
## Common Use Cases
|
||||
|
||||
1. **Web Screenshots** - Automatically visit and capture screenshots
|
||||
2. **Data Scraping** - Extract data from dynamic web pages
|
||||
3. **UI Testing** - Automated UI testing scenarios
|
||||
4. **Form Automation** - Batch fill and submit forms
|
||||
|
||||
## References
|
||||
|
||||
- [Playwright Official Site](https://playwright.dev/)
|
||||
- [MCP Documentation](https://modelcontextprotocol.io/)
|
||||
- [Docker Hub - mcp/playwright](https://hub.docker.com/r/mcp/playwright)
|
||||
|
||||
## License
|
||||
|
||||
MIT License
|
||||
67
mcp-servers/playwright/README.zh.md
Normal file
67
mcp-servers/playwright/README.zh.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# Playwright MCP Server
|
||||
|
||||
Playwright MCP Server 是一个基于 Playwright 的模型上下文协议(MCP)服务器,提供浏览器自动化和网页抓取功能。
|
||||
|
||||
## 功能特性
|
||||
|
||||
- 🌐 **浏览器自动化** - 自动化浏览器操作
|
||||
- 📸 **截图捕获** - 捕获网页截图
|
||||
- 🔍 **网页抓取** - 智能提取网页内容
|
||||
- 📝 **表单填写** - 自动化表单填写
|
||||
- 🎭 **多浏览器支持** - 支持 Chromium、Firefox、WebKit
|
||||
- 🔐 **Cookie 和会话管理** - Cookie 和会话管理
|
||||
|
||||
## 环境变量
|
||||
|
||||
| 变量 | 默认值 | 说明 |
|
||||
| -------------------------- | -------- | --------------- |
|
||||
| `PLAYWRIGHT_VERSION` | `latest` | Docker 镜像版本 |
|
||||
| `PLAYWRIGHT_PORT_OVERRIDE` | `8000` | 服务端口 |
|
||||
| `TZ` | `UTC` | 时区 |
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 1. 配置环境
|
||||
|
||||
创建 `.env` 文件:
|
||||
|
||||
```env
|
||||
PLAYWRIGHT_VERSION=latest
|
||||
PLAYWRIGHT_PORT_OVERRIDE=8000
|
||||
TZ=Asia/Shanghai
|
||||
```
|
||||
|
||||
### 2. 启动服务
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### 3. 验证服务
|
||||
|
||||
```bash
|
||||
curl http://localhost:8000/health
|
||||
```
|
||||
|
||||
## 资源需求
|
||||
|
||||
- 最小内存:512MB
|
||||
- 推荐内存:2GB
|
||||
- 共享内存:2GB(已配置)
|
||||
|
||||
## 常见使用场景
|
||||
|
||||
1. **网页截图** - 自动访问并捕获截图
|
||||
2. **数据抓取** - 从动态网页提取数据
|
||||
3. **UI 测试** - 自动化 UI 测试场景
|
||||
4. **表单自动化** - 批量填写和提交表单
|
||||
|
||||
## 参考链接
|
||||
|
||||
- [Playwright 官方网站](https://playwright.dev/)
|
||||
- [MCP 文档](https://modelcontextprotocol.io/)
|
||||
- [Docker Hub - mcp/playwright](https://hub.docker.com/r/mcp/playwright)
|
||||
|
||||
## 许可证
|
||||
|
||||
MIT License
|
||||
42
mcp-servers/playwright/docker-compose.yaml
Normal file
42
mcp-servers/playwright/docker-compose.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
x-default: &default
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 100m
|
||||
max-file: "3"
|
||||
|
||||
services:
|
||||
playwright:
|
||||
<<: *default
|
||||
image: mcp/playwright:${PLAYWRIGHT_VERSION:-latest}
|
||||
environment:
|
||||
- MCP_HOST=0.0.0.0
|
||||
- TZ=${TZ:-UTC}
|
||||
ports:
|
||||
- "${PLAYWRIGHT_PORT_OVERRIDE:-8000}:8000"
|
||||
# 如果需要访问本地文件,可以挂载卷
|
||||
volumes:
|
||||
- playwright_data:/app/data
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8000/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 20s
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.00'
|
||||
memory: 2G
|
||||
reservations:
|
||||
cpus: '0.5'
|
||||
memory: 512M
|
||||
# Playwright 需要额外的权限来运行浏览器
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
shm_size: '2gb'
|
||||
|
||||
volumes:
|
||||
playwright_data:
|
||||
driver: local
|
||||
Reference in New Issue
Block a user