Repository navigation
A rewrite on the official MCP TypeScript SDK. It fixes several tools that didn't work and removes duplicate tools.
Breaking changes
| 2.x | 3.0 |
|---|---|
takeScreenshot |
screenshot (now takes fullPage, selector and format) |
screenshot type / selector parameters |
fullPage / selector |
moveMouse |
mouseMove |
evaluateWithReturn |
executeJavaScript |
getPageTitle, getPageUrl |
getPageInfo |
Entry point dist/server.js |
dist/index.js |
| Node.js 16+ | Node.js 20+ |
executeJavaScript now always returns JSON, so string results are quoted ("Example" instead of Example). The old non-JSON-RPC {"command": …} input format is gone.
Fixed
- Protocol: debug logs went to stdout and corrupted the MCP stream.
initializereturned malformed capabilities and an old protocol version, andpingand unknown methods got no reply. Protocol handling now comes from@modelcontextprotocol/sdk. getConsoleMessagesandgetNetworkRequestsalways returned[]: they started listening at call time. The page is now monitored from the moment it opens.executeJavaScriptreturnedundefinedfor expressions such asdocument.title. Expressions, statements withreturnandawaitall work now.getElementHierarchyignoredmaxDepth: 0, andtyperejected an empty string.- Errors now include Playwright's actual reason instead of a generic message.
- An action on a missing element now fails after 10 seconds (configurable) instead of 30.
- The server reports its real version instead of
1.0.0. - The browser is closed when the client disconnects.
Added
goBackandreloadtools (goBackwas implemented but never exposed), plusinspectElement.screenshotreturns the image to the model, and saving to a file is optional.- The browser launches automatically on first use.
clickoptionsbuttonanddoubleClick;typeoptionsclearandsubmit;waitForSelectoroptionstate; aclearoption for the console and network buffers.- Input validation with zod schemas, plus tool titles and read-only/destructive annotations.
- Server instructions sent to the client at connection, with workflow tips for the model.
AGENTS.mdfor coding agents working on the repository.playmcpbin entry, a test suite (npm test) and GitHub Actions CI.- Environment variables:
PLAYMCP_HEADLESS,PLAYMCP_TIMEOUT,PLAYMCP_DEBUG.
Install
git clone --branch v3.0.0 https://github.com/jomon003/PlayMCP.git
cd PlayMCP && npm install && npm run build && npx playwright install chromiumThen point your MCP client at node /absolute/path/to/PlayMCP/dist/index.js. See the README for client configs.