Skip to content

Comments

MCP Server for the gym#337

Merged
ollmer merged 24 commits intomainfrom
mcp_server
Apr 22, 2025
Merged

MCP Server for the gym#337
ollmer merged 24 commits intomainfrom
mcp_server

Conversation

@ollmer
Copy link
Collaborator

@ollmer ollmer commented Apr 15, 2025

MCP Server that wraps up the BrowserGym gym, could be configured for any subset of task actions.
Short docs:

python browsergym/core/src/browsergym/utils/mcp_server.py -h
usage: python browsergym/core/src/browsergym/utils/mcp_server.py [options]

BrowserGym MCP server

options:
  -h, --help            show this help message and exit
  -t TASK_ID, --task_id TASK_ID
                        Task ID to run (default: browsergym/openended)
  -l, --headless        Run in headless mode (default: False)
  -r RECORD_VIDEO_DIR, --record_video_dir RECORD_VIDEO_DIR
                        Directory to save recorded videos (default: None)
  --demo_mode {off,default,all_blue,only_visible_elements}
                        Demo mode for action set (default: off)
  --timeout_ms TIMEOUT_MS
                        Timeout in milliseconds for each step (default: 10000)
  --subset {chat,infeas,bid,coord,nav,tab,miniwob_all,miniwob_shi17,miniwob_liu18,miniwob_humphreys22,webarena,visualwebarena,workarena,workarena++,weblinx,assistantbench}
                        Subset of actions to use (default: workarena++)
  --validate_actions VALIDATE_ACTIONS [VALIDATE_ACTIONS ...]
                        Names of actions for which validation should be performed (default: ['click', 'goto'])

To run Dev UI: mcp dev browsergym/core/src/browsergym/utils/mcp_server.py -e browsergym/core/

How to debug and run tool calls manually with web UI:

  1. run mcp dev browsergym/core/src/browsergym/utils/mcp_server.py -e browsergym/core/
  2. open http://127.0.0.1:6274 in browser
  3. click Connect on the left panel.

How to run only the server with a visible browser:

python browsergym/core/src/browsergym/utils/mcp_server.py

Description by Korbit AI

What change is being made?

Introduce an MCP server for BrowserGym, enhancing its functionality to support remote procedural calls and facilitating environment interaction through a command-line interface, with necessary modifications to the project's configuration files to accommodate this feature.

Why are these changes being made?

These changes are being made to enable BrowserGym to operate as a server, handling web automation tasks remotely via MCP, which aligns with the goals of increasing the framework's flexibility and interoperability in automation environments. The addition of a CLI option enhances user experience by allowing more granular control over task execution parameters.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

@korbit-ai
Copy link

korbit-ai bot commented Apr 15, 2025

Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment /korbit-review.

Your admin can change your review schedule in the Korbit Console

@ollmer ollmer changed the title [WIP] basic mcp server that exposes all tools from the configured action set MCP Server for the gym Apr 16, 2025
@ollmer ollmer marked this pull request as ready for review April 16, 2025 10:15
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Readability Missing Return Type Hints ▹ view ✅ Fix detected
Readability Critical Method Missing Type Hints ▹ view ✅ Fix detected
Readability Direct Access to Internal Implementation ▹ view ✅ Fix detected
Performance Redundant Dictionary Operations ▹ view ✅ Fix detected
Error Handling Over-broad exception handling ▹ view
Design Global Configuration State ▹ view ✅ Fix detected
Files scanned
File Path Reviewed
browsergym/core/src/browsergym/utils/mcp_server.py
browsergym/core/src/browsergym/core/env.py

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Current Korbit Configuration

General Settings
Setting Value
Review Schedule Automatic excluding drafts
Max Issue Count 10
Automatic PR Descriptions
Issue Categories
Category Enabled
Documentation
Logging
Error Handling
Readability
Design
Performance
Security
Functionality

Feedback and Support

@ollmer ollmer requested a review from optimass April 16, 2025 10:37
Copy link
Collaborator

@recursix recursix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool. Let's dicuss further what's left to do for broader integration i.e what are the current limitations, how can it be used in AgentLab (probably need to automatically spawn a server per job).

Copy link
Collaborator

@recursix recursix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All clean. Shouldn't break anything.

@ollmer ollmer merged commit 544bf9f into main Apr 22, 2025
13 checks passed
@ollmer ollmer deleted the mcp_server branch April 22, 2025 10:19
layahaasini pushed a commit to layahaasini/BrowserGym that referenced this pull request Nov 21, 2025
* basic MCP server that exposes all tools from the action set
* separate pre and post-processing of a gym step from the step execution
* MCP server wraps every function into an async wrapper that calls the gym and sets up required global vars
---------

Co-authored-by: ThibaultLSDC <thibault.de.chezelles@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants