Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9a918ba
initial commit
ashwin-ranade Nov 18, 2025
841b6c1
fix: Add timeout configuration for MCP servers
ashwin-ranade Dec 18, 2025
35b2051
Remove orphaned K8s resource cleanup code
ashwin-ranade Dec 19, 2025
0ed67b8
Revert aiohttp timeout changes - only fix Istio VirtualService timeout
ashwin-ranade Dec 19, 2025
13739e6
Simplify timeout logic - just check passthrough forwarder type
ashwin-ranade Dec 19, 2025
e28f72c
Remove unused orphaned cleanup methods - not needed for timeout fix
ashwin-ranade Dec 19, 2025
59295c7
Add back /mcp route check - passthrough alone is not sufficient
ashwin-ranade Dec 19, 2025
2b39d41
Update comment: clarify that empty string defaults to 30 seconds
ashwin-ranade Dec 19, 2025
6e01fb9
Update comment format
ashwin-ranade Dec 19, 2025
7769c54
Simplify comment to just state default timeout
ashwin-ranade Dec 19, 2025
162ead8
Merge branch 'main' into asr/fix-mcp-timeout
ashwin-ranade Dec 19, 2025
8b436c0
Fix black formatting - split long line
ashwin-ranade Dec 19, 2025
553f872
Merge remote-tracking branch 'origin/main' into asr/fix-mcp-timeout
ashwin-ranade Jan 16, 2026
f93cce0
fix: Remove trailing whitespace in k8s_resource_types.py
ashwin-ranade Jan 16, 2026
b892af9
fix: Add proper indentation to MCP_TIMEOUT in YAML template
ashwin-ranade Jan 16, 2026
66f8e77
fix: Add newline to MCP_TIMEOUT to ensure valid YAML formatting
ashwin-ranade Jan 16, 2026
df55401
fix: Use YAML comment for empty MCP_TIMEOUT to avoid invalid blank line
ashwin-ranade Jan 16, 2026
668eb3d
fix: Remove blank lines from YAML after template substitution to hand…
ashwin-ranade Jan 16, 2026
5bbe67f
fix: Improve blank line removal logic in YAML post-processing
ashwin-ranade Jan 16, 2026
9619cb5
fix: Remove all whitespace-only lines from YAML to fix empty MCP_TIME…
ashwin-ranade Jan 16, 2026
9bc80c4
fix: Target specific blank line pattern for empty MCP_TIMEOUT instead…
ashwin-ranade Jan 16, 2026
a58ef4f
fix: Use regex to remove blank lines from empty MCP_TIMEOUT substitution
ashwin-ranade Jan 16, 2026
a811a5b
fix: Improve regex pattern to handle empty MCP_TIMEOUT lines with or …
ashwin-ranade Jan 16, 2026
fea83d1
fix: Use simple line filtering to remove empty MCP_TIMEOUT lines
ashwin-ranade Jan 16, 2026
630dab6
fix: Filter out whitespace-only lines from YAML template substitutions
ashwin-ranade Jan 16, 2026
caa364c
fix: Simplify blank line removal logic for empty template substitutions
ashwin-ranade Jan 16, 2026
59e8574
fix: Format timeout assignment to comply with Black formatting rules
ashwin-ranade Jan 16, 2026
7c02088
fix: Format timeout assignment as if/else to comply with Black
ashwin-ranade Jan 16, 2026
b6a6edd
fix: Apply Black formatting to k8s_resource_types.py
ashwin-ranade Jan 16, 2026
a634ed7
revert: Remove blank line removal logic - keep original MCP timeout f…
ashwin-ranade Jan 16, 2026
8c63c35
docs: Update comment to remove reference to removed blank line remova…
ashwin-ranade Jan 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,7 @@ data:
host: "${RESOURCE_NAME}.${NAMESPACE}.svc.cluster.local"
port:
number: 80
${MCP_TIMEOUT}
{{- end }}
{{- if .Values.destinationrule.enabled }}
destination-rule.yaml: |-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import os
import re
from string import Template
from typing import Any, Dict, List, Optional, Tuple

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ class VirtualServiceArguments(_BaseEndpointArguments):
"""Keyword-arguments for substituting into virtual-service templates."""

DNS_HOST_DOMAIN: str
MCP_TIMEOUT: str # "" (Default) is 30 seconds


class LwsServiceEntryArguments(_BaseEndpointArguments):
Expand Down Expand Up @@ -1361,6 +1362,25 @@ def get_endpoint_resource_arguments_from_request(
SERVICE_NAME_OVERRIDE=service_name_override,
)
elif endpoint_resource_name == "virtual-service":
# Set 5-minute timeout for MCP servers to fix 30-second default timeout issue
# MCP servers use passthrough forwarder and have routes containing /mcp
is_mcp_server = False
if isinstance(flavor, RunnableImageLike) and flavor.forwarder_type == "passthrough":
all_routes = []
if flavor.predict_route:
all_routes.append(flavor.predict_route)
if flavor.routes:
all_routes.extend(flavor.routes)
if flavor.extra_routes:
all_routes.extend(flavor.extra_routes)
is_mcp_server = any("/mcp" in route.lower() for route in all_routes)
# Format timeout with proper indentation (10 spaces to match YAML structure)
# When not MCP server, use empty string
if is_mcp_server:
timeout = " timeout: 300s"
else:
timeout = ""

return VirtualServiceArguments(
# Base resource arguments
RESOURCE_NAME=k8s_resource_group_name,
Expand All @@ -1373,6 +1393,7 @@ def get_endpoint_resource_arguments_from_request(
OWNER=owner,
GIT_TAG=GIT_TAG,
DNS_HOST_DOMAIN=infra_config().dns_host_domain,
MCP_TIMEOUT=timeout,
)
elif endpoint_resource_name == "destination-rule":
return DestinationRuleArguments(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
from model_engine_server.domain.services import ModelEndpointService
from model_engine_server.domain.use_cases.model_endpoint_use_cases import MODEL_BUNDLE_CHANGED_KEY
from model_engine_server.infra.gateways import ModelEndpointInfraGateway
from model_engine_server.infra.gateways.resources.k8s_endpoint_resource_delegate import (
K8SEndpointResourceDelegate,
)
from model_engine_server.infra.repositories import ModelEndpointCacheRepository
from model_engine_server.infra.repositories.model_endpoint_record_repository import (
ModelEndpointRecordRepository,
Expand Down