Skip to content

fix: Add timeout configuration for MCP servers#741

Closed
ashwin-ranade wants to merge 12 commits intomainfrom
asr/fix-mcp-timeout
Closed

fix: Add timeout configuration for MCP servers#741
ashwin-ranade wants to merge 12 commits intomainfrom
asr/fix-mcp-timeout

Conversation

@ashwin-ranade
Copy link
Collaborator

@ashwin-ranade ashwin-ranade commented Dec 19, 2025

Summary

This PR adds timeout configuration for MCP servers to prevent hanging requests and fix 30-second timeout errors.

Problem

MCP servers often have long-running operations that exceed the default 30-second Istio timeout, causing request failures.

Solution

  • Detect MCP servers by checking if forwarder_type is 'passthrough' and routes contain '/mcp'
  • Keep default timeouts for non-MCP endpoints

@ashwin-ranade ashwin-ranade changed the title fix: Add endpoint_name fallback for orphaned K8s resource cleanup fix: Add timeout configuration for MCP servers Dec 19, 2025
@ashwin-ranade ashwin-ranade marked this pull request as ready for review December 19, 2025 17:36
Add configurable Istio VirtualService timeout for MCP servers to prevent
30-second default timeout errors on long-running operations.

- MCP servers (passthrough forwarder with /mcp routes): 5-minute timeout
- All other endpoints: explicit 30-second timeout (Istio default)

Always sets an explicit timeout value to avoid YAML formatting issues.
Add request_timeout_seconds field to RunnableImageLike flavor to allow
configurable Istio VirtualService timeout per endpoint.

- Add request_timeout_seconds: Optional[int] field to RunnableImageLike
- Add database column and migration
- Update VirtualService logic to use configurable timeout instead of
  MCP detection heuristic
- Defaults to 30s (Istio default) when not specified

This allows any endpoint (not just MCP servers) to configure a custom
timeout by setting request_timeout_seconds in their flavor config.
- Restore MCP server detection logic (passthrough forwarder + /mcp routes)
- MCP servers: use request_timeout_seconds if set, otherwise 30s
- Non-MCP servers: do nothing (empty string, use Istio default)
…ence

request_timeout_seconds is a runtime configuration field that doesn't
need to be persisted in the database. It can be set via API when
creating/updating bundles but won't be stored in DB columns.
- Add MCP_TIMEOUT_SECONDS env var (defaults to 30s)
- Remove request_timeout_seconds from RunnableImageLike model
- Remove all database model changes and translation logic
- MCP servers use MCP_TIMEOUT_SECONDS env var for timeout
- Non-MCP servers use Istio default (no timeout set)
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.

1 participant