bevy_debugger_mcp 0.1.0

AI-assisted debugging for Bevy games through Claude Code using Model Context Protocol
Documentation

Bevy Debugger MCP Server

Build Status License: GPL v3 Rust Bevy

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
git clone https://github.com/ladvien/bevy_debugger_mcp.git
cd bevy_debugger_mcp
cargo build --release

# Install (macOS/Linux)
./scripts/install.sh

# Setup Claude Code integration
./scripts/setup-claude.sh

Setup Your Bevy Game

Add the RemotePlugin to your Bevy app:

use bevy::prelude::*;
use bevy::remote::RemotePlugin;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(RemotePlugin::default()) // Enable remote debugging
        .run();
}
# Cargo.toml
[dependencies]
bevy = { version = "0.14", features = ["remote"] }

Start Debugging

  1. Run your Bevy game: cargo run
  2. Open Claude Code in your project directory
  3. 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:

export BEVY_BRP_HOST=localhost    # Bevy Remote Protocol host
export BEVY_BRP_PORT=15702        # Bevy Remote Protocol port  
export MCP_PORT=3000              # MCP server port (not used in stdio mode)
export RUST_LOG=info              # 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
./scripts/service.sh start      # Start background service
./scripts/service.sh stop       # Stop service
./scripts/service.sh status     # Check status
./scripts/service.sh logs       # View logs

๐Ÿค Contributing

We welcome contributions! Please see our contribution guidelines.

# Development setup
git clone https://github.com/ladvien/bevy_debugger_mcp.git
cd bevy_debugger_mcp
cargo test                      # Run tests
cargo fmt                       # Format code
cargo clippy                    # Lint code

๐Ÿ“š Documentation

๐Ÿ”’ 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


Questions? Open an issue or join the discussion in Bevy's Discord.