"""FastMCP transport for Atlas2 tools."""

from __future__ import annotations

from mcp.server.fastmcp import FastMCP
from mcp.server.transport_security import TransportSecuritySettings

from .resolve import ResolveService


mcp = FastMCP(
    "atlas2",
    transport_security=TransportSecuritySettings(
        enable_dns_rebinding_protection=False
    ),
)


@mcp.tool(
    name="resolve",
    description="Resolve a subject string to a canonical entity (atlas2 scaffold).",
)
async def resolve_tool(
    subject: str,
    context: dict | None = None,
    constraints: dict | None = None,
    hints: dict | None = None,
    debug: dict | None = None,
    strategy: dict | None = None,
):
    # Service pulls configuration exclusively from the project's .env.
    svc = ResolveService()
    return await svc.resolve(
        subject=subject,
        context=context,
        constraints=constraints,
        hints=hints,
        debug=debug,
        strategy=strategy,
    )

