---
title: "Deploy Playwright MCP"
description: "Playwright MCP headless browser for AI agents, behind a token gateway."
category: "AI/ML"
url: https://railway.com/deploy/playwright-mcp
---

# Deploy Playwright MCP

Playwright MCP headless browser for AI agents, behind a token gateway.

**[Deploy Playwright MCP on Railway](https://railway.com/template/playwright-mcp)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/playwright-mcp/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** AI/ML

## Template content

### playwright https://raw.githubusercontent.com/microsoft/playwright/v1.63.0/browser_patches/webkit/embedder/Playwright/Images.xcassets/AppIcon.appiconset/logo-256.png

- **Image:** mcr.microsoft.com/playwright/mcp:v0.0.82
- **Start command:** `node /app/cli.js --headless --browser chromium --no-sandbox --isolated --host :: --port 8931 --allowed-hosts *`

### gateway https://raw.githubusercontent.com/microsoft/playwright/v1.63.0/browser_patches/webkit/embedder/Playwright/Images.xcassets/AppIcon.appiconset/logo-256.png

- **Image:** caddy:2.11.4-alpine
- **Start command:** `sh -c 'printf "%s\n" "$CADDYFILE" > /tmp/Caddyfile && exec caddy run --config /tmp/Caddyfile --adapter caddyfile'`
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host Playwright MCP on Railway

Playwright MCP is Microsoft's Model Context Protocol server that gives AI agents a real browser. Agents navigate pages, click, type, fill forms, take screenshots and read structured accessibility snapshots instead of pixels, which makes web automation reliable for Claude, Cursor, VS Code, Codex and other MCP clients.

## About Hosting Playwright MCP

This template deploys Playwright MCP v0.0.82 with headless Chromium on the Railway private network and a small Caddy gateway in front. The gateway requires a generated bearer token on every request, because the server itself has no authentication and its browser can reach anything the service can. Each session uses an isolated in-memory profile, so nothing persists between sessions. Connect your MCP client to the gateway's `/mcp` URL with the token as a header. Chromium needs a few hundred megabytes of memory per session; the Hobby plan handles light use.

## Common Use Cases

- Giving coding agents and chat assistants a remote browser
- Agent-driven testing and QA of web applications
- Web research and data collection from pages that need JavaScript

## Dependencies for Playwright MCP Hosting

- `mcr.microsoft.com/playwright/mcp:v0.0.82` (official image)
- `caddy:2.11.4-alpine` as the authenticating gateway

### Deployment Dependencies

- [Playwright MCP on GitHub](https://github.com/microsoft/playwright-mcp)
- [Playwright MCP v0.0.82 release](https://github.com/microsoft/playwright-mcp/releases/tag/v0.0.82)
- [Model Context Protocol](https://modelcontextprotocol.io/)
- [Railway private networking](https://docs.railway.com/reference/private-networking)

### Implementation Details

| Service | Image | Networking | Storage |
| --- | --- | --- | --- |
| gateway | `caddy:2.11.4-alpine` | public domain on 8080 | none |
| playwright | `mcr.microsoft.com/playwright/mcp:v0.0.82` | private only, port 8931 | none |

Claude Code:

```bash
claude mcp add --transport http playwright https:///mcp \
  --header "Authorization: Bearer "
```

| Variable | Service | Default | Purpose |
| --- | --- | --- | --- |
| `MCP_API_TOKEN` | gateway | generated | Bearer token required on every request |
| `MCP_URL` | gateway | `https:///mcp` | Endpoint for MCP clients |

Notes:

- Use `browser_snapshot` to get page content inline; `browser_navigate` refers to a snapshot file kept inside the container.
- The browser can reach the Railway private network, so treat the token like a password.

This is a community-maintained deployment package and does not imply affiliation with or endorsement by the Playwright MCP project or its maintainers.

## Why Deploy Playwright MCP on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Playwright MCP on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/playwright-mcp
