feat: add global default MCP server timeout configs#2065
Open
7Sageer wants to merge 6 commits into
Open
Conversation
Add a `[mcp] startup_timeout_ms` config.toml section with a `KIMI_MCP_STARTUP_TIMEOUT_MS` env override as the global default MCP server connection (startup + tool discovery) timeout. Precedence: per-server `startupTimeoutMs` in mcp.json > env var > config.toml > built-in 30s default.
🦋 Changeset detectedLatest commit: 5fe32b3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
Extend the `[mcp]` section with `tool_timeout_ms` and the `KIMI_MCP_TOOL_TIMEOUT_MS` env override as the global default for single MCP tool calls, mirroring the startup timeout: a per-server `toolTimeoutMs` in mcp.json still wins, and unset entries fall back to the SDK built-in 60s default.
Port the `[mcp]` section (`startup_timeout_ms` / `tool_timeout_ms`) and the `KIMI_MCP_STARTUP_TIMEOUT_MS` / `KIMI_MCP_TOOL_TIMEOUT_MS` env overrides to agent-core (v1), mirroring the v2 semantics: per-server fields in mcp.json > env vars > config.toml > built-in defaults. The v1 TOML loader gains explicit `mcp` read/write mappings, and both connection-manager construction sites (Session, testGlobalMcpServer RPC) pass the resolved defaults through.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
No linked issue — the problem is explained below.
Problem
The MCP server connection (startup + tool discovery) timeout and the single tool-call timeout were only configurable per server via
startupTimeoutMs/toolTimeoutMsinmcp.json. When the whole environment is slow (coldnpxstarts, corporate proxies), users had to edit every server entry by hand; there was no global default and no env-level override.What changed
[mcp]section inconfig.tomlwithstartup_timeout_msandtool_timeout_ms, plusKIMI_MCP_STARTUP_TIMEOUT_MS/KIMI_MCP_TOOL_TIMEOUT_MSenv overrides. Precedence: per-server fields inmcp.json> env var >config.toml> built-in defaults (30s startup, 60s tool call). Invalid env values are ignored.mcpconfig section follows the registry + env-binding pattern (same as[subagent] timeout_ms); the env overlay is stripped before persistence so it never leaks intoconfig.toml. The session MCP service resolves the section into the connection manager's new global defaults.mcpadded to the config schema with explicit TOML read/write mappings; the connection manager takes the resolved defaults at both construction sites (Session and thetestGlobalMcpServerRPC).[mcp]section in config-files, env var rows in env-vars, and a global-default note on the MCP page (zh + en kept in sync).Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.