1.0.9 • Published 4 months ago

hyperbrowser-mcp v1.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

Hyperbrowser MCP Server

This project is a server implementation for the Hyperbrowser using the Model Context Protocol (MCP). The server provides various tools to scrape, extract structured data, and crawl webpages.

More information about the Hyperbrowser can be found here. The hyperbrowser API supports a superset of features present in the mcp server.

More information about the Model Context Protocol can be found here.

Table of Contents

Installation

To install the server, run:

npx hyperbrowser-mcp

Development

For development purposes, you can run the server directly from the source code.

  1. Clone the repository:

    git clone git@github.com:hyperbrowserai/mcp.git hyperbrowser-mcp
    cd hyperbrowser-mcp
  2. Install dependencies:

    npm install # or yarn install
    npm run build
  3. Run the server:

    node dist/server.js

Example config

This is an example config for the Hyperbrowser MCP server for the Claude Desktop client.

{
  "mcpServers": {
    "hyperbrowser": {
      "command": "npx",
      "args": ["--yes", "hyperbrowser-mcp"],
      "env": {
        "HYPERBROWSER_API_KEY": "your-api-key" // or set the param in the prompt itself
      }
    }
  }
}

Other client (such as Cursor) do not support the env field in the config or as a part of the command param. In that case, you can use a shell script to run the server with the correct environment variable. An example shell script is provided in the repository as run_server.sh.

{
  "mcpServers": {
    "hyperbrowser": {
      "command": "bash",
      "args": ["/path/to/hyperbrowser-mcp/run_server.sh"]
    }
  }
}

Running with SSE

The server can also be run in Server-Sent Events (SSE) mode, which allows for real-time communication over HTTP. To run the server in SSE mode, use the --sse flag:

npx --yes hyperbrowser-mcp --sse

Specifying the port for SSE

By default, the SSE server will start on port 3001. The port can be customized using the SSE_PORT env var.

SSE_PORT=3010 npx --yes hyperbrowser-mcp --sse

If for some reason you can't provide the API key in the config or in a shell script, you can set it within whatever prompt you are using. It will be upto the mcp client to pass it to the server.

Tools

Scrape Webpage

This tool allows you to scrape a webpage and retrieve content in various formats such as markdown, HTML, links, and screenshots.

Parameters:

  • url: The URL of the webpage to scrape.
  • apiKey: (Optional) The API key to use for browser control. If not provided, then will look for the API Key in the environment variables.
  • sessionOptions: (Optional) Options for the browser session.
  • outputFormat: The format of the output (from a list of markdown, html, links, screenshot).

Extract Structured Data

This tool extracts structured information from a list of webpages using a specified prompt and JSON schema.

Parameters:

  • urls: The list of URLs of the webpages to extract structured information from.
  • apiKey: (Optional) The API key to use for browser control. If not provided, then will look for the API Key in the environment variables.
  • sessionOptions: (Optional) Options for the browser session.
  • prompt: (Optional - if not provided, the tool will try to infer the prompt from the schema) The prompt to use for the extraction.
  • schema: (Optional - if not provided, the tool will try to infer the schema from the prompt) The JSON schema to use for the extraction.

Crawl Webpages

This tool crawls a list of webpages, optionally following links and limiting the number of pages.

Parameters:

  • url: The URL of the webpage to crawl.
  • apiKey: (Optional) The API key to use for browser control. If not provided, then will look for the API Key in the environment variables.
  • sessionOptions: (Optional) Options for the browser session.
  • outputFormat: The format of the output (from a list of markdown, html, links, screenshot).
  • followLinks: Whether to follow links on the crawled webpages.
  • maxPages: The maximum number of pages to crawl.

Browser Use

This tool creates a Browser Use session, and uses taht to accomplish the task provided. Note: This can be a very long running process depending on the task, so make sure that the timeout is configured accordingly.

Parameters:

  • task: The task to accomplish using Browser Use.
  • apiKey: (Optional) The API key to use for browser control. If not provided, then will look for the API Key in the environment variables.
  • sessionOptions: (Optional) Options for the browser session.
  • returnStepInfo: (Optional) Returns the information about the intermediate steps taked. Note that this is a large amount of information and can fill up the context window very quickly. We recommend setting this to false.
  • maxSteps: (Optional) The maximum number of steps to perform while doing the task.

Session Options

The sessionOptions parameter allows you to configure various aspects of the browser session. It is an optional parameter and can include the following fields:

  • useProxy: (Optional) Whether to use a proxy.
  • useStealth: (Optional) Whether to use stealth mode.
  • solveCaptchas: (Optional) Whether to solve captchas.
  • acceptCookies: (Optional) Whether to automatically close the accept cookies popup.

These options help in customizing the behavior of the browser session to suit your specific needs.

Resources

The server provides the documentation about hyperbrowser through the resources methods. Any client which can do discovery over resources has access to it.

Configuration

The server can be configured using environment variables or by modifying the source code directly. Ensure that the HYPERBROWSER_API_KEY environment variable is set if you are not providing an API key directly in the requests.

License

This project is licensed under the MIT License.

1.0.9

4 months ago

1.0.8

4 months ago

1.0.7

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago