cursor-browser-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cursor-browser-mcpNavigate to http://localhost:3000 and take a screenshot"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
cursor-browser-cli
Drive Cursor IDE’s built-in Browser Tab from any CLI agent or shell — Grok Build, Claude Code, Codex, OpenCode, or plain terminal — without leaving Cursor and without spinning up a separate Chrome/Playwright stack.
Stay in a long chat in Cursor’s integrated terminal. Navigate, take accessibility snapshots with refs, click/type/fill by ref, wait for page state, lock the tab, screenshot, and inspect console/network/DOM — all on the same Browser Tab you already see in the IDE.
Grok Build · Claude Code · Codex · OpenCode · shell
│
│ CLI (cursor-browser)
│ or MCP stdio (mcp/server.mjs)
▼
localhost HTTP 127.0.0.1:<port>
│
▼
Cursor extension (workspace host)
│ cursor.browserView.*
▼
Cursor Browser Tab (this project window)Why this exists
The problem
Cursor ships Browser Automation for its own Cursor Agent (chat/composer with built-in browser tools). That is great when you stay inside Cursor Agent.
Many people do not stay there. A common workflow is:
Open a project in Cursor
Run Grok Build, Claude Code, Codex, or another CLI agent in the integrated terminal
Still want to use the in-IDE Browser Tab for UI checks, local apps, auth flows, visual verification, etc.
Those CLI agents cannot call Cursor Agent’s built-in browser tools. Without something else, you end up:
Opening extra Chrome windows and tabs
Re-explaining context across tools
Running a separate Playwright/CDP stack just to “see” the app
Or bouncing back into Cursor Agent only for browser steps
That breaks the flow: you wanted one IDE window, one Browser Tab, and multiple agents that can share it.
The solution
cursor-browser-cli is a small local stack that lets any agent (or script) control Cursor’s Browser Tab the same way Cursor Agent does — via:
Surface | Best for |
| Fast, scriptable loops; agents that shell out; one-off commands |
MCP server ( | Claude Code, Codex, Grok, and any stdio MCP client with native tool calling |
Agent skill ( | Teaches agents the snapshot → ref → wait loop and multi-window routing |
You keep working in the CLI agent. The Browser Tab stays inside Cursor. No second browser product required for day-to-day agent work.
What this is not
Need | Use instead |
Cursor’s own Agent chat/composer | Built-in browser tools (no extra install) |
Real Chrome user profile / extensions | Chrome CDP MCP, browser extensions, etc. |
Headless CI / pure automation outside Cursor | Playwright, Puppeteer, or a headless browser MCP |
Native macOS UI outside the Browser Tab | Other OS automation tools |
This project targets one job: multi-agent access to Cursor’s Browser Tab from CLI/MCP while you work inside Cursor.
Related MCP server: @nimbus21.ai/chrome-devtools-mcp
Features
Multi-agent by design
Same Browser Tab for Grok Build, Claude Code, Codex, OpenCode, shell scripts, and humans
CLI and MCP share the same extension HTTP API
Workspace routing so multiple Cursor windows do not step on each other
Optional skill files for Grok / Claude / agents that load
SKILL.md
Agent-grade interaction (ref model)
Accessibility snapshot with refs (
e1,e5, …) — YAML-style tree agents can read and act onClick / type / fill / hover by ref (CSS selector fallback where supported)
waitfor URL substring, visible text, ref, or CSS selector (reduces agent races)Lock / unlock the tab during automation so accidental human input does not fight the agent
Resize viewport
open/navreturn a snapshot by default so the next step has fresh refs
Fast, CLI-first
Single binary-style script on your
PATH:cursor-browserLow overhead: Node built-ins only, loopback HTTP, no runtime npm deps
Multi-window:
--workspace <folder>or matchcwdSingle-tab policy: reuse one tab;
closeextras for predictable automation
Under the hood (debug like DevTools)
Screenshot (PNG path; MCP can return image content when available)
inspect — meta, counts, headings, links, inputs, body text
console / network via Cursor
getConsoleLogs/getNetworkRequestseval — run page JavaScript
Local and contained
Listens on 127.0.0.1 only
Per-window port (default base 17373, auto-increments if busy)
State under
~/.cursor-browser-cli/Status bar shows
project :portso you know which window is listening
Requirements
Cursor IDE with Browser Tab /
cursor.browserView.*APIs availableNode.js ≥ 18 (CLI + MCP; no production npm dependencies)
macOS / Linux / Windows (where Cursor runs)
Install (recommended: npm)
npm install -g cursor-browser-cliThat installs:
Piece | What you get |
CLI |
|
MCP |
|
Extension | Copied into |
Skills | Agent skill templates when those skill roots exist |
If the extension step was skipped (e.g. npm i --ignore-scripts), run:
cursor-browser setupThen reload each Cursor window you use:
Cmd+Shift+P (or Ctrl+Shift+P) → Developer: Reload Window
Confirm the status bar shows something like your-project :17375, then:
cursor-browser windows
cursor-browser --workspace <project-folder> open https://example.com
cursor-browser --workspace <project-folder> snapshotSkip automatic setup
CURSOR_BROWSER_SKIP_SETUP=1 npm install -g cursor-browser-cli
cursor-browser setup # when readyFrom source (optional)
git clone https://github.com/bcharleson/cursor-browser-cli.git
cd cursor-browser-cli
npm install # runs setup
# or: ./scripts/install.shExtension commands (inside Cursor)
Command palette | Purpose |
Cursor Browser CLI: Show Status | Health + workspace/port |
Cursor Browser CLI: Restart Server | Restart the localhost HTTP server |
Settings
Setting | Default | Meaning |
|
| Preferred port (falls through if busy) |
|
| Start the HTTP server on activation |
Quick start (agent loop)
This is the loop CLI agents should follow:
export WS=my-app # folder name of the Cursor workspace
# 1) One clean tab + navigate → snapshot with [ref=e…] printed
cursor-browser --workspace $WS close
cursor-browser --workspace $WS open http://localhost:3000
# 2) Interact by ref from the snapshot
cursor-browser --workspace $WS click e5
cursor-browser --workspace $WS fill e3 "hello"
cursor-browser --workspace $WS press Enter
# 3) Wait for navigation / UI (avoid races)
cursor-browser --workspace $WS wait --url /results --timeout 15000
cursor-browser --workspace $WS wait --text "Success"
# 4) Visual / debug
cursor-browser --workspace $WS screenshot /tmp/out.png
cursor-browser --workspace $WS inspect
cursor-browser --workspace $WS consoleRules of thumb
Take a fresh
snapshotafter navigation or large DOM changes before using refs.Prefer ref (
e12) over CSS when the snapshot provides one.Prefer
open/nav(they return snapshots) over bare navigate without a follow-up snap.Use
waitafter clicks that change URL or content.Use
closeif extra tabs pile up; keep one tab for reliability.With multiple Cursor windows, always pass
--workspace.
CLI reference
cursor-browser [--workspace NAME|PATH] [--port N] <command> [args]Global flags
Flag | Alias | Description |
|
| Target Cursor window by workspace folder name or absolute path |
|
| Force a specific bridge port (skips discovery) |
|
| Show usage |
Environment variables
Variable | Purpose |
| Default workspace when |
| Default port when |
Legacy env names from earlier package renames may still be read by clients for compatibility.
Routing commands
Command | Description |
| List Cursor windows with a running server |
| Resolved target + health |
| Low-level reachability check |
Tabs and navigation
Command | Description |
| Single-tab open/reuse + navigate + snapshot |
| Navigate active tab + snapshot |
| List Browser Tab view IDs |
| Close extras / specific tab (single-tab hygiene) |
| Select a tab by view ID |
| Lock tab from human input during automation |
| History and reload |
| Current URL or document title |
Interaction (prefer refs from snapshot)
Command | Description |
| Accessibility tree with refs ( |
| Click element |
| Type (append) into element |
| Clear and fill element |
| Hover by ref |
| Key press ( |
Wait, viewport, capture, debug
Command | Description |
| Poll until condition (see flags below) |
| Resize viewport |
| Capture viewport (default under |
| Structured page summary |
| Console messages |
| Network requests |
| Run JavaScript in the page |
wait flags
Flag | Meaning |
| URL contains substring |
| Page/snapshot text contains string |
| Ref exists / is available |
| CSS selector matches (also positional) |
| Max wait (default 30000) |
Examples:
cursor-browser --workspace my-app wait --url /dashboard --timeout 15000
cursor-browser --workspace my-app wait --text "Welcome"
cursor-browser --workspace my-app wait --ref e12
cursor-browser --workspace my-app wait --selector "button.save"Multi-window routing order
When you have several Cursor projects open, the CLI picks a target in this order:
--port/CURSOR_BROWSER_CLI_PORT--workspace/CURSOR_BROWSER_WORKSPACEMatch current
cwdto a registered workspace folderProcess discovery fallback (
lsofon loopback ports in the 173xx range)Single open instance
cursor-browser windows
cursor-browser --workspace af-exec-travel whoami
cursor-browser --workspace af-exec-travel open http://localhost:3000MCP server
Stdio MCP server for agents that prefer tools over shelling out.
After npm install -g cursor-browser-cli, the bin cursor-browser-mcp is on your PATH.
Register
# Grok Build
grok mcp add cursor-browser -- cursor-browser-mcp
# Claude Code
claude mcp add cursor-browser -- cursor-browser-mcpAny stdio MCP client:
{
"mcpServers": {
"cursor-browser": {
"command": "cursor-browser-mcp"
}
}
}Fallback (from a clone or if the bin is not on PATH):
{
"mcpServers": {
"cursor-browser": {
"command": "node",
"args": ["/absolute/path/to/cursor-browser-cli/mcp/server.mjs"]
}
}
}Optional env on the server process:
CURSOR_BROWSER_WORKSPACECURSOR_BROWSER_CLI_PORT
Or pass workspace on each tool call.
Tools
All tools accept optional workspace (project folder name or path) unless noted.
Tool | Purpose |
| List windows with active servers |
| Health + workspace for a window |
| Open/reuse single tab, navigate, return ref snapshot |
| Navigate active tab + snapshot |
| Accessibility snapshot with refs ( |
| Click by |
| Type (append) by |
| Clear + fill by |
| Hover by |
| Press key ( |
| Wait for URL/text/ref/selector ( |
| Tab lock |
| Viewport size ( |
| PNG (+ image content when data URL is available) |
| DOM/meta/links/inputs/body summary |
| Console log dump |
| Network request dump |
| Run |
| List view IDs |
| Current URL / title |
| History / reload |
Screenshot note: When the page returns a data URL, the MCP layer can attach an image content block for vision-capable models, plus a text payload with the saved path.
Skills
npm install -g / cursor-browser setup copies skill/SKILL.md to:
~/.grok/skills/cursor-browser/SKILL.md~/.claude/skills/cursor-browser/SKILL.md(if that tree exists)~/.agents/skills/cursor-browser/SKILL.md(if that tree exists)
The skill teaches agents:
Always route the correct Cursor window (
windows/--workspace)Preferred snapshot → ref click/fill → wait loop
When to screenshot, inspect, console, network
Failure modes (stale refs, wrong project, connection refused)
Architecture
┌─ Cursor window: your-project ──────────────────────────┐
│ Extension host HTTP 127.0.0.1:1737x │
│ │ │
│ │ cursor.browserView.* │
│ ▼ │
│ Browser Tab │
│ · refs via data-cursor-ref after snapshot │
│ · DOM click/type/fill (not raw CDP Input) │
└────────────────────────────────────────────────────────┘
▲
│ loopback only
CLI · MCP · scripts
(Grok / Claude Code / Codex / shell)Piece | Role |
| VS Code/Cursor extension: HTTP API, workspace registry, status bar, |
| Multi-window client; resolves port; pretty-prints actions |
| Stdio MCP → same HTTP actions |
| Agent instructions for the preferred loop |
| CLI symlink, extension copy, skills, MCP hints |
On-disk state (~/.cursor-browser-cli/):
File | Purpose |
| Registered windows (workspace paths, ports, PIDs) |
| Last/default port hint |
| Extension host log |
Ports start at 17373 and try up to 32 candidates if the preferred port is taken (one port per Cursor window).
How agents should use it
Typical product/UI session
browser_windowsorcursor-browser windowsopen/browser_openonhttp://localhost:…or staging URLRead refs from the snapshot
click/fill/presswaitfor URL or textNew
snapshotafter major UI changescreenshotorinspectwhen stuck
Multi-project day
Always pin the project:
cursor-browser --workspace project-a open http://localhost:3000
cursor-browser --workspace project-b open http://localhost:4000Or set CURSOR_BROWSER_WORKSPACE in that agent’s shell profile / MCP env.
Switching agents mid-project
The Browser Tab is owned by the Cursor window, not by a single agent process. You can:
Use Cursor Agent for some steps (built-in tools)
Switch to Claude Code / Grok / Codex in the terminal
Continue with
cursor-browseror MCP on the same tab
That continuity is the whole point of this tool.
Security
The HTTP server binds to loopback only (
127.0.0.1).Anyone who can reach that port on your machine can drive the Browser Tab (navigate, click, run page JS, read console/network).
Treat it like a local debugger: do not tunnel or expose the port; do not run on untrusted multi-user machines without isolation.
eval/browser_evaluateexecute arbitrary page JavaScript — only run code you trust.
Troubleshooting
Symptom | Fix |
Connection refused |
|
Wrong project / wrong app |
|
Stale ref / element not found | New |
Race / empty or intermediate page |
|
Extra tabs / flaky targeting |
|
MCP tools missing | Re-register MCP with absolute path to |
CLI not found | Ensure |
CDP Input blocked | Expected — use |
Logs: ~/.cursor-browser-cli/bridge.log
Repo layout
cursor-browser-cli/
├── README.md
├── LICENSE # MIT
├── package.json # npm package (bins + postinstall setup)
├── cli/
│ └── cursor-browser # CLI entry (Node)
├── extension/
│ ├── package.json
│ ├── extension.js # HTTP API + cursor.browserView.*
│ └── snapshot.js # Accessibility snapshot + refs
├── mcp/
│ └── server.mjs # MCP stdio server → bin: cursor-browser-mcp
├── scripts/
│ ├── setup.js # extension + skills install
│ └── install.sh # thin wrapper → setup.js
└── skill/
└── SKILL.md # Agent skill templateNo runtime npm dependencies — Node built-ins only (http, fs, path, os, etc.).
Development notes
Extension activation:
onStartupFinishedPreferred port configurable via
cursorBrowserCli.portClients still understand legacy state dirs / names from earlier renames for smoother upgrades
After changing extension code:
cursor-browser setup(ornpm run setup) and Reload WindowPublish:
npm publish(requires npm login)
License
MIT © Brandon Charleson
Contributing / sharing
This repo is intended to be shared as open source so CLI agents in Cursor can share one Browser Tab.
If you publish or fork:
Keep the why clear: multi-agent access to Cursor’s Browser Tab
Document both CLI and MCP equally
Stress workspace routing and the snapshot → ref → wait loop
Issues and PRs that improve multi-window routing, snapshot quality, or agent docs are especially welcome.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceEnables real browser automation as tools in Cursor, Claude Desktop, Windsurf, and any MCP-compatible client, allowing AI agents to interact with web pages through natural language.Last updated10MIT
- Alicense-qualityBmaintenanceLets AI coding agents control and inspect a live Chrome browser via MCP, providing Chrome DevTools capabilities for automation, debugging, and performance analysis.Last updated5Apache 2.0
- AlicenseAqualityDmaintenanceProvides AI coding agents real-time browser access to console logs, network requests, DOM elements, and screenshots via MCP, enabling tight edit-reload-verify feedback loops.Last updated1592MIT
- Flicense-qualityCmaintenanceEnables browser automation through the MCP protocol, allowing AI agents to control a real browser using accessibility snapshots and natural language commands.Last updated
Related MCP Connectors
Live browser debugging for AI assistants — DOM, console, network via MCP.
Provides cloud browser automation capabilities using Stagehand and Browserbase, enabling LLMs to i…
A paid remote MCP for AI agent browser DevTools MCP, built to return verdicts, receipts, usage logs,
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/bcharleson/cursor-browser-cli'
If you have feedback or need assistance with the MCP directory API, please join our Discord server