Hello Docker Community,
I’m trying to set up a Model Context Protocol (MCP) server for Playwright within Docker Compose to capture screenshots and save them to a volume. I’m running into a connection issue when using the static gateway configuration.
My Goal:
I want my Playwright MCP server to save screenshots to a persistent Docker volume so I can access them from my host machine.
The Problem:
When I configure the MCP gateway in static mode, the Playwright server fails to start. The gateway logs show a connection error, specifically a name resolution failure for mcp-playwright.
Error Log:
gateway-1 | - Reading configuration...
gateway-1 | - Reading catalog from [https://desktop.docker.com/mcp/catalog/v2/catalog.yaml]
gateway-1 | - Configuration read in 155.932751ms
gateway-1 | - Those servers are enabled: playwright, fetch
gateway-1 | - Listing MCP tools...
gateway-1 | > fetch: (1 tools) (1 prompts)
gateway-1 | - playwright: 2025/09/04 12:04:23 socat[22] W getaddrinfo("mcp-playwright", "4444", {0x20,0,1,6}, {}): Name does not resolve
gateway-1 | - playwright: 2025/09/04 12:04:23 socat[22] E _xioopen_ipapp_prepare(node="mcp-playwright", service="4444", pf=0, ...): Name does not resolve
gateway-1 | > Can't start playwright: failed to connect: calling "initialize": EOF
gateway-1 | > 1 tools listed in 8.873016616s
gateway-1 | > Initialized in 9.03722259s
gateway-1 | > Start streaming server on port 8811
My Configuration:
Here is a simplified version of my compose.yaml (I’ve replaced sensitive names with placeholders):
services:
gateway:
image: docker/mcp-gateway
ports:
- "8811:8811"
command:
- --transport=streaming
- --servers=playwright,fetch
- --port=8811
- --static=true
- --verbose
depends_on:
- playwright
- mcp-fetch
playwright:
image: mcp/playwright:latest
entrypoint: [ "node", "cli.js", "--headless", "--browser", "chromium", "--no-sandbox" ]
init: true
cpus: 1
mem_limit: 2g
stdin_open: true
tty: true
security_opt:
- no-new-privileges
labels:
- docker-mcp=true
- docker-mcp-tool-type=mcp
- docker-mcp-name=playwright
- docker-mcp-transport=stdio
volumes:
- type: image
source: docker/mcp-gateway
target: /docker-mcp
mcp-fetch:
image: mcp/fetch
entrypoint: ["/docker-mcp/misc/docker-mcp-bridge", "mcp-server-fetch"]
init: true
cpus: 1
mem_limit: 2g
security_opt:
- no-new-privileges
labels:
- docker-mcp=true
- docker-mcp-tool-type=mcp
- docker-mcp-name=fetch
- docker-mcp-transport=stdio
volumes:
- type: image
source: docker/mcp-gateway
target: /docker-mcp
My Questions:
-
Volume Mounting: My primary goal is to save screenshots to a volume. If using
staticmode is the correct way to define custom volumes for MCP servers, how do I properly configure the service discovery to fix the connection error? -
Alternative Approach: If the
staticgateway is not the intended method for this, what is the best practice for attaching a volume to an MCP server (like Playwright) when using the default automatic gateway? I can’t see a way to define volumes for services I’m not manually defining in the compose file.
Any guidance on resolving the connection issue or the correct pattern for mounting volumes with MCP servers would be greatly appreciated.
Thank you!