"""Local stdio adapter for clients such as Claude Desktop."""

from typing import Any
from mcp.server.fastmcp import FastMCP
from postalform_client import call_tool, list_tools

server = FastMCP("PostalForm hosted checkout")


@server.tool()
async def postalform_tools() -> list[dict[str, Any]]:
    """Read PostalForm's live schemas for discovery, unpaid draft and status tools."""
    return await list_tools()


@server.tool()
async def postalform_call(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
    """Use a schema from postalform_tools; present preview and checkout URL to the owner."""
    return await call_tool(name, arguments)


if __name__ == "__main__":
    server.run(transport="stdio")
