Skip to main content
Glama
raidenrock

USCardForum MCP Server

by raidenrock

get_hot_topics

Fetch trending topics from USCardForum to discover current community discussions, breaking news, and popular conversations ranked by engagement metrics.

Instructions

Fetch currently trending/hot topics from USCardForum.

This returns the most actively discussed topics right now, ranked by
engagement metrics like recent replies, views, and likes.

Use this to:
- See what the community is currently discussing
- Find breaking news or time-sensitive opportunities
- Discover popular ongoing discussions

Args:
    page: Page number for pagination (0-indexed). Use page=1 to get more topics.

Returns a list of TopicSummary objects with fields:
- id: Topic ID (use with get_topic_posts)
- title: Topic title
- posts_count: Total replies
- views: View count
- like_count: Total likes
- created_at: Creation timestamp
- last_posted_at: Last activity timestamp

Example response interpretation:
A topic with high views but low posts may be informational.
A topic with many recent posts is actively being discussed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination (0-indexed, default: 0)

Implementation Reference

  • MCP tool handler for get_hot_topics: decorated with @mcp.tool(), calls the client API with optional page parameter, returns list of TopicSummary.
    @mcp.tool()
    def get_hot_topics(
        page: Annotated[
            int | None,
            Field(default=None, description="Page number for pagination (0-indexed, default: 0)"),
        ] = None,
    ) -> list[TopicSummary]:
        """
        Fetch currently trending/hot topics from USCardForum.
    
        This returns the most actively discussed topics right now, ranked by
        engagement metrics like recent replies, views, and likes.
    
        Use this to:
        - See what the community is currently discussing
        - Find breaking news or time-sensitive opportunities
        - Discover popular ongoing discussions
    
        Args:
            page: Page number for pagination (0-indexed). Use page=1 to get more topics.
    
        Returns a list of TopicSummary objects with fields:
        - id: Topic ID (use with get_topic_posts)
        - title: Topic title
        - posts_count: Total replies
        - views: View count
        - like_count: Total likes
        - created_at: Creation timestamp
        - last_posted_at: Last activity timestamp
    
        Example response interpretation:
        A topic with high views but low posts may be informational.
        A topic with many recent posts is actively being discussed.
        """
        return get_client().get_hot_topics(page=page)
  • Pydantic model TopicSummary used as return type for get_hot_topics, defining the structure of each topic summary.
    class TopicSummary(BaseModel):
        """Summary of a topic for list views (hot, new, top topics)."""
    
        id: int = Field(..., description="Unique topic identifier")
        title: str = Field(..., description="Topic title")
        posts_count: int = Field(0, description="Total number of posts")
        views: int = Field(0, description="Total view count")
        like_count: int = Field(0, description="Total likes on the topic")
        category_id: int | None = Field(None, description="Category identifier")
        category_name: str | None = Field(None, description="Category name")
        created_at: datetime | None = Field(None, description="When topic was created")
        last_posted_at: datetime | None = Field(None, description="Last activity time")
    
        class Config:
            extra = "ignore"
  • Client-side API implementation in TopicsAPI.get_hot_topics: makes HTTP GET to /hot.json, parses JSON, returns list of TopicSummary.
    def get_hot_topics(self, *, page: int | None = None) -> list[TopicSummary]:
        """Fetch currently trending topics.
    
        Args:
            page: Page number for pagination (0-indexed, default: 0)
    
        Returns:
            List of hot topic summaries
        """
        params: dict[str, Any] = {}
        if page is not None:
            params["page"] = int(page)
    
        payload = self._get(
            "/hot.json",
            params=params or None,
            headers={"Accept": "application/json, text/plain, */*"},
        )
        topics = payload.get("topic_list", {}).get("topics", [])
        return [TopicSummary(**t) for t in topics]
  • get_client() helper: creates and returns the shared DiscourseClient instance, handles auto-login if credentials provided.
    def get_client() -> DiscourseClient:
        """Get or create the Discourse client instance."""
        global _client, _login_attempted
    
        if _client is None:
            base_url = os.environ.get("USCARDFORUM_URL", "https://www.uscardforum.com")
            timeout = float(os.environ.get("USCARDFORUM_TIMEOUT", "15.0"))
    
            username = os.environ.get("NITAN_USERNAME")
            password = os.environ.get("NITAN_PASSWORD")
            user_api_key = os.environ.get("NITAN_API_KEY")
            user_api_client_id = os.environ.get("NITAN_API_CLIENT_ID")
    
            _client = DiscourseClient(
                base_url=base_url,
                timeout_seconds=timeout,
                user_api_key=user_api_key if not (username and password) else None,
                user_api_client_id=(
                    user_api_client_id if not (username and password) else None
                ),
            )
    
            if _client.is_authenticated:
                print("[uscardforum] Using User API Key authentication")
            elif not _login_attempted:
                _login_attempted = True
    
                if username and password:
                    try:
                        result = _client.login(username, password)
                        if result.success:
                            print(f"[uscardforum] Auto-login successful as '{result.username}'")
                        elif result.requires_2fa:
                            print(
                                "[uscardforum] Auto-login failed: 2FA required. Use login() tool with second_factor_token."
                            )
                        else:
                            print(
                                f"[uscardforum] Auto-login failed: {result.error or 'Unknown error'}"
                            )
                    except Exception as e:  # pragma: no cover - logging side effect
                        print(f"[uscardforum] Auto-login error: {e}")
    
        return _client
  • Import of get_hot_topics from server_tools/topics.py in server_tools __init__.py, which triggers registration via @mcp.tool() decorator when imported by server.py.
    from .topics import (
        get_all_topic_posts,
        get_hot_topics,
        get_new_topics,
        get_top_topics,
        get_topic_info,
        get_topic_posts,
    )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/raidenrock/uscardforum-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server