We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/poguuniverse/42crunch-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
config.py•1.14 KiB
"""Configuration management for 42crunch MCP Server."""
import os
from typing import Optional
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
class Config:
"""Configuration class for 42crunch MCP Server."""
BASE_URL = "https://us.42crunch.cloud"
API_V1_BASE = f"{BASE_URL}/api/v1"
API_V2_BASE = f"{BASE_URL}/api/v2"
def __init__(self):
"""Initialize configuration and validate required settings."""
self.token: Optional[str] = os.getenv("42C_TOKEN")
self._validate()
def _validate(self) -> None:
"""Validate that required configuration is present."""
if not self.token:
raise ValueError(
"42C_TOKEN environment variable is required. "
"Please set it in your .env file or environment."
)
def get_auth_headers(self) -> dict[str, str]:
"""Get authentication headers for API requests.
Uses X-API-Key header as required by 42crunch API.
"""
return {
"X-API-Key": self.token,
"Content-Type": "application/json",
}