Skip to content

Commit f1d33d5

Browse files
refactor: use GraphQLFeaturesTransport internally
Replace inline GraphQL-Features header logic in bearerAuthTransport with the exported GraphQLFeaturesTransport. This removes code duplication and ensures the transport is actually used, not just exported.
1 parent d3ff0a2 commit f1d33d5

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

internal/ghmcp/server.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ func createGitHubClients(cfg MCPServerConfig, apiHost apiHost) (*githubClients,
9999
// We use NewEnterpriseClient unconditionally since we already parsed the API host
100100
gqlHTTPClient := &http.Client{
101101
Transport: &bearerAuthTransport{
102-
transport: http.DefaultTransport,
103-
token: cfg.Token,
102+
transport: &github.GraphQLFeaturesTransport{
103+
Transport: http.DefaultTransport,
104+
},
105+
token: cfg.Token,
104106
},
105107
}
106108
gqlClient := githubv4.NewEnterpriseClient(apiHost.graphqlURL.String(), gqlHTTPClient)
@@ -639,12 +641,6 @@ type bearerAuthTransport struct {
639641
func (t *bearerAuthTransport) RoundTrip(req *http.Request) (*http.Response, error) {
640642
req = req.Clone(req.Context())
641643
req.Header.Set("Authorization", "Bearer "+t.token)
642-
643-
// Check for GraphQL-Features in context and add header if present
644-
if features := github.GetGraphQLFeatures(req.Context()); len(features) > 0 {
645-
req.Header.Set("GraphQL-Features", strings.Join(features, ", "))
646-
}
647-
648644
return t.transport.RoundTrip(req)
649645
}
650646

pkg/github/transport.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99
// header to requests based on context values. This is required for using
1010
// non-GA GraphQL API features like the agent assignment API.
1111
//
12-
// This transport is exported for use by library consumers who need to build
13-
// their own HTTP clients with GraphQL feature flag support. The MCP server
14-
// itself uses an inline implementation in its transport stack.
12+
// This transport is used internally by the MCP server and is also exported
13+
// for library consumers who need to build their own HTTP clients with
14+
// GraphQL feature flag support.
1515
//
1616
// Usage:
1717
//

0 commit comments

Comments
 (0)