"""{{ display_name }} MCP server — generated by mcpify. Do not hand-edit."""

from __future__ import annotations

import sys

import httpx

from ..auth.auth_manager import AuthManager
from ..core.config import Transport, load_config


async def run() -> None:
    config = load_config()
    auth_manager = AuthManager(config.auth_method)
    headers = await auth_manager.apply_auth_headers({}, "GET", config.url, Transport.STDIO)

    try:
        async with httpx.AsyncClient(timeout=config.timeout_ms / 1000) as client:
            await client.get(config.url, headers=headers)
    except httpx.HTTPError as err:
        print(f"connection failed: {err}", file=sys.stderr)
        sys.exit(1)
    else:
        print("connection OK")
