Skip to main content
Glama
GodisinHisHeaven

USCardForum MCP Server

get_new_topics

Fetch recently created topics from USCardForum to find new deals, fresh questions, and emerging discussions before they become popular.

Instructions

Fetch the latest/newest topics from USCardForum.

Returns recently created topics sorted by creation time (newest first).
These may have fewer replies but contain fresh information.

Use this to:
- Find newly posted deals or offers
- See fresh questions from the community
- Discover emerging discussions before they get popular

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

Returns a list of TopicSummary objects with:
- id: Topic ID
- title: Topic title
- posts_count: Number of posts
- created_at: When the topic was created
- category_id: Which forum section it's in

Tip: New topics with high view counts may indicate important news.

Input Schema

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

Implementation Reference

  • MCP tool handler for 'get_new_topics' decorated with @mcp.tool(). Defines input schema via Annotated page parameter and detailed docstring. Executes tool logic by delegating to shared client instance's get_new_topics method, which fetches latest topics from the forum API.
    @mcp.tool()
    def get_new_topics(
        page: Annotated[
            int | None,
            Field(default=None, description="Page number for pagination (0-indexed, default: 0)"),
        ] = None,
    ) -> list[TopicSummary]:
        """
        Fetch the latest/newest topics from USCardForum.
    
        Returns recently created topics sorted by creation time (newest first).
        These may have fewer replies but contain fresh information.
    
        Use this to:
        - Find newly posted deals or offers
        - See fresh questions from the community
        - Discover emerging discussions before they get popular
    
        Args:
            page: Page number for pagination (0-indexed). Use page=1 to get more topics.
    
        Returns a list of TopicSummary objects with:
        - id: Topic ID
        - title: Topic title
        - posts_count: Number of posts
        - created_at: When the topic was created
        - category_id: Which forum section it's in
    
        Tip: New topics with high view counts may indicate important news.
        """
        return get_client().get_new_topics(page=page)
  • Imports the get_new_topics tool (line 24) along with all other MCP tools from server_tools package. Importing the decorated functions registers them with the FastMCP server instance.
    from uscardforum.server_tools import (
        analyze_user,
        bookmark_post,
        compare_cards,
        find_data_points,
        get_all_topic_posts,
        get_categories,
        get_current_session,
        get_hot_topics,
        get_new_topics,
        get_notifications,
        get_top_topics,
        get_topic_info,
        get_topic_posts,
        get_user_actions,
        get_user_badges,
        get_user_followers,
        get_user_following,
        get_user_reactions,
        get_user_replies,
        get_user_summary,
        get_user_topics,
        list_users_with_badge,
        login,
        research_topic,
        resource_categories,
        resource_hot_topics,
        resource_new_topics,
        search_forum,
        subscribe_topic,
    )
  • Shared helper function get_client() that returns the singleton DiscourseClient instance used by all MCP tools, including get_new_topics. Handles client creation, Cloudflare bypass, and optional auto-login.
    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"))
            _client = DiscourseClient(base_url=base_url, timeout_seconds=timeout)
    
            # Auto-login if credentials are provided
            if not _login_attempted:
                _login_attempted = True
                username = os.environ.get("NITAN_USERNAME")
                password = os.environ.get("NITAN_PASSWORD")
    
                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
  • Core API helper in TopicsAPI.get_new_topics() that performs the HTTP GET request to /latest.json endpoint, parses the JSON response, and constructs TopicSummary models from the raw topic data.
    def get_new_topics(self, *, page: int | None = None) -> list[TopicSummary]:
        """Fetch latest new topics.
    
        Args:
            page: Page number for pagination (0-indexed, default: 0)
    
        Returns:
            List of new topic summaries
        """
        params: dict[str, Any] = {}
        if page is not None:
            params["page"] = int(page)
    
        payload = self._get(
            "/latest.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]
  • DiscourseClient.get_new_topics() wrapper that delegates to TopicsAPI and enriches the returned TopicSummary list with category names using _enrich_with_categories method.
    def get_new_topics(self, *, page: int | None = None) -> list[TopicSummary]:
        """Fetch latest new topics.
    
        Args:
            page: Page number for pagination (0-indexed, default: 0)
    
        Returns:
            List of new topic summaries
        """
        topics = self._topics.get_new_topics(page=page)
        return self._enrich_with_categories(topics)

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/GodisinHisHeaven/uscardforum-mcp'

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