"""
Entrypoint for running the g-gremlin MCP server.
"""

from __future__ import annotations

import argparse
import os

from g_gremlin.mcp.server import run_server


def main() -> None:
    parser = argparse.ArgumentParser(prog="python -m g_gremlin.mcp")
    parser.add_argument("--enable-writes", action="store_true", help="Expose write/apply tools.")
    parser.add_argument(
        "--provider",
        choices=["sfdc", "dynamics", "apollo", "outreach", "zoominfo"],
        default="sfdc",
        help="Tool namespace provider to expose.",
    )
    parser.add_argument(
        "--dynamics-profile",
        default=None,
        help="Default Dynamics profile when --provider dynamics.",
    )
    args = parser.parse_args()
    if str(args.provider) == "dynamics" and args.dynamics_profile:
        os.environ["G_GREMLIN_MCP_DYNAMICS_PROFILE"] = str(args.dynamics_profile).strip()
    run_server(enable_writes=bool(args.enable_writes), provider=str(args.provider))


if __name__ == "__main__":
    main()
