diff --git a/changelog.d/1389.fixed.md b/changelog.d/1389.fixed.md new file mode 100644 index 000000000..c01f3defd --- /dev/null +++ b/changelog.d/1389.fixed.md @@ -0,0 +1 @@ +**The Java attach guidance and the server's free-port probe keep to loopback** — the text an agent reads before attaching to a JVM (the `attach_to_process` description, the Java adapter's attach hint, the workflow prompt and the debugging skill) told it to start the JVM with `address=*:`, which opens the unauthenticated JDWP port on every network interface. All four now give `address=127.0.0.1:`, and the three general ones name the case that needs more: a JVM in a Docker container reached through a published port, which is then published on the host's loopback. The Java docs and skill reference name `127.0.0.1` where they gave a bare port, which is every interface on a JDK 8 target. The server's own free-port probe, each time a launch or an attach is prepared (a dry run included), listened with no host and so on every interface for an instant; it binds `127.0.0.1`. A check in the unit suite now holds a recorded list of every `.listen(` call and Java socket constructor in the server's and adapters' sources and the Java bridge, each with what it binds and why, and of every line there or in the skill text that writes one of the wildcard shapes it knows (`0.0.0.0`, `[::]`, a `--listen` value that starts with a colon, a wildcard or non-loopback JDWP `address=`): a new one fails until someone has looked at it and recorded it, and so does a recorded line that no longer matches. It does not see a host handed to a spawned debug adapter on its command line (#1389) diff --git a/docs/java/README.md b/docs/java/README.md index eb78fff95..a15f8d221 100644 --- a/docs/java/README.md +++ b/docs/java/README.md @@ -86,7 +86,7 @@ Connect to a running JVM that was started with JDWP agent. Start your JVM with JDWP enabled: ```bash -java -agentlib:jdwp=transport=dt_socket,server=y,address=5005,suspend=y \ +java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1:5005,suspend=y \ -cp . MyProgram ``` @@ -244,7 +244,7 @@ javac -g Calculator.java ```bash # Terminal 1: Start JVM with JDWP javac -g MyServer.java -java -agentlib:jdwp=transport=dt_socket,server=y,address=5005,suspend=y \ +java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1:5005,suspend=y \ -cp . MyServer # Output: "Listening for transport dt_socket at address: 5005" ``` diff --git a/examples/java/InfiniteWait.java b/examples/java/InfiniteWait.java index d62e33749..6a4e5ca7f 100644 --- a/examples/java/InfiniteWait.java +++ b/examples/java/InfiniteWait.java @@ -2,7 +2,7 @@ * Simple Java program for testing attach-mode debugging. * * Launch with JDWP agent to allow debugger attach: - * java -agentlib:jdwp=transport=dt_socket,server=y,address=,suspend=y \ + * java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1:,suspend=y \ * -cp . InfiniteWait * * With suspend=y the JVM pauses at startup, so the program just needs diff --git a/packages/adapter-java/src/java-adapter-factory.ts b/packages/adapter-java/src/java-adapter-factory.ts index 9ac02a49d..13e58a45f 100644 --- a/packages/adapter-java/src/java-adapter-factory.ts +++ b/packages/adapter-java/src/java-adapter-factory.ts @@ -60,7 +60,7 @@ export class JavaAdapterFactory implements IAdapterFactory { attachBy: ['port'], attachHints: { processId: - 'JDWP has no PID step; start the JVM with -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*: and pass that port' + 'JDWP has no PID step; start the JVM with -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1: and pass that port' } }, icon: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBmaWxsPSIjRTc2RjAwIiBkPSJNNDcuNiA3Ni41cy00LjYgMi43IDMuMyAzLjZjOS41IDEuMSAxNC40LjkgMjQuOS0xLjEgMCAwIDIuOCAxLjcgNi42IDMuMi0yMy40IDEwLTUzLTAuNi0zNC44LTUuN3ptLTIuOS0xMy4xcy01LjIgMy44IDIuNyA0LjZjMTAuMiAxLjEgMTguMiAxLjIgMzIuMS0xLjYgMCAwIDEuOSAyIDQuOSAzLjEtMjguMyA4LjMtNTkuOC42LTM5LjctNi4xeiIvPjxwYXRoIGZpbGw9IiM1MzgyQTEiIGQ9Ik02OS40IDQ1LjFjNS43IDYuNi0xLjUgMTIuNS0xLjUgMTIuNXMxNC41LTcuNSA3LjktMTYuOWMtNi4yLTguOC0xMC45LTEzLjIgMTQuNy0yOC4yIDAgMC00MC4yIDEwLTIxLjEgMzIuNnoiLz48cGF0aCBmaWxsPSIjRTc2RjAwIiBkPSJNOTUuOCA4My45czMuNCAyLjgtMy44IDVjLTEzLjUgNC4xLTU2LjIgNS4zLTY4LjEuMi00LjMtMS45IDMuOC00LjQgNi40LTUgMi43LS42IDQuMi0uNSA0LjItLjUtNC44LTMuNC0zMS4zIDYuNy0xMy40IDkuNSA0OC42IDcuNyA4OC42LTMuNSA3NC43LTkuMnpNNDkuOSA1NS42cy0yMi4yIDUuMy03LjkgNy4yYzYuMS44IDE4LjIuNiAyOS41LS4zIDkuMi0uOCAxOC41LTIuNCAxOC41LTIuNHMtMy4zIDEuNC01LjYgM2MtMjIuOCA2LTY2LjggMy4yLTU0LjEtMi45IDEwLjctNS4yIDE5LjYtNC42IDE5LjYtNC42ek04NS43IDcxLjJjMjMuMS0xMiAxMi40LTIzLjYgNS0yMiAtMS44LjQtMi42LjctMi42LjdzLjctMS4xIDItMS41YzE0LjctNS4yIDI2IDE1LjItNC44IDIzLjMgMCAwIC40LS4zLjQtLjV6Ii8+PHBhdGggZmlsbD0iIzUzODJBMSIgZD0iTTc2LjUgMS45czEyLjggMTIuOC0xMi4xIDMyLjVjLTIwIDE1LjgtNC42IDI0LjggMCAzNS4xLTExLjctMTAuNS0yMC4yLTE5LjgtMTQuNS0yOC40QzU4LjMgMjguNCA4MS4xIDIyIDc2LjUgMS45eiIvPjxwYXRoIGZpbGw9IiNFNzZGMDAiIGQ9Ik01MS40IDEwNC41YzIyLjIgMS40IDU2LjMtLjggNTcuMS0xMS4zIDAgMC0xLjYgNC0xOC40IDcuMi0xOSAzLjYtNDIuNCAzLjItNTYuMy45IDAgMCAyLjggMi40IDE3LjYgMy4yeiIvPjwvc3ZnPg==', diff --git a/packages/shared/src/interfaces/adapter-policy-go.ts b/packages/shared/src/interfaces/adapter-policy-go.ts index ba69b0cd4..12b741f09 100644 --- a/packages/shared/src/interfaces/adapter-policy-go.ts +++ b/packages/shared/src/interfaces/adapter-policy-go.ts @@ -2,7 +2,7 @@ * GoAdapterPolicy - policy for Go Debug Adapter (Delve/dlv) * * Encodes Delve-specific behaviors and variable handling logic. - * Delve operates in DAP mode via `dlv dap --listen=:port` + * Delve operates in DAP mode via `dlv dap --listen=127.0.0.1:` */ import type { DebugProtocol } from '@vscode/debugprotocol'; import * as path from 'path'; diff --git a/skills/debugging/SKILL.md b/skills/debugging/SKILL.md index ef52c02dc..c0af49428 100644 --- a/skills/debugging/SKILL.md +++ b/skills/debugging/SKILL.md @@ -83,7 +83,7 @@ attach_to_process {sessionId, host: "localhost", port: 5678, sourcePaths: [": ...`; to address breakpoints by local-checkout path, map it onto the debuggee tree with `adapterConfig: {pathMappings: [{localRoot: "", remoteRoot: "/app"}]}` - **Ruby**: target ran `rdbg --open --port ...` (works through `kubectl port-forward`); `localfsMap: "/app:"` maps paths - **JavaScript**: target ran `node --inspect=: ...` → attach by `host`/`port`; a plain `node app.js` on the same host → attach by `processId` (mcp-debugger opens its inspector on 9229, and it stays open, unauthenticated, after detach and close: #1261 — pass `port` too if the target set `--inspect-port=`) -- **Java**: target JVM has `-agentlib:jdwp=transport=dt_socket,server=y,address=*:`; breakpoints in not-yet-loaded classes are deferred automatically, and a fully-qualified class name as `file` needs no source files at all +- **Java**: target JVM has `-agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1:`. JDWP has no authentication, so keep it on loopback: that serves this machine, an in-pod sidecar and an SSH tunnel to another machine. A JVM in a Docker container reached through a published port needs `*` in place of `127.0.0.1`: publish that port on the host's loopback (`-p 127.0.0.1::`). Breakpoints in not-yet-loaded classes are deferred automatically, and a fully-qualified class name as `file` needs no source files at all - **C/C++ (and other native)**: attach by PID instead of port — `attach_to_process {sessionId, processId: , adapterConfig: {program: ""}}`; in a Kubernetes ephemeral debug container use `processId: 1` with `program: "/proc/1/root/"` (on Linux, mind `kernel.yama.ptrace_scope`) - **COBOL**: attach by PID like C/C++, plus `adapterConfig: {sources: ["", …], dialect: "ibm"}` (the manifest is regenerated by a translate-only `cobc -C`; pass the options the binary was built with) or `adapterConfig: {manifestDirs: [""]}` (an earlier source launch's `.debug-mcp/cobol/-[-container]///`, needs no cobc) so variables are COBOL-shaped; without either only the engine's C view is available. A job paused inside libcob still shows its program's data division (scopes from the nearest COBOL frame up the stack) - **Dart/Flutter**: attach by VM-service URI, never by PID — `attach_to_process {sessionId, adapterConfig: {vmServiceUri: "ws://127.0.0.1:/=/ws"}}` (the URI a `dart --enable-vm-service … run` target prints, or `flutter run --machine`'s `app.debugPort` event) or `adapterConfig: {vmServiceInfoFile: ""}`; a bare `host`/`port` only works for a VM started with `--disable-service-auth-codes`. The `dart-test`/`flutter-test` runners refuse attach. An isolate idle in an `await` shows an empty stack at the attach pause — set a breakpoint and `continue_execution`, or attach with `stopOnEntry: false` diff --git a/skills/debugging/references/java.md b/skills/debugging/references/java.md index 43e8090da..300ff2815 100644 --- a/skills/debugging/references/java.md +++ b/skills/debugging/references/java.md @@ -53,7 +53,7 @@ close_debug_session {"sessionId": ""} Start the target JVM with the JDWP agent (`suspend=y` pauses until a debugger attaches; `suspend=n` for already-running servers): ```bash -java -agentlib:jdwp=transport=dt_socket,server=y,address=5005,suspend=y -cp . MyServer +java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1:5005,suspend=y -cp . MyServer ``` ```json diff --git a/src/implementations/network-manager-impl.ts b/src/implementations/network-manager-impl.ts index 3f96caa89..1f10565c3 100644 --- a/src/implementations/network-manager-impl.ts +++ b/src/implementations/network-manager-impl.ts @@ -15,7 +15,7 @@ export class NetworkManagerImpl implements INetworkManager { const server = net.createServer(); server.unref(); server.on('error', reject); - server.listen(0, () => { + server.listen(0, '127.0.0.1', () => { const address = server.address(); if (address && typeof address === 'object' && 'port' in address) { const port = address.port; diff --git a/src/server/tool-schemas.ts b/src/server/tool-schemas.ts index daf7243f0..1f11dcc5f 100644 --- a/src/server/tool-schemas.ts +++ b/src/server/tool-schemas.ts @@ -262,7 +262,7 @@ export function buildToolDefinitions(options: BuildToolDefinitionsOptions): Tool } }, { name: 'restart_debugging', description: 'Restart the debuggee: terminate the current program (if still running) and relaunch it with the same configuration as the last start_debugging. All current breakpoints are re-applied automatically. The get_output buffer starts fresh — read from since=0 after a restart. A Flutter session hot-restarts in place instead, an attached one included: same process, output buffer kept, and the answer carries hotRestart: true. Works while running, paused, or after the program has exited. Not available for sessions never launched, or for attach sessions of the other adapters (detach and re-attach). Answers like start_debugging, including "running" with pending:true when the relaunch has not stopped within the same short hold (then call wait_for_stop)', inputSchema: { type: 'object', properties: { sessionId: { type: 'string' } }, required: ['sessionId'] } }, - { name: 'attach_to_process', description: `Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state "running" with pending:true; the late event alone changes the session to "paused" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: ${attachPathForms} (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap ":"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo`, inputSchema: { + { name: 'attach_to_process', description: `Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state "running" with pending:true; the late event alone changes the session to "paused" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: ${attachPathForms} (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap ":"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo`, inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: 'Debug session ID' }, diff --git a/src/skill-content.ts b/src/skill-content.ts index 9c325a091..e741bd3d0 100644 --- a/src/skill-content.ts +++ b/src/skill-content.ts @@ -5,7 +5,8 @@ * `instructions` field); DEBUGGING_WORKFLOW_PROMPT backs the * `debugging-workflow` prompt. Both are condensed views of the full agent * skill in skills/debugging/ — when editing one, check the other and the - * skill for drift. + * skill for drift. The Java loopback recipe is pinned across these surfaces + * by tests/core/unit/server/server-instructions.test.ts. * * Both texts are built per addressing mode (issue #271): the * DEBUG_MCP_BP_ADDRESSING flag must hide content-addressing features from @@ -205,7 +206,7 @@ attach_to_process {sessionId, host, port, sourcePaths, adapterConfig} - Python: target started with "python -m debugpy --listen host:port ..."; map a local checkout onto the debuggee tree with adapterConfig: {pathMappings: [{localRoot, remoteRoot}]} - Ruby: target started with "rdbg --open --port N ..." (works via kubectl port-forward); localfsMap: "/app:" maps paths - JavaScript: host/port of a "node --inspect" target, or processId of a plain local node process (its inspector is opened for you on 9229 and stays open, unauthenticated, after detach and close: #1261; pass port too for an --inspect-port target) -- Java: JVM flag -agentlib:jdwp=transport=dt_socket,server=y,address=*:PORT (breakpoints defer until class load); FQCN as "file" needs no source at all +- Java: JVM flag -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1:PORT (breakpoints defer until class load); a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1:PORT:PORT; reach another machine through an SSH tunnel. FQCN as "file" needs no source at all - C/C++ (and other native): attach by PID — attach_to_process {sessionId, processId, adapterConfig: {program: ""}} - COBOL: attach by PID like C/C++; add adapterConfig: {sources: ["", …]} (the manifest is regenerated by a translate-only cobc -C) or adapterConfig: {manifestDirs: ["<.debug-mcp/cobol/-// dir of the running build>"]} so the shim finds the symbol manifest, or variables show only the engine's C view - Dart/Flutter: attach to a running VM service — pass adapterConfig.vmServiceUri or vmServiceInfoFile, not a PID (the SDK adapter is spawned locally and connects to the VM service); a Flutter app on an Android device or emulator takes adapterConfig.deviceId alone with no URI (flutter attach discovers it; the app.debugPort URI of another flutter run is that tool's own DDS and never connects) diff --git a/tests/adapters/java/unit/java-adapter-factory.test.ts b/tests/adapters/java/unit/java-adapter-factory.test.ts index 6171ee98c..fdfa56a35 100644 --- a/tests/adapters/java/unit/java-adapter-factory.test.ts +++ b/tests/adapters/java/unit/java-adapter-factory.test.ts @@ -87,6 +87,12 @@ describe('JavaAdapterFactory', () => { const metadata = factory.getMetadata(); expect(metadata.documentationUrl).toContain('github.com'); }); + + it('recommends loopback for the local JDWP attach port (#1389)', () => { + expect(factory.getMetadata().modes?.attachHints?.processId).toContain( + '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:' + ); + }); }); describe('validate', () => { diff --git a/tests/core/unit/loopback-bindings.test.ts b/tests/core/unit/loopback-bindings.test.ts new file mode 100644 index 000000000..1631ec76a --- /dev/null +++ b/tests/core/unit/loopback-bindings.test.ts @@ -0,0 +1,344 @@ +/** + * Line-level tripwire for listener defaults and agent-facing bind guidance (#1389). + * Like check-structure.mjs, resolve the repository from this module, normalize + * paths to forward slashes and compare both additions and removals with a record. + * Walk the requested source roots directly so new, untracked files count too. + * + * Scope: src and each package's src (.ts/.js/.mjs/.cjs), each package's java + * tree (.java), packages/mcp-debugger/extensions and tools (.js/.mjs/.cjs), + * and the skills tree (.md). + * docs/, examples/ and READMEs outside those roots are not scanned: #1390 owns + * their wildcards. dist output, dependencies and other languages are out. + * + * Two kinds of rule. + * An address written as text: an IPv4 wildcard address, [::], a --listen value + * that starts with a colon, address=* anywhere and, on a line that names JDWP, + * address= without a loopback host. + * A listener by its spelling: every `.listen(` call, `inspector.open(` and + * `dgram.createSocket(`, and in Java every ServerSocket or InetSocketAddress + * constructor, `ServerSocketChannel.open(`, `createServerSocket(` and + * `startListening(`. Some of these are not sockets, and an + * InetSocketAddress may be for an outgoing connection: the recorded reason says + * so. The check does not judge what such a line binds. A line scan cannot do + * that soundly (a literal may sit in a callback, a fallback, a nested call), so + * every one is recorded with what it binds and why, and a new one fails until + * someone has looked at it and written that down. Two things it does not see: + * the line elsewhere that sets a recorded listener's host, and a host handed to + * a spawned debug adapter on its command line. + * Comments and strings count as text. Another listener API or another spelling + * of "every interface" needs a new rule: only these shapes are covered, and what + * a spawned debug adapter binds by its own default is outside this scan. + */ +import { describe, expect, it } from 'vitest'; +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const ROOT = fileURLToPath(new URL('../../..', import.meta.url)); + +interface Occurrence { + file: string; + line: string; + number: number; + rules: string[]; +} + +interface AllowedOccurrence { + file: string; + line: string; + reason: string; +} + +// Exact text, including indentation: changing or removing a line requires review. +const ALLOWED: AllowedOccurrence[] = [ + { + "file": "packages/adapter-dart/src/bridge/dap-stdio-bridge-core.ts", + "line": " server.listen(options.port, host, () => {", + "reason": "Dart bridge receives the session adapterHost, 127.0.0.1; standalone use defaults to loopback." + }, + { + "file": "packages/adapter-mock/src/mock-adapter-process.ts", + "line": " this.server.listen(port, host, () => {", + "reason": "Mock receives the session adapterHost, 127.0.0.1; a standalone start defaults to localhost." + }, + { + "file": "packages/shared/src/utils/deadline.ts", + "line": " tree.listen(outside);", + "reason": "DeadlineTree.listen subscribes to an AbortSignal; it opens no network socket." + }, + { + "file": "packages/shared/src/utils/loopback-host.ts", + "line": " * Anything else — a LAN address, a container or pod name, `0.0.0.0` — is not", + "reason": "Documentation excludes the bind-all address from loopback destinations." + }, + { + "file": "packages/shared/src/utils/loopback-host.ts", + "line": " * loopback: `0.0.0.0` is a bind-all address, never a destination.", + "reason": "Documentation explains why a bind-all address is never a destination." + }, + { + "file": "src/cli/bind-address.ts", + "line": " * `http` used to call `app.listen(port)`, which binds", + "reason": "Historical example explains the unsafe hostless HTTP default that was replaced." + }, + { + "file": "src/cli/bind-address.ts", + "line": " * `MCP_HTTP_BIND=0.0.0.0` so a published port keeps working; the `-p", + "reason": "Documents the explicit Docker bind-all override and loopback port publishing." + }, + { + "file": "src/cli/bind-address.ts", + "line": " '0.0.0.0 listens on every interface and is reachable from other machines — pair it with ' +", + "reason": "CLI help warns that an explicit bind-all address is reachable from other machines." + }, + { + "file": "src/cli/bind-address.ts", + "line": " throw new BindAddressError(`${chosen.origin} is empty; give an IP address such as 127.0.0.1 or 0.0.0.0`);", + "reason": "Validation error lists valid IP literals for an explicitly configured HTTP bind." + }, + { + "file": "src/cli/bind-address.ts", + "line": " `${chosen.origin} value '${trimmed}' is not an IP address; give one such as 127.0.0.1, 0.0.0.0 or :: ` +", + "reason": "Validation error lists valid IP literals rather than accepting DNS hostnames." + }, + { + "file": "src/cli/bind-address.ts", + "line": "/** 0.0.0.0 or :: — every interface (`::` is dual-stack unless ipv6Only). */", + "reason": "Documents the wildcard-address predicate used by bindNotice and describeEndpoint." + }, + { + "file": "src/cli/bind-address.ts", + "line": " return bare === '0.0.0.0' || bare === '::';", + "reason": "Identifies wildcard addresses for bindNotice and describeEndpoint." + }, + { + "file": "src/cli/bind-address.ts", + "line": " * softening: the image's own `MCP_HTTP_BIND=0.0.0.0` under `MCP_CONTAINER=true`", + "reason": "Documents info instead of warn for the startup notice of the image's own wildcard bind." + }, + { + "file": "src/cli/bind-address.ts", + "line": " 'Give one it has, 0.0.0.0 for every interface, or 127.0.0.1.'", + "reason": "Unavailable-address diagnostic offers explicit wildcard or loopback alternatives." + }, + { + "file": "src/cli/http-command.ts", + "line": " const server = app.listen(port, bind.address);", + "reason": "HTTP uses the validated bind.address, defaulting to loopback with explicit operator overrides." + }, + { + "file": "tools/dev-proxy/backend-subscriptions.mjs", + "line": " open = await client.listen({", + "reason": "MCP client.listen opens a subscription stream to the backend, not a listening socket." + }, + { + "file": "packages/adapter-cobol/src/shim/shim-core.ts", + "line": " probe.listen(0, '127.0.0.1', () => {", + "reason": "The COBOL shim's free-port probe for its CodeLLDB: binds 127.0.0.1 and closes at once." + }, + { + "file": "packages/adapter-cobol/src/shim/shim-core.ts", + "line": " server.listen(config.listenPort, '127.0.0.1', () => {", + "reason": "The COBOL shim's DAP socket for the proxy: binds 127.0.0.1." + }, + { + "file": "packages/adapter-dotnet/src/utils/netcoredbg-bridge-core.ts", + "line": " server.listen(port, '127.0.0.1');", + "reason": "The netcoredbg TCP-to-stdio bridge, for the proxy: binds 127.0.0.1." + }, + { + "file": "packages/adapter-java/java/JdiDapServer.java", + "line": " try (ServerSocket serverSocket = new ServerSocket(port, 1, InetAddress.getLoopbackAddress())) {", + "reason": "The Java bridge's DAP socket for the proxy: binds the JVM's loopback address, one client (#1394 covers a JVM that prefers IPv6)." + }, + { + "file": "packages/adapter-java/java/JdiDapServer.java", + "line": " try (ServerSocket ss = new ServerSocket(0, 1, InetAddress.getLoopbackAddress())) {", + "reason": "The Java bridge's free-port probe for the launched JVM's JDWP port: binds the loopback address and closes at once." + }, + { + "file": "src/implementations/network-manager-impl.ts", + "line": " server.listen(0, '127.0.0.1', () => {", + "reason": "The server's free-port probe for a session's adapter port: binds 127.0.0.1 and closes at once." + }, + { + "file": "src/proxy/dap-mirror-server.ts", + "line": " server.listen({ port, host: '127.0.0.1' }, () => {", + "reason": "The DAP mirror endpoint of expose_session: binds 127.0.0.1 on a random port, behind a token." + } +]; + +function walk(directory: string): string[] { + return fs.readdirSync(path.join(ROOT, directory), { withFileTypes: true }) + .flatMap(entry => { + const file = `${directory}/${entry.name}`; + if (entry.isDirectory() && entry.name !== 'node_modules') return walk(file); + return entry.isFile() ? [file] : []; + }).sort(); +} + +function sourceFiles(): string[] { + const script = /\.(?:js|mjs|cjs)$/; + const source = /\.(?:ts|js|mjs|cjs)$/; + const packageSources = fs.readdirSync(path.join(ROOT, 'packages'), { withFileTypes: true }) + .filter(entry => entry.isDirectory()) + .flatMap(entry => ['src', 'java'].flatMap(directory => { + const root = `packages/${entry.name}/${directory}`; + if (!fs.existsSync(path.join(ROOT, root))) return []; + return walk(root).filter(file => directory === 'java' ? file.endsWith('.java') : source.test(file)); + })); + return [ + ...walk('src').filter(file => source.test(file)), + ...packageSources, + ...walk('packages/mcp-debugger/extensions').filter(file => script.test(file)), + ...walk('skills').filter(file => file.endsWith('.md')), + ...walk('tools').filter(file => script.test(file)) + ].sort(); +} + +const LISTENER_RULES = ['listener', 'java-socket']; + +function rulesFor(line: string): string[] { + const rules: string[] = []; + if (/(? match[1].startsWith('*')) || + (/jdwp/i.test(line) && addresses.some(match => !loopbackAddress.test(match[1])))) { + rules.push('jdwp-address'); + } + // A listening socket, whatever it binds: recorded, not judged. + if (/\.listen\s*\(|\b(?:inspector\.open|dgram\.createSocket)\s*\(/.test(line)) rules.push('listener'); + if (/\bnew\s+(?:java\.net\.)?(?:ServerSocket|InetSocketAddress)\s*\(|\b(?:ServerSocketChannel\.open|createServerSocket|startListening)\s*\(/.test(line)) { + rules.push('java-socket'); + } + return rules; +} + +function advice(rules: string[]): string { + return rules.some(rule => LISTENER_RULES.includes(rule)) + ? 'A .listen( call or a Java socket constructor. Add this exact line to ALLOWED with what it binds and why, or why it opens no socket; bind 127.0.0.1 unless an operator chooses the address.' + : 'Write a loopback address, or add this exact line to ALLOWED with a one-line reason.'; +} + +function differences(found: Occurrence[], allowed: AllowedOccurrence[]): string[] { + const remaining = [...allowed]; + const problems: string[] = []; + const newFiles = new Set(); + for (const occurrence of found) { + const index = remaining.findIndex(entry => entry.file === occurrence.file && entry.line === occurrence.line); + if (index === -1) { + newFiles.add(occurrence.file); + problems.push(`New occurrence: ${occurrence.file}:${occurrence.number} [${occurrence.rules.join(', ')}]\n${occurrence.line}\n${advice(occurrence.rules)}`); + } else { + remaining.splice(index, 1); + } + } + for (const entry of remaining) { + problems.push(`Stale allowance: ${entry.file} [${rulesFor(entry.line).join(', ') || 'no rule still matches'}; no matching source line]\n${entry.line}\nRemove this entry from ALLOWED; it no longer matches an occurrence.`); + } + for (const file of new Set(remaining.map(entry => entry.file))) { + if (newFiles.has(file)) { + problems.push(`${file}: If you edited a recorded line, update its text in ALLOWED.`); + } + } + return problems; +} + +describe('loopback bindings and guidance', () => { + it('records every reviewed occurrence and rejects stale allowances', () => { + const found = sourceFiles().flatMap(file => fs.readFileSync(path.join(ROOT, file), 'utf8') + .split(/\r?\n/).flatMap((line, index) => { + const rules = rulesFor(line); + return rules.length ? [{ file, line, number: index + 1, rules }] : []; + })); + for (const entry of ALLOWED) { + expect(entry.reason.trim(), `${entry.file}: give a one-line reason`).not.toBe(''); + expect(entry.reason).not.toMatch(/[\r\n]/); + } + expect(differences(found, ALLOWED).join('\n\n')).toBe(''); + }); + + it.each([ + ['0.0.0.0', ['ipv4-wildcard']], + ['binds 0.0.0.0.', ['ipv4-wildcard']], + ['--host 0.0.0.0 --port 1', ['ipv4-wildcard']], + ['// 10.0.0.0/8', []], + ['// 0.0.0.01', []], + ['// 0.0.0.0.1', []], + ['[::]:5005', ['ipv6-wildcard']], + ['[::1]:5005', []], + ["nodeId.split('::')", []], + ['dlv dap --listen=:port', ['wildcard-listen-option']], + ['dlv dap --listen :port', ['wildcard-listen-option']], + ['dlv dap --listen=127.0.0.1:5005', []], + ['address=*:5005', ['jdwp-address']], + ['address=*:', ['jdwp-address']], + ['address=5005', []], + ['(address=${attachHost})', []], + ['address=[::]:5005', ['ipv6-wildcard']], + ['address=0.0.0.0:5005', ['ipv4-wildcard']], + ['-agentlib:jdwp=transport=dt_socket,server=y,address=5005', ['jdwp-address']], + ['-agentlib:jdwp=transport=dt_socket,server=y,address=', ['jdwp-address']], + ['-agentlib:jdwp=transport=dt_socket,server=y,address=*:5005', ['jdwp-address']], + ['-agentlib:jdwp=transport=dt_socket,server=y,address=[::]:5005', ['ipv6-wildcard', 'jdwp-address']], + ['-agentlib:jdwp=transport=dt_socket,server=y,address=0.0.0.0:5005', ['ipv4-wildcard', 'jdwp-address']], + ['-agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1:', []], + ['-agentlib:jdwp=transport=dt_socket,server=y,address=localhost:5005', []], + ['-agentlib:jdwp=transport=dt_socket,server=y,address=[::1]:5005', []], + ['-agentlib:jdwp=transport=dt_socket,server=y,address=::1:5005', []], + ['-agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.10:5005', ['jdwp-address']], + ['-agentlib:jdwp=transport=dt_socket,server=y,address=', ['jdwp-address']], + ['-agentlib:jdwp=transport=dt_socket,server=y,myaddress=5005', []], + ['JDWP: address=5005', ['jdwp-address']], + ['server.listen(0, () => {', ['listener']], + ['server.listen({', ['listener']], + ['server .listen (port);', ['listener']], + ['a.listen(0); b.listen(1);', ['listener']], + ["server.listen(0, '127.0.0.1', callback);", ['listener']], + ["server.listen({ port, host: '127.0.0.1' }, callback);", ['listener']], + ['tree.listen(outside);', ['listener']], + ['emitter.listening(port);', []], + ['const listen = 1;', []], + ['inspector.open(0);', ['listener']], + ["inspector.open(9229, '::');", ['listener']], + ["dgram.createSocket('udp4');", ['listener']], + ['handler.bind(this);', []], + ['new ServerSocket(0)', ['java-socket']], + ['new ServerSocket(0, 1, InetAddress.getLoopbackAddress())', ['java-socket']], + ['new java.net.ServerSocket(port)', ['java-socket']], + ['renew ServerSocket(port)', []], + ['ServerSocket serverSocket;', []], + ['new InetSocketAddress(port)', ['java-socket']], + ['new java.net.InetSocketAddress("127.0.0.1", port)', ['java-socket']], + ['InetSocketAddress remote;', []], + ['ServerSocketChannel.open().bind(null);', ['java-socket']], + ['factory.createServerSocket(port)', ['java-socket']], + ['connector.startListening(args)', ['java-socket']] + ] satisfies Array<[string, string[]]>)('classifies %s', (line, expected) => { + expect(rulesFor(line)).toEqual(expected); + }); + + it('requires exact text and counts repeated occurrences separately', () => { + const allowed = { file: 'src/example.ts', line: 'server.listen(port);', reason: 'Example reviewed for this test.' }; + const occurrence = { ...allowed, number: 3, rules: ['listener'] }; + expect(differences([occurrence], [allowed])).toEqual([]); + expect(differences([], [allowed]).join()).toContain('Stale allowance'); + expect(differences([occurrence, occurrence], [allowed]).join()).toContain('New occurrence'); + const changed = { ...occurrence, line: ` ${allowed.line}` }; + const message = differences([changed], [allowed]).join('\n'); + expect(message).toContain('src/example.ts:3 [listener]'); + expect(message).toContain('A .listen( call or a Java socket constructor.'); + expect(message).toMatch(/New occurrence[\s\S]*Stale allowance/); + expect(message).toContain('If you edited a recorded line, update its text in ALLOWED.'); + expect(differences([occurrence], []).join()).not.toContain('If you edited'); + const stale = { ...allowed, line: 'other.listen(port);' }; + expect(differences([occurrence, occurrence], [allowed, stale]).join()).toContain('If you edited'); + }); +}); diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-explicit.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-explicit.container-true.json index 13f130a85..93a549be9 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-explicit.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-explicit.container-true.json @@ -299,7 +299,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-explicit.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-explicit.container-unset.json index 28b42f777..8f9db4c18 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-explicit.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-explicit.container-unset.json @@ -299,7 +299,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-open.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-open.container-true.json index fc0753cfc..3ce7db21a 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-open.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-open.container-true.json @@ -299,7 +299,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-open.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-open.container-unset.json index dc98b8d4a..97c2bcd9f 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-open.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-open.container-unset.json @@ -299,7 +299,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-unset.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-unset.container-true.json index fc0753cfc..3ce7db21a 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-unset.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-unset.container-true.json @@ -299,7 +299,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-unset.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-unset.container-unset.json index dc98b8d4a..97c2bcd9f 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-unset.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-assert.va-unset.container-unset.json @@ -299,7 +299,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-explicit.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-explicit.container-true.json index 390b733b7..0075edee1 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-explicit.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-explicit.container-true.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-explicit.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-explicit.container-unset.json index 0dfb94826..55760614e 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-explicit.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-explicit.container-unset.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-open.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-open.container-true.json index 303bdfb60..f1c22bbb4 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-open.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-open.container-true.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-open.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-open.container-unset.json index d212d44e8..fcea342d0 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-open.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-open.container-unset.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-unset.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-unset.container-true.json index 303bdfb60..f1c22bbb4 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-unset.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-unset.container-true.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-unset.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-unset.container-unset.json index d212d44e8..fcea342d0 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-unset.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-content.va-unset.container-unset.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-explicit.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-explicit.container-true.json index 599596add..cfb1a43bf 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-explicit.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-explicit.container-true.json @@ -295,7 +295,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-explicit.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-explicit.container-unset.json index 112256687..a45292793 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-explicit.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-explicit.container-unset.json @@ -295,7 +295,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-open.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-open.container-true.json index 8b97338a1..3be6a6f6f 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-open.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-open.container-true.json @@ -295,7 +295,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-open.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-open.container-unset.json index e20503906..9f89b5f54 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-open.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-open.container-unset.json @@ -295,7 +295,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-unset.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-unset.container-true.json index 8b97338a1..3be6a6f6f 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-unset.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-unset.container-true.json @@ -295,7 +295,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-unset.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-unset.container-unset.json index e20503906..9f89b5f54 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-unset.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-line.va-unset.container-unset.json @@ -295,7 +295,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them) or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-explicit.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-explicit.container-true.json index 390b733b7..0075edee1 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-explicit.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-explicit.container-true.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-explicit.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-explicit.container-unset.json index 0dfb94826..55760614e 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-explicit.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-explicit.container-unset.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-open.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-open.container-true.json index 303bdfb60..f1c22bbb4 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-open.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-open.container-true.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-open.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-open.container-unset.json index d212d44e8..fcea342d0 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-open.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-open.container-unset.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-unset.container-true.json b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-unset.container-true.json index 303bdfb60..f1c22bbb4 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-unset.container-true.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-unset.container-true.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-unset.container-unset.json b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-unset.container-unset.json index d212d44e8..fcea342d0 100644 --- a/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-unset.container-unset.json +++ b/tests/core/unit/server/__snapshots__/tool-list/bp-unset.va-unset.container-unset.json @@ -309,7 +309,7 @@ }, { "name": "attach_to_process", - "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=*:; C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", + "description": "Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state \"running\" with pending:true; the late event alone changes the session to \"paused\" — call wait_for_stop to block until it does. The target is started under its debugger or named by processId: Python python -m debugpy --listen ; Ruby rdbg --open --port ; Node.js node --inspect (host, port), or a local node process by processId; Java -agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1: (a JVM in a Docker container reached through a published port needs * in place of 127.0.0.1, with -p 127.0.0.1::); C/C++, COBOL and .NET by processId; Dart and Flutter a VM service (adapterConfig.vmServiceUri or vmServiceInfoFile; a Flutter app on an Android device: adapterConfig.deviceId). list_supported_languages shows each language's forms (attachBy). Breakpoint paths are resolved on the target's filesystem: use the paths the target sees (get_stack_trace shows them), function breakpoints, or a mapping (Python: adapterConfig.pathMappings [{localRoot, remoteRoot}]; Ruby: adapterConfig.localfsMap \":\"). Kubernetes pods (port-forward or an ephemeral sidecar, per-language presets): docs/kubernetes.md in the mcp-debugger repo", "inputSchema": { "type": "object", "properties": { diff --git a/tests/core/unit/server/server-instructions.test.ts b/tests/core/unit/server/server-instructions.test.ts index 2b958b600..4959f8c14 100644 --- a/tests/core/unit/server/server-instructions.test.ts +++ b/tests/core/unit/server/server-instructions.test.ts @@ -12,8 +12,10 @@ * descriptions are checked at the end: each long one is stated once. */ import { describe, it, expect } from 'vitest'; +import { readFileSync } from 'fs'; import { buildServerInstructions, + DEBUGGING_WORKFLOW_PROMPT, SERVER_INSTRUCTIONS_LIMIT, type ServerInstructionsOptions } from '../../../../src/skill-content.js'; @@ -320,6 +322,27 @@ describe('server instructions (issue #1331)', () => { }); }); +describe('Java attach guidance (#1389)', () => { + it('keeps the workflow prompt, agent skill and attach tool on loopback', () => { + const skill = readFileSync(new URL('../../../../skills/debugging/SKILL.md', import.meta.url), 'utf8'); + const tools = buildToolDefinitions({ + supportedLanguages: ['java'], + environment: { + get: () => undefined, + getAll: () => ({}), + getCurrentWorkingDirectory: () => process.cwd() + } + }); + const attach = tools.find(tool => tool.name === 'attach_to_process')?.description ?? ''; + for (const text of [DEBUGGING_WORKFLOW_PROMPT, skill, attach]) { + expect(text).toContain('-agentlib:jdwp=transport=dt_socket,server=y,address=127.0.0.1:'); + expect(text).toContain('in a Docker container reached through a published port'); + expect(text).toMatch(/-p 127\.0\.0\.1:(?:|PORT):(?:|PORT)/); + } + expect(skill).toContain('JDWP has no authentication'); + }); +}); + describe('the rules that moved into the tool descriptions (issue #1331)', () => { const toolsFor = (variableAccess: 'open' | 'explicit'): ReturnType => buildToolDefinitions({ diff --git a/tests/unit/implementations/network-manager-impl.test.ts b/tests/unit/implementations/network-manager-impl.test.ts index 11e5b9190..37ff352ea 100644 --- a/tests/unit/implementations/network-manager-impl.test.ts +++ b/tests/unit/implementations/network-manager-impl.test.ts @@ -71,7 +71,8 @@ describe('NetworkManagerImpl', () => { const freePort = 12345; // Setup mock behavior - mockServer.listen.mockImplementation(((port: number, callback?: Function) => { + mockServer.listen.mockImplementation(((...args: unknown[]) => { + const callback = args.find((arg): arg is () => void => typeof arg === 'function'); if (callback) { process.nextTick(() => callback()); } @@ -92,7 +93,7 @@ describe('NetworkManagerImpl', () => { expect(result).toBe(freePort); expect((net as any).createServer).toHaveBeenCalled(); expect(mockServer.unref).toHaveBeenCalled(); - expect(mockServer.listen).toHaveBeenCalledWith(0, expect.any(Function)); + expect(mockServer.listen).toHaveBeenCalledWith(0, '127.0.0.1', expect.any(Function)); expect(mockServer.close).toHaveBeenCalled(); }); @@ -113,7 +114,8 @@ describe('NetworkManagerImpl', () => { it('should handle invalid address format', async () => { - mockServer.listen.mockImplementation(((port: number, callback?: Function) => { + mockServer.listen.mockImplementation(((...args: unknown[]) => { + const callback = args.find((arg): arg is () => void => typeof arg === 'function'); if (callback) { process.nextTick(() => callback()); } @@ -135,7 +137,8 @@ describe('NetworkManagerImpl', () => { it('should handle null address', async () => { - mockServer.listen.mockImplementation(((port: number, callback?: Function) => { + mockServer.listen.mockImplementation(((...args: unknown[]) => { + const callback = args.find((arg): arg is () => void => typeof arg === 'function'); if (callback) { process.nextTick(() => callback()); } @@ -158,14 +161,15 @@ describe('NetworkManagerImpl', () => { it('should clean up server resources on success', async () => { const freePort = 54321; - mockServer.listen.mockImplementation(((port: number, callback?: Function) => { + mockServer.listen.mockImplementation(((...args: unknown[]) => { + const callback = args.find((arg): arg is () => void => typeof arg === 'function'); if (callback) { process.nextTick(() => callback()); } return mockServer; }) as any); - mockServer.address.mockReturnValue({ port: freePort, family: 'IPv4', address: '0.0.0.0' }); + mockServer.address.mockReturnValue({ port: freePort, family: 'IPv4', address: '127.0.0.1' }); let closeCallbackCalled = false; mockServer.close.mockImplementation(((callback?: Function) => {