Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: wider mcp server audience (#19784)

p0ny6fe421cc9430
diff --git a/backend/api/mcp/server.go b/backend/api/mcp/server.go
index 2ee57f8393..c5921c81f1 100644
--- a/backend/api/mcp/server.go
+++ b/backend/api/mcp/server.go
@@ -101,7 +101,7 @@ func (s *Server) authMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
return echo.NewHTTPError(http.StatusUnauthorized, "invalid token")
}
- // Validate audience - must be OAuth2 access token
+ // Validate audience - accept both user access tokens and OAuth2 access tokens
aud, ok := claims["aud"]
if !ok {
return echo.NewHTTPError(http.StatusUnauthorized, "invalid token: missing audience")
@@ -110,10 +110,10 @@ func (s *Server) authMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
validAudience := false
switch v := aud.(type) {
case string:
- validAudience = v == auth.OAuth2AccessTokenAudience
+ validAudience = v == auth.OAuth2AccessTokenAudience || v == auth.AccessTokenAudience
case []any:
for _, a := range v {
- if str, ok := a.(string); ok && str == auth.OAuth2AccessTokenAudience {
+ if str, ok := a.(string); ok && (str == auth.OAuth2AccessTokenAudience || str == auth.AccessTokenAudience) {
validAudience = true
break
}