karellen-jdb-mcp
OfficialClick on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@karellen-jdb-mcpattach to JVM process 54321 and inspect deadlocked threads"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server for JDB Java Debugging (karellen-jdb-mcp)
Overview
karellen-jdb-mcp is an MCP (Model Context Protocol)
server that enables any MCP-compliant LLM client to use JDB
(the Java Debugger) for debugging JVM processes. The LLM can attach to a running JVM,
set breakpoints, step through code, evaluate expressions, inspect threads, and analyze
concurrency issues, all through structured JSON tool calls over the JDWP protocol.
Requirements
Java Development Kit (JDK) with
jdbon PATH (JDK 8 through 24+ supported)Python >= 3.10
Works on Linux, macOS, and Windows (anywhere JDB runs)
Installing a JDK
Fedora / RHEL / CentOS:
sudo dnf install java-21-openjdk-develUbuntu / Debian:
sudo apt install openjdk-21-jdkmacOS (Homebrew):
brew install openjdk@21Verify the setup
jdb -versionThis should print something like This is jdb version 21.0.4.
Installation
pip install karellen-jdb-mcpOr with pipx for an isolated environment:
pipx install karellen-jdb-mcpClaude Code Integration
Claude Code plugin (recommended)
The plugin automatically configures the MCP server and includes:
Exception detection hook that suggests JDB when a Bash command output contains Java exception stack traces (
Exception in thread,NullPointerException, etc.)/karellen-jdb-mcp:jdb-debugskill that walks through the full launch-attach-debug workflow step by step, with build-tool-specific JDWP stanzasjdb-investigatoragent that Claude can spawn to autonomously investigate Java exceptions, deadlocks, and logic bugs using JDB
From the Karellen plugins marketplace:
claude plugin marketplace add karellen/claude-plugins
claude plugin install karellen-jdb-mcp@karellen-pluginsOr from the official Anthropic marketplace (if accepted):
claude plugin install karellen-jdb-mcp@claude-plugins-officialOr load directly from a local checkout for testing:
claude --plugin-dir /path/to/karellen-jdb-mcpManual MCP server configuration
If you prefer not to use the plugin, you can configure the MCP server directly. This gives you the MCP tools but not the skill, agent, or exception detection hook.
Using the CLI:
claude mcp add --transport stdio karellen-jdb-mcp -- karellen-jdb-mcpOr manually add to ~/.claude.json (user scope) or .mcp.json in your project root
(project scope, shared via version control):
{
"mcpServers": {
"karellen-jdb-mcp": {
"type": "stdio",
"command": "karellen-jdb-mcp"
}
}
}If installed with pipx:
claude mcp add --transport stdio karellen-jdb-mcp -- pipx run karellen-jdb-mcpor manually:
{
"mcpServers": {
"karellen-jdb-mcp": {
"type": "stdio",
"command": "pipx",
"args": ["run", "karellen-jdb-mcp"]
}
}
}Auto-approve jdb tools
By default Claude Code will prompt for confirmation before each jdb_* tool call.
You can approve individually by selecting "Yes, and don't ask again" when prompted.
To auto-approve all tools upfront, add a permission rule to your user settings
(~/.claude/settings.json):
{
"permissions": {
"allow": [
"mcp__plugin_karellen-jdb-mcp_karellen-jdb-mcp__*",
"mcp__karellen-jdb-mcp__*"
]
}
}The first rule covers plugin-loaded tools, the second covers manual MCP configuration.
Or for a project-scoped setting, add the same rule to .claude/settings.json in your
project root (this file can be committed to version control so all team members get it).
Quick Start
With jdb_launch (recommended)
Launch the JVM with ${JDB_PORT} substitution — a random free port is allocated:
jdb_launch(["java", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:${JDB_PORT}",
"-cp", "target/classes", "com.example.Main"])Connect (port auto-resolves when there's one launched process):
jdb_connect(wait_timeout=30)Debug:
jdb_breakpoint_set("com.example.Main:42")
jdb_run()
jdb_where()
jdb_locals()Clean up:
jdb_disconnect()
jdb_launch_stop(port=<port>)With a manually started JVM
Start the JVM yourself with JDWP on a known port, then connect:
jdb_connect(port=5005, wait_timeout=30)Available Tools
Process Launch
Tool | Description |
| Launch a JVM with JDWP on a random port. |
| List all launched JVM processes with status. |
| Get status of a launched process by port. |
| Stop a launched process by port. |
Session Lifecycle
Tool | Description |
| Attach to a running JVM via JDWP. Auto-resolves port from single launched process, or defaults to 5005. |
| Disconnect and clean up. Port optional if only one session active. |
| List all active debug sessions with port, connection status, and JDK version. |
| Get JDB version info and available features. |
Execution Control
Tool | Description |
| Start execution of the application's main class. Returns immediately once execution resumes. |
| Continue execution. Returns immediately once the JVM resumes (fire-and-forget). Returns stop event if a breakpoint/exception is hit within |
| Step into (enter method calls). Returns stop event on completion or returns immediately if execution resumes. |
| Step over (skip method calls). Same return behavior as step. |
| Step out (run until current method returns). Same return behavior as step. |
| Wait for a stop event after |
Breakpoints
Tool | Description |
| Set breakpoint at class:line or class.method. Supports thread filters and suspend policy on JDK 13+. |
| Clear a breakpoint. |
| List all breakpoints. |
| Break on exception (caught/uncaught/all). Supports wildcard patterns. |
| Cancel an exception breakpoint. |
Watchpoints
Tool | Description |
| Watch field access/modifications. |
| Remove a field watchpoint. |
Thread Management
Tool | Description |
| List all threads by group with status. |
| Set default thread for subsequent commands. |
| Suspend threads (all or specific). |
| Resume threads (all or specific). |
Stack Navigation
Tool | Description |
| Get call stack (stack trace). Use |
| Move up the call stack (toward caller). |
| Move down the call stack (toward callee). |
State Inspection
Tool | Description |
| Evaluate Java expression (fields, locals, method calls, arithmetic). |
| Dump object showing all fields (static and instance). |
| Evaluate expression (alias for print). |
| Assign value to variable, field, or array element. |
| List local variables with values. |
Class Introspection
Tool | Description |
| List all loaded classes. |
| Show class details (superclass, interfaces). |
| List class methods. |
| List class fields. |
Source
Tool | Description |
| List source code at current position or specified location. |
| Display or change source path for .java files. |
| Print classpath info from target JVM. |
Concurrency Analysis
Tool | Description |
| Object lock/monitor info (owner thread, waiting threads). |
| Thread lock info (owned monitors, lock being waited on). |
Frame Manipulation
Tool | Description |
| Pop current frame (return to caller, allows re-execution). |
| Re-enter current method from the beginning. |
Tracing
Tool | Description |
| Trace method entries/exits (optionally per-thread). |
| Stop tracing. |
Monitors (Auto-execute)
Tool | Description |
| Auto-execute a command on every stop (e.g. |
| List active monitors. |
| Remove a monitor. |
Configuration
Tool | Description |
| Set/display step exclusion filter (skip library classes when stepping). |
Note: All debugging tools accept an optional port parameter. When only one session
is active, it auto-resolves. When multiple sessions are active, port is required.
Configuration
Timeouts
All timeouts are configurable via environment variables (in seconds). Set them in your MCP server configuration:
{
"mcpServers": {
"karellen-jdb-mcp": {
"type": "stdio",
"command": "karellen-jdb-mcp",
"env": {
"JDB_MCP_TIMEOUT_EXECUTION": "300"
}
}
}
}Variable | Default | Description |
| 60 | JDB attach and initial prompt |
| 30 | Non-execution commands (breakpoints, inspection, etc.) |
| 120 | Prompt-based commands (used internally by |
| 5 | Execution commands (run, cont, step, next, step up). These return immediately when output arrives or after this timeout if execution resumes with no output (fire-and-forget). |
Build Tool Debug Stanzas
To debug a JVM process, it must be started with the JDWP agent. The exact syntax varies by build tool:
Build Tool | Command |
Plain |
|
Maven Surefire |
|
Maven Failsafe |
|
Gradle tests |
|
Tycho Surefire |
|
Spring Boot |
|
Any (fallback) |
|
License
Apache-2.0
Privacy
See PRIVACY.md. This software does not collect or transmit any data.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/karellen/karellen-jdb-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server