Connect Playwright to Claude Code

Navigate and automate websites in a browser sandbox. Add Toolspoke to Claude Code once and it can use 9 Playwright actions. Your Playwright credential stays in Toolspoke, and you choose which actions Claude Code may call.

Set it up in Claude Code

Three steps, the first one once for every toolkit you will ever add.

  1. Add Toolspoke to Claude Code

    Run it in your project, then /mcp to sign in

    claude mcp add --transport http toolspoke https://toolspoke.com/mcp

    The sign-in opens in your browser, and Toolspoke asks you to approve it.

  2. Install Playwright and connect it

    Add Playwright to a project in your Toolspoke workspace.

    Playwright needs no credential. There is nothing to go and fetch: the settings below are optional, and they are configuration rather than secrets.

  3. Choose what Claude Code may do

    All 9 actions start on. Switch off any of the 3 actions that change something in Playwright, and Claude Code gets a refusal if it tries.

What you can ask Claude Code for

A few of the Playwright actions that only read, so they are safe to try first.

  • Open a URL and return its rendered text content, optionally scoped to one CSS selector
  • Open a URL and run a JavaScript function inside the page, returning its result
  • Open a URL and return the browser console output it produced, newest last
  • Open a URL and list the network requests the page made, with status codes

What Claude Code can do in Playwright

6 actions read and 3 write.

Reads

  • Open page

    Open a URL and return the page's accessibility snapshot: headings, links, buttons and form fields with the selectors needed to interact with them. Start here before any click or form action. Pass snapshot_depth on large pages to keep the response small.

  • Find on page

    Open a URL and search its accessibility snapshot for text or a regular expression, returning only the matching nodes with a few lines of context. Much cheaper than open_page when you already know what you are looking for.

  • Extract text

    Open a URL and return its rendered text content, optionally scoped to one CSS selector. Use this to read an article, a rendered price or any content that only exists after JavaScript runs.

  • Evaluate

    Open a URL and run a JavaScript function inside the page, returning its result. Use it to pull structured data out of the DOM, for example "() => [...document.querySelectorAll('h2')].map(node => node.textContent)". The code runs in the page, not on the server.

  • Console messages

    Open a URL and return the browser console output it produced, newest last. Use it to find JavaScript errors on a page you are debugging.

  • Network requests

    Open a URL and list the network requests the page made, with status codes. Static assets are excluded unless you ask for them, so this is a quick way to discover the JSON APIs a page calls.

Writes

  • Click

    Open a URL, click one element and return the resulting page snapshot. The selector is a CSS selector or a ref taken from open_page. Because the browser is recreated per call, this always navigates first, chain further steps with run_flow instead of calling click twice.

  • Fill form

    Open a URL, fill one or more fields and optionally submit, then return the resulting page snapshot. Use it for logins, searches and filter forms. Never send credentials you were not explicitly given.

  • Run flow

    Open a URL and run an ordered sequence of interactions in one browser session, then return the final snapshot. This is the only way to chain steps, because the browser does not survive between calls, use it for multi-step flows such as accept a cookie banner, type a search, click a result.

Playwright in Claude Code: questions

Does Claude Code see my Playwright credential?

No. The credential is stored encrypted in Toolspoke, and the gateway adds it to each call. Claude Code only ever talks to Toolspoke, and the dashboard shows the last four characters of the credential and nothing more.

Can I stop Claude Code from changing things in Playwright?

Yes. Each of the 9 actions can be switched off for a project. Turn off the 3 that change something and Claude Code can only read.

Will 9 actions crowd Claude Code's context?

No. Toolspoke shows Claude Code five bridge tools, plus a guide where a toolkit has one, and Claude Code searches for the Playwright action it needs when it needs it. Adding more toolkits does not add more tools to its list.

Can I add it once for every project?

Yes. Add --scope user to the command and Claude Code keeps Toolspoke in every project on this machine. Without it, the server is added to the project you ran the command in.

What does it cost?

Tool calls are free on every plan. Playwright runs in a sandbox, so a call bills the sandbox time it uses.

Try Playwright in Claude Code

Free to start, and tool calls cost nothing on any plan.