Yes—Ollama can control a browser through MCP. Ollama runs the local language model, an MCP client coordinates tool calls, and Playwright MCP performs browser actions. The reliable setup is an iterative loop: send Ollama the user request and MCP tool schemas, execute every tool call through Playwright, append each result to the conversation, and call Ollama again until it returns no more tool calls.
This guide sets up a local Playwright MCP server, shows headed, headless and HTTP modes, explains authentication and profile safety, and gives a practical tool-call loop you can adapt to your MCP client.
What the integration actually contains
There are three separate components:
- Ollama: the local model runtime. Its chat API is http://localhost:11434/api/chat and accepts a model, messages and optional tools.
- Playwright MCP: the browser server. It exposes navigation, clicking, filling, screenshots and other actions through MCP. Results are structured accessibility snapshots, allowing semantic element references instead of pixel coordinates.
- An MCP-capable client: the host that starts or connects to the server, discovers its tools and runs the tool calls requested by Ollama.
MCP is the interface; Ollama does not launch Playwright by itself. Your client must bridge Ollama’s function-calling format to MCP requests.
Prerequisites
- Node.js 20 or newer.
- Ollama running locally with a model that supports tool calling. The API can accept a
toolsarray, but a model without tool-calling capability will not emit usefultool_calls. - An MCP-capable client such as a desktop, editor or agent application that can register MCP servers.
- A Chromium-family browser or another engine supported by your Playwright installation.
Confirm Ollama is reachable before debugging MCP:
curl http://localhost:11434/api/tags
If this request cannot connect, start Ollama and resolve that problem first.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
- Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
Install and register Playwright MCP
Standard local launch
Playwright’s documented launch command uses npx:
npx @playwright/mcp@latest
Add the server to your MCP client’s configuration. The standard entry is:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}
Restart or reload the client, then verify that it lists Playwright tools. Ask for a low-risk action such as opening a public page and returning its title. Playwright MCP’s accessibility snapshot lets the model identify links, buttons and fields by their roles and names.
Headless mode for CI
The normal launch is headed, so a visible browser is useful while developing. For a server or continuous-integration job, add --headless:
npx @playwright/mcp@latest --headless
Selecting a browser engine
Choose an engine with --browser. Supported choices documented for the server include chrome, firefox, webkit and msedge:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
npx @playwright/mcp@latest --browser firefox --headless
Standalone HTTP server
Use HTTP when the MCP client and browser server are separate processes, containers or machines:
npx @playwright/mcp@latest --port 8931
Configure the client to connect to http://localhost:8931/mcp. In a containerized deployment, replace localhost with a host name reachable from the client and expose the selected port deliberately; a process listening only inside one container cannot be reached from another without network configuration.
Rank #2
- Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM)
- Includes Pre-Loaded 32GB EVO+ Micro SD Card (Class 10), USB MicroSD Card Reader
- CanaKit Premium High-Gloss Raspberry Pi 4 Case with Integrated Fan Mount, CanaKit Low Noise Bearing System Fan
- CanaKit 3.5A USB-C Raspberry Pi 4 Power Supply (US Plug) with Noise Filter, Set of Heat Sinks, Display Cable - 6 foot (Supports up to 4K60p)
- CanaKit USB-C PiSwitch (On/Off Power Switch for Raspberry Pi 4)
Connecting to an existing browser
Playwright MCP can connect through a Chrome DevTools Protocol (CDP) endpoint, a Playwright endpoint or the Playwright browser extension. These modes are appropriate when the browser is already logged in or managed elsewhere. They also increase the importance of access control: every tool call can act with that browser’s permissions.
Configure browser state and authentication
Playwright MCP uses a persistent profile by default. Cookies and local storage can therefore survive between runs, which is convenient for a personal workflow but risky on shared machines and in CI.
Fresh, isolated context
Start with --isolated when each run should have a clean context:
npx @playwright/mcp@latest --isolated --headless
Controlled saved state
Use --storage-state to load a specific, controlled authentication state rather than an implicit profile. Keep that file secret and limit its lifetime. A profile can be locked if another browser process is using it; close the competing process or choose an isolated context.
Choosing the right mode
| Need | Recommended mode |
|---|---|
| Interactive development | Local headed launch with the default profile |
| Repeatable tests or CI | --headless --isolated, or an explicitly supplied storage state |
| Reuse an already logged-in browser | CDP, Playwright endpoint or extension connection |
| Separate client and server | Standalone HTTP on a deliberately reachable port |
How Ollama’s MCP tool loop works
Do not expect one prompt to complete a multi-step browser task. The client must repeat these stages:
- Send the user message, the selected Ollama model and the MCP-discovered tool schemas to
/api/chat. - When Ollama returns an assistant message containing
tool_calls, append that complete assistant message to the conversation. - For each requested function, call the corresponding Playwright MCP tool through the client.
- Append each result as a
toolmessage containing the tool name and returned content. - Call
/api/chatagain. Continue until the assistant response contains no tool calls, then display its text.
The message order matters. Omitting the assistant tool-call message or returning results under the wrong tool name leaves the model without the context needed to continue.
Recommended Free Tools
Rank #3
- Not including the Raspberry Pi 5 (8GB), the Crowpi advanced version comes with the Raspberry Pi 5
- ELECROW Black Case for the Raspberry Pi 5, CrowPi is equipped with a 9-inch HD touchscreen along with a camera; All the regular components used in DIY electronics are packed into the CrowPi development board, such as LCD, LED matrix, buzzer, light sensor, PIR sensor, ultrasonic sensor, IR sensor, etc
- Raspberry Pi Sensors: The Crowpi raspberry pi 5 programming kit is jam-packed with lots of buttons such as 19 different sensors in a tidy easy to use package; You don't have to wait and wire things
- Build Quality: Solid ABS shell and well made components in one place make it strong and convenient to travel
- Programming Lessons: This raspberry pi 5 learning kit ships with step by step instructions and provides 21 lessons to take you through identifying components reading code and running it in the terminal
Conceptual message flow
user request
-> Ollama /api/chat + MCP tool schemas
-> assistant tool_calls
-> MCP browser action (navigate, click, fill, screenshot, ...)
-> tool result appended to messages
-> Ollama /api/chat
-> final answer or another tool call
Ollama request shape
The following request demonstrates the API shape. Your client should populate tools with the exact schemas returned by its MCP discovery step; tool names and argument schemas vary by server version and client.
curl http://localhost:11434/api/chat
-H 'Content-Type: application/json'
-d '{
"model": "YOUR_TOOL_CAPABLE_MODEL",
"messages": [
{"role": "user", "content": "Open https://example.com and report the page title."}
],
"tools": [/* MCP tool schemas supplied by your client */],
"stream": false
}'
In a real client, replace the comment with the discovered JSON schemas. Do not guess a browser function name: use the server’s advertised list.
Parallel and streaming calls
Ollama documents single-tool, parallel-tool, multi-turn and streaming patterns. If several independent calls are returned, your client may execute them in parallel when the MCP server and workflow permit it. With streaming enabled, accumulate partial thinking, content and tool_calls fields; only append the completed assistant message and execute tools after the stream has supplied the full call data.
A practical setup sequence
- Install Node.js 20+ and install or start Ollama.
- Choose a model whose documentation confirms tool-calling support, then download it through your normal Ollama workflow.
- Register the local Playwright entry in your MCP client.
- Reload the client and inspect its available Playwright tools.
- Start with a public, non-destructive URL in headed mode.
- Ask Ollama to navigate, inspect the accessibility snapshot, and perform one action at a time.
- Move to
--headless --isolatedfor CI, or to HTTP mode for a separately hosted server. - Only then add authentication state, custom browser connections or write actions.
Troubleshooting
No tool calls are emitted
Cause: the selected model may not support tool calling, or the client did not send valid schemas. Fix: verify model capability, log the exact tools array sent to Ollama, and test with a simple one-tool request.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteThe MCP server will not start
Cause: an old Node.js version, an unavailable npx, or a failed package download. Fix: confirm Node.js is 20 or newer, run npx @playwright/mcp@latest directly in a terminal, and read the startup error before changing client settings.
The client cannot connect in HTTP mode
Cause: wrong URL, a port not exposed from a container, or a server bound to an unreachable interface. Fix: use the exact http://HOST:8931/mcp endpoint, confirm the process is listening, and configure firewall or container networking intentionally.
Rank #4
- Fully assembled for plug-and-play operation
- Includes Raspberry Pi 5 with 8GB RAM
- 256 GB PCIe Pi NVMe SSD (Pre-loaded with Pi 64-Bit OS)
- M.2 HAT+
- CanaKit Turbine Black Case for the Pi 5
The browser opens but actions target the wrong element
Cause: the page changed, a modal obscures the target, or the model is using stale references. Fix: request a fresh accessibility snapshot, refer to the element’s current role and accessible name, and handle consent or login dialogs before the intended action.
Authentication disappears
Cause: --isolated creates a fresh context, or the persistent profile is not the one expected. Fix: use a deliberately managed --storage-state file or the intended existing-browser connection. Never copy a personal profile into an untrusted environment.
Profile locked
Cause: another browser process owns the persistent profile. Fix: close it, select a different profile or use --isolated.
The model loops or repeats a tool
Cause: the tool result was not appended with role tool, the tool name did not match, or the result lacked useful content. Fix: preserve the assistant call exactly, return each result under its requested name, and include the MCP server’s structured output.
Reliability, safety and operating costs
Browser automation is stateful. Pages can redirect, require authentication, change their accessibility tree or block automation. Keep actions small, request a new snapshot after navigation, and make destructive operations require an explicit confirmation step.
Persistent cookies and local storage are credentials. Use isolated contexts for shared workstations and CI, restrict storage-state files, and avoid sending secrets in prompts or logs. For remote HTTP deployments, protect network access and treat the endpoint as a control surface, not a public service.
Best Value
- 【What you Get】You will get 1*Pi 5 8GB Single Board,1*RasTech Case,1*Active Cooler,1*Screwdriver,1*Installation instructions,12-month free warranty, lifetime service, 24-hour prompt and friendly response.
- 【More Connectors】There are two USB 3.0 ports(5Gbps simultaneously) and two USB 2.0 ports, which triple total bandwidth ,support any combination of up to two cameras or displays. Peak SD card performance is doubled through support for the SDR104 high-speed mode. It provides a smooth desktop experience for you. Offer Gigabit Ethernet and a PCIe interface, along with dual-band Wi-Fi and Bluetooth 5.0/BLE wireless capability. The RasTech Pi 5 Kit use the new 27W 5.1V 5A USB-C power connector.
- 【 Support Dual 4Kp60 Display 】Each of the two microHDMI sockets can control a 4K display at 60 Hertz, now support HDR, offering super HD video for media streaming projects. RPi 5 is the first RPi model that comes with a PCI Express port (PCIe 2.0 x1 with 500 MB/s) to attach SSDs (requires separate M.2 HAT).
- 【 Excellent Chips And Applications】Pi 5 is a full-size Pi computer using silicon built in-house at Pi. The RP1 “southbridge” provides the bulk of the I/O capabilities for Pi 5. Pi 5 is more friendly and convenient in the development of Internet of Things, Web development, machine identification, automatic control and other electronic equipment applications and network.
- 【 Faster CPU, Better GPU 】 Pi 5 features a Broadcom BCM2712 64-bit quad-core Arm Cortex-A76 processor running at 2.4GHz, it delivers a 2–3× increase in CPU performance relative to RaspberryPi 4. The 800MHz VideoCore VII GPU is compatible to OpenGL ES 3.1 and Vulkan 1.2, substantial uplift in graphics performance. Pi 5 Offers lightning-fast CPU speed, a PCI Express interface, a Real Time Clock (RTC) and a power button and runs significantly cooler than Pi 4.
There are no topic-specific published performance or market statistics in the official setup material. Node.js 20+, port 8931 and the Ollama localhost endpoint are configuration values, not speed or reliability guarantees. Actual latency depends on model generation, page load time and the browser action.
Or skip the browser setup
If your goal is dependable screenshots rather than interactive browser control, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status.
One request returns PNG, JPEG, WebP or PDF. The API supports full-page screenshots with lazy images, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF paper settings, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting and an OpenAPI specification. Its parameter names are compatible with those used by many other screenshot APIs.
cURL (see the ScreenshotNeo API documentation):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo also exposes MCP tools named take_screenshot, get_page_info and capture_pdf, so an AI agent can request captures without you maintaining a Playwright browser process. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Frequently Asked Questions
Can I use any Ollama model with Playwright MCP?
No. The model must support tool calling; otherwise it may answer in text without producing executable tool_calls.
Should I use a persistent profile in CI?
Usually not. Use an isolated context or an explicitly controlled storage-state file so cookies and local storage do not leak between jobs.
When is HTTP mode preferable to the local command?
Use standalone HTTP when the MCP client and browser server run as separate processes, containers or hosts and you can secure the network path.
Why does Playwright MCP use accessibility snapshots?
They expose semantic roles and names, allowing the model to select page elements without depending on fragile pixel coordinates.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallQuick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




