# Add global and HTTP context server timeout settings \(\#45378\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/62ae7fb51bfbc0e17483b3f944ee59b5f71fcb7f)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 62ae7fb51bfbc0e17483b3f944ee59b5f71fcb7f

Requested commit: 62ae7fb51bfbc0e17483b3f944ee59b5f71fcb7f

Commit: 62ae7fb51bfbc0e17483b3f944ee59b5f71fcb7f

Tree: deea55e0558bcea29202f7097278b0e48d984901

Author: John D\. Swanson

Committer: GitHub

## Message

```
Add global and HTTP context server timeout settings (#45378)

### Closes 
- Maybe https://github.com/zed-industries/zed/issues/38252 (there might
be something going on with NPX too)
- Also addresses
https://github.com/zed-industries/zed/pull/39021#issuecomment-3644818347



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

## Parents

- [beece469d6f31fb506ea4cb7c49a687152d3c32f](https://git.cafe/gitcafe/zed/commit/beece469d6f31fb506ea4cb7c49a687152d3c32f?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/62ae7fb51bfbc0e17483b3f944ee59b5f71fcb7f?format=markdown)
