mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2025-07-26 08:32:26 +08:00
Add Docker support (#220)
This commit is contained in:
parent
d4f8f87b03
commit
dc955c73a3
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
FROM node:22-bookworm-slim
|
||||||
|
|
||||||
|
# Set the working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package.json and package-lock.json at this stage to leverage the build cache
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
# Install chromium and its dependencies, but only for headless mode
|
||||||
|
RUN npx -y playwright install --with-deps --only-shell chromium
|
||||||
|
|
||||||
|
# Copy the rest of the app
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the app
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Run in headless and only with chromium (other browsers need more dependencies not included in this image)
|
||||||
|
ENTRYPOINT ["node", "cli.js", "--headless", "--browser", "chromium"]
|
22
README.md
22
README.md
@ -17,6 +17,8 @@ A Model Context Protocol (MCP) server that provides browser automation capabilit
|
|||||||
|
|
||||||
### Example config
|
### Example config
|
||||||
|
|
||||||
|
#### NPX
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
@ -30,6 +32,19 @@ A Model Context Protocol (MCP) server that provides browser automation capabilit
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Docker
|
||||||
|
|
||||||
|
**NOTE:** The Docker implementation only supports headless chromium at the moment.
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"playwright": {
|
||||||
|
"command": "docker",
|
||||||
|
"args": ["run", "-i", "--rm", "--init", "mcp/playwright"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### Installation in VS Code
|
#### Installation in VS Code
|
||||||
|
|
||||||
@ -154,6 +169,13 @@ To use Vision Mode, add the `--vision` flag when starting the server:
|
|||||||
Vision Mode works best with the computer use models that are able to interact with elements using
|
Vision Mode works best with the computer use models that are able to interact with elements using
|
||||||
X Y coordinate space, based on the provided screenshot.
|
X Y coordinate space, based on the provided screenshot.
|
||||||
|
|
||||||
|
### Build with Docker
|
||||||
|
|
||||||
|
You can build the Docker image yourself.
|
||||||
|
```
|
||||||
|
docker build -t mcp/playwright .
|
||||||
|
```
|
||||||
|
|
||||||
### Programmatic usage with custom transports
|
### Programmatic usage with custom transports
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
Loading…
x
Reference in New Issue
Block a user