jdbg
Agent-friendly Java debugging from a Rust CLI.
Wraps the JDK jdb with prompt-aware control, persistent sessions,
an optional JDI sidecar backend, structured output, and native MCP tools for Claude Code,
Codex, OpenCode, Pi, and humans.
Demo
Quick Start
Why jdbg
Agent Setup
Commands
Architecture
Debug Java without Bash glue
jdbg gives coding agents a stable debugging surface for Java:
no sleeps, no temp files, no shell command injection surface, and no one-shot
process that forgets the session.
- Prompt-aware: reads
jdb until the prompt or stop event is complete.
- Stateful: one background daemon keeps sessions alive across calls.
- Agent-native: exposes the same debugger through CLI and MCP tools.
- JDI-capable: optional sidecar backend for structured inspect, expression eval, mutation, and force return.
|
Built for agent workflows
| Claude Code | MCP tools plus skill | | Codex | MCP server config plus skill | | OpenCode | Local MCP config plus skill | | Pi | CLI skill |
|
Demo
Quick Start
Install
The installer downloads the right release artifact for your OS and adds jdbg to your user-level PATH.
Open a new terminal afterwards so the command is visible.
Windows:
powershell -ExecutionPolicy Bypass -c "irm https://github.com/PieceOfFall/jdbg/releases/latest/download/java-agent-debugger-installer.ps1 | iex"
macOS / Linux:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/PieceOfFall/jdbg/releases/latest/download/java-agent-debugger-installer.sh | sh
Already have Rust? Install with cargo or build from source.
# Install to ~/.cargo/bin/jdbg
cargo install --git https://github.com/PieceOfFall/jdbg.git
# Build from source
git clone https://github.com/PieceOfFall/jdbg.git
cd jdbg
# Source builds need JDK 17+ for the Gradle sidecar build.
cargo build --release
Register With Your Agent
jdbg setup
Use non-interactive setup when provisioning machines:
jdbg setup --target claude,codex,opencode,pi --yes
jdbg setup --backend jdi --target codex --yes
jdbg setup --target codex --print
jdbg setup --target opencode --print
jdbg setup --target pi --print
Debug Something
# Compile with debug info for locals and line breakpoints
javac -g Main.java
# Launch a debug session. The daemon starts automatically.
jdbg launch Main --classpath .
# Set a breakpoint and run
jdbg break-at Main 9
jdbg run
# Inspect the stopped program
jdbg locals
jdbg where
jdbg print myVar
# Move execution forward
jdbg step
jdbg cont
# Clean up
jdbg kill
jdbg daemon stop
In Claude Code, Codex, or OpenCode, ask the agent to debug the Java program.
It drives the same flow through mcp__jdbg__* tools. In Pi, the installed skill drives the jdbg CLI.
Why jdbg