### Start MCP Browser Agent Server Source: https://context7.com/imprvhub/mcp-browser-agent/llms.txt Demonstrates how to start the MCP Browser Agent server using command-line arguments, a JSON configuration file, or environment variables. The server integrates with Claude Desktop via stdio transport. ```typescript // src/index.ts — start the server manually // node dist/index.js --browser chrome --viewport-width 1920 --viewport-height 1080 --device-scale-factor 1.0 ``` ```json // ~/.mcp_browser_agent_config.json (auto-created/updated on start) { "browserType": "chrome", "viewportWidth": 1920, "viewportHeight": 1080, "deviceScaleFactor": 1.0 } ``` ```bash // Environment variable alternative // MCP_BROWSER_TYPE=firefox MCP_VIEWPORT_WIDTH=1280 node dist/index.js ``` ```json // Claude Desktop integration — claude_desktop_config.json { "mcpServers": { "browserAgent": { "command": "node", "args": [ "/absolute/path/to/mcp-browser-agent/dist/index.js", "--browser", "chrome", "--viewport-width", "1280", "--viewport-height", "800" ] } } } ``` ```text // Expected: MCP server starts, connects via stdio, browser launches on first tool call ``` -------------------------------- ### Clone and Install MCP Browser Agent Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Steps to clone the MCP Browser Agent repository and install its dependencies using npm. ```bash git clone https://github.com/imprvhub/mcp-browser-agent cd mcp-browser-agent npm install ``` -------------------------------- ### Build MCP Browser Agent Project Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Build the MCP Browser Agent project after installation. ```bash npm run build ``` -------------------------------- ### Configure Multiple MCP Servers in Claude Desktop Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Example of configuring multiple MCP servers, including the browserAgent, within the Claude Desktop configuration file. ```json { "mcpServers": { "otherMcp1": { "command": "...", "args": ["..."] }, "otherMcp2": { "command": "...", "args": ["..."] }, "browserAgent": { "command": "node", "args": [ "ABSOLUTE_PATH_TO_DIRECTORY/mcp-browser-agent/dist/index.js", "--browser", "chrome" ] } } } ``` -------------------------------- ### Install Playwright Browsers Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Manually install Playwright browser drivers for supported browsers. Playwright automatically installs drivers on first use, but these commands allow for manual installation. ```bash npx playwright install chrome npx playwright install firefox npx playwright install webkit npx playwright install msedge ``` -------------------------------- ### Run MCP Server with Firefox Argument Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Start the MCP server manually and specify Firefox as the browser type using a command-line argument. ```bash node dist/index.js --browser firefox ``` -------------------------------- ### MCP Tool Call: browser_navigate Source: https://context7.com/imprvhub/mcp-browser-agent/llms.txt Illustrates an MCP tool call to navigate the browser to a specified URL. Includes optional parameters for timeout and `waitUntil` strategies, and shows example success and error responses. ```json // MCP tool call (as Claude would issue it) { "name": "browser_navigate", "arguments": { "url": "https://example.com", "timeout": 15000, "waitUntil": "networkidle" } } ``` ```json // Success response: // { "content": [{ "type": "text", "text": "Navigated to https://example.com" }], "isError": false } ``` ```json // Error response (unreachable host): // { "content": [{ "type": "text", "text": "Navigation failed: net::ERR_NAME_NOT_RESOLVED" }], "isError": true } ``` -------------------------------- ### Configure Claude Desktop for Browser Agent Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Add the Browser Agent MCP configuration to the Claude Desktop configuration file to enable auto-starting. Replace ABSOLUTE_PATH_TO_DIRECTORY with the actual path to your mcp-browser-agent installation. ```json { "mcpServers": { "browserAgent": { "command": "node", "args": ["ABSOLUTE_PATH_TO_DIRECTORY/mcp-browser-agent/dist/index.js", "--browser", "chrome" ] } } } ``` -------------------------------- ### Perform GET Request with API Tool Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Use the `api_get` tool to make an HTTP GET request to a specified URL. Optional `headers` can be provided. ```text Perform a GET request to https://jsonplaceholder.typicode.com/todos/1 ``` -------------------------------- ### Run MCP Server with Firefox Environment Variable Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Start the MCP server manually and specify Firefox as the browser type using the MCP_BROWSER_TYPE environment variable. ```bash MCP_BROWSER_TYPE=firefox node dist/index.js ``` -------------------------------- ### Perform HTTP GET Request with api_get Source: https://context7.com/imprvhub/mcp-browser-agent/llms.txt Performs an HTTP GET request and returns the status code and formatted response body. JSON responses are pretty-printed; other content types are returned as raw text. Use for fetching data from APIs. ```json { "name": "api_get", "arguments": { "url": "https://jsonplaceholder.typicode.com/todos/1", "headers": { "Accept": "application/json" } } } ``` -------------------------------- ### api_get Source: https://context7.com/imprvhub/mcp-browser-agent/llms.txt Performs an HTTP GET request and returns the status code and formatted response body. JSON responses are pretty-printed; other content types are returned as raw text. ```APIDOC ## api_get — HTTP GET Request Performs an HTTP GET request and returns the status code and formatted response body. JSON responses are pretty-printed; other content types are returned as raw text. ### Arguments * `url` (string): The URL to send the GET request to. * `headers` (object, optional): An object containing request headers. ### Example ```json { "name": "api_get", "arguments": { "url": "https://jsonplaceholder.typicode.com/todos/1", "headers": { "Accept": "application/json" } } } ``` ### Response ```json { "content": [ { "type": "text", "text": "GET https://jsonplaceholder.typicode.com/todos/1 - Status: 200" }, { "type": "text", "text": "Response body:\n{\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"delectus aut autem\",\n \"completed\": false\n}" } ], "isError": false } ``` ``` -------------------------------- ### Initialize Playwright Project Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Use this command to initialize a new Playwright project, which includes Playwright and necessary dependencies for browser automation. ```bash npm init playwright@latest ``` -------------------------------- ### Login Form Interaction with Browser Tools Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Demonstrates filling form fields for username and password, followed by clicking the login button. Requires selectors for the input fields and the button. ```text Navigate to https://the-internet.herokuapp.com/login and fill in the username field with "tomsmith" and the password field with "SuperSecretPassword!" ``` ```text Go to https://the-internet.herokuapp.com/login, fill in the username and password fields, then click the login button ``` -------------------------------- ### Navigate and Search with Browser Tool Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Combines navigation and interaction by first navigating to a URL and then performing a search action. Assumes the search input is identifiable by a selector. ```text Navigate to https://www.wikipedia.org and search for "Model Context Protocol" ``` -------------------------------- ### Run Tests Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Execute the project's test suite. Use watch mode for continuous testing or coverage for a detailed report. ```bash npm test # Run tests npm run test:watch # Watch mode npm run test:coverage # Coverage report ``` -------------------------------- ### Navigate to URL with Browser Tool Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Use the `browser_navigate` tool to direct the browser to a specified URL. Supports optional `timeout` and `waitUntil` parameters. ```text Navigate to the Google homepage at https://www.google.com ``` -------------------------------- ### Register MCP Browser and API Tools Source: https://context7.com/imprvhub/mcp-browser-agent/llms.txt Shows how to register all available browser and API tools using `registerTools()` from the MCP SDK. The registered tools are exposed to Claude via the `tools/list` protocol method. ```typescript import { registerTools, BROWSER_TOOLS, API_TOOLS } from "./tools.js"; const tools = registerTools(); // tools is Tool[] with 12 entries: // BROWSER_TOOLS: ["browser_set_viewport","browser_navigate","browser_screenshot", // "browser_click","browser_fill","browser_select","browser_hover","browser_evaluate"] // API_TOOLS: ["api_get","api_post","api_put","api_patch","api_delete"] console.log(tools.map(t => t.name)); ``` ```text // Output: // ["browser_set_viewport","browser_navigate","browser_screenshot","browser_click", // "browser_fill","browser_select","browser_hover","browser_evaluate", // "api_get","api_post","api_put","api_patch","api_delete"] ``` -------------------------------- ### Watch for Changes Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Use this command to watch for file changes during development. ```bash npm run watch ``` -------------------------------- ### Configure Browser Type via .mcp_browser_agent_config.json Source: https://github.com/imprvhub/mcp-browser-agent/blob/main/README.md Specify the browser type for the MCP Browser Agent by creating or editing the .mcp_browser_agent_config.json file in your home directory. ```json { "browserType": "chrome" } ``` -------------------------------- ### Select a Dropdown Option with browser_select Source: https://context7.com/imprvhub/mcp-browser-agent/llms.txt Waits for a `` element and selects the matching option by value or label text. ```APIDOC ## browser_select — Select a Dropdown Option Waits for a `