Spaces:
Sleeping
Sleeping
Update server.py
Browse files12345650 unmodified lines575859606162from mcp.server.fastmcp import FastMCPimport loggingimport os# Initialize the servermcp = FastMCP("Math-Education-Server")50 unmodified lines)if __name__ == "__main__":# FastMCP handles the --transport sse argument automatically# if you use mcp.run()mcp.run()123456750 unmodified lines58596061626364656667686970717273747576777879from mcp.server.fastmcp import FastMCPimport loggingimport osfrom pathlib import Path# Initialize the servermcp = FastMCP("Math-Education-Server")50 unmodified lines)if __name__ == "__main__":# For Docker/HF Spaces deployment, we need to run with HTTP transport# The server will listen on the port specified by environment variable or default to 7860import sys# Check if we're running in deployment mode (Docker/HF Spaces)port = int(os.getenv("PORT", "7860"))host = os.getenv("HOST", "0.0.0.0")logger.info(f"Starting MCP Server on {host}:{port}")# For local development, use stdio# For deployment, use SSE transportif "--stdio" in sys.argv:logger.info("Running in stdio mode for local development")mcp.run(transport="stdio")else:logger.info(f"Running in SSE mode for deployment on {host}:{port}")# Run with SSE transport for HTTP-based communicationmcp.run(transport="sse", host=host, port=port)
server.py+20-3