"""Entry point for shaped-mcp CLI."""

import argparse
import os


def main() -> None:
    """Entry point for the shaped-mcp CLI."""
    parser = argparse.ArgumentParser(description="Shaped MCP server")
    parser.add_argument(
        "--transport",
        choices=["stdio", "streamable-http"],
        default="stdio",
        help="Transport: stdio (default) or streamable-http",
    )
    parser.add_argument(
        "--host", default="0.0.0.0", help="Host for HTTP (default: 0.0.0.0)"
    )
    parser.add_argument(
        "--port", type=int, default=8080, help="Port for HTTP (default: 8080)"
    )
    args = parser.parse_args()

    # Set env before import so FastMCP picks up host/port.
    if args.transport != "stdio":
        os.environ["FASTMCP_HOST"] = args.host
        os.environ["FASTMCP_PORT"] = str(args.port)

    from shaped_mcp.server import run  # noqa: E402

    run(transport=args.transport, host=args.host, port=args.port)


if __name__ == "__main__":
    main()
