Bevy Debugger MCP Server
A powerful Model Context Protocol (MCP) server that enables AI-assisted debugging of Bevy games through Claude Code. Debug your game state, analyze performance, and test hypotheses with natural language commands.
โจ Features
- ๐ Real-time Observation: Monitor entities, components, and resources as your game runs
- ๐งช Smart Experimentation: Test game behavior changes with automatic rollback
- ๐ Performance Analysis: Identify bottlenecks and optimize game performance
- ๐จ Anomaly Detection: Automatically spot unusual patterns in game behavior
- ๐น Session Recording: Record and replay debugging sessions for analysis
- ๐ก๏ธ Error Recovery: Robust error handling with automatic diagnostics
๐ Quick Start
Prerequisites
- Rust 1.70+ and Cargo
- Claude Code CLI
- A Bevy game with RemotePlugin enabled
Installation
# Clone and build
# Install (macOS/Linux)
# Setup Claude Code integration
Setup Your Bevy Game
Add the RemotePlugin to your Bevy app:
use *;
use RemotePlugin;
# Cargo.toml
[]
= { = "0.14", = ["remote"] }
Start Debugging
- Run your Bevy game:
cargo run - Open Claude Code in your project directory
- Start debugging: Try commands like:
- "Show me all entities in the game"
- "Monitor the player's health component"
- "Test what happens when I spawn 100 enemies"
- "Record this gameplay session for analysis"
๐ฎ Example Usage
Human: My player is randomly teleporting. Can you help debug this?
Claude: I'll help investigate the teleportation issue. Let me examine the player's Transform component and movement system.
[Uses MCP tools to observe player entity, analyze movement patterns, and identify the bug]
I found the issue! The player's position is being reset every frame due to a conflicting movement system. The `PlayerController` and `PhysicsSystem` are both trying to control the transform simultaneously.
๐ ๏ธ Configuration
The server uses environment variables for configuration:
# Bevy Remote Protocol host
# Bevy Remote Protocol port
# MCP server port (not used in stdio mode)
# Logging level
๐ Project Structure
bevy_debugger_mcp/
โโโ src/
โ โโโ main.rs # Entry point with stdio/TCP transport
โ โโโ mcp_server.rs # MCP protocol implementation
โ โโโ brp_client.rs # Bevy Remote Protocol client
โ โโโ tools/ # Debugging tool implementations
โ โ โโโ observe.rs # Entity/component observation
โ โ โโโ experiment.rs # Game state experimentation
โ โ โโโ stress.rs # Performance stress testing
โ โ โโโ ...
โ โโโ ...
โโโ scripts/ # Installation and management scripts
โโโ docs/ # Documentation
โโโ tests/ # Integration tests
โโโ README.md
๐งช Available Tools
| Tool | Description |
|---|---|
observe |
Monitor game entities, components, and resources |
experiment |
Test changes to game state with automatic rollback |
stress |
Performance testing and bottleneck identification |
anomaly |
Detect unusual patterns in game behavior |
replay |
Record and replay debugging sessions |
orchestrate |
Chain multiple debugging operations |
๐ฅ๏ธ Platform Support
| Platform | Installation | Status |
|---|---|---|
| macOS | ./scripts/install.sh |
โ Full support with LaunchAgent service |
| Linux | ./scripts/install.sh |
โ Full support |
| Windows | Manual build | โ ๏ธ Basic support (help wanted) |
macOS Service Management
On macOS, the debugger can run as a background service:
# Service management
๐ค Contributing
We welcome contributions! Please see our contribution guidelines.
# Development setup
๐ Documentation
- Usage Guide - Detailed feature documentation
- Claude Prompts - Effective prompting strategies
- macOS Service Setup - Background service configuration
๐ Security & Privacy
- All communication happens locally between your game and Claude Code
- No game data is transmitted externally
- Sensitive information is automatically redacted from logs
- Debug recordings are stored locally and encrypted
๐ License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
๐ Acknowledgments
- Built for the Bevy Engine community
- Powered by Anthropic's MCP
- Inspired by the need for better game debugging tools
Questions? Open an issue or join the discussion in Bevy's Discord.