Skip to content

Add global and HTTP context server timeout settings#45378

Merged
probably-neb merged 8 commits intomainfrom
global-and-http-mcp-timeout
Jan 5, 2026
Merged

Add global and HTTP context server timeout settings#45378
probably-neb merged 8 commits intomainfrom
global-and-http-mcp-timeout

Conversation

@swannysec
Copy link
Contributor

@swannysec swannysec commented Dec 19, 2025

Closes

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

Release Notes:

  • Added the ability to configure timeouts for context server tool calls. The new global context_server_timeout setting controls the default timeout (default is 60s, max: 10min). Additionally, per-server timeouts can be configured using the timeout field within servers defined in the `"context_servers" setting

- 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
Contributor

zed-industries-bot commented Dec 19, 2025

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 ad78f84

@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
@probably-neb probably-neb merged commit 62ae7fb into main Jan 5, 2026
24 checks passed
@probably-neb probably-neb deleted the global-and-http-mcp-timeout branch January 5, 2026 18:45
rtfeldman pushed a commit that referenced this pull request Jan 5, 2026
### Closes 
- Maybe #38252 (there might
be something going on with NPX too)
- Also addresses
#39021 (comment)



### 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


### Release Notes:

- Added the ability to configure timeouts for context server tool calls.
The new global `context_server_timeout` setting controls the default
timeout (default is 60s, max: 10min). Additionally, per-server timeouts
can be configured using the `timeout` field within servers defined in
the `"context_servers" setting

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…5378)

### Closes 
- Maybe zed-industries#38252 (there might
be something going on with NPX too)
- Also addresses
zed-industries#39021 (comment)



### 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


### Release Notes:

- Added the ability to configure timeouts for context server tool calls.
The new global `context_server_timeout` setting controls the default
timeout (default is 60s, max: 10min). Additionally, per-server timeouts
can be configured using the `timeout` field within servers defined in
the `"context_servers" setting

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…5378)

### Closes 
- Maybe zed-industries#38252 (there might
be something going on with NPX too)
- Also addresses
zed-industries#39021 (comment)



### 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


### Release Notes:

- Added the ability to configure timeouts for context server tool calls.
The new global `context_server_timeout` setting controls the default
timeout (default is 60s, max: 10min). Additionally, per-server timeouts
can be configured using the `timeout` field within servers defined in
the `"context_servers" setting

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
…5378)

### Closes 
- Maybe zed-industries#38252 (there might
be something going on with NPX too)
- Also addresses
zed-industries#39021 (comment)



### 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


### Release Notes:

- Added the ability to configure timeouts for context server tool calls.
The new global `context_server_timeout` setting controls the default
timeout (default is 60s, max: 10min). Additionally, per-server timeouts
can be configured using the `timeout` field within servers defined in
the `"context_servers" setting

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
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