Skip to main content
Glama
yashpreetbathla

MCP Accessibility Bridge

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 );

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