inspector icon indicating copy to clipboard operation
inspector copied to clipboard

CLI: Progress notifications not captured, preventing timeout reset functionality

Open olaservo opened this issue 2 months ago • 2 comments

Inspector Version

  • 0.17.1 (current main branch)

Describe the bug

The CLI mode accepts --reset-timeout-on-progress flag but it doesn't actually reset timeouts on progress notifications because the CLI doesn't capture or handle progress notifications from MCP servers. This causes long-running operations to timeout even when progress notifications are being sent and --reset-timeout-on-progress true is specified.

The web UI correctly displays progress notifications and handles timeout resets, but the CLI mode does not yet implement this functionality.

To Reproduce

  1. Run a long-running operation with tight timeout values:
    node build/cli.js npx @modelcontextprotocol/server-everything --cli --method tools/call --tool-name longRunningOperation --tool-arg duration=3 steps=2 --request-timeout 2000 --reset-timeout-on-progress true
    
  2. Observe that the operation times out even though:
    • The server is sending progress notifications (verified in web UI)
    • --reset-timeout-on-progress true is set
    • The timeout should be reset on each progress update

Expected behavior

When --reset-timeout-on-progress true is set, the CLI should:

  1. Listen for progress notifications from the MCP server
  2. Reset the request timeout each time a progress notification is received
  3. Display or log progress notifications (similar to how the web UI shows them)
  4. Allow long-running operations to complete successfully as long as progress is being reported

Environment:

  • OS: All platforms (Windows, macOS, Linux)
  • CLI mode (not browser-based)

Additional context

  • PR #373 adds the --request-timeout, --reset-timeout-on-progress, and --max-total-timeout flags to CLI mode
  • The flags are parsed and passed to the SDK correctly
  • However, the CLI code in cli/src/client/connection.ts and related files doesn't set up listeners for progress notifications
  • This limitation means that --reset-timeout-on-progress and --max-total-timeout don't provide the full intended functionality for managing long-running operations in CLI mode

Related Issues/PRs:

  • #330 - Original request to add timeout configuration to CLI mode (addressed by PR #373)
  • #373 - PR that added the timeout flags but with the limitation documented
  • #408, #452 - Related to displaying server logs/stderr in CLI mode

Suggested Implementation:

The CLI should implement progress notification handling similar to the web UI:

  1. Set up notification listeners after connecting to the server
  2. Handle notifications/progress messages
  3. Optionally display progress updates to stderr (so they don't interfere with JSON output on stdout)
  4. Ensure the SDK's timeout reset mechanism is triggered on progress notifications

olaservo avatar Oct 20 '25 00:10 olaservo

When I run the command you listed above (note: I had to changenode build/cli.js to node build/cli.js):

node build/cli.js npx @modelcontextprotocol/server-everything --cli --method tools/call --tool-name longRunningOperation --tool-arg duration=3 steps=2 --request-timeout 2000 --reset-timeout-on-progress true

I get:

On main

Image

On Kavyapriya-1804/feat-cli-server-request-configs (from #373)

Image

cliffhall avatar Oct 20 '25 18:10 cliffhall

I would like a way to access the notifications/message also.

scottschreckengaust avatar Oct 23 '25 23:10 scottschreckengaust