Skip to main content
Glama
talhaorak

Taiga MCP Bridge

by talhaorak

login

Authenticate users to Taiga project management platform by logging in with username and password, generating a session_id for secure, authenticated API interactions.

Instructions

Logs into a Taiga instance using username/password and returns a session_id for subsequent authenticated calls.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYes
passwordYes
usernameYes

Implementation Reference

  • The primary handler for the 'login' MCP tool. It creates a TaigaClientWrapper, authenticates using username/password, generates a UUID session_id, stores the wrapper in active_sessions dict, and returns the session_id.
    @mcp.tool("login", description="Logs into a Taiga instance using username/password and returns a session_id for subsequent authenticated calls.")
    def login(host: str, username: str, password: str) -> Dict[str, str]:
        """
        Handles Taiga login and creates a session.
    
        Args:
            host: The URL of the Taiga instance (e.g., 'https://tree.taiga.io').
            username: The Taiga username.
            password: The Taiga password.
    
        Returns:
            A dictionary containing the session_id upon successful login.
            Example: {"session_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
        """
        logger.info(f"Executing login tool for user '{username}' on host '{host}'")
    
        try:
            wrapper = TaigaClientWrapper(host=host)
            login_successful = wrapper.login(username=username, password=password)
    
            if login_successful:
                # Generate a unique session ID
                new_session_id = str(uuid.uuid4())
                # Store the authenticated wrapper in our manual session store
                active_sessions[new_session_id] = wrapper
                logger.info(
                    f"Login successful for '{username}'. Created session ID: {new_session_id}")
                # Return the session ID to the client
                return {"session_id": new_session_id}
            else:
                # Should not happen if login raises exception on failure, but handle defensively
                logger.error(
                    f"Login attempt for '{username}' returned False unexpectedly.")
                raise RuntimeError("Login failed for an unknown reason.")
    
        except (ValueError, TaigaException) as e:
            logger.error(f"Login failed for '{username}': {e}", exc_info=False)
            # Re-raise the exception - FastMCP will turn it into an error response
            raise e
        except Exception as e:
            logger.error(
                f"Unexpected error during login for '{username}': {e}", exc_info=True)
            raise RuntimeError(
                f"An unexpected server error occurred during login: {e}")
  • Supporting login method within the TaigaClientWrapper class, called by the MCP 'login' handler to perform the actual pytaigaclient authentication.
    def login(self, username: str, password: str) -> bool:
        """
        Authenticates with the Taiga instance using username and password.
        Uses pytaigaclient.
        """
        try:
            logger.info(
                f"Attempting login for user '{username}' on {self.host}")
            # Initialize the client here
            api_instance = TaigaClient(host=self.host)
            # Use the auth resource's login method
            api_instance.auth.login(username=username, password=password)
            self.api = api_instance
            logger.info(
                f"Login successful for user '{username}'. Auth token acquired.")
            return True
        except TaigaException as e:
            logger.error(
                f"Taiga login failed for user '{username}': {e}", exc_info=False)
            self.api = None
            raise e
        except Exception as e:
            logger.error(
                f"An unexpected error occurred during login for user '{username}': {e}", exc_info=True)
            self.api = None
            # Wrap unexpected errors in TaigaException if needed, or re-raise
            raise TaigaException(f"Unexpected login error: {e}")

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/talhaorak/pytaiga-mcp'

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