browser-pool-mcp
A dynamic browser pool MCP server that enables multiple concurrent, isolated Playwright sessions for Claude Code and other MCP clients. It manages on-demand instances on dynamic ports to resolve session conflicts and includes automatic cleanup of idle browsers.
README
browser-pool-mcp
A dynamic browser pool MCP server that wraps @playwright/mcp to enable multiple concurrent browser sessions for Claude Code and other MCP clients.
Problem Solved
The standard Playwright MCP server only allows one browser instance at a time. If you try to use browser tools from multiple Claude Code sessions simultaneously, you get:
Browser is already in use for C:\Users\...\mcp-chrome-xxx, use --isolated to run multiple instances
browser-pool-mcp solves this by:
- Spawning Playwright MCP instances on-demand on dynamic ports (9000+)
- Automatically detecting port conflicts from other sessions
- Assigning each Claude session to its own isolated browser
- Auto-cleanup of idle instances after 30 minutes
Architecture
Claude Code Session 1 ──stdio──> browser-pool-mcp ──SSE──> Playwright MCP (port 9000)
Claude Code Session 2 ──stdio──> browser-pool-mcp ──SSE──> Playwright MCP (port 9001)
Claude Code Session 3 ──stdio──> browser-pool-mcp ──SSE──> Playwright MCP (port 9002)
Each Claude Code session gets its own browser-pool-mcp process, which spawns and connects to an isolated Playwright instance on an available port.
Installation
Prerequisites
- Node.js 18+
- npm
Setup
- Clone or download this repository:
git clone https://github.com/everdijsje/browser-pool-mcp.git
cd browser-pool-mcp
npm install
- Add to your Claude Code MCP configuration (
~/.claude.json):
{
"mcpServers": {
"browser": {
"type": "stdio",
"command": "node",
"args": ["/path/to/browser-pool-mcp/index.js"]
}
}
}
- Restart Claude Code
Usage
Use browser tools as normal in Claude Code:
Navigate to https://example.com
Take a screenshot
Click on the "Learn more" link
Additional Tools
pool_status- Check the status of running browser instancespool_test- Debug tool to test async responses
Configuration
Environment variables:
| Variable | Default | Description |
|---|---|---|
BROWSER_POOL_DEBUG |
0 |
Set to 1 to enable debug logging to debug.log |
Constants in index.js:
| Constant | Default | Description |
|---|---|---|
BASE_PORT |
9000 |
Starting port for Playwright instances |
MAX_INSTANCES |
10 |
Maximum concurrent browser instances |
INSTANCE_TIMEOUT_MS |
1800000 |
Idle timeout before killing instance (30 min) |
How It Works
-
When you call any browser tool (e.g.,
browser_navigate), browser-pool-mcp:- Checks if this session already has an assigned Playwright instance
- If not, finds an available port (checking for conflicts)
- Spawns
npx @playwright/mcp@latest --port PORT --isolated - Connects via MCP SDK client over SSE
- Proxies the tool call to Playwright
-
Each session is assigned one browser instance for its lifetime
-
Instances are cleaned up after 30 minutes of inactivity
-
When max instances are reached, the oldest idle instance is recycled
Supported Browser Tools
All standard Playwright MCP tools are proxied:
browser_navigate- Navigate to URLbrowser_snapshot- Get page accessibility snapshotbrowser_click- Click elementbrowser_type- Type text into elementbrowser_screenshot- Take screenshotbrowser_tabs- Manage browser tabsbrowser_press_key- Press keyboard keybrowser_hover- Hover over elementbrowser_select_option- Select dropdown optionbrowser_evaluate- Run JavaScriptbrowser_wait_for- Wait for conditionbrowser_resize- Resize browser windowbrowser_handle_dialog- Handle alerts/confirmsbrowser_file_upload- Upload filesbrowser_console_messages- Get console logsbrowser_network_requests- Get network activitybrowser_navigate_back- Go backbrowser_close- Close browser
Dependencies
@modelcontextprotocol/sdk- MCP SDK for server and client communicationzod- Schema validation@playwright/mcp- Spawned as child processes (installed via npx)
License
MIT
Author
Built by Claude Code for Everdijs
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.