Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions mcpgateway/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8784,18 +8784,12 @@ async def admin_metrics_partial_html(
Raises:
HTTPException: If entity_type is not one of the valid types
"""
LOGGER.debug(
f"User {get_user_email(user)} requested metrics partial "
f"(entity_type={entity_type}, page={page}, per_page={per_page})"
)
LOGGER.debug(f"User {get_user_email(user)} requested metrics partial " f"(entity_type={entity_type}, page={page}, per_page={per_page})")

# Validate entity type
valid_types = ["tools", "resources", "prompts", "servers"]
if entity_type not in valid_types:
raise HTTPException(
status_code=400,
detail=f"Invalid entity_type. Must be one of: {', '.join(valid_types)}"
)
raise HTTPException(status_code=400, detail=f"Invalid entity_type. Must be one of: {', '.join(valid_types)}")

# Constrain parameters
page = max(1, page)
Expand Down
3 changes: 3 additions & 0 deletions mcpgateway/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ async def get_team_from_token(payload: Dict[str, Any], db: Session) -> Optional[
>>> del sys.modules["mcpgateway.services.team_management_service"]
"""
team_id = payload.get("teams")[0] if payload.get("teams") else None
if isinstance(team_id, dict):
team_id = team_id.get("id")
user_email = payload.get("sub")

# If no team found in token, get user's personal team
if not team_id:

Expand Down
Loading