main.py•1.01 kB
# Import mcp from server
from server import mcp
import sys
import os
from utils.config import config
if __name__ == "__main__":
# Check if transport type is specified via environment variable or default to sse for Cloudflare
transport_type = config["MCP_TRANSPORT"] or "streamable-http"
if transport_type == "streamable-http":
# Set uvicorn environment variables for host/port (FastMCP uses uvicorn internally for SSE)
port = config["MCP_PORT"] or "8000"
host = config["MCP_HOST"] or "127.0.0.1"
print(f"Starting MCP server with streamable-http transport on {host}:{port}", file=sys.stderr)
print(f"Access the server at: http://{host}:{port}", file=sys.stderr)
# Run with standard-http transport for HTTP/network access (Cloudflare tunnel)
mcp.run(transport="streamable-http",mount_path="/mcp")
else:
print(f"Starting MCP server with stdio transport", file=sys.stderr)
mcp.run(transport="stdio")