Skip to main content
Glama
helpers.py942 B
""" Utility functions for the CML MCP Server """ import sys import traceback from typing import Dict, Any, Union from ..client import get_client def check_auth() -> Union[None, Dict[str, str]]: """ Check if the client is authenticated Returns: None if authenticated, error dictionary if not """ if not get_client(): return {"error": "You must initialize the client first with initialize_client()"} return None def handle_api_error(operation: str, error: Exception) -> Dict[str, Any]: """ Handle API errors consistently Args: operation: Description of the operation that failed error: Exception that was raised Returns: Error dictionary with consistent format """ print(f"Error during {operation}: {str(error)}", file=sys.stderr) traceback.print_exc(file=sys.stderr) return {"error": f"Error during {operation}: {str(error)}"}

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/MediocreTriumph/claude-cml-toolkit'

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