Skip to main content
Glama

Firefox MCP Server

by JediLuke
README-multi.md6.28 kB
# Firefox Multi-Tab MCP Server An enhanced MCP server that enables control of multiple Firefox browser tabs simultaneously with isolated sessions. Each tab has its own cookies, storage, and session data - perfect for testing multiplayer applications and scenarios requiring multiple user sessions. ## 🌟 Key Features - **Multiple Isolated Sessions**: Each tab runs in its own browser context with separate cookies and storage - **Simultaneous Control**: Control all tabs from within Cline without manual browser window management - **Perfect for Multiplayer Testing**: Test multiplayer games/apps with multiple users from one interface - **Backward Compatible**: All existing tools work, plus new multi-tab capabilities ## 🛠️ Setup The server is automatically configured in your MCP settings. Both versions are available: - **firefox-control**: Multi-tab server (default) - `index-multi.js` - **firefox-control-single**: Original single-tab server - `index.js` ## 📋 New Tools ### Core Multi-Tab Management #### `launch_firefox_multi` Launch Firefox with multi-tab support ```javascript // Launch browser launch_firefox_multi({ headless: false }) ``` #### `create_tab` Create a new tab with isolated session ```javascript // Create tab for host player create_tab({ tabId: "host", url: "http://localhost:4000/stellar-bonds" }) // Create tab for player 1 create_tab({ tabId: "player1", url: "http://localhost:4000/stellar-bonds" }) ``` #### `list_tabs` List all active tabs ```javascript list_tabs() // Returns: Active tabs (2): // - host: http://localhost:4000/stellar-bonds (active) // - player1: http://localhost:4000/stellar-bonds ``` #### `close_tab` Close a specific tab ```javascript close_tab({ tabId: "player1" }) ``` #### `set_active_tab` Set which tab receives commands when tabId is not specified ```javascript set_active_tab({ tabId: "host" }) ``` ### Enhanced Existing Tools All existing tools now accept an optional `tabId` parameter: ```javascript // Click in specific tab click({ tabId: "host", selector: "button.create-game" }) // Type in specific tab type_text({ tabId: "player1", selector: "input.game-code", text: "AB12" }) // Take screenshot of specific tab screenshot({ tabId: "host", path: "host_screenshot.png" }) // Get page content from specific tab get_page_text({ tabId: "player1", selector: ".lobby-players" }) ``` ## 🎮 Multiplayer Testing Example Here's how to test a multiplayer game with multiple isolated sessions: ```javascript // 1. Launch multi-tab browser launch_firefox_multi() // 2. Create tabs for different players (each with isolated cookies) create_tab({ tabId: "host", url: "http://localhost:4000/stellar-bonds" }) create_tab({ tabId: "player1", url: "http://localhost:4000/stellar-bonds" }) create_tab({ tabId: "player2", url: "http://localhost:4000/stellar-bonds" }) // 3. Host creates game click({ tabId: "host", selector: "button.create-game" }) wait_for_element({ tabId: "host", selector: ".game-code" }) // 4. Get game code from host const gameCodeText = get_page_text({ tabId: "host", selector: ".game-code" }) const gameCode = gameCodeText.match(/([A-Z0-9]{4})/)[1] // 5. Players join game click({ tabId: "player1", selector: "button.join-game" }) type_text({ tabId: "player1", selector: "input.game-code", text: gameCode }) click({ tabId: "player1", selector: "button.submit" }) click({ tabId: "player2", selector: "button.join-game" }) type_text({ tabId: "player2", selector: "input.game-code", text: gameCode }) click({ tabId: "player2", selector: "button.submit" }) // 6. Verify all players see each other get_page_text({ tabId: "host", selector: ".player-list" }) get_page_text({ tabId: "player1", selector: ".player-list" }) get_page_text({ tabId: "player2", selector: ".player-list" }) // 7. Take screenshots of all tabs screenshot({ tabId: "host", path: "host_lobby.png" }) screenshot({ tabId: "player1", path: "player1_lobby.png" }) screenshot({ tabId: "player2", path: "player2_lobby.png" }) ``` ## 🔍 Session Isolation Each tab created with `create_tab` gets its own browser context, which means: - ✅ **Separate Cookies**: Each tab has its own cookie jar - ✅ **Isolated Storage**: LocalStorage, SessionStorage are separate - ✅ **Independent Sessions**: Each tab represents a different user - ✅ **Separate Cache**: No shared cached resources - ✅ **Individual History**: Each tab has its own navigation history ## 🚀 Benefits for Testing ### Before (Single Tab) - Only one user session at a time - Manual browser window management required - Difficult to test real-time multiplayer features - No true session isolation ### After (Multi-Tab) - Multiple user sessions simultaneously - All controlled from Cline - Perfect for testing multiplayer scenarios - True session isolation with separate cookies ## 📖 Usage Tips 1. **Always specify tabId** for clarity when working with multiple tabs 2. **Use descriptive tab names** like "host", "player1", "admin" 3. **Take screenshots** of each tab to verify behavior 4. **Use list_tabs** to see all active tabs and their URLs 5. **Close unused tabs** to free up resources ## 🔧 Migration from Single-Tab The multi-tab server is backward compatible. If you don't specify `tabId`, it uses the active tab (first tab created by default). ### Old way: ```javascript launch_firefox({ url: "http://localhost:4000" }) click({ selector: "button" }) ``` ### New way (same result): ```javascript launch_firefox_multi() create_tab({ tabId: "main", url: "http://localhost:4000" }) click({ selector: "button" }) // Uses active tab // or explicitly: click({ tabId: "main", selector: "button" }) ``` ## 🐛 Debugging Multi-Session Issues When testing multiplayer applications: 1. **Check each tab individually** - use `get_page_text` with specific tabIds 2. **Verify session isolation** - ensure different tabs show different user states 3. **Monitor real-time updates** - check if changes in one tab appear in others 4. **Take comparative screenshots** - visual comparison across tabs 5. **Check browser console** - use `execute_script` to check for errors in each tab This multi-tab server transforms multiplayer testing from a manual, error-prone process into an automated, reliable workflow.

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/JediLuke/firefox-mcp-server'

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