Static Compose MCP Gateway with Playwright Mcp Microsoft

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:

  1. Volume Mounting: My primary goal is to save screenshots to a volume. If using static mode is the correct way to define custom volumes for MCP servers, how do I properly configure the service discovery to fix the connection error?

  2. Alternative Approach: If the static gateway 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!

I tried your compose file yesterday, but couldn’t finish testing and solving it. I won’t have it now either, but I still write some notes.

First of all the domain name of containers are the container names and compose service names. You named one service with the “mcp” prefix, but not the “playwright” service. If you used “mcp-playwright” that would solve your name resolution issue. I’m not sure how the domain name used by the gateway could be customized, but I read that there should be a config file where you configure the targets.

Even if you fix the domain name, it would probably not work. It didn’t work for me at least, because the gateway wants to use port 4444, but there was nothing listening on it in the playwight container. Playwright has a --port parameter. When I set it, I saw a process listening on it, but I still got connection refused.

By the way, you could simplify the playwright service definition by removing the entrypoint line and adding a command like this:

    command:
      - "--no-sandbox"
      - "--port"
      - "4444"

This is because a command is the agument of the entrypoint and the default entrypoint already contains the first parameters, you just need to add those you need additional to the defaults. Change the entrypoint only if some of the default parametrs have to be disabled.

It won’t solve your original problem, but a simpler compose file can make debugging simpler too.

Hello,

If you just need to add or tweak arguments, using command is the preferred and safer approach, as it preserves the default. You also made the distinction between when to use entrypoint vs command, which is exactly the kind of nuance that makes Docker Compose easier to manage and debug. Clean, minimal Compose files help reduce confusion during troubleshooting.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.