CLI: Progress notifications not captured, preventing timeout reset functionality
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
- 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 - Observe that the operation times out even though:
- The server is sending progress notifications (verified in web UI)
--reset-timeout-on-progress trueis set- The timeout should be reset on each progress update
Expected behavior
When --reset-timeout-on-progress true is set, the CLI should:
- Listen for progress notifications from the MCP server
- Reset the request timeout each time a progress notification is received
- Display or log progress notifications (similar to how the web UI shows them)
- 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-timeoutflags to CLI mode - The flags are parsed and passed to the SDK correctly
- However, the CLI code in
cli/src/client/connection.tsand related files doesn't set up listeners for progress notifications - This limitation means that
--reset-timeout-on-progressand--max-total-timeoutdon'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:
- Set up notification listeners after connecting to the server
- Handle
notifications/progressmessages - Optionally display progress updates to stderr (so they don't interfere with JSON output on stdout)
- Ensure the SDK's timeout reset mechanism is triggered on progress notifications
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
On Kavyapriya-1804/feat-cli-server-request-configs (from #373)
I would like a way to access the notifications/message also.