Skip to main content
Glama

MCP Linux Deployment

by dnchandra
config.py2.53 kB
#!/usr/bin/env python3 """ Configuration loader for MCP Server Loads configuration from environment variables and .env file """ import os from pathlib import Path from dotenv import load_dotenv # Load .env file if it exists env_path = Path(__file__).parent / '.env' if env_path.exists(): load_dotenv(env_path) class Config: """Configuration class for MCP Server""" # Backend API Configuration API_BASE = os.getenv("WIN_DASH_API_BASE", "http://127.0.0.1:8000") BACKEND_API_TOKEN = os.getenv("BACKEND_API_TOKEN", "") # MCP Server Configuration MCP_HOST = os.getenv("MCP_HOST", "0.0.0.0") MCP_PORT = int(os.getenv("MCP_PORT", "3000")) # Security Configuration MCP_API_TOKEN = os.getenv("MCP_API_TOKEN", "") # Default Windows Credentials WIN_DEFAULT_USER = os.getenv("WIN_DEFAULT_USER", "") WIN_DEFAULT_PASS = os.getenv("WIN_DEFAULT_PASS", "") # Logging Configuration LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO") @classmethod def validate(cls): """Validate required configuration""" errors = [] if not cls.API_BASE: errors.append("WIN_DASH_API_BASE is not set") if not cls.WIN_DEFAULT_USER: print("WARNING: WIN_DEFAULT_USER is not set - credentials must be provided per request") if not cls.WIN_DEFAULT_PASS: print("WARNING: WIN_DEFAULT_PASS is not set - credentials must be provided per request") if not cls.MCP_API_TOKEN: print("WARNING: MCP_API_TOKEN is not set - authentication is DISABLED") if errors: raise ValueError(f"Configuration errors: {', '.join(errors)}") @classmethod def display(cls): """Display current configuration (hiding sensitive values)""" print("=" * 80) print("MCP Server Configuration") print("=" * 80) print(f"API Backend: {cls.API_BASE}") print(f"MCP Host: {cls.MCP_HOST}") print(f"MCP Port: {cls.MCP_PORT}") print(f"Backend API Token: {'***' if cls.BACKEND_API_TOKEN else 'Not set'}") print(f"MCP API Token: {'***' if cls.MCP_API_TOKEN else 'Not set (AUTH DISABLED)'}") print(f"Default User: {cls.WIN_DEFAULT_USER or 'Not set'}") print(f"Default Pass: {'***' if cls.WIN_DEFAULT_PASS else 'Not set'}") print(f"Log Level: {cls.LOG_LEVEL}") print("=" * 80) if __name__ == "__main__": Config.validate() Config.display()

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/dnchandra/mcp_linux'

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