Sandbox
@Linzo99/browser-use-mcp-client

React MCP client for browser-use servers

This is a React app that connects to MCP servers through Server-Sent Events. It gives you a chat-like interface, message history, request canceling, theme support, and live screenshot previews from browser-use responses.

39 starsโ€ข4 forksโ€ขTypeScriptโ€ขUpdated 1y ago
Who it's for

Builders who want a simple UI for talking to MCP servers and watching browser automation results.

What it delivers

You can send tasks to a browser-use MCP server from a web interface instead of wiring up your own client.

What it does

SSE connection to MCP servers

Sends and receives messages from an MCP server over Server-Sent Events.

Chat-style message history

Keeps threaded conversation history and lets you clear it.

Live screenshot preview

Shows browser screenshots returned by the server during a run.

Request controls

Lets you cancel an in-progress request and manage the current session.

Theme support

Supports light mode, dark mode, and system preference detection.

Connection setup

Lets you configure the MCP server connection from the interface.

How to get it

  1. 1Clone the Repository
    git clone <repository-url>
    cd browser-use-mcp-client
  2. 2Install Dependencies
    pnpm install
  3. 3Start the Development Server
    pnpm dev
  4. 4Start the Proxy Server
    ./proxy/index.js

README

Browser-use MCP Client

A modern React application that provides a user-friendly interface for interacting with Model Context Protocol (MCP) servers through Server-Sent Events (SSE).

๐ŸŽฅ Demo

https://github.com/user-attachments/assets/52ab11ad-741f-4506-99ad-9f1972a3aad1

๐Ÿš€ Features

  • Real-time Communication: Direct SSE connection to MCP servers
  • Interactive UI: Clean and responsive interface built with React and Tailwind CSS
  • Theme Support: Light and dark mode with system preference detection
  • Screenshot Preview: Live browser screenshots from MCP server responses
  • Message History: Persistent chat history with clear message threading
  • Request Management: Cancel in-progress requests and clear chat history
  • Connection Management: Easy server connection configuration

๐Ÿ“‹ Prerequisites

  • Node.js (v18 or later)
  • pnpm (recommended package manager)
  • A running MCP server for connection
  • Python 3.8+ (for running the example server)

๐Ÿš€ Getting Started

  1. Clone the Repository

    git clone <repository-url>
    cd browser-use-mcp-client
    
  2. Install Dependencies

    pnpm install
    
  3. Start the Development Server

    pnpm dev
    
  4. Start the Proxy Server

    ./proxy/index.js
    

The application will be available at http://localhost:5173

๐Ÿ’ป Usage

๐Ÿค– Example MCP Server

Here's an example of a Python-based MCP server that uses browser automation:

#!/usr/bin/env python3
import asyncio
from dotenv import load_dotenv
from typing import Awaitable, Callable
from mcp.server.fastmcp import FastMCP, Context
from browser_use import Agent, Browser, BrowserConfig
from langchain_google_genai import ChatGoogleGenerativeAI

# Load environment variables from .env file
load_dotenv()

# Initialize FastMCP server
mcp = FastMCP("browser-use")

browser = Browser(
    config=BrowserConfig(
        chrome_instance_path="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --remote-debugging-port=9222",
        headless=True
    )
)

llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash")
agent = None


@mcp.tool()
async def perform_search(task: str, context: Context):
    """Perform the actual search in the background."""
    async def step_handler(state, *args):
        if len(args) != 2:
            return
        await context.session.send_log_message(
            level="info",
            data={"screenshot": state.screenshot, "result": args[0]}
        )

    asyncio.create_task(
        run_browser_agent(task=task, on_step=step_handler)
    )
    return "Processing Request"


@mcp.tool()
async def stop_search(*, context: Context):
    """Stop a running browser agent search by task ID."""
    if agent is not None:
        await agent.stop()
    return "Running Agent stopped"


async def run_browser_agent(task: str, on_step: Callable[[], Awaitable[None]]):
    """Run the browser-use agent with the specified task."""
    global agent
    try:
        agent = Agent(
            task=task,
            browser=browser,
            llm=llm,
            register_new_step_callback=on_step,
            register_done_callback=on_step,
        )

        await agent.run()
    except asyncio.CancelledError:
        return "Task was cancelled"

    except Exception as e:
        return f"Error during execution: {str(e)}"
    finally:
        await browser.close()

if __name__ == "__main__":
    mcp.run(transport="sse")

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Files in the repo

Repository payloadโ€ข16 top-level entries
  • assets
  • proxy
  • public
  • src
  • .gitignore
  • components.json
  • eslint.config.js
  • index.html
  • package.json
  • pnpm-lock.yaml
  • README.md
  • start_dev.sh
  • tsconfig.app.json
  • tsconfig.json
  • tsconfig.node.json
  • vite.config.ts

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

๐Ÿชจ why use many token when few token do trick โ€” Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k