Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ All integrations are configured in **Settings** from the UI. Credentials are enc
| **AWS** | Native (boto3) | CloudWatch, EC2, Lambda, RDS, ECS |
| **GitHub** | MCP — `@modelcontextprotocol/server-github` (stdio) | Code search, file content, commits, blame |
| **PagerDuty** | Native + MCP — `mcp.pagerduty.com` (streamable-http) | Incidents, services, escalation policies, on-call schedules |
| **Hetzner Cloud** | Native (REST API v1) | Servers, load balancers, firewalls, networks, volumes, metrics |

All integrations except OpenAI support multiple instances (e.g. multiple AWS accounts).

Expand Down
65 changes: 65 additions & 0 deletions agent_service/agent/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,70 @@ async def _discover_sentry(settings: dict[str, Any]) -> list[dict[str, Any]]:
return nodes


# ── Hetzner ──────────────────────────────────────────────────────


async def _discover_hetzner_instance(instance: dict[str, str]) -> list[dict[str, Any]]:
api_token = instance.get("api_token")
if not api_token:
return []

headers = {"Authorization": f"Bearer {api_token}"}
nodes: list[dict[str, Any]] = []

try:
async with httpx.AsyncClient() as client:
resp = await client.get(
"https://api.hetzner.cloud/v1/servers",
headers=headers,
timeout=30,
)
resp.raise_for_status()

servers = resp.json().get("servers", [])
for srv in servers:
public_net = srv.get("public_net", {})
ipv4 = public_net.get("ipv4", {}).get("ip", "") if isinstance(public_net.get("ipv4"), dict) else ""
location = srv.get("datacenter", {}).get("location", {})

nodes.append(_node(
name=srv["name"],
type="server",
source="hetzner",
external_id=str(srv.get("id", "")),
attrs={
"status": srv.get("status", ""),
"server_type": srv.get("server_type", {}).get("description", ""),
"public_ipv4": ipv4,
"datacenter": srv.get("datacenter", {}).get("name", ""),
"location": location.get("city", ""),
},
))

logger.info("Hetzner discovery: %d servers", len(nodes))
except Exception as exc:
logger.warning("Hetzner discovery failed: %s", exc)

return nodes


async def _discover_hetzner(settings: dict[str, Any]) -> list[dict[str, Any]]:
instances = _get_instances(settings, "hetzner")
if not instances:
return []
results = await asyncio.gather(
*[_discover_hetzner_instance(inst) for inst in instances],
return_exceptions=True,
)
nodes: list[dict[str, Any]] = []
for result in results:
if isinstance(result, Exception):
logger.warning("Hetzner instance discovery failed: %s", result)
else:
nodes.extend(result)
return nodes


# ── Edge inference ───────────────────────────────────────────────


Expand Down Expand Up @@ -526,6 +590,7 @@ async def discover_resources(
_discover_aws(settings),
_discover_pagerduty(settings),
_discover_sentry(settings),
_discover_hetzner(settings),
]

results = await asyncio.gather(*tasks, return_exceptions=True)
Expand Down
Loading