Skip to main content
Glama
Hanny658

browser-mcp-demo

by Hanny658

Remote Browser + MCP Tool Gateway (Multi-Site MVP)

This project provides a minimal HITL (human-in-the-loop) remote browser session and an MCP tool gateway for restricted search/extraction. It currently supports XHS and includes real search adapters for Yelp and TripAdvisor.

Requirements

  • Node.js >= 18

  • Playwright Chromium (npx playwright install chromium)

Related MCP server: browser-research-mcp

Install

npm install
npx playwright install chromium

Copy the environment template and adjust as needed:

cp .env.example .env

Run

npm run dev

This starts:

  • HTTP server on http://HOST:PORT

  • MCP server on stdio (connect with an MCP client)

Docker (single-user + noVNC)

This path is intended for a single user (or MAX_SESSIONS=1). It runs the browser inside Xvfb and streams the desktop via noVNC.

Build:

docker build -t browser-mcp-demo .

Run:

docker run --rm \
  -p 3000:3000 -p 7900:7900 \
  -e HOST=0.0.0.0 \
  -e HEADLESS=false \
  -e MAX_SESSIONS=1 \
  -e VIEW_MODE=novnc \
  -e PUBLIC_BASE_URL=http://YOUR_SERVER_IP:3000 \
  -e NOVNC_URL_TEMPLATE="http://YOUR_SERVER_IP:7900/vnc.html?autoconnect=1&resize=scale&path=websockify" \
  -e PROFILES_DIR=/data/profiles \
  -e AUDIT_LOG_PATH=/data/logs/audit.log \
  -e DELETE_PROFILE=false \
  -v "$PWD/profiles:/data/profiles" \
  -v "$PWD/logs:/data/logs" \
  browser-mcp-demo

Notes:

  • VIEW_MODE=novnc makes /session/view/:id embed the live browser stream.

  • Update PUBLIC_BASE_URL and NOVNC_URL_TEMPLATE with your public host or domain.

HITL Login Flow

  1. Call MCP tool create_session -> { sessionId, viewUrl }

  2. Open viewUrl in your browser.

    • Default mode: a local Chromium window is opened for login.

    • noVNC mode (VIEW_MODE=novnc): the remote browser stream is embedded in the page.

  3. Login on that window (QR/OTP/2FA handled by the user).

  4. Call wait_for_login until status is READY (site-aware when site is provided).

MCP Tools (stdio)

Tools:

  • create_session

  • wait_for_login (optional site)

  • platform_search (site-aware via site param)

  • xhs_open_and_extract (site-aware via site param)

  • destroy_session

Example (pseudo):

const session = await client.callTool("create_session", {});
await client.callTool("wait_for_login", { sessionId: session.sessionId, timeoutSec: 120 });
const results = await client.callTool("platform_search", {
  sessionId: session.sessionId,
  query: "camping",
  maxNotes: 10,
  scrollTimes: 0,
  site: "xhs" // xhs | yelp | tripadvisor
});
const detail = await client.callTool("xhs_open_and_extract", {
  sessionId: session.sessionId,
  url: results.notes[0]?.url,
  site: "xhs"
});

Security Boundary

  • Tools return sanitized structured JSON only.

  • No cookies, localStorage, sessionStorage, storageState, or userDataDir exposure.

  • No screenshot tool.

  • Audit log is written to logs/audit.log with redaction.

Agent HTTP Endpoints

  • POST /agent/run → start a run and execute until login required or done

  • POST /agent/continue → continue a run after user login

  • GET /agent/run/:id → fetch current run state

Example request body:

{
  "query": "camping",
  "maxNotes": 10,
  "scrollTimes": 0,
  "detailCount": 3,
  "detailParallel": 4,
  "site": "xhs"
}

Configuration

Key environment variables:

  • HOST, PORT, PUBLIC_BASE_URL

  • UI_DIST_DIR (serve built UI from the same server)

  • VIEW_MODE (info | novnc)

  • NOVNC_URL_TEMPLATE (supports {sessionId} placeholder)

  • OPENAI_API_KEY, OPENAI_MODEL

  • AGENT_RUN_TTL_MINUTES

  • MAX_SESSIONS, SESSION_TTL_MINUTES

  • PROFILES_DIR, DELETE_PROFILE

  • HEADLESS

  • XHS_BASE_URL

  • AUDIT_LOG_PATH

Notes

  • XHS, Yelp, and TripAdvisor all support search in the current adapter layer. XHS detail extraction is implemented; Yelp/TripAdvisor detail extraction is still stubbed.

  • The DOM selectors for each site may change. Update src/browser/xhs.ts or src/sites/*.ts if extraction breaks.

  • This MVP does not implement large-scale crawling or anti-bot bypass.

Available Tools

5 tools
create_sessionC

Create a new browser session and return sessionId + viewUrl.

ParametersJSON Schema
NameRequiredDescriptionDefault
siteNo

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must bear full weight. Only mentions return values but omits behavioral traits like browser launch, authentication needs, or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence is efficient but too sparse for a session creation tool. Lacks structure to convey essential details while remaining concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given one parameter, no annotations, and no output schema, the description fails to explain parameter semantics, return value structure, or when to use. Incomplete for effective agent usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Single parameter 'site' with type string and no description. Schema coverage is 0%, and the description provides no clarification on what 'site' means (e.g., URL, domain, name).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a new browser session') and the return values ('sessionId + viewUrl'). It distinguishes itself from sibling tools like destroy_session and platform_search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives. Lacks prerequisites or context, such as requiring a valid site parameter or network connectivity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

destroy_sessionC

Destroy a browser session.

ParametersJSON Schema
NameRequiredDescriptionDefault
sessionIdYes

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but only implies irreversibility through 'Destroy'. It fails to disclose side effects, required permissions, or what exactly happens to the session.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

At 4 words, it is maximally concise, but the trade-off is insufficient context. The sentence is front-loaded but lacks necessary detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite low complexity (1 parameter, no output schema), the description omits critical behavioral details and parameter semantics, making it inadequate for reliable agent invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage for the single parameter (sessionId). The description adds no meaning, leaving the agent to guess the parameter's purpose or source.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Destroy') and the resource ('a browser session'), distinctly differentiating it from sibling tools like create_session.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when or when not to use this tool, nor does it mention any prerequisites or alternatives. The agent receives no context for decision-making.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

wait_for_loginC

Poll login status for a session (site-specific when provided).

ParametersJSON Schema
NameRequiredDescriptionDefault
sessionIdYes
timeoutSecNo
siteNo

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must reveal behavioral traits. It only states 'poll login status' without explaining whether the call blocks, times out, or returns immediately. Key behaviors like polling frequency, error handling, and status values are absent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The single-sentence description is highly concise and contains no filler. Every word contributes to the purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite the tool's apparent simplicity, the description omits critical context: return type, blocking nature, error states, and relationship to session lifecycle. With no output schema, the agent lacks information to handle the tool's response properly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% and the description barely explains parameters. It hints at the optional site parameter but fails to describe sessionId (required) or timeoutSec (optional). Consequently, the description adds little value over the raw schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool polls login status for a session and notes site-specific behavior. It is distinct from sibling tools like create_session and destroy_session which handle session lifecycle, though sibling differentiation is not explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like create_session or platform_search. It does not mention prerequisites (e.g., session must exist) or when polling is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

xhs_open_and_extractC

Open a note and extract full detail (site-specific).

ParametersJSON Schema
NameRequiredDescriptionDefault
sessionIdYes
urlYes
siteNo

TDQS

C2.8/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and the description fails to disclose any behavioral traits such as destructive potential, authentication needs, rate limits, or error behavior. For a tool with zero annotation coverage, this is a critical gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no fluff, but it could include more useful detail without becoming verbose. It is appropriately concise but not maximally informative.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 3 parameters, no output schema, and no annotations, the description is far too brief. It does not explain return values, error handling, or prerequisites for opening a note, leaving agents underinformed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% (no parameter descriptions), but parameter names (sessionId, url, site) are self-explanatory. The description adds 'site-specific' hint but does not elaborate on the optional 'site' parameter or its values.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Open a note and extract full detail') and the resource ('note'), with 'site-specific' hinting at context. This uniquely identifies the tool's purpose among siblings like create_session, destroy_session, platform_search, and wait_for_login.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives, no prerequisites or exclusions. The description only states what it does, leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv0.3.0
    • First observedcreate_session
    • First observeddestroy_session
    • First observedplatform_search
    • First observedwait_for_login
    • First observedxhs_open_and_extract

TDQS

B3/5.0
Disambiguation5/5

Each tool has a clear and distinct purpose: session creation/destruction, platform searching, login polling, and site-specific extraction. No overlapping functionality.

Naming Consistency2/5

Naming conventions are inconsistent: create_session and destroy_session follow verb_noun, but platform_search is noun_verb, wait_for_login uses a preposition, and xhs_open_and_extract is a long combined verb. No uniform pattern.

Tool Count5/5

Five tools is an appropriate scope for a demo browser MCP server, covering essential workflows without being overwhelming.

Completeness3/5

The set covers a specific workflow (session management, search, login, extraction) for a particular site, but lacks generic browser actions like navigation, clicking, or form filling, which limits its applicability to other contexts.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    C
    quality
    C
    maintenance
    Provides browser automation and web scraping as MCP tools, enabling autonomous URL ingestion, crawling, extraction, and anti-bot handling with interactive browser control.
    62
    5
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Browser-based research MCP server that drives a real Chromium browser via patched Playwright to access JavaScript-rendered content, dynamic tables, and login-walled dashboards. It provides tools for visiting URLs to extract DOM text and screenshots, and for performing structured data extraction using Anthropic Claude Sonnet.
    3
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides a real browser that bypasses bot detection (Cloudflare, Turnstile) for AI agents, enabling navigation, clicking, typing, screenshots, and data collection through MCP tools.
    104
    MIT

Latest Blog Posts

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/Hanny658/browser-mcp-demo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server