@@ -10,7 +10,7 @@ import (
10
10
"k8s.io/utils/ptr"
11
11
12
12
"github.com/manusa/kubernetes-mcp-server/pkg/config"
13
- "github.com/manusa/kubernetes-mcp-server/pkg/kubernetes"
13
+ internalk8s "github.com/manusa/kubernetes-mcp-server/pkg/kubernetes"
14
14
"github.com/manusa/kubernetes-mcp-server/pkg/output"
15
15
"github.com/manusa/kubernetes-mcp-server/pkg/version"
16
16
)
@@ -41,7 +41,7 @@ func (c *Configuration) isToolApplicable(tool server.ServerTool) bool {
41
41
type Server struct {
42
42
configuration * Configuration
43
43
server * server.MCPServer
44
- k * kubernetes .Manager
44
+ k * internalk8s .Manager
45
45
}
46
46
47
47
func NewServer (configuration Configuration ) (* Server , error ) {
@@ -65,7 +65,7 @@ func NewServer(configuration Configuration) (*Server, error) {
65
65
}
66
66
67
67
func (s * Server ) reloadKubernetesClient () error {
68
- k , err := kubernetes .NewManager (s .configuration .StaticConfig .KubeConfig , s .configuration .StaticConfig )
68
+ k , err := internalk8s .NewManager (s .configuration .StaticConfig .KubeConfig , s .configuration .StaticConfig )
69
69
if err != nil {
70
70
return err
71
71
}
@@ -132,5 +132,17 @@ func NewTextResult(content string, err error) *mcp.CallToolResult {
132
132
}
133
133
134
134
func contextFunc (ctx context.Context , r * http.Request ) context.Context {
135
- return context .WithValue (ctx , kubernetes .AuthorizationHeader , r .Header .Get (kubernetes .AuthorizationHeader ))
135
+ // Get the standard Authorization header (OAuth compliant)
136
+ authHeader := r .Header .Get (internalk8s .OAuthAuthorizationHeader )
137
+ if authHeader != "" {
138
+ return context .WithValue (ctx , internalk8s .OAuthAuthorizationHeader , authHeader )
139
+ }
140
+
141
+ // Fallback to custom header for backward compatibility
142
+ customAuthHeader := r .Header .Get (internalk8s .CustomAuthorizationHeader )
143
+ if customAuthHeader != "" {
144
+ return context .WithValue (ctx , internalk8s .OAuthAuthorizationHeader , customAuthHeader )
145
+ }
146
+
147
+ return ctx
136
148
}
0 commit comments