Scope ETag cache to REST client and bound it by bytes · github/github-mcp-server@7667cc7 · GitHub
Skip to content

Commit 7667cc7

Browse files
joshfreeCopilot
authored andcommitted
Scope ETag cache to REST client and bound it by bytes
Restrict the conditional-request cache to the long-lived local (stdio) REST client and give the raw-content client a separate transport without it, so large file bodies are streamed rather than buffered into memory. Bound the cache by a per-entry and total-byte budget in addition to the entry count, and never retain responses marked non-storable by HTTP cache directives (request or response Cache-Control: no-store, or Vary: *). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4959e1f9-f8e6-4e97-a487-f395a0123c79
1 parent 67df036 commit 7667cc7

4 files changed

Lines changed: 360 additions & 42 deletions

File tree

‎internal/ghmcp/server.go‎

Lines changed: 35 additions & 11 deletions

‎pkg/http/headers/headers.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ const (
1313
ETagHeader = "ETag"
1414
// IfNoneMatchHeader is a standard HTTP Header used to make a request conditional on an entity tag.
1515
IfNoneMatchHeader = "If-None-Match"
16+
// CacheControlHeader is a standard HTTP Header carrying caching directives.
17+
CacheControlHeader = "Cache-Control"
18+
// VaryHeader is a standard HTTP Header describing which request headers a response varies on.
19+
VaryHeader = "Vary"
1620

1721
// ContentTypeJSON is the standard MIME type for JSON.
1822
ContentTypeJSON = "application/json"

‎pkg/http/transport/etag.go‎

Lines changed: 147 additions & 31 deletions

0 commit comments

Comments
 (0)