Skip to content

Bundled CLI leaks DEBUG_MCP_SKIP_AUTO_START into debuggees, preventing mcp-debugger self-launch #717

Description

@debugmcpdev

Problem

When using the bundled mcp-debugger CLI to debug the repository's dist/index.js, the target exits successfully without starting its HTTP server. This makes self-debugging appear to run to completion even though the expected server was never started.

Reproduction and observations

  1. Build mcp-debugger and run the bundled packages/mcp-debugger/dist/cli.mjs through the development proxy.
  2. Create a JavaScript debug session and launch the repository's dist/index.js with args: ['http', '-p', '<free port>'] and stopOnEntry: false.
  3. The launch reports state: 'stopped', exit code 0, and that the program ran to completion. The target HTTP endpoint never becomes available.

Observed on Windows / Node v24.14.1, mcp-debugger main f8d55f4493ebfc4253475cf4fc4a2faf4b90a55d, while dogfooding a locally built js-debug adapter. An isolated control with MCP_EXIT_ON_STDIN_CLOSE: '0' and DEBUG_MCP_SKIP_AUTO_START: '1' reproduces the same immediate successful exit. With both flags set to '0', the target starts, serves HTTP, and can be paused, inspected, stepped, and resumed.

Cause

packages/mcp-debugger/src/cli-entry.ts sets process.env.DEBUG_MCP_SKIP_AUTO_START = '1' before importing the source entry point and explicitly invoking main().

JavaScript launch inherits the server environment. In the debuggee, src/index.ts checks that inherited flag and skips its own main() entirely.

Expected

The bundled CLI's internal bootstrap flag should not suppress startup in subsequently launched debuggees. Avoid leaving bootstrap-only state in the inherited environment, or explicitly scope that state to the server's own initialization.

Tested workaround

Pass this in start_debugging.dapLaunchArgs.env when debugging an independent mcp-debugger server:

{
  "DEBUG_MCP_SKIP_AUTO_START": "0",
  "MCP_EXIT_ON_STDIN_CLOSE": "0"
}

The second flag opts the target out of the development proxy's parent-stdin supervision policy; the first is the startup-suppression defect isolated above. Add regression coverage for launching a second mcp-debugger process from the bundled CLI.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions