Skip to main content
Glama
dragons96

MCP-Undetected-Chromedriver

by dragons96

browser_navigate

Directs a Chrome browser to a specified URL using undetected automation, bypassing anti-bot detection mechanisms. Includes an optional timeout parameter for navigation control, ideal for web scraping and testing.

Instructions

Navigate to a URL

Args:
    url: The URL to navigate to - required
    timeout: The timeout for the navigation - optional, default is 30000

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeoutNo
urlYes

Implementation Reference

  • The main handler function for the 'browser_navigate' tool. It uses undetected ChromeDriver to navigate to the specified URL with an optional timeout. Includes input validation, page load timeout setting, and error handling via safe_execute.
    @mcp.tool()
    async def browser_navigate(url: str, timeout: int = 30000):
        """Navigate to a URL
    
        Args:
            url: The URL to navigate to - required
            timeout: The timeout for the navigation - optional, default is 30000
        """
    
        assert url, "URL is required"
    
        async def navigate_handler(driver: uc.Chrome):
            print(f"Navigating to {url}")
            driver.set_page_load_timeout(timeout)
            driver.get(url)
            return await create_success_response(f"Navigated to {url}")
    
        return await tool.safe_execute(
            ToolContext(webdriver=await ensure_browser()), navigate_handler
        )
  • The @mcp.tool() decorator registers the browser_navigate function as an MCP tool.
    @mcp.tool()
  • The docstring provides the tool schema with parameter descriptions and types implied by function signature (url: str required, timeout: int optional default 30000).
    """Navigate to a URL
    
    Args:
        url: The URL to navigate to - required
        timeout: The timeout for the navigation - optional, default is 30000
    """
  • Helper function to ensure the ChromeDriver instance is initialized.
    async def ensure_browser(config: dict | None = None):
        if not Global.webdriver:
            Global.webdriver = uc.Chrome(
                driver_executable_path=ChromeDriverManager().install()
            )
        return Global.webdriver
  • Helper to create successful tool response.
    async def create_success_response(message: str | list[str]) -> types.CallToolResult:
        if isinstance(message, str):
            message = [message]
        return types.CallToolResult(
            content=[TextContent(type="text", text=msg) for msg in message],
            isError=False,
        )
Install Server

Other Tools

Related 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/dragons96/mcp-undetected-chromedriver'

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