Skip to main content
Glama
raidenrock

USCardForum MCP Server

by raidenrock

login

Authenticate with USCardForum to access personalized features like reading notifications, bookmarking posts, and subscribing to topics using your forum credentials.

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

  • The main MCP handler function for the 'login' tool. It takes username, password, and optional second_factor_token, calls get_client().login(), and returns a 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 BaseModel defining the output schema for the login tool: success, username, error, requires_2fa fields with from_api_response classmethod.
    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"], username=None, requires_2fa=False)
            if data.get("second_factor_required"):
                return cls(success=False, requires_2fa=True, username=username, error=None)
            return cls(success=True, username=username, error=None, requires_2fa=False)
  • Imports the login tool (along with other auth tools) from the auth module into server_tools __init__.py, making it available for MCP registration upon import.
    from .auth import (
        bookmark_post,
        get_current_session,
        get_notifications,
        login,
        subscribe_topic,
    )
  • Adds 'login' to __all__ in server_tools/__init__.py, explicitly exposing the tool for import and MCP auto-registration.
    # 🔐 Auth
    "login",
    "get_current_session",
    "get_notifications",
    "bookmark_post",
    "subscribe_topic",
  • The underlying AuthAPI.login() method called by get_client().login(), handling the HTTP POST request to /session.json with CSRF token and parsing LoginResult.
    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
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure and does so effectively. It explains the session persistence ('The session remains authenticated for subsequent calls'), security handling ('Credentials are used only for this session and are not persisted'), and return format details. It doesn't mention rate limits or specific error conditions, preventing a perfect score.

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 guidance, returns, behavioral notes). It's appropriately sized for a security-sensitive authentication tool, though the parameter section duplicates schema information, preventing a perfect score for conciseness.

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?

For an authentication tool with no annotations but with output schema, the description provides excellent contextual completeness. It covers purpose, usage guidance, parameter overview, return value details, session behavior, and security considerations. The presence of an output schema means the description doesn't need to fully document return values, and it effectively supplements the structured data.

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 fully documents all three parameters. The description repeats the parameter information in the Args section but doesn't add meaningful semantic context beyond what's in the schema. This meets the baseline expectation when schema coverage is complete.

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 authentication tool from its many sibling tools that perform read operations. It explicitly identifies the resource being accessed (forum credentials) and the verb (authenticate).

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 ('Only use this if you need authenticated features like...') and when not to use it ('Most read operations work without authentication'). It clearly differentiates this authentication tool from the many read-only sibling tools listed.

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

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