Skip to content

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

@alfonsodg

Description

@alfonsodg

Problem

Multiple requests.get() calls throughout server.py have no timeout parameter, which can cause the server to hang indefinitely if the remote server is unresponsive.

Exact locations

All in minimax_mcp/server.py:

  1. voice_clone()requests.get(file) for URL download (line ~175)
  2. voice_clone()requests.get(response_data.get("demo_audio")).content (line ~205)
  3. play_audio()requests.get(input_file_path).content (line ~220)
  4. generate_video()requests.get(download_url) for video download (line ~330)
  5. query_video_generation()requests.get(download_url) (line ~365)
  6. text_to_image()requests.get(image_url) for image download (line ~410)

Impact

  • MCP server can hang indefinitely waiting for a response
  • No way to recover without killing the process
  • Blocks the entire MCP tool pipeline

Proposed solution

Add a module-level constant and apply to all requests.get() calls:

# At module level
DOWNLOAD_TIMEOUT = 120  # seconds

# Apply everywhere:
requests.get(url, timeout=DOWNLOAD_TIMEOUT)

Also consider adding stream=True for large downloads (video) to avoid loading entire file into memory.

Acceptance criteria

  • Every requests.get() call has an explicit timeout parameter
  • Large file downloads use streaming where appropriate
  • Timeout errors are caught and reported to the user

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions