Skip to main content
Glama
yashpreetbathla

MCP Accessibility Bridge

Connect to Chrome Browser

browser_connect

Connect to a Chrome browser to access its accessibility tree for generating test selectors, performing audits, and reading element roles as a screen reader would.

Instructions

Connect to a running Chrome browser via the Chrome DevTools Protocol (CDP). Chrome must be started with --remote-debugging-port=9222. Command: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug-profile

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
debugUrlNoChrome remote debugging URL. Default: http://localhost:9222. Start Chrome with --remote-debugging-port=9222.http://localhost:9222

Implementation Reference

  • The browserConnectHandler function that executes the browser_connect tool logic. It connects to a Chrome browser via the Chrome DevTools Protocol using the provided debug URL, retrieves the current page URL and title, and returns a success response with connection details.
    export async function browserConnectHandler(
      args: { debugUrl?: string }
    ): Promise<ReturnType<typeof toolSuccess | typeof toolError>> {
      try {
        const url = args.debugUrl ?? 'http://localhost:9222';
        await browserManager.connect(url);
    
        const { page } = browserManager.requireConnection();
        const currentUrl = page.url();
        const title = await page.title().catch(() => '');
    
        return toolSuccess({
          connected: true,
          debugUrl: url,
          currentUrl,
          pageTitle: title,
          message: `Connected to Chrome at ${url}. Active page: "${title || currentUrl}"`,
        });
      } catch (error) {
        return toolError(error);
      }
    }
  • The browserConnectSchema defines the input validation for the browser_connect tool. It accepts an optional debugUrl parameter with a default value of 'http://localhost:9222', which must be a valid URL.
    export const browserConnectSchema = {
      debugUrl: z
        .string()
        .url()
        .optional()
        .default('http://localhost:9222')
        .describe(
          'Chrome remote debugging URL. Default: http://localhost:9222. ' +
          'Start Chrome with --remote-debugging-port=9222.'
        ),
    };
  • src/index.ts:20-32 (registration)
    Registration of the browser_connect tool with the MCP server. It registers the tool name, title, description, input schema, and the handler function.
    server.registerTool(
      'browser_connect',
      {
        title: 'Connect to Chrome Browser',
        description:
          'Connect to a running Chrome browser via the Chrome DevTools Protocol (CDP). ' +
          'Chrome must be started with --remote-debugging-port=9222. ' +
          'Command: /Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome ' +
          '--remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug-profile',
        inputSchema: browserConnectSchema,
      },
      browserConnectHandler
    );
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses key behavioral traits such as the requirement for Chrome to be running with specific flags and the use of CDP, but it lacks details on error handling, connection persistence, or what happens after connection (e.g., does it return a session ID?). This is adequate but has gaps for a tool with no annotations.

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 description is front-loaded with the core purpose in the first sentence, followed by essential prerequisites and a concrete example. Every sentence earns its place by providing critical information without redundancy, making it highly efficient and well-structured.

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

Completeness4/5

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

Given the tool's complexity (connecting to a browser via CDP), no annotations, and no output schema, the description does a good job covering prerequisites and usage. However, it lacks details on what the tool returns (e.g., connection status or session handle) and potential failure modes, which would enhance completeness for a tool with no structured output information.

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 description coverage is 100%, so the schema already fully documents the single parameter 'debugUrl' with its type, format, default, and description. The description does not add any meaningful parameter semantics beyond what the schema provides, such as explaining why the default is used or edge cases for the URL. Baseline 3 is appropriate when schema does the heavy lifting.

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 specific action ('Connect to a running Chrome browser') and the mechanism ('via the Chrome DevTools Protocol'), distinguishing it from siblings like browser_disconnect or browser_navigate. It provides a precise verb+resource combination that leaves no ambiguity about what the tool does.

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

Usage Guidelines4/5

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

The description explicitly states when to use this tool by specifying the prerequisite condition ('Chrome must be started with --remote-debugging-port=9222') and provides a concrete command example. However, it does not explicitly contrast when to use this versus alternatives like browser_disconnect or other browser-related tools, which prevents a perfect score.

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

Install Server

Other Tools

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/yashpreetbathla/mcp-accessibility-bridge'

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