#!/usr/bin/env python3
"""
Storm Logger MCP Server - Module Entry Point
============================================

Allows running the MCP server as a module: python -m _mcp
"""

import sys
import os
from pathlib import Path

# Import with flexible handling
try:
    # Try relative import first (when running as python -m _mcp)
    from .main import mcp
except ImportError:
    # Fall back to adding parent to path and importing
    parent_dir = Path(__file__).parent.parent
    if str(parent_dir) not in sys.path:
        sys.path.insert(0, str(parent_dir))
    
    from _mcp.main import mcp

if __name__ == "__main__":
    # Set environment variable to indicate we're running as main module
    os.environ['STORM_MCP_RUNNING'] = '1'
    
    # Run the MCP server
    mcp.run()