FoundryBrowserAutomation

Electron desktop application that demonstrates intelligent browser automation using Microsoft Foundry Local SDK and Playwright MCP (Model Context Protocol).

GitHub Stars

3

User Rating

Not Rated

Favorites

0

Views

2

Forks

0

Issues

0

README
๐Ÿš€ Foundry Local & Browser Automation Demo

A modern Electron desktop application that demonstrates the integration of Microsoft Foundry Local SDK for AI model inference with Playwright MCP (Model Context Protocol) for intelligent browser automation.

License
Electron
Node.js
Playwright

โœจ What This App Does

This application showcases the powerful combination of local AI models and browser automation in a sleek, modern interface. It demonstrates how AI can intelligently control web browsers using natural language commands, making web automation accessible to both developers and non-technical users.

๐ŸŽฏ Key Capabilities
  • ๐Ÿค– Local AI Integration: Execute AI models locally using Microsoft Foundry Local SDK
  • ๐ŸŒ Intelligent Browser Automation: Control browsers with natural language using Playwright MCP
  • ๐Ÿ’ฌ Natural Language Commands: Tell the browser what to do in plain English
  • ๐Ÿ“ธ Visual Feedback: Automatic screenshot capture and display
  • ๐ŸŽจ Modern UI: Beautiful tabbed interface with dark/light mode support
  • ๐Ÿ“Š Real-time Monitoring: Live logs and status indicators
  • ๐Ÿ”ง Built-in Diagnostics: Comprehensive testing and troubleshooting tools
๐Ÿ–ผ๏ธ Application Interface

The application features a modern, tabbed interface with three main sections:

  1. AI Model Tab: Configure and test AI model connections
  2. Browser Automation Tab: Execute natural language browser commands
  3. Logs Tab: Monitor real-time application activity

Note: To see the application interface, run the app using the instructions below.

๐Ÿš€ Quick Start
Prerequisites
  • Node.js v16+ and npm
  • Microsoft Foundry Local SDK (optional - app includes fallback functionality)
  • Windows/macOS/Linux (cross-platform support)
Installation & Setup
  1. Clone the repository

    git clone <repository-url>
    cd electron-app
    
  2. Install dependencies (automatically installs Playwright browsers)

    npm install
    
  3. Start the application

    npm start
    

That's it! The app will automatically set up everything needed and launch with a beautiful splash screen.

๐Ÿ“‹ How to Use
๐Ÿค– AI Model Testing
  1. Navigate to the AI Model tab
  2. Select a model from the dropdown (if Foundry Local is available)
  3. Enter a prompt and click Submit
  4. View the AI response in the interface
๐ŸŒ Browser Automation
  1. Go to the Browser Automation tab

  2. Try these example commands in the MCP prompt field:

    Basic Navigation:

    Go to microsoft.com and take a screenshot
    

    Complex Interactions:

    Navigate to github.com, search for "playwright", and screenshot the results
    

    Content Extraction:

    Visit wikipedia.org, search for "artificial intelligence", and take a screenshot of the article
    
  3. Click Run MCP Prompt to execute

  4. View screenshots and results in the interface

๐Ÿ”ง Testing & Diagnostics
  • Run MCP Test: Click to run comprehensive browser automation tests
  • Diagnose MCP: Check MCP installation and configuration
  • View Logs: Monitor all application activity in real-time
๐Ÿ› ๏ธ Available Commands
Command Description
npm start Launch the application with auto-setup
npm test Run all automated tests
npm run test:mcp Test Playwright MCP functionality
npm run diagnose:mcp Diagnose MCP installation issues
npm run fix:mcp Reinstall MCP components
npm run package Build distributable packages
๐Ÿ—๏ธ Architecture
Core Components
โ”œโ”€โ”€ main.js              # Electron main process & IPC handling
โ”œโ”€โ”€ renderer.js          # UI logic & event handling
โ”œโ”€โ”€ preload.js          # Secure IPC bridge
โ”œโ”€โ”€ browser-automation.js # Playwright MCP integration
โ”œโ”€โ”€ fallback-mcp.js     # Fallback automation (when MCP unavailable)
โ”œโ”€โ”€ theme.js            # Dark/light mode & UI animations
โ””โ”€โ”€ tests/
    โ”œโ”€โ”€ mcp-test.js     # Comprehensive MCP testing
    โ””โ”€โ”€ find-mcp.js     # MCP diagnostics
UI Structure
โ”œโ”€โ”€ index.html          # Main application layout
โ”œโ”€โ”€ styles.css          # Modern styling & animations
โ”œโ”€โ”€ animation.css       # UI transition effects
โ””โ”€โ”€ splash.html         # Startup splash screen
๐ŸŽจ Features Showcase
๐ŸŒ“ Theming
  • Automatic dark/light mode based on system preferences
  • Manual theme toggle with smooth transitions
  • Consistent color scheme throughout the interface
๐Ÿ“ฑ Responsive Design
  • Tabbed interface for organized content
  • Card-based layout with subtle shadows and rounded corners
  • Responsive controls that adapt to window size
โšก Performance
  • Lazy loading of heavy components
  • Efficient IPC communication between processes
  • Background processing for non-blocking operations
๐Ÿ”’ Security
  • Context isolation enabled in Electron
  • Secure IPC communication via preload scripts
  • Sandboxed renderer process
๐Ÿงช Testing
Automated Tests

Run all tests:

npm test

Test specific functionality:

npm run test:mcp      # Test browser automation
npm run test:browser  # Test basic browser functionality
Manual Testing Examples

Try these commands to test the application:

  1. Simple Navigation Test

    Go to example.com and take a screenshot
    
  2. Search Test

    Navigate to duckduckgo.com, search for "electron apps", take a screenshot
    
  3. Multi-step Test

    Go to github.com, click on "Explore", then take a screenshot of the page
    
๐Ÿšจ Troubleshooting
Common Issues

MCP Not Working?

npm run diagnose:mcp  # Check MCP installation
npm run fix:mcp       # Reinstall MCP components

Browser Won't Launch?

npx playwright install  # Install browser binaries

Connection Issues?

  • Ensure Foundry Local is running (if using AI features)
  • Check firewall settings
  • Verify network connectivity
Getting Help
  1. Check the Logs tab in the application for detailed error messages
  2. Run diagnostics using npm run diagnose:mcp
  3. Check the console output when running from terminal
  4. Review error messages in the application interface
๐Ÿ”ง Advanced Configuration
Custom Model Configuration

Edit the model dropdown options in renderer.js to add your preferred models.

Browser Automation Settings

Modify browser launch options in browser-automation.js for specific requirements.

UI Customization

Update styles.css and animation.css to customize the application appearance.

๐Ÿ“ฆ Building & Distribution

Create distributable packages:

npm run package

This creates platform-specific packages in the dist/ directory:

  • Windows: .exe installer
  • macOS: .dmg disk image
  • Linux: .AppImage portable app
๐Ÿ›ก๏ธ Security & Privacy
  • Local Processing: All AI inference happens locally (no cloud dependency)
  • Secure Automation: Browser automation runs in isolated contexts
  • No Data Collection: Application doesn't collect or transmit user data
  • Open Source: Full source code available for review
๐Ÿ“š Technologies Used
Technology Purpose Version
Electron Desktop app framework ^29.0.0
Playwright Browser automation ^1.52.0
@playwright/mcp Natural language browser control ^0.0.26
Node.js Runtime environment 16+
Microsoft Foundry Local Local AI inference Latest
๐ŸŽฏ Use Cases

This application demonstrates several practical use cases:

  • ๐Ÿงช AI Model Testing: Quick testing of local AI models
  • ๐Ÿ•ท๏ธ Web Scraping: Automated data extraction from websites
  • ๐Ÿง‘โ€๐Ÿ’ป Browser Testing: Automated UI testing with natural language
  • ๐Ÿ“Š Monitoring: Automated website monitoring and screenshot capture
  • ๐ŸŽ“ Education: Learning browser automation and AI integration
  • ๐Ÿš€ Prototyping: Rapid prototyping of automation workflows
๐Ÿ”ฎ Future Enhancements
  • ๐Ÿค– Advanced AI Integration: Support for more AI providers
  • ๐Ÿ“ Script Recording: Record browser actions as reusable scripts
  • ๐Ÿ”„ Workflow Builder: Visual workflow creation interface
  • โ˜๏ธ Cloud Integration: Optional cloud AI model support
  • ๐Ÿ“ฑ Mobile Support: Electron-based mobile app version
๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

๐Ÿ†˜ Support

If you encounter any issues or have questions:

  1. Check the troubleshooting section above
  2. Run the built-in diagnostics (npm run diagnose:mcp)
  3. Review the application logs in the Logs tab
  4. Open an issue on GitHub with detailed information

Built with โค๏ธ using Electron, Playwright, and Microsoft Foundry Local SDK

Author Information
Lee Stott

Principal Cloud Advocate Manager, Microsoft, Commerce and Ecosystems Honorary Associate Professor University College London

MicrosoftWorldWide

740

Followers

161

Repositories

4

Gists

0

Total Contributions