Skip to content

fix(server): add timeout to all requests.get() calls to prevent indefinite hangs (#64)#86

Open
TumCucTom wants to merge 1 commit into
MiniMax-AI:mainfrom
TumCucTom:fix/mcp-64-request-timeouts
Open

fix(server): add timeout to all requests.get() calls to prevent indefinite hangs (#64)#86
TumCucTom wants to merge 1 commit into
MiniMax-AI:mainfrom
TumCucTom:fix/mcp-64-request-timeouts

Conversation

@TumCucTom
Copy link
Copy Markdown

Summary

  • Add DOWNLOAD_TIMEOUT = 120 constant in minimax_mcp/const.py.
  • Pass timeout=DOWNLOAD_TIMEOUT to all 6 requests.get() call sites in minimax_mcp/server.py.
  • For video downloads (generate_video, query_video_generation) also add stream=True to avoid loading whole file into memory.
  • New regression test: tests/test_download_timeout.py verifies the timeout is plumbed through.

Why

Issue #64: missing timeouts meant a slow remote could block the MCP server forever. requests.Timeout is a subclass of requests.RequestException which is already caught by existing except blocks, so no new exception handling is needed.

Test plan

  • New test tests/test_download_timeout.py mocks requests.get and asserts the timeout kwarg
  • pytest tests/ green

Fixes #64.

🤖 Generated with Claude Code

…inite hangs

The 6 requests.get() call sites in minimax_mcp/server.py had no
timeout= argument, so a slow or unresponsive remote server would
block the MCP tool pipeline indefinitely with no way to recover
short of killing the process.

Add a module-level DOWNLOAD_TIMEOUT = 120 in const.py and pass it
to every requests.get() call. For video downloads (generate_video,
query_video_generation) also add stream=True to avoid loading
the whole file into memory before writing it out.

MinimaxTimeoutError (already defined in exceptions.py) is a subclass
of MinimaxRequestError, which is already caught by the existing
except blocks — no exception-routing change needed.

Fixes MiniMax-AI#64.

Co-authored-by: Zippy AI <tomkinsbale@icloud.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

fix(server): missing timeout on all requests.get() calls — potential indefinite hang

1 participant