mcp-debugger

debugmcpdev/mcp-debugger

3.3

If you are the rightful owner of mcp-debugger and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

MCP Debugger is a server that enhances AI agents with debugging capabilities using the Model Context Protocol.

Tools
  1. create_debug_session

    Create a new debugging session

  2. list_debug_sessions

    List all active sessions

  3. set_breakpoint

    Set a breakpoint in a file

  4. start_debugging

    Start debugging a script

  5. get_stack_trace

    Get the current stack trace

  6. get_scopes

    Get variable scopes for a frame

  7. get_variables

    Get variables in a scope

  8. step_over

    Step over the current line

  9. step_into

    Step into a function

  10. step_out

    Step out of a function

  11. continue_execution

    Continue running

  12. close_debug_session

    Close a session

mcp-debugger

MCP Debugger Logo - A stylized circuit board with debug breakpoints

MCP server for step-through debugging โ€“ give your AI agents debugging superpowers ๐Ÿš€

CI npm version Docker Pulls

๐ŸŽฏ Overview

mcp-debugger is a Model Context Protocol (MCP) server that provides debugging tools as structured API calls. It enables AI agents to perform step-through debugging of Python scripts using the Debug Adapter Protocol (DAP).

๐ŸŽฌ Demo Video: See the debugger in action!

Recording in progress - This will show an AI agent discovering and fixing the variable swap bug in real-time

โœจ Key Features

  • ๐Ÿ Python debugging via debugpy โ€“ Full DAP protocol support
  • ๐Ÿ”„ STDIO and SSE transport modes โ€“ Works with any MCP client
  • ๐Ÿงช >90% test coverage โ€“ Battle-tested with 657+ passing tests
  • ๐Ÿณ Docker and npm packages โ€“ Deploy anywhere
  • ๐Ÿค– Built for AI agents โ€“ Structured JSON responses for easy parsing

๐Ÿš€ Quick Start

For MCP Clients (Claude Desktop, etc.)

Add to your MCP settings configuration:

{
  "mcpServers": {
    "mcp-debugger": {
      "command": "node",
      "args": ["C:/path/to/mcp-debugger/dist/index.js", "--log-level", "debug", "--log-file", "C:/path/to/logs/debug-mcp-server.log"],
      "disabled": false,
      "autoApprove": ["create_debug_session", "set_breakpoint", "get_variables"]
    }
  }
}

Using Docker

docker run -v $(pwd):/workspace debugmcp/mcp-debugger:0.9.0

Using npm

npm install -g mcp-debugger
mcp-debugger --help

๐Ÿ“ธ Screenshot: MCP Integration in Action

This screenshot will show real-time MCP protocol communication with tool calls and JSON responses flowing between the AI agent and debugger.

๐Ÿ“š How It Works

mcp-debugger exposes debugging operations as MCP tools that can be called with structured JSON parameters:

// Tool: create_debug_session
// Request:
{
  "language": "python",
  "name": "My Debug Session"
}
// Response:
{
  "success": true,
  "sessionId": "a4d1acc8-84a8-44fe-a13e-28628c5b33c7",
  "message": "Created python debug session: My Debug Session"
}

๐Ÿ“ธ Screenshot: Active Debugging Session

This screenshot will show the debugger paused at a breakpoint with the stack trace visible in the left panel, local variables in the right panel, and source code with line highlighting in the center.

๐Ÿ› ๏ธ Available Tools

ToolDescriptionStatus
create_debug_sessionCreate a new debugging sessionโœ… Implemented
list_debug_sessionsList all active sessionsโœ… Implemented
set_breakpointSet a breakpoint in a fileโœ… Implemented
start_debuggingStart debugging a scriptโœ… Implemented
get_stack_traceGet the current stack traceโœ… Implemented
get_scopesGet variable scopes for a frameโœ… Implemented
get_variablesGet variables in a scopeโœ… Implemented
step_overStep over the current lineโœ… Implemented
step_intoStep into a functionโœ… Implemented
step_outStep out of a functionโœ… Implemented
continue_executionContinue runningโœ… Implemented
close_debug_sessionClose a sessionโœ… Implemented
pause_executionPause running executionโŒ Not Implemented
evaluate_expressionEvaluate expressionsโŒ Not Implemented
get_source_contextGet source code contextโŒ Not Implemented

๐Ÿ“ธ Screenshot: Multi-Session Debugging

This screenshot will show the debugger managing multiple concurrent debug sessions, demonstrating how AI agents can debug different scripts simultaneously with isolated session management.

๐Ÿ’ก Example: Debugging Python Code

Here's a complete debugging session example:

# buggy_swap.py
def swap_variables(a, b):
    a = b  # Bug: loses original value of 'a'
    b = a  # Bug: 'b' gets the new value of 'a'
    return a, b

Step 1: Create a Debug Session

// Tool: create_debug_session
// Request:
{
  "language": "python",
  "name": "Swap Bug Investigation"
}
// Response:
{
  "success": true,
  "sessionId": "a4d1acc8-84a8-44fe-a13e-28628c5b33c7",
  "message": "Created python debug session: Swap Bug Investigation"
}

Step 2: Set Breakpoints

// Tool: set_breakpoint
// Request:
{
  "sessionId": "a4d1acc8-84a8-44fe-a13e-28628c5b33c7",
  "file": "buggy_swap.py",
  "line": 2
}
// Response:
{
  "success": true,
  "breakpointId": "28e06119-619e-43c0-b029-339cec2615df",
  "file": "C:\\path\\to\\buggy_swap.py",
  "line": 2,
  "verified": false,
  "message": "Breakpoint set at C:\\path\\to\\buggy_swap.py:2"
}

Step 3: Start Debugging

// Tool: start_debugging
// Request:
{
  "sessionId": "a4d1acc8-84a8-44fe-a13e-28628c5b33c7",
  "scriptPath": "buggy_swap.py"
}
// Response:
{
  "success": true,
  "state": "paused",
  "message": "Debugging started for buggy_swap.py. Current state: paused",
  "data": {
    "message": "Debugging started for buggy_swap.py. Current state: paused",
    "reason": "breakpoint"
  }
}

Step 4: Inspect Variables

First, get the scopes:

// Tool: get_scopes
// Request:
{
  "sessionId": "a4d1acc8-84a8-44fe-a13e-28628c5b33c7",
  "frameId": 3
}
// Response:
{
  "success": true,
  "scopes": [
    {
      "name": "Locals",
      "variablesReference": 5,
      "expensive": false,
      "presentationHint": "locals",
      "source": {}
    },
    {
      "name": "Globals", 
      "variablesReference": 6,
      "expensive": false,
      "source": {}
    }
  ]
}

Then get the local variables:

// Tool: get_variables
// Request:
{
  "sessionId": "a4d1acc8-84a8-44fe-a13e-28628c5b33c7",
  "scope": 5
}
// Response:
{
  "success": true,
  "variables": [
    {"name": "a", "value": "10", "type": "int", "variablesReference": 0, "expandable": false},
    {"name": "b", "value": "20", "type": "int", "variablesReference": 0, "expandable": false}
  ],
  "count": 2,
  "variablesReference": 5
}

๐Ÿ“ธ Screenshot: Variable Inspection Reveals the Bug

This screenshot will show the TUI visualizer after stepping over line 4, where both variables incorrectly show value 20, clearly demonstrating the variable swap bug. The left panel shows the execution state, the center shows the highlighted code, and the right panel displays the incorrect variable values.

๐Ÿ“– Documentation

  • ๐Ÿ“˜ โ€“ Complete API documentation
  • ๐Ÿšฆ โ€“ First-time setup
  • ๐Ÿ โ€“ Python-specific features
  • ๐Ÿ”ง โ€“ Common issues & solutions
  • ๐Ÿ—๏ธ โ€“ Technical deep-dive

๐Ÿค Contributing

We welcome contributions! See for guidelines.

# Development setup
git clone https://github.com/debugmcp/mcp-debugger.git
cd mcp-debugger
npm install
npm run build
npm test

Running Container Tests Locally

We use Act to run GitHub Actions workflows locally:

# Build the Docker image first
docker build -t mcp-debugger:local .

# Run tests with Act (use WSL2 on Windows)
act -j build-and-test --matrix os:ubuntu-latest

See for detailed testing instructions.

๐Ÿ“Š Project Status

  • โœ… Production Ready: v0.9.0 with comprehensive test coverage
  • ๐Ÿšง Coming Soon: Expression evaluation, conditional breakpoints
  • ๐Ÿ“ˆ Active Development: Regular updates and improvements

See for planned features.

๐Ÿ“„ License

MIT License - see for details.

๐Ÿ™ Acknowledgments

Built with:


Give your AI the power to debug like a developer! ๐ŸŽฏ