Top Tags

Modifying MCP Gateway to Use Playwright with Custom Directory

A guide to modifying the MCP Gateway to use the Playwright server with a custom directory for persistent storage.

To modify the MCP Gateway to use the Playwright server with a custom directory (e.g., mounting a persistent directory), you need to update the MCP catalog and configure the Playwright server entry:

Export the Current MCP Catalog

Export the official MCP catalog to a local YAML file for editing:

bash
1docker mcp catalog show docker-mcp --format yaml > docker-mcp.yaml

Modify the Playwright Server Entry

Open the docker-mcp.yaml file in a text editor and locate the Playwright server entry. It will look something like this:

yaml
1- name: playwright
2 image: mcp/server-playwright:latest
3 description: "Playwright server for browser automation"

Add a volumes section to mount a persistent directory. For example:

yaml
1- name: playwright
2 image: mcp/server-playwright:latest
3 description: "Playwright server for browser automation"
4 volumes:
5 - /path/to/your/local/directory:/app

Replace /path/to/your/local/directory with the path to your desired persistent directory.

Mount Playwright screenshots Directory

bash
1volumes:
2 - /path/to/your/local/directory:/tmp

Import the Modified Catalog

After editing the catalog, import it back into the MCP Gateway:

bash
1docker mcp catalog import docker-mcp.yaml

Enable the Playwright Server

Enable the Playwright server in the MCP Gateway:

bash
1docker mcp server enable playwright

Verify the Configuration

List the enabled servers to ensure the Playwright server is active:

bash
1docker mcp server list

Logging

bash
1docker mcp gateway run --verbose --log-calls

Sources:

https://www.docker.com/blog/build-custom-mcp-catalog/

https://github.com/docker/mcp-gateway/blob/main/docs/catalog.md