
import asyncio
import logging

# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

# ……MCP初始化代码……


async def main():
    """Start the MCP server with streamable transport."""
    logger.info("Starting MCP Server with FastMCP")

    # Start the streamable HTTP server
    await mcp.run_streamable_http_async()


def sync_main():
    """Synchronous entry point for the server."""
    try:
        asyncio.run(main())
    except KeyboardInterrupt:
        logger.info("Server shutdown requested")
    except Exception as e:
        logger.error(f"Server error: {e}")
        raise


if __name__ == "__main__":
    sync_main()
