fix(config): Add support for MCP server configuration parameters (#812)

* fix(config): Add support for MCP server configuration parameters

* refact: rename the sse_readtimeout to sse_read_timeout

* update the code with review comments

* update the MCP document for the latest change
This commit is contained in:
Willem Jiang
2026-01-10 15:59:49 +08:00
committed by GitHub
parent e52e69bdd4
commit 6b73a53999
9 changed files with 207 additions and 13 deletions
+6 -2
View File
@@ -1046,13 +1046,16 @@ async def mcp_server_metadata(request: MCPServerMetadataRequest):
)
try:
# Set default timeout with a longer value for this endpoint
timeout = 300 # Default to 300 seconds for this endpoint
# Set default timeout for this endpoint (configurable via env)
timeout = get_int_env("MCP_DEFAULT_TIMEOUT_SECONDS", 60)
# Use custom timeout from request if provided
if request.timeout_seconds is not None:
timeout = request.timeout_seconds
# Get sse_read_timeout from request if provided
sse_read_timeout = request.sse_read_timeout
# Load tools from the MCP server using the utility function
tools = await load_mcp_tools(
server_type=request.transport,
@@ -1062,6 +1065,7 @@ async def mcp_server_metadata(request: MCPServerMetadataRequest):
env=request.env,
headers=request.headers,
timeout_seconds=timeout,
sse_read_timeout=sse_read_timeout,
)
# Create the response with tools