Repository navigation
Add Selenium Grid tools and saved Grids - #3
Merged
Merged
Conversation
Agents that run browsers on a Selenium Grid had no way to see what the Grid was doing, and had to be told the Grid URL on every start. Add five selenium_grid_* tools to the default list: use, status, sessions, queue and bug_report. They only read the Grid, over /status, GraphQL and the session queue. Ending sessions, draining or removing nodes and clearing the queue are left to the person, and no tool guesses which node, session or request is meant. selenium_grid_use saves a Grid the person names to a config file (--config, SELENIUM_MCP_CONFIG, ./.selenium-mcp.json, then the user's config) as the default, so they are not asked again. Browsers then start on it. --grid now takes a saved Grid's name as well as a URL. No credentials are saved; a Grid is assumed to sit behind its own network or auth. Browsers started on a Grid are named selenium-mcp, so people can tell them apart in the Grid UI. CI runs the Grid tools against a real hub with two nodes.
Brings in the --caps tool groups. The Grid tools stay in the default list; the optional groups are listed after them in the README.
Brings in the retirement of browser_install. The default list is now 19 browser tools plus the 5 Grid tools, 24 in all, under the cap of 25.
diemol
approved these changes
Nov 25, 2026
diemol
left a comment
Member
There was a problem hiding this comment.
Just a small comment on the CI workflow.
Aside of that, I got the impression that the tool implementation is wrapping the API's response and mapping it to a format that could be usable. I'm just wondering if we are overdoing it or if we need to fix something in the grid so the info comes here a bit more clean. It seems like a bit of duplicate code and duplicate work. It is not a showstopper. I think we should do this initial version like this, but let's just pay attention to see if we need to refactor this code in future iterations.
The CI job pinned the server jar to 4.52.0. Download the newest release instead so the Grid tests follow what people run, as asked in review.
diemol
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by David · project thread
🔗 Related Issues
Phase 1 of the Grid operations MCP plan.
💥 What does this PR do?
Agents that run browsers on a Selenium Grid couldn't see what the Grid was doing, and had to be given the Grid URL on every start. This PR fixes both.
Five
selenium_grid_*tools, in the default list:selenium_grid_useselenium_grid_statusnode, one node in detailselenium_grid_sessionsselenium_grid_queueselenium_grid_bug_report/status, GraphQL and the session queue. Ending sessions, draining or removing nodes and clearing the queue are left to the person. Tools never guess which node, session or request is meant, and the server instructions say so too.--config,SELENIUM_MCP_CONFIG,./.selenium-mcp.jsonand~/.config/selenium-mcp/config.json, and saves back to the same file. Browsers start on the saved default Grid.--gridnow takes a saved name as well as a URL, and still wins for that run.--gridstill works, but only for that run.se:name: selenium-mcp, so they show up named in the Grid UI.🔧 Implementation Notes
selenium_grid_status(nodeargument) rather than being a sixth tool, to keep a free slot under the 25-tool default cap thattools_test.jsenforces. With browser_install retired (Retire the browser_install tool #6), the default list is 19 browser tools plus these 5, so 24. The tool list is well inside the 4,000-token budget.charset=utf-8;GridApisends that.--capsgroups are untouched.💡 Additional Considerations
/statusand GraphQL. The queue hint compares browser names only, and says so.🔄 Types of changes
🧪 Testing
npm run lintpasses.test/unit/grid_test.jscovers config file lookup order, saving, validation and errors, the formatters, andGridApierrors. The formatter tests run against/status, GraphQL and queue answers recorded from a real 4.52 hub with two nodes, four sessions and two queued requests.test/e2e/grid_test.jsstarts a real hub and two nodes fromSELENIUM_MCP_TEST_SERVER_JAR, and is skipped without it. It saves the Grid, reads status and node details, and starts the browser on the Grid. That browser start exercises BiDi through Grid. It also lists theselenium-mcpsession, the empty queue and the bug report. 5/5 pass locally against Grid 4.52.0.--selenium-manager trueon the nodes. Green on Node 22 and 24 after merging trunk (Retire the browser_install tool #6).snapshot_test.jsneed the nightlyselenium-webdriver, which needs a GitHub Packages token this environment doesn't have; CI runs them. The e2e tool count is now 24.🤖 AI assistance
Generated by Claude Code