Black Friday Up to 20% off with code BLACKFRIDAY until Tue 1 Dec, 23:59 UK time
MC

AI & agents · Setup guide

How to use a proxy with Playwright MCP

Playwright MCP lets an AI agent drive a real browser. Start the server with --proxy-server and every page the agent opens goes through your ZenProxy IP. Choosing a proxy type for this? See proxies for AI training data and agents.

Broken on our side? Fixed within 48 hours of your report, or the unused part refunded. A website blocking the proxies isn’t covered. Refund Policy

Quick answer

To use a proxy with Playwright MCP, follow four steps: (1) Add the Playwright MCP server to your AI client; (2) Add --proxy-server=http://USERNAME:PASSWORD@HOST:PORT to its args; (3) Restart the MCP server or your AI client; (4) Ask the agent to open ipinfo.io/json to confirm the exit IP. Take the host, port, username and password from a line in your ZenProxy generator.

You need Playwright MCP and a ZenProxy proxy line from the generator. In the examples, replace HOST, PORT, USERNAME and PASSWORD for the values in your line (where to find them).

Quick setup

  1. 1Add the Playwright MCP server to your AI client.
  2. 2Add --proxy-server=http://USERNAME:PASSWORD@HOST:PORT to its args.
  3. 3Restart the MCP server or your AI client.
  4. 4Ask the agent to open ipinfo.io/json to confirm the exit IP.

Add the proxy to your MCP client config

Most MCP clients use a JSON config with an mcpServers section. Add the proxy as an argument.

MCP client config
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest",
        "--proxy-server=http://USERNAME:PASSWORD@HOST:PORT"
      ]
    }
  }
}

Restart the MCP server (or your AI client) after changing the config, then ask the agent to open https://ipinfo.io/json to confirm the exit IP.

Your proxy details

After you buy a plan, open My proxies. Choose the Proxy Type (Rotating or Sticky; static IP plans skip this and show your list of IPs), the Protocol (HTTP, or SOCKS5 where your plan offers it) and a Format, then copy a line. The generator offers three formats (SOCKS5 lines always use the protocol:// format):

HOST:PORT:USERNAME:PASSWORD

Paste into apps and anti-detect browsers that split the fields or auto-fill them.

USERNAME:PASSWORD@HOST:PORT

Tools that want credentials before the address.

http://USERNAME:PASSWORD@HOST:PORT

Code and command-line tools. This is the proxy URL used in the examples below.

In the examples on this page, replace USERNAME, PASSWORD, HOST and PORT with the values from your line. SOCKS5_PORT is the port the generator shows when you pick SOCKS5.

Residential lines are either rotating (a new IP on new connections) or sticky (one IP for the time you choose). Static Datacenter, Shared ISP and Private ISP plans give you a fixed list of IPs, one per line as IP:PORT:USERNAME:PASSWORD: Private ISP IPs are yours alone, while Shared ISP IPs can also be used by other customers. Rotating Datacenter and IPv6 plans give you one endpoint, with rotating or sticky lines; IPv6 only reaches sites that have an IPv6 address.

To test a line, open https://ipinfo.io/json through it: it shows the exit IP and country. For HTTP lines you can also use the free proxy checker.

Or use a config file

A config file keeps the credentials out of your client config, and lets you set the proxy as separate fields.

playwright-mcp.json
{
  "browser": {
    "launchOptions": {
      "proxy": {
        "server": "http://HOST:PORT",
        "username": "USERNAME",
        "password": "PASSWORD"
      }
    }
  }
}
MCP client config
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp@latest", "--config", "/absolute/path/to/playwright-mcp.json"]
    }
  }
}

Use a sticky line

An agent often works on one site for several minutes. A sticky line keeps the same IP for the whole task, so logins and carts survive. Pick a Sticky Duration in the generator that covers the task. For accounts the agent uses over days, use a static ISP IP. To make sticky lines, open the generator, set Proxy Type to Sticky, choose a Sticky Duration if your plan offers one, set how many lines you want in Sticky Amount, then copy or download them. Each line keeps its IP for the chosen time. The session part of a sticky username differs by plan, so always generate sticky lines instead of editing usernames by hand.

Browse from a country

Build the line in the generator: it writes the country, and a state, a city or a sticky session if you want one, into the username in the format your plan uses, and shows only the options your plan supports. On most residential plans the country is -country- and a two-letter code at the end of the username (for example USERNAME-country-gb), but older Unlimited Residential plans use a different format, so do not edit that username by hand. Datacenter and ISP IPs have a fixed location that you choose when you buy them. Agents then see local prices, search results and language.

Skip the proxy for local sites

Add --proxy-bypass=localhost,127.0.0.1 so the agent can still reach apps on your machine directly.

Troubleshooting

  • The agent sees a proxy sign-in prompt or a 407

    The credentials aren’t reaching the browser. Check the --proxy-server value or the config file path, then restart the server.More on this error →

  • The agent still shows your own IP

    The client is running an older server process. Restart the client, and check that the args are in the right server entry.

  • net::ERR_TUNNEL_CONNECTION_FAILED

    The proxy refused the CONNECT request. Run the line through curl -v to see the real status (407, 502 or 503).More on this error →

  • The site shows CAPTCHAs

    Use residential sticky lines and slow the agent down.More on this error →

Seeing another error? Read proxy errors and how to fix them, or contact support.

Questions

How do I give an AI agent a proxy?

Start Playwright MCP with --proxy-server=http://USERNAME:PASSWORD@HOST:PORT, or with a config file that sets browser.launchOptions.proxy.

Which proxy type is best for AI browsing agents?

Residential sticky lines for browsing sessions, and static ISP IPs for accounts the agent uses again and again.

Can I use SOCKS5 with Playwright MCP?

The browser can’t log in to SOCKS5 proxies with a password, so use HTTP lines.

How do I check the agent is using the proxy?

Ask it to open https://ipinfo.io/json and read back the IP and country.

Try it with Playwright MCP for $0.49

Get 1 GB of Residential Lite, then copy your rotating or sticky lines from the generator and paste them into the steps above.

Broken on our side? Fixed within 48 hours of your report, or the unused part refunded. A website blocking the proxies isn’t covered. Refund Policy

Related guides

All integrations →