# Beacon v2 Quickstart

## Installation

```bash
pip install "ai4gh[beacon]"
```

## Query a Beacon Server

```python
import asyncio
from ai4gh.specs.beacon.client import BeaconClient


async def main():
    async with BeaconClient(base_url="https://beacon.example.org") as client:
        # Get server info
        info = await client.get_info()
        print(f"Beacon: {info.name} ({info.api_version})")

        # Get available datasets
        map_data = await client.get_map()
        print(f"Endpoints: {map_data}")

        # Query for variants
        result = await client.query("BRCA1")
        print(result)


asyncio.run(main())
```

## Service Info

```python
async with BeaconClient(base_url="https://beacon.example.org") as client:
    info = await client.get_service_info()
    print(f"ID: {info.id}")
    print(f"Type: {info.type}")
    print(f"Version: {info.version}")
```

## Compliance Testing

```bash
# Run the Beacon compliance suite
ai4gh test beacon https://beacon.example.org

# Generate HTML report
ai4gh test beacon https://beacon.example.org --format html -o beacon-report.html
```

## MCP Tool

The `beacon_query` MCP tool enables AI agents to query Beacon servers:

```json
{
  "tool": "beacon_query",
  "arguments": {
    "base_url": "https://beacon.example.org",
    "query": "BRCA1"
  }
}
```

## Data Models

```python
from ai4gh.specs.beacon.models import (
    BeaconInfo,
    BeaconQuery,
    BeaconResponse,
    BeaconServiceInfo,
)
```
