#!/usr/bin/env python3 """Direct entry point for FoodWise MCP server. This script bypasses Python module path issues by directly importing the server components with explicit path handling. """ import sys import os from pathlib import Path # Add the project root and src directory to Python path project_root = Path(__file__).parent src_path = project_root / "src" sys.path.insert(0, str(project_root)) sys.path.insert(0, str(src_path)) # Load environment variables from .env file (optional) env_file = project_root / ".env" if env_file.exists(): try: from dotenv import load_dotenv load_dotenv(env_file) except ImportError: # dotenv not available, load manually with open(env_file) as f: for line in f: line = line.strip() if line and not line.startswith('#') and '=' in line: key, value = line.split('=', 1) os.environ[key.strip()] = value.strip() # Now import and run the server from foodwise.mcp_server.main import mcp if __name__ == "__main__": mcp.run()