"""Main entry point for Enterprise MCP Server."""
import asyncio
import logging
from .server import MCPServer, default_health_check
from .services import SelfHealth, ServiceNowMCP
from .settings import ServerSettings
# Configure logging
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
logger = logging.getLogger(__name__)
async def main():
"""Main entry point."""
try:
server = MCPServer(
settings=ServerSettings(),
readiness_check=default_health_check,
liveness_check=default_health_check,
)
health_service = SelfHealth()
service_now_service = ServiceNowMCP()
await health_service.register(mcp_server=server.mcp)
await service_now_service.register(mcp_server=server.mcp)
await server.start()
except Exception as exception:
logger.error(str(exception))
raise
def run_server():
"""Synchronous entry point for console script."""
try:
asyncio.run(main())
except KeyboardInterrupt:
logger.info("Server stopped by user")
except Exception as e:
logger.error(f"Server error: {e}")
exit(1)
if __name__ == "__main__":
run_server()