feat: per-service timeout in services.json#15
Conversation
Services can now specify a `timeout` field (ms) that overrides the global MCP2CLI_TOOL_TIMEOUT env var for tool call timeouts. Useful for slow backends like AppleScript-based MCP servers. Priority: per-service config > MCP2CLI_TOOL_TIMEOUT env > 30s default Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @rodaddy's task —— View job PR Review: feat/per-service-timeout
Overall this is a clean, minimal change with good schema validation. A few issues worth addressing: Bug:
|
| Severity | Issue |
|---|---|
| Bug | NaN from bad MCP2CLI_TOOL_TIMEOUT causes instant timeouts |
| Minor | Abort listener not marked { once: true } |
| Cleanup | Redundant "timeout" in serviceConfig guard |
| Minor | TOCTOU double getConfig() across await |
| Nit | No upper bound on schema timeout |
The schema addition in schema.ts is clean and correct. The core timeout logic is sound — just the env var fallback path and the listener leak need addressing.
Summary
timeoutfield to service config schema (shared across stdio/http/websocket backends)MCP2CLI_TOOL_TIMEOUTenv var, then 30s defaultContext
Discovered while integrating Apple services --
mcp-apple-calendar(AppleScript) took >60s to list events. Swapped tomcp-ical(EventKit, ~3s) but the per-service timeout is still useful for other slow backends.Test plan
timeoutfield passes validation🤖 Generated with Claude Code