@@ -1665,8 +1665,12 @@ def validate_mcp_auth_headers(self) -> Self:
16651665 Validate MCP server authorization headers against authentication module.
16661666
16671667 Removes any MCP server with authorization_headers="kubernetes" when the
1668- authentication module is not "k8s". This prevents sending wrong credential
1669- types to MCP servers.
1668+ authentication module is not "k8s" or "noop-with-token". This prevents sending
1669+ wrong credential types to MCP servers.
1670+
1671+ Note: "noop-with-token" should only be used for testing/development purposes.
1672+ When using "noop-with-token" with kubernetes authorization headers, a real
1673+ Kubernetes token must still be passed in the request headers.
16701674
16711675 Returns:
16721676 Self: The model instance after validation.
@@ -1680,15 +1684,28 @@ def validate_mcp_auth_headers(self) -> Self:
16801684 is_valid = True
16811685 if mcp_server .authorization_headers :
16821686 for value in mcp_server .authorization_headers .values ():
1683- if value .strip () == "kubernetes" and auth_module != "k8s" :
1687+ if (
1688+ value .strip () == constants .MCP_AUTH_KUBERNETES
1689+ and auth_module
1690+ not in [
1691+ constants .AUTH_MOD_K8S ,
1692+ constants .AUTH_MOD_NOOP_WITH_TOKEN ,
1693+ ]
1694+ ):
16841695 logger .warning (
16851696 "Removing MCP server '%s': has authorization_headers with "
1686- "value 'kubernetes ' but authentication module is '%s' "
1687- "(not 'k8s' ). Either change authentication.module to 'k8s' "
1688- "or update the MCP server's authorization_headers to use a "
1689- "file path or 'client '." ,
1697+ "value '%s ' but authentication module is '%s' "
1698+ "(not '%s' or '%s' ). Either change authentication.module to "
1699+ "'%s' or '%s' or update the MCP server's authorization_headers "
1700+ "to use a file path or '%s '." ,
16901701 mcp_server .name ,
1702+ constants .MCP_AUTH_KUBERNETES ,
16911703 auth_module ,
1704+ constants .AUTH_MOD_K8S ,
1705+ constants .AUTH_MOD_NOOP_WITH_TOKEN ,
1706+ constants .AUTH_MOD_K8S ,
1707+ constants .AUTH_MOD_NOOP_WITH_TOKEN ,
1708+ constants .MCP_AUTH_CLIENT ,
16921709 )
16931710 is_valid = False
16941711 break
0 commit comments