Skip to main content
Glama
GodisinHisHeaven

USCardForum MCP Server

login

Authenticate to access USCardForum features like notifications, bookmarks, and subscriptions using your forum credentials and optional 2FA.

Instructions

Authenticate with USCardForum credentials.

Args:
    username: Your forum username
    password: Your forum password
    second_factor_token: 2FA code if you have 2FA enabled (optional)

IMPORTANT: Only use this if you need authenticated features like:
- Reading notifications
- Bookmarking posts
- Subscribing to topics

Most read operations work without authentication.

Returns a LoginResult with:
- success: Whether login succeeded
- username: Logged-in username
- error: Error message if failed
- requires_2fa: Whether 2FA is required

The session remains authenticated for subsequent calls.

Security note: Credentials are used only for this session
and are not persisted.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesYour forum username
passwordYesYour forum password
second_factor_tokenNo2FA code if you have 2FA enabled

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNoError message if failed
successYesWhether login succeeded
usernameNoLogged-in username
requires_2faNoWhether 2FA is required

Implementation Reference

  • MCP tool handler for the 'login' tool. Decorated with @mcp.tool(), accepts username, password, optional 2FA token, and delegates to DiscourseClient.login() returning LoginResult.
    @mcp.tool()
    def login(
        username: Annotated[
            str,
            Field(description="Your forum username"),
        ],
        password: Annotated[
            str,
            Field(description="Your forum password"),
        ],
        second_factor_token: Annotated[
            str | None,
            Field(default=None, description="2FA code if you have 2FA enabled"),
        ] = None,
    ) -> LoginResult:
        """
        Authenticate with USCardForum credentials.
    
        Args:
            username: Your forum username
            password: Your forum password
            second_factor_token: 2FA code if you have 2FA enabled (optional)
    
        IMPORTANT: Only use this if you need authenticated features like:
        - Reading notifications
        - Bookmarking posts
        - Subscribing to topics
    
        Most read operations work without authentication.
    
        Returns a LoginResult with:
        - success: Whether login succeeded
        - username: Logged-in username
        - error: Error message if failed
        - requires_2fa: Whether 2FA is required
    
        The session remains authenticated for subsequent calls.
    
        Security note: Credentials are used only for this session
        and are not persisted.
        """
        return get_client().login(
            username, password, second_factor_token=second_factor_token
        )
  • Pydantic model defining the output schema for login results, including success status, username, error, and 2FA requirement.
    class LoginResult(BaseModel):
        """Result of a login attempt."""
    
        success: bool = Field(..., description="Whether login succeeded")
        username: str | None = Field(None, description="Logged-in username")
        error: str | None = Field(None, description="Error message if failed")
        requires_2fa: bool = Field(False, description="Whether 2FA is required")
    
        class Config:
            extra = "ignore"
    
        @classmethod
        def from_api_response(
            cls, data: dict[str, Any], username: str
        ) -> "LoginResult":
            """Parse from raw API response."""
            if "error" in data:
                return cls(success=False, error=data["error"])
            if data.get("second_factor_required"):
                return cls(success=False, requires_2fa=True, username=username)
            return cls(success=True, username=username)
  • Core implementation of login in AuthAPI class: fetches CSRF token, POSTs to /session.json with credentials and optional 2FA, parses response into LoginResult, updates session state.
    def login(
        self,
        username: str,
        password: str,
        second_factor_token: str | None = None,
        remember_me: bool = True,
    ) -> LoginResult:
        """Login to the forum.
    
        Args:
            username: Forum username
            password: Forum password
            second_factor_token: Optional 2FA token
            remember_me: Remember session (default: True)
    
        Returns:
            Login result with success status
        """
        token = self.fetch_csrf_token()
    
        data: dict[str, Any] = {
            "login": username,
            "password": password,
            "remember": remember_me,
        }
        if second_factor_token:
            data["second_factor_token"] = second_factor_token
    
        headers = {
            "Accept": "application/json",
            "Content-Type": "application/json",
            "Referer": f"{self._base_url}/login",
            "X-CSRF-Token": token,
            "X-Requested-With": "XMLHttpRequest",
        }
    
        payload = self._post("/session.json", json=data, headers=headers)
        result = LoginResult.from_api_response(payload, username)
    
        if result.success:
            # Verify session and get username
            session = self.get_current_session()
            if session.current_user:
                self._logged_in_username = session.current_user.username
            else:
                self._logged_in_username = username
    
        return result
  • DiscourseClient.login() wrapper that delegates to the underlying AuthAPI.login() method.
    def login(
        self,
        username: str,
        password: str,
        second_factor_token: str | None = None,
        remember_me: bool = True,
    ) -> LoginResult:
        """Login to the forum.
    
        Args:
            username: Forum username
            password: Forum password
            second_factor_token: Optional 2FA token
            remember_me: Remember session (default: True)
    
        Returns:
            Login result with success status
        """
        return self._auth.login(
            username, password, second_factor_token=second_factor_token, remember_me=remember_me
        )
  • Imports the login tool (and others) from server_tools modules, which registers them via @mcp.tool() decorators when imported into the main server entrypoint.
    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,
    )
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Since no annotations are provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: the session remains authenticated for subsequent calls, credentials are used only for this session and not persisted, and it explains the return structure (LoginResult) with specific fields. This covers authentication persistence, security handling, and response format.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, args, usage guidelines, returns, behavioral notes) and appropriately sized. While efficient, the repetition of parameter details in the 'Args' section adds some redundancy since the schema already covers them, preventing a perfect score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that this is an authentication tool with no annotations but with a detailed output schema (implied by the Returns section), the description provides complete context. It covers purpose, usage guidelines, parameters, return values, session behavior, and security considerations, making it fully adequate for the tool's complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description repeats parameter information in the 'Args' section but adds minimal additional semantic context beyond what's in the schema. The baseline score of 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Authenticate with USCardForum credentials') and distinguishes this tool from siblings by explicitly mentioning it's for authentication while most read operations work without it. The verb 'authenticate' is precise and the resource 'USCardForum credentials' is well-defined.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool ('if you need authenticated features like: Reading notifications, Bookmarking posts, Subscribing to topics') and when not to use it ('Most read operations work without authentication'). It also implicitly suggests alternatives by listing specific authenticated features that would require this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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