
mobidev-org/treegress-browser-mcp
Developer toolsTreegress Browser MCP is a Treegress-maintained fork of Playwright MCP. It exposes browser automation tools for MCP clients while delegating the snapshot and locator core to the Treegress Playwright...
Overview
Treegress Browser MCP is a Treegress-maintained fork of Playwright MCP. It exposes browser automation tools for MCP clients while delegating the snapshot and locator core to the Treegress Playwright...
README
Treegress Browser MCP
Treegress Browser MCP is a Treegress-maintained fork of Playwright MCP. It exposes browser automation tools for MCP clients while delegating the snapshot and locator core to the Treegress Playwright fork.
This repository is the source for the published package @treegress.com/treegress-browser-mcp.
Why Treegress Extends Playwright MCP
AI agents need access to the actual page structure they are testing.
Standard Playwright MCP flows expose an ARIA snapshot derived from the accessibility tree. In real test flows, not just simple demos, this can leave part of the UI outside the model’s view when interactable elements are poorly represented in the accessibility layer. Even when an element is returned by an ARIA snapshot, the information about that element can be too abstract for an agent to properly understand how to interact with the website and implement the scenario.
Treegress extends this flow by:
- serializing the full DOM tree
- extracting the full set of interactable elements
- enriching the information about the elements
- assigning a
refIdto each element so downstream tools such asbrowser_click,browser_fill_form, and similar operations can target it reliably.
This gives the agent a structurally complete representation of the page instead of a partial accessibility-based abstraction. In practice, that improves element coverage and enables broader, more reliable test scenarios.
If you want to better understand the problem and technical details, you can check Riding Blind: The Hidden Blind Spot in Playwright MCP.
Here you can find a video comparing Playwright MCP and Treegress MCP on a complex real-world page: Playwright MCP vs Treegress MCP.
In the video, you can see the differences in the number of tests produced by each MCP on the same page, differences in test exploration costs, and how Treegress MCP can find and interact with elements that are missing from the Playwright MCP snapshot.
If you want to see what Treegress is building in the area of automated testing, visit treegress.com.
What This Fork Adds
- MCP browser tools backed by Treegress custom DOM snapshots
- A thin adapter layer over the Treegress Playwright fork instead of a second standalone DOM engine
- Integration path designed for LLM agents that work from structured snapshots instead of screenshots
Installation
Most users only need the MCP package.
Requirements
- Node.js 18 or newer
- Cursor, VS Code, Windsurf, Claude Desktop, Goose, or any other MCP client with local
stdioMCP support
Getting started
First, install the Treegress MCP server with your client.
Standard config works in most tools:
{
"servers": {
"treegress-browser": {
"type": "stdio",
"command": "npx",
"args": [
"--yes",
"[email protected]/treegress-browser-mcp@latest",
"treegress-browser-mcp",
"--snapshot-engine",
"dom"
]
}
}
}
If your client only accepts a single shell command, use this equivalent launcher:
bash -lc 'npm_config_cache=/tmp/treegress-mcp-cache npx --yes [email protected]/treegress-browser-mcp@latest treegress-browser-mcp --snapshot-engine dom'
Notes:
- Requires
Node.js 18+ - Global
npm i -gis not required @treegress.com/treegress-browser-coreis installed automatically as a dependency--snapshot-engine domenables the Treegress custom DOM path
CLI check
npx --yes [email protected]/treegress-browser-mcp@latest treegress-browser-mcp --help
The installed binary name remains:
npx treegress-browser-mcp --help
CLI Options (Generated)
> npx @treegress.com/treegress-browser-mcp@latest --help
--allowed-hosts comma-separated list of hosts this
server is allowed to serve from.
Defaults to the host the server is bound
to. Pass '*' to disable the host check.
--allowed-origins semicolon-separated list of TRUSTED
origins to allow the browser to request.
Default is to allow all.
Important: *does not* serve as a
security boundary and *does not* affect
redirects.
--allow-unrestricted-file-access allow access to files outside of the
workspace roots. Also allows
unrestricted access to file:// URLs. By
default access to file system is
restricted to workspace root directories
(or cwd if no roots are configured)
only, and navigation to file:// URLs is
blocked.
--blocked-origins semicolon-separated list of origins to
block the browser from requesting.
Blocklist is evaluated before allowlist.
If used without the allowlist, requests
not matching the blocklist are still
allowed.
Important: *does not* serve as a
security boundary and *does not* affect
redirects.
--block-service-workers block service workers
--browser browser or chrome channel to use,
possible values: chrome, firefox,
webkit, msedge.
--caps comma-separated list of additional
capabilities to enable, possible values:
vision, pdf, devtools.
--cdp-endpoint CDP endpoint to connect to.
--cdp-header CDP headers to send with the connect
request, multiple can be specified.
--cdp-timeout timeout in milliseconds for connecting
to CDP endpoint, defaults to 30000ms
--codegen specify the language to use for code
generation, possible values:
"typescript", "none". Default is
"typescript".
--config path to the configuration file.
--console-level level of console messages to return:
"error", "warning", "info", "debug".
Each level includes the messages of more
severe levels.
--device device to emulate, for example: "iPhone
15"
--executable-path path to the browser executable.
--extension Connect to a running browser instance
(Edge/Chrome only). Requires the
"Playwright MCP Bridge" browser
extension to be installed.
--grant-permissions List of permissions to grant to the
browser context, for example
"geolocation", "clipboard-read",
"clipboard-write".
--headless run browser in headless mode, headed by
default
--host host to bind server to. Default is
localhost. Use 0.0.0.0 to bind to all
interfaces.
--ignore-https-errors ignore https errors
--init-page path to TypeScript file to evaluate on
Playwright page object
--init-script path to JavaScript file to add as an
initialization script. The script will
be evaluated in every page before any of
the page's scripts. Can be specified
multiple times.
--isolated keep the browser profile in memory, do
not save it to the disk.
--image-responses whether to send image responses to the
client. Can be "allow" or "omit",
Defaults to "allow".
--no-sandbox disable the sandbox for all process
types that are normally sandboxed.
--output-dir path to the directory for output files.
--output-mode whether to save snapshots, console
messages, network logs to a file or to
the standard output. Can be "file" or
"stdout". Default is "stdout".
--port port to listen on for SSE transport.
--proxy-bypass comma-separated domains to bypass proxy,
for example
".com,chromium.org,.domain.com"
--proxy-server specify proxy server, for example
"http://myproxy:3128" or
"socks5://myproxy:8080"
--sandbox enable the sandbox for all process types
that are normally not sandboxed.
--save-session Whether to save the Playwright MCP
session into the output directory.
--save-trace Whether to save the Playwright Trace of
the session into the output directory.
--save-video Whether to save the video of the session
into the output directory. For example
"--save-video=800x600"
--secrets path to a file containing secrets in the
dotenv format
--shared-browser-context reuse the same browser context between
all connected HTTP clients.
--snapshot-engine snapshot engine for page snapshots.
"dom" uses the playwright-core
custom-dom backend, "aria" keeps the
legacy accessibility fallback. Default
is "dom".
--dom-serializer path to a domSerializer.js file for the
historical/debug-only local DOM engine.
--snapshot-mode when taking snapshots for responses,
specifies the mode to use. Can be
"incremental", "full", or "none".
Default is incremental.
--dom-fallback-to-aria historical/debug-only local DOM engine:
fallback to aria-ref resolving when
local dom based resolution fails.
--dom-nonstrict historical/debug-only local DOM engine:
disable strict locator enforcement.
--storage-state path to the storage state file for
isolated sessions.
--test-id-attribute specify the attribute to use for test
ids, defaults to "data-testid"
--timeout-action specify action timeout in milliseconds,
defaults to 5000ms
--timeout-navigation specify navigation timeout in
milliseconds, defaults to 60000ms
--user-agent specify user agent string
--user-data-dir path to the user data directory. If not
specified, a temporary directory will be
created.
--viewport-size specify browser viewport size in pixels,
for example "1280x720"
Config Schema (Generated)
{
/**
* The browser to use.
*/
browser?: {
/**
* The type of browser to use.
*/
browserName?: 'chromium' | 'firefox' | 'webkit';
/**
* Keep the browser profile in memory, do not save it to disk.
*/
isolated?: boolean;
/**
* Path to a user data directory for browser profile persistence.
* Temporary directory is created by default.
*/
userDataDir?: string;
/**
* Launch options passed to
* @see https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context
*
* This is useful for settings options like `channel`, `headless`, `executablePath`, etc.
*/
launchOptions?: playwright.LaunchOptions;
/**
* Context options for the browser context.
*
* This is useful for settings options like `viewport`.
*/
contextOptions?: playwright.BrowserContextOptions;
/**
* Chrome DevTools Protocol endpoint to connect to an existing browser instance in case of Chromium family browsers.
*/
cdpEndpoint?: string;
/**
* CDP headers to send with the connect request.
*/
cdpHeaders?: Record;
/**
* Timeout in milliseconds for connecting to CDP endpoint. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
*/
cdpTimeout?: number;
/**
* Remote endpoint to connect to an existing Playwright server.
*/
remoteEndpoint?: string;
/**
* Paths to TypeScript files to add as initialization scripts for Playwright page.
*/
initPage?: string[];
/**
* Paths to JavaScript files to add as initialization scripts.
* The scripts will be evaluated in every page before any of the page's scripts.
*/
initScript?: string[];
},
server?: {
/**
* The port to listen on for SSE or MCP transport.
*/
port?: number;
/**
* The host to bind the server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.
*/
host?: string;
/**
* The hosts this server is allowed to serve from. Defaults to the host server is bound to.
* This is not for CORS, but rather for the DNS rebinding protection.
*/
allowedHosts?: string[];
},
/**
* List of enabled tool capabilities. Possible values:
* - 'core': Core browser automation features.
* - 'pdf': PDF generation and manipulation.
* - 'vision': Coordinate-based interactions.
*/
capabilities?: ToolCapability[];
/**
* Whether to save the Playwright session into the output directory.
*/
saveSession?: boolean;
/**
* Whether to save the Playwright trace of the session into the output directory.
*/
saveTrace?: boolean;
/**
* If specified, saves the Playwright video of the session into the output directory.
*/
saveVideo?: {
width: number;
height: number;
};
/**
* Reuse the same browser context between all connected HTTP clients.
*/
sharedBrowserContext?: boolean;
/**
* Secrets are used to prevent LLM from getting sensitive data while
* automating scenarios such as authentication.
* Prefer the browser.contextOptions.storageState over secrets file as a more secure alternative.
*/
secrets?: Record;
/**
* The directory to save output files.
*/
outputDir?: string;
console?: {
/**
* The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
*/
level?: 'error' | 'warning' | 'info' | 'debug';
},
network?: {
/**
* List of origins to allow the browser to request. Default is to allow all. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
*/
allowedOrigins?: string[];
/**
* List of origins to block the browser to request. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
*/
blockedOrigins?: string[];
};
/**
* Specify the attribute to use for test ids, defaults to "data-testid".
*/
testIdAttribute?: string;
timeouts?: {
/*
* Configures default action timeout: https://playwright.dev/docs/api/class-page#page-set-default-timeout. Defaults to 5000ms.
*/
action?: number;
/*
* Configures default navigation timeout: https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout. Defaults to 60000ms.
*/
navigation?: number;
};
/**
* Whether to send image responses to the client. Can be "allow", "omit", or "auto". Defaults to "auto", which sends images if the client can display them.
*/
imageResponses?: 'allow' | 'omit';
snapshot?: {
/**
* When taking snapshots for responses, specifies the mode to use.
*/
mode?: 'incremental' | 'full' | 'none';
/**
* Snapshot engine used to resolve element references.
* "aria" uses the built-in aria-ref engine.
* "dom" uses the playwright-core custom-dom backend.
*/
engine?: 'aria' | 'dom';
/**
* Path to a DOM serializer module used only by the historical/debug-only
* local DOM engine retained in this fork.
*/
domSerializerPath?: string;
/**
* Historical/debug-only local DOM engine: allow fallback to aria-ref
* resolution.
*/
domFallbackToAria?: boolean;
/**
* Historical/debug-only local DOM engine: disable strict uniqueness check.
*/
domNonstrict?: boolean;
}
/**
* Whether to allow file uploads from anywhere on the file system.
* By default (false), file uploads are restricted to paths within the MCP roots only.
*/
allowUnrestrictedFileAccess?: boolean;
}
Browser Tools (Generated)
How It Fits Together
The Treegress browser stack is split into two published packages:
Source repositories:
- Core runtime repository: github.com/MobiDev-Org/treegress-browser-core
- MCP adapter repository: github.com/MobiDev-Org/treegress-browser-mcp
Role split:
treegress-browser-coreis the source of truth for custom-dom snapshot/runtime behavior (snapshot envelope, formatting helpers, locator-plan compilation, ref-resolution internals).treegress-browser-mcpprovides MCP server wiring, tool contracts and client-facing integration on top of that core runtime.
This repository keeps the Playwright MCP fork structure. The publishable MCP package lives in:
Maintainers
For release, dependency-sync and build instructions, see DEVELOPING.md.
If an MCP release depends on new runtime behavior from Treegress core, run npm run build in the core repository before running npm pack or npm publish here.
Package-specific notes for the published MCP package live in:
Based On Playwright MCP
This repository is a customized fork built on top of Playwright MCP and the broader Playwright ecosystem.
- Upstream MCP repository: github.com/microsoft/playwright-mcp
- Upstream Playwright repository: github.com/microsoft/playwright
- Upstream docs: playwright.dev
- License: Apache-2.0
Treegress-specific behavior should stay explicit and attributable. The intent is to extend upstream Playwright MCP for Treegress browser automation, while preserving clear lineage to the original projects.
Copyright And Licensing
Copyright 2026 MobiDev Corporation. All rights reserved. This project is licensed under the Apache License 2.0.
Install
npx --yes [email protected]/treegress-browser-mcp@latest treegress-browser-mcp --snapshot-engine domConfiguration
{
"mcpServers": {
"treegress-browser": {
"type": "stdio",
"command": "npx",
"args": [
"--yes",
"[email protected]/treegress-browser-mcp@latest",
"treegress-browser-mcp",
"--snapshot-engine",
"dom"
]
}
}
}