microsoft / microsoft/DebugMCP

[RFC / Feature Request] Multi-session debugging support via optional sessionId

Open
#159 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
511
Forks
60
Avg merge
2d 1h
Merged PRs (30d)
18

Description

Summary

Currently, DebugMCP assumes a single active debug session model by binding operations to vscode.debug.activeDebugSession.

In complex application architectures (e.g. frontend + backend services launched via compound debug configurations, client/server setups, microservices, or parent/child worker processes), multiple DAP debug sessions run concurrently in the same VS Code workspace. When this happens, an AI agent cannot deterministically target or inspect a specific session without risking race conditions or relying on VS Code's global active session focus.

Motivation

For AI agents managing full-stack or multi-process debugging workflows:

  1. Targeted Inspection & Stepping: The agent needs to step or inspect variables in the backend service while the frontend service continues running (or vice-versa).
  2. Session Disambiguation: Without a session identifier, inspection tools (get_variables_values, evaluate_expression) fail or hit the wrong target if another session steals focus.
Proposed Architecture & Prototype

We explored a working prototype of this approach on our fork here:
👉 Prototype Branch: https://github.com/ankitajha6475-jpg/DebugMCP/tree/feature/multi-session
👉 Key Implementation Commit: https://github.com/ankitajha6475-jpg/DebugMCP/commit/6943502a17a58fde7299bc89cecf126515488f1e

The core design in that prototype:

  1. Active Session Map in DebuggingExecutor: Maintain a map of active debug sessions (Map<string, vscode.DebugSession>) updated via onDidStartDebugSession / onDidTerminateDebugSession.
  2. Optional sessionId?: string Parameter: Add an optional sessionId to tool schemas:
    • step_over, step_into, step_out
    • continue_execution, pause_execution, restart_debugging
    • get_variables_values, evaluate_expression
    • (And now potentially get_debug_status)
  3. Graceful Fallback: If sessionId is omitted, fall back to vscode.debug.activeDebugSession, keeping 100% backward compatibility for standard single-session workflows.
  4. Session Enumeration: Provide an easy way for agents to list active sessions (their IDs, names, and types) to discover target IDs.
Status & Contribution Handoff

We validated this pattern in our own workflows and wanted to document the architecture and share the reference branch for anyone in the community interested in taking this forward.

Because we currently lack the bandwidth to drive this implementation to completion or actively shepherd a PR, we are leaving this RFC and prototype open for the maintainers or any community contributor to adopt, adapt, or build upon whenever multi-session support becomes a priority.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked prototype branch and commit, then inspect the existing DebuggingExecutor and the listed debugging tools. Compare the prototype's active-session map, optional sessionId handling, fallback behavior, and session enumeration with the current implementation. Done would require an agreed, tested multi-session design, but this RFC does not identify specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.