zed/crates/context_server/src
bgfraser 12e1e24434
Initiate MCP OAuth flow on post-initialize 401 responses (#60236)
MCP servers may accept `initialize` unauthenticated but return `401`
with a `WWW-Authenticate` challenge only on a later request such as
`tools/list` or `tools/call`. Previously Zed only started the Auth flow
when `initialize` itself was challenged, so these servers failed
opaquely and stayed stuck in `Running` with a dead client.

`ContextServerStore` now handles `TransportError::AuthRequired` returned
from any request, not just startup: it runs Auth discovery and
transitions the server into `AuthRequired` so the UI offers to
authenticate. The discovery logic is shared with the startup path, and
the tool/prompt request sites route their errors through it.

Release Notes:

- Fixed MCP servers that require auth only on tool calls (not on
`initialize`) failing to prompt for authentication.

---------

Co-authored-by: Tom Houlé <tom@tomhoule.com>
2026-07-03 18:24:54 +00:00
..
transport Initiate MCP OAuth flow on post-initialize 401 responses (#60236) 2026-07-03 18:24:54 +00:00
client.rs Initiate MCP OAuth flow on post-initialize 401 responses (#60236) 2026-07-03 18:24:54 +00:00
context_server.rs Initiate MCP OAuth flow on post-initialize 401 responses (#60236) 2026-07-03 18:24:54 +00:00
listener.rs Support latest MCP protocol version (#54494) 2026-04-29 16:29:48 +00:00
oauth.rs Implement MCP OAuth client preregistration (#52900) 2026-05-19 17:45:07 +00:00
protocol.rs Initiate MCP OAuth flow on post-initialize 401 responses (#60236) 2026-07-03 18:24:54 +00:00
test.rs Support latest MCP protocol version (#54494) 2026-04-29 16:29:48 +00:00
transport.rs Initiate MCP OAuth flow on post-initialize 401 responses (#60236) 2026-07-03 18:24:54 +00:00
types.rs Support latest MCP protocol version (#54494) 2026-04-29 16:29:48 +00:00