Skip to content

Commit 1c72eab

Browse files
fix(mcp): preserve JWT issuer URL for token validation
Do not transform server.Issuer to internal FQDN. The issuer must match the JWT iss claim, which uses the external hostname (OBOT_SERVER_HOSTNAME). The issuer URL is only used for string comparison during JWT validation, not for network communication. Without this fix, MCP server pods reject valid JWT tokens with error: 'token has invalid claims: token has invalid issuer'
1 parent e69d471 commit 1c72eab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/mcp/kubernetes.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ func (k *kubernetesBackend) ensureServerDeployment(ctx context.Context, server S
9898
// Transform URLs to use internal service FQDN (for cluster-internal communication)
9999
server.TokenExchangeEndpoint = k.replaceHostWithServiceFQDN(server.TokenExchangeEndpoint)
100100
server.AuditLogEndpoint = k.replaceHostWithServiceFQDN(server.AuditLogEndpoint)
101-
server.Issuer = k.replaceHostWithServiceFQDN(server.Issuer)
101+
// NOTE: Do NOT transform server.Issuer - it must match the JWT issuer claim,
102+
// which uses the external hostname (OBOT_SERVER_HOSTNAME). The issuer is only
103+
// used for string comparison during JWT validation, not for network calls.
102104

103105
// Transform audiences to use internal service FQDN
104106
for i, audience := range server.Audiences {

0 commit comments

Comments
 (0)