OPEN-SOURCE · MCP BROWSER CONTROL INFRASTRUCTURE

Controlled browser interaction for AI agents.

MiraiLens is the control layer between AI agents and the real browser — keeping execution observable, interruptible, and subject to human authority.

control_state/
IDLE

AI can request an action. MiraiLens controls whether the action is permitted. The human can take control at any time.

01Architecture

A control layer between AI intent and browser execution.

AI intent passes through MiraiLens before reaching the browser. The extension maintains the authoritative control state, can interrupt active execution, detects human takeover, and prevents an MCP client or AI agent from overriding human-held control.

Control relationship

AI requests control. MiraiLens evaluates and executes permitted actions. The human retains the ability to interrupt and take control.

00

AI Agent

Issues intent

01

MCP Client

Model Context Protocol

02

MiraiLens MCP Server

npx mirailens@latest

03

MiraiLens Connector

Authoritative control layer

04

Real Chrome Browser

Live session

05

Web Page

Execution target

node 03 is the authoritative control gate

02Control model

The extension is authoritative over browser control.

The AI can request control. MiraiLens decides whether the action is permitted. The human always has the final authority.

  • A human can explicitly take control.
  • Trusted human interaction can trigger implicit takeover.
  • Active AI execution is aborted when takeover occurs.
  • Emergency stop blocks further AI execution.
  • An MCP client cannot spoof human authority through a WebSocket message.
  • Human-held control cannot be forcibly overridden by the AI.
  • Emergency-stop state persists across extension reloads.

Control state machine

IDLE
AGENT_RUNNING
HUMAN_TAKEOVER
HUMAN_CONTROLLED
AGENT_RESUMING
BLOCKED
COMPLETED
FAILED

AI Control Human Takeover Human Control

03MCP server

Exposes browser automation to MCP-compatible clients.

The MiraiLens MCP server enables AI assistants to control and observe web browsers through high-level browser automation tools.

Package
mirailens
Registry
npm
Runtime
Node.js
Protocol
Model Context Protocol
Browser
Chrome / Chromium

Capabilities

Navigation
Back and forward navigation
Clicking
Hovering
Typing
Selecting options
Keyboard input
Waiting
Accessibility snapshots
Console log access
Screenshots
Browser control state
Human takeover handling
Pause and resume control
Emergency stop
04Chrome extension

MiraiLens Connector

Connects the MiraiLens MCP server to an active Chrome browser session. The extension is the authoritative browser-side control layer — presented as infrastructure, not as an AI assistant.

Responsibilities

  1. 01Connect the browser to the MCP server
  2. 02Maintain browser-control state
  3. 03Execute authorized browser actions
  4. 04Monitor connection health
  5. 05Detect trusted human interaction
  6. 06Allow explicit human takeover
  7. 07Return control to the agent when authorized
  8. 08Abort active execution
  9. 09Provide emergency stop
  10. 10Persist safety-critical control state
  11. 11Prevent unauthorized agent control transitions
05Security

Designed around controlled execution.

Control transitions are extension-authoritative. The MCP server mirrors browser control state but cannot override a state owned by the human.

Known limitations
  • A browser navigation API call that has already started cannot always be physically aborted midway.
  • Implicit takeover currently focuses on trusted mouse and keyboard interaction.
  • Additional interaction types may require future refinement.

Safety mechanisms

Centralized control state machine
AI execution gatekeeping
Human takeover
Trusted event detection
In-flight action abortion
Emergency stop
WebSocket heartbeat monitoring
Disconnect safety
Tab lifecycle validation
Concurrent action protection
Persistent emergency-stop state
Protection against AI resume spoofing
06Engineering

Reproducible, state-machine tested.

State machine tests

12/12

passing

  • Security before convenience
  • Human authority over automation
  • Deterministic control transitions
  • Explicit state
  • Fail-safe behavior
  • Observable execution
  • Reproducible testing
  • Minimal UI

Test coverage

  • Normal agent execution
  • Emergency stop
  • Implicit human takeover
  • Unrelated-tab validation
  • AI resume spoofing
  • Emergency-stop persistence
  • AI versus human pause behavior
  • Concurrent action protection
  • WebSocket disconnect safety
  • Connected-tab closure
  • Heartbeat behavior
  • Control-state transitions

Repository infrastructure

  • GitHub Actions CI
  • Extension build validation
  • Dependency security auditing
  • CodeQL analysis
  • Dependabot
  • Issue templates
  • Security reporting workflow
  • Pull request template
  • CODEOWNERS
  • Automated extension packaging
07Privacy

Permissions exist to serve one purpose.

MiraiLens connects AI agents to Chrome through MCP, enabling controlled browser interaction while allowing you to monitor agent activity, take control of the browser, and stop execution when needed. It does not use remote executable JavaScript or WebAssembly — extension code ships packaged with the extension.

  • No sale of user data.
  • No use of user data for unrelated purposes.
  • No use of user data for creditworthiness or lending decisions.
  • Browser permissions exist to provide core control functionality — not to independently collect data.

Permission justification

scripting

Enables authorized browser interactions on the active page — interacting with elements and executing supported browser actions.

tabs

Identifies and manages the tab associated with an active session, and safely handles events like tab closure mid-session.

activeTab

Accesses the tab the user is actively controlling or has authorized for a session, required for core control functionality.

storage

Persists configuration and control-state information so control stays safe across extension and browser lifecycle events.

alarms

Runs periodic heartbeat checks between the extension and MCP server to detect stale connections.

host_permissions

Grants access to web pages, required for the MCP-connected agent to perform authorized interactions.

08Open source

Built in the open. Available under the MiraiLens Community License.

MiraiLens is developed publicly on GitHub. Documentation prioritizes clear installation, transparent architecture, and honest limitations over marketing language.