Skip to content

fix(mcp): reject non-finite or non-positive connect timeouts#679

Merged
evalstate merged 1 commit intoevalstate:mainfrom
strato-space:fix/upstream-mcp-timeout-finite
Feb 11, 2026
Merged

fix(mcp): reject non-finite or non-positive connect timeouts#679
evalstate merged 1 commit intoevalstate:mainfrom
strato-space:fix/upstream-mcp-timeout-finite

Conversation

@iqdoctor
Copy link
Contributor

Summary

Validate /mcp connect --timeout values to reject non-finite and non-positive numbers.

Previously parse_connect_input accepted float(...) without finiteness checks, which allowed values like nan and inf.

Changes

  • src/fast_agent/commands/handlers/mcp_runtime.py
    • After parsing timeout via float, require:
      • math.isfinite(timeout_seconds)
      • timeout_seconds > 0
    • Raise a clear ValueError when invalid.
  • tests/unit/fast_agent/commands/test_mcp_runtime_handlers.py
    • Added parameterized coverage for nan, inf, -inf, 0, and -1.

Validation

  • uv run pytest tests/unit/fast_agent/commands/test_mcp_runtime_handlers.py -q
  • uv run ruff check src/fast_agent/commands/handlers/mcp_runtime.py tests/unit/fast_agent/commands/test_mcp_runtime_handlers.py

@evalstate evalstate merged commit 70eeab9 into evalstate:main Feb 11, 2026
11 checks passed
@evalstate
Copy link
Owner

LOL, you were quick on that one.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants