Skip to content

Conversation

@swannysec
Copy link
Contributor

Closes

Release Notes:

  • Added global context_server_timeout setting (default: 60s, max: 10min) to configure default timeout for all MCP servers
    • Per-server timeout overrides now added via timeout field for HTTP context server configurations
    • Automatic timeout precedence (per-server > global > default) with safety cap prevents resource exhaustion

Why

Some more involved MCP servers timeout often, especially on first setup. I got tired of having to set timeouts manually per server. I also noticed a timeout could not be set for http context servers, which causes Context7 or GitHub's remote servers to timeout at 60s sometimes.

Overview

MCP Timeout Configuration Feature

This PR adds additional configurable timeout settings for Model Context Protocol servers including a global timeout and the addition of timeouts for http servers, addressing issues where servers were timing out after a fixed 60 seconds regardless of user needs.

Key Features:

  • Global timeout setting (context_server_timeout) - default timeout for all MCP servers (default: 60s, max: 10min)
  • Per-server timeout overrides - individual servers can specify custom timeouts via timeout field
  • Precedence hierarchy - per-server timeout > global timeout > default (60s)
  • Automatic bounds checking - enforces 10-minute maximum to prevent resource exhaustion
  • Support for both transports - works with stdio and HTTP-based context servers
  • Comprehensive test coverage - 3 new tests validating global, override, and stdio timeout behavior
  • Full backward compatibility - existing configurations work unchanged with sensible defaults

- Add global context_server_timeout setting (default 60000ms)
- Add per-server timeout field to HTTP context server configuration
- Implement timeout precedence: per-server > global > 60s default
- Both Stdio and HTTP servers now support timeout configuration
- Update ContextServer to pass timeout to HTTP transport
- Document timeout settings with examples in default.json
- Fix URL construction in tests (use url::Url::parse instead of .into())
- Fix test assertions to properly call create_context_server
- Add test_context_server_global_timeout: verifies global timeout setting
- Add test_context_server_per_server_timeout_override: verifies per-server override
- Add test_context_server_stdio_timeout: verifies stdio server timeout handling
- All three tests now passing successfully
- Replace .unwrap() with .expect() for set_user_settings calls
- Replace .unwrap() with .expect() for URL parsing in test setup
- Provides descriptive panic messages if test setup fails
- Follows Zed test patterns seen in project_tests.rs
- All tests still passing
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 19, 2025
@zed-industries-bot
Copy link

Messages
📖

This PR includes links to the following GitHub Issues: #38252
If this PR aims to close an issue, please include a Closes #ISSUE line at the top of the PR body.

Generated by 🚫 dangerJS against 548df67

@swannysec swannysec marked this pull request as ready for review December 19, 2025 20:13
@maxdeviant maxdeviant changed the title Add global and http context server timeout settings Add global and HTTP context server timeout settings Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants