Skip to content

fix(handlers): return 499 on client cancel for get-server endpoints#1401

Open
piyushbag wants to merge 1 commit into
modelcontextprotocol:mainfrom
piyushbag:fix/1323-handler-cancellation-get-endpoints
Open

fix(handlers): return 499 on client cancel for get-server endpoints#1401
piyushbag wants to merge 1 commit into
modelcontextprotocol:mainfrom
piyushbag:fix/1323-handler-cancellation-get-endpoints

Conversation

@piyushbag

Copy link
Copy Markdown

Summary

Fixes #1323 (handler-side scope; CDN/RPS follow-up tracked separately on the issue)

Problem

#1335 fixed cancellation handling for GET /v0/servers only. rdimitrov noted that PR only partially addressed #1323. The get-server-version and get-server-versions handlers still logged benign cancellations at error level and returned 500, which can trigger huma superfluous response.WriteHeader warnings.

Test plan

  • go test ./internal/api/handlers/v0/... -run 'ListServersError|GetServerDetailsError|GetServerVersionsError'
  • go test -race ./internal/api/handlers/v0/... -run 'ListServersError|GetServerDetailsError|GetServerVersionsError'
  • go vet ./internal/api/handlers/v0/...

Extend the ListServersError pattern from modelcontextprotocol#1335 to get-server-version
and get-server-versions so benign client disconnects no longer log as
500s or trigger huma superfluous WriteHeader warnings.

Fixes modelcontextprotocol#1323
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/v0/servers logs benign client cancellations as "list servers failed" and triggers "superfluous response.WriteHeader" warnings

1 participant