#!/usr/bin/env python3
import json, yaml, urllib.request, urllib.error
PAT = yaml.safe_load(open('/root/.hermes/config.yaml'))['mcp_servers']['airtable']['env']['AIRTABLE_API_KEY']

# Probe several endpoints
for url in [
    'https://api.airtable.com/v0/meta/bases',
    'https://api.airtable.com/v0/appE43UvTyARe5oJs',
]:
    r = urllib.request.Request(url, headers={'Authorization': f'Bearer {PAT}'})
    try:
        with urllib.request.urlopen(r, timeout=15) as resp:
            print('OK', url, resp.status, resp.read().decode()[:300])
    except urllib.error.HTTPError as e:
        print('ERR', url, e.code, e.read().decode()[:300])
