Skip to content

Support configurable MCP gateway tool timeout via engine.mcp.tool-timeout #29630

@lpcox

Description

@lpcox

Problem

The MCP gateway has a hardcoded default toolTimeout of 60 seconds. Workflows using slow MCP backends (e.g., Repo Mind Light which requires full-text search over large indexes) hit this timeout even when GH_AW_TOOL_TIMEOUT is set much higher (e.g., 600s).

Root cause: GH_AW_TOOL_TIMEOUT is an env var consumed by the agent container (Copilot CLI), but the MCP gateway — which proxies tool calls between the agent and backend MCP servers — enforces its own independent 60s timeout that is not configurable from the workflow frontmatter.

Evidence: github/pull-requests run 25225648212 shows:

  • GH_AW_TOOL_TIMEOUT: 600 (agent env)
  • Gateway: toolTimeout=60 (gateway internal default)
  • Result: net/http: timeout awaiting response headers on repo-mind query after ~60s

Proposed Solution

Add engine.mcp.tool-timeout to the workflow frontmatter schema, following the same pattern as engine.mcp.session-timeout (PR #29354):

engine:
  mcp:
    tool-timeout: 120   # seconds (or duration string like "2m")
    session-timeout: 6h # already supported

Implementation

  1. Schema: Add engine.mcp.tool-timeout property to the JSON schema (integer seconds or duration string)
  2. Parsing: Add MCPToolTimeout field to EngineConfig in ExtractEngineConfig
  3. Validation: Add validateEngineMCPToolTimeout (bounds: 10s–600s) in engine_validation.go
  4. Config propagation: In buildMCPGatewayConfig, propagate to MCPGatewayRuntimeConfig.ToolTimeout
  5. Rendering: Pass toolTimeout in the gateway stdin JSON config (requires mcpg support — see companion issue)
  6. Default: When not specified, omit from config (gateway uses its own default of 60s)

Frontmatter example

engine:
  mcp:
    tool-timeout: 120

Depends On

  • github/gh-aw-mcpg companion issue: mcpg must accept toolTimeout in its stdin JSON config and apply it to HTTP backend requests

Related

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

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