Expand description
§Bevy Debugger MCP
AI-assisted debugging for Bevy games through Claude Code using Model Context Protocol.
This crate provides a comprehensive debugging toolkit for Bevy games, enabling natural language interaction with game state through Claude Code. It bridges the gap between AI assistance and game development by offering intelligent observation, experimentation, and analysis capabilities.
§Quick Start
- Add BRP to your Bevy game:
[dependencies]
bevy = { version = "0.12", features = ["bevy_remote_protocol"] }- Enable BRP in your game:
use bevy::prelude::*;
use bevy::remote::RemotePlugin;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(RemotePlugin::default())
.run();
}- Install and configure the MCP server:
cargo install bevy_debugger_mcp
bevy-debugger-mcp --help- Configure Claude Code:
{
"mcpServers": {
"bevy-debugger-mcp": {
"command": "bevy-debugger-mcp",
"args": [],
"type": "stdio"
}
}
}§Features
- 🔍 Natural Language Queries: Ask about your game state in plain English
- 🧪 Controlled Experiments: Test hypotheses with systematic variations
- 📊 Performance Analysis: Monitor and analyze game performance in real-time
- ⏱️ Time-Travel Debugging: Record, replay, and branch timelines
- 🚨 Anomaly Detection: Automatically detect unusual patterns in game behavior
- 📈 Stress Testing: Systematically test your game under various loads
- 🔧 Tool Orchestration: Chain debugging operations into complex workflows
§Core Modules
§Observation and Query
query_parser- Natural language to game queriessemantic_analyzer- Semantic understanding of game conceptsbrp_client- Bevy Remote Protocol communication
§Experimentation and Testing
experiment_system- Controlled game state experimentshypothesis_system- Property-based testing for gamesstress_test_system- Systematic stress testing
§Time and State Management
recording_system- Game state recording and persistenceplayback_system- Deterministic replay capabilitiestimeline_branching- Multi-timeline debugging with branchingcheckpoint- Save/restore debugging sessions
§Analysis and Monitoring
anomaly_detector- Pattern recognition for unusual behaviorstate_diff- Intelligent state comparison and diffingdiagnostics- System health monitoring and reporting
§Infrastructure
mcp_server- Model Context Protocol server implementationtool_orchestration- Complex debugging workflow coordinationerror- Comprehensive error handling and recoveryconfig- Configuration management
§Example Usage
use bevy_debugger_mcp::prelude::*;
// Connect to your Bevy game
let mut client = BrpClient::connect("ws://localhost:15702").await?;
// Parse natural language queries
let parser = RegexQueryParser::new();
let request = parser.parse("find entities with Transform and Velocity")?;
// Execute the query
let response = client.send_request(request).await?;
println!("Found entities: {:?}", response);§Architecture
The system follows a modular architecture:
Claude Code ←→ MCP Protocol ←→ MCP Server ←→ BRP Protocol ←→ Bevy Game
↓
Tool Modules
(observe, experiment,
stress, replay, etc.)§Error Handling
All operations return Result<T, Error> types. The system includes
comprehensive error recovery with automatic reconnection, dead letter queues for
failed operations, and checkpoint/restore capabilities.
Modules§
- anomaly_
detector - brp_
client - brp_
command_ handler - brp_
integration - brp_
messages - checkpoint
- command_
cache - compile_
opts - config
- dead_
letter_ queue - debug_
brp_ handler - debug_
command_ processor - diagnostics
- entity_
inspector - error
- experiment_
system - hot_
reload - hypothesis_
system - issue_
detector - issue_
detector_ processor - lazy_
init - mcp_
server - memory_
profiler - memory_
profiler_ processor - pattern_
learning - performance_
budget - performance_
budget_ processor - playback_
system - prelude
- Common imports for typical usage
- profiling
- query_
builder - query_
builder_ processor - query_
parser - recording_
system - resource_
manager - response_
pool - semantic_
analyzer - session_
manager - session_
processor - state_
diff - stress_
test_ system - suggestion_
engine - system_
profiler - system_
profiler_ processor - timeline_
branching - tool_
orchestration - tools
- visual_
debug_ overlay - visual_
debug_ overlay_ processor - workflow_
automation
Macros§
- concat_
strs - Compile-time string concatenation for efficiency
- debug_
only - Zero-cost abstraction for debug-only operations
- fast_
path - Fast path for common cases with minimal overhead
- feature_
enabled - Zero-overhead feature flag checks
- feature_
stub - No-op implementations for disabled features
- if_
optimized - Conditional compilation based on optimization level
- likely_
if - Branch prediction hints for hot paths
- profile_
async_ block - Async version of profile_block macro
- profile_
block - Macro for easy profiling of code blocks
- release_
only - Zero-cost abstraction for release-only operations
- static_
assert_ config - Compile-time assertions for configuration validation
- unlikely_
if - with_
feature - Conditional compilation for different feature sets
- without_
feature