Gafoor2005/LAM-mcp
If you are the rightful owner of LAM-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Browser Automation MCP Server provides intelligent browser automation with session-based context analysis, enabling AI assistants to interact with web pages and make smart decisions.
Browser Automation MCP Server with Session Context
A Model Context Protocol (MCP) server that provides intelligent browser automation with session-based context analysis. This server enables AI assistants to interact with web pages and make smart decisions based on page analysis and surrounding context.
✨ Key Features
🧠 Session-Based Context Intelligence
- Smart Element Identification: Analyzes page structure to find the right elements for your task
- Context-Aware Suggestions: Recommends elements based on labels, nearby text, and relevance
- Semantic Search: Find relevant page sections using natural language queries
- Progress Tracking: Monitor actions and success rates during the session
- Ephemeral Memory: Session-only storage that clears when done (no persistent learning)
- Relevance Scoring: Elements ranked by confidence based on context analysis
🌐 Core Browser Automation
- Web Navigation: Navigate to URLs, handle redirects, and manage browser history
- Element Interaction: Click buttons, links, and other interactive elements
- Text Input: Type into form fields, search boxes, and text areas
- Content Extraction: Extract text, HTML, and structured data from web pages
- Screenshot Capture: Take full-page or element-specific screenshots
- JavaScript Execution: Run custom JavaScript code in the browser context
🚀 Advanced Capabilities
- Form Handling: Automatically fill out complex web forms
- Cookie Management: Get, set, and manage browser cookies
- Session Persistence: Maintain browser sessions across operations
- Multi-Browser Support: Chrome, Firefox, Edge with automatic driver management
- Headless/Headed Modes: Run browsers with or without GUI
- Element Waiting: Smart waiting for dynamic content and AJAX loads
📦 Installation
-
Install Dependencies:
pip install -e . # or uv add mcp selenium webdriver-manager pillow beautifulsoup4 chromadb sentence-transformers -
Browser Drivers (handled automatically by webdriver-manager):
- Chrome/Chromium driver
- Firefox GeckoDriver
- Edge WebDriver
-
Context Analysis Dependencies:
- ChromaDB for in-memory vector storage
- sentence-transformers for semantic embeddings (all-MiniLM-L6-v2)
Usage
Running the Server
# STDIO transport (for local development)
python -m browser_mcp_server.server
# SSE transport (for web-based clients)
python -m browser_mcp_server.server --transport sse --port 8000
Configuration with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"browser-automation": {
"command": "uv",
"args": ["run", "python", "-m", "browser_mcp_server.server"],
"env": {
"BROWSER_HEADLESS": "true",
"BROWSER_TYPE": "chrome"
}
}
}
}
Available Tools
🧠 Session Context Intelligence Tools
analyze_current_page: Analyze page structure and store in session contextfind_page_context: Find relevant page sections for your task using semantic searchget_smart_element_selector: Get elements with surrounding context for better identificationtrack_action_result: Track actions and success/failure in current sessionget_session_progress: View session statistics, actions taken, and success rateclear_session_context: Clear session memory and start fresh
Navigation & Page Control
navigate_to_url: Navigate to a specific URLget_page_source: Get the full HTML source of the current pageget_rendered_html: Get dynamically rendered HTML (after JavaScript)get_current_url: Get the current page URLrefresh_page: Refresh the current pagego_back: Navigate back in browser historygo_forward: Navigate forward in browser history
Element Interaction
click_element: Click on elements by CSS selector or XPathtype_text: Type text into input fieldsclear_field: Clear text from input fieldsget_element_text: Extract text content from elementsget_element_attribute: Get attribute values from elementsis_element_present: Check if an element exists on the page
Content Extraction
extract_links: Extract all links from the current pageextract_images: Extract all images and their attributesextract_tables: Extract table data as structured JSONextract_forms: Extract form fields and their propertiessearch_text: Search for text patterns on the page
Form Automation
fill_form: Fill out entire forms with structured dataselect_dropdown_option: Select options from dropdown menuscheck_checkbox: Check or uncheck checkbox elementsselect_radio_button: Select radio button options
Visual & Media
take_screenshot: Capture full-page or element screenshotsscroll_page: Scroll the page in various directionshover_element: Hover mouse over elementsdrag_and_drop: Drag and drop elements
JavaScript & Advanced
execute_javascript: Execute custom JavaScript codewait_for_element: Wait for elements to appear or disappearwait_for_page_load: Wait for page load completionswitch_to_frame: Switch context to iframeshandle_alert: Handle JavaScript alerts and confirmations
Session & Cookies
get_cookies: Retrieve browser cookiesset_cookies: Set browser cookiesdelete_cookies: Delete specific or all cookiesget_local_storage: Access browser local storageset_local_storage: Set local storage values
Environment Variables
BROWSER_TYPE: Browser to use (chrome,firefox,edge) - default:chromeBROWSER_HEADLESS: Run in headless mode (true/false) - default:trueBROWSER_TIMEOUT: Default timeout for operations in seconds - default:30BROWSER_WINDOW_SIZE: Browser window size (1920x1080) - default:1920x1080BROWSER_USER_AGENT: Custom user agent stringBROWSER_DOWNLOAD_DIR: Directory for file downloads
Example Usage Patterns
Web Scraping
# Navigate to a website and extract data
await navigate_to_url("https://example.com")
await wait_for_element("css:.content")
content = await extract_text("css:.main-content")
links = await extract_links()
Form Automation
# Fill out and submit a contact form
await navigate_to_url("https://example.com/contact")
await fill_form({
"name": "John Doe",
"email": "john@example.com",
"message": "Hello from MCP!"
})
await click_element("css:button[type='submit']")
E-commerce Automation
# Search and interact with e-commerce sites
await navigate_to_url("https://shop.example.com")
await type_text("css:#search-input", "laptop")
await click_element("css:.search-button")
await wait_for_element("css:.product-list")
products = await extract_text("css:.product-item")
Security Considerations
This server provides powerful browser automation capabilities that can:
- Navigate to any website
- Execute arbitrary JavaScript
- Access and modify cookies and local storage
- Take screenshots of web content
- Fill out and submit forms
Recommendations:
- Use in controlled environments
- Implement proper authentication for production
- Review and approve automation scripts
- Monitor for suspicious activities
- Use headless mode in production
- Implement rate limiting and timeouts
Development
Running Tests
uv run pytest tests/
Code Formatting
uv run black browser_mcp_server/
uv run isort browser_mcp_server/
Type Checking
uv run mypy browser_mcp_server/
License
MIT License - see LICENSE file for details.