About
bevy_brp_extras does two things
- Configures your app for bevy remote protocol (BRP)
- Adds additional methods that can be used with BRP
Supported Bevy Versions
| bevy | bevy_brp_extras |
|---|---|
| 0.18 | 0.18.0-0.18.1 |
| 0.17 | 0.17.0-0.17.2 |
| 0.16 | 0.1 - 0.2 |
Features
Adds the following Bevvy Remote Protocol methods:
brp_extras/screenshot- Capture screenshots of the primary windowbrp_extras/shutdown- Gracefully shutdown the applicationbrp_extras/send_keys- Send keyboard input to the applicationbrp_extras/set_window_title- Change the primary window title
Usage
Add to your Cargo.toml:
[]
= "0.18.0"
Add the plugin to your Bevy app
use *;
use BrpExtrasPlugin;
Custom Port
You can specify a custom port for the BRP server:
.add_plugins
Alternatively, you can set the port at runtime using the BRP_EXTRAS_PORT environment variable:
BRP_EXTRAS_PORT=8080
Port priority: BRP_EXTRAS_PORT environment variable > with_port() > default port (15702)
BRP Method Details
Screenshot
- Method:
brp_extras/screenshot - Parameters:
path(string, required): File path where the screenshot should be saved
- Returns: Success status with the absolute path where the screenshot will be saved
Important: Your Bevy app must have the png feature enabled for screenshots to work:
[]
= { = "0.18", = ["png"] }
Without this feature, screenshot files will be created but will be 0 bytes as Bevy cannot encode the image data.
Note: If you're not using this with bevy_brp_mcp, you'll need to tell your AI agent that this method requires a path parameter, or let it discover this by trying the method and getting an error message.
Shutdown
- Method:
brp_extras/shutdown - Parameters: None
- Returns: Success status with shutdown confirmation
Send Keys
- Method:
brp_extras/send_keys - Parameters:
keys(array of strings, required): Key codes to send (e.g.,["KeyA", "Space", "Enter"])duration_ms(number, optional): How long to hold keys before releasing in milliseconds (default: 100, max: 60000)
- Returns: Success status with the keys sent and duration used
Simulates keyboard input by sending press and release events for the specified keys. Keys are pressed simultaneously and held for the specified duration before being released.
Example:
# Send "hi" by pressing H and I keys
# Hold space key for 2 seconds
Set Window Title
- Method:
brp_extras/set_window_title - Parameters:
title(string, required): The new title for the primary window
- Returns: Success status with the old and new window titles
Changes the title of the primary window.
Example:
Integration with bevy_brp_mcp
This crate is designed to work seamlessly with bevy_brp_mcp, which provides a Model Context Protocol (MCP) server for controlling Bevy apps. When both are used together:
- Add
BrpExtrasPluginto your Bevy app - Use
bevy_brp_mcpwith your AI coding assistant - The additional methods will be automatically discovered and made available in the MCP server so you won't have to manually implement or execute (as with the curl examples above)
License
Dual-licensed under either:
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option.