@civic/playwright-tokensaver-proxy
v0.2.0
Published
Single stdio MCP proxy for Playwright with token-saving run_code_cheap output compression
Readme
@civic/playwright-tokensaver-proxy
A single stdio MCP server that proxies to Playwright MCP and adds a token-saving run_code_cheap tool.
What it does
- Runs as one stdio MCP server (easy to drop into MCP client config)
- Launches upstream Playwright MCP via stdio:
- default command:
npx -y @playwright/mcp@latest
- default command:
- Clones
browser_run_codeintorun_code_cheap - Keeps all Playwright tools exposed
- Adds guidance to
browser_*tools to preferrun_code_cheapwhen full output is not needed - Rewrites
run_code_cheapcalls through a harness and returns compact results:successfailure
Behavioral contract for run_code_cheap
Your provided code should return:
{ "success": true }Anything else is treated as failure:
- throw
{ "success": false }- invalid return shape
Usage
Claude Code
claude mcp add playwrightsave -- npx -y @civic/playwright-tokensaver-proxyMCP client config (JSON)
{
"mcpServers": {
"playwrightsave": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@civic/playwright-tokensaver-proxy"],
"env": {}
}
}
}Environment variables
PLAYWRIGHT_COMMAND: defaultnpxPLAYWRIGHT_ARGS: comma-separated args, e.g.-y,@playwright/mcp@latest,--headless,--isolatedPLAYWRIGHT_ARGS_JSON: JSON array alternative toPLAYWRIGHT_ARGS(takes precedence)PLAYWRIGHT_HEADLESS: set totrue/1/yesto append--headlesswhen using default argsPLAYWRIGHT_ISOLATED: set totrue/1/yesto append--isolatedwhen using default argsPLAYWRIGHT_CWD: optional working directory for the upstream Playwright MCP process
