Tailscale and Headscale for ClawQL
Private tailnet = WireGuard mesh + DNS so clawql-mcp-http at /mcp and your execute targets (Ollama, Paperless, Onyx, …) stay off the public internet. This page is the on-site walkthrough; the canonical copy (for PRs and deep links) is docs/deployment/tailscale-and-headscale-for-clawql.md.
Why bother?
- MCP clients need a real
url(not onlylocalhostif the IDE runs elsewhere). executefollowsBASE_URL/ specservers. Wrong URLs send traffic out to the public internet.- A tailnet gives stable 100.x addresses and MagicDNS names for members only.
Concepts (quick)
| Term | Meaning |
|---|---|
| Tailscale client | Software on each device; registers with the control plane. |
| Tailnet | Your private mesh of machines + policy. |
| Control plane | Tailscale Inc. (managed) or Headscale (you self-host). |
| MagicDNS | Names like *.ts.net or *.clawql.local → tailnet IP. |
| ACL | Who may reach which ports; tighten after bootstrap (#213). |
Primers: What is Tailscale? · MagicDNS · ACLs.
Managed Tailscale vs Headscale
| Managed Tailscale | Headscale (self-hosted) | |
|---|---|---|
| Operator | Tailscale admin console | Your headscale server + CLI |
| Names | *.ts.net | You pick MagicDNS base (repo pattern clawql.local) |
| Pick when | Fastest path, less infra | Control plane ownership / residency |
Part A — Managed Tailscale (recommended first)
Issue context: #211. Shorter env notes: docs/readme/deployment.md — Private tailnet.
- Install Tailscale on the MCP host and every operator laptop.
- Sign in so all machines join the same tailnet (admin console → Machines).
- Enable MagicDNS so each host gets a stable
*.ts.net(or your tailnet’s) name — MagicDNS KB. - Expose MCP with HTTPS — e.g. Tailscale Serve proxying to
http://127.0.0.1:8080so clients usehttps://…/mcp. - Cursor / MCP: set
CLAWQL_MCP_URLand use${env:CLAWQL_MCP_URL}inmcp.json(Cursor env interpolation). - Workflows:
CLAWQL_MCP_URLis for scripts likeworkflow:complex-release-stack:mcp(polls/healthz); the MCP process itself does not read it. - Provider URLs: align
PAPERLESS_BASE_URL,ONYX_BASE_URL,TIKA_BASE_URL,CLAWQL_SANDBOX_BRIDGE_URL,CLAWQL_API_BASE_URL,CLAWQL_GRAPHQL_*, etc., to tailnet hostnames — see.env.example.
Smoke test: from another tailnet device, curl your /healthz, then confirm listTools / a safe execute in the client.
Part B — Headscale (self-hosted control plane)
Full ops runbook: docs/deployment/headscale-tailnet.md (#206).
- Run Headscale on a small always-on host; configure
server_url, TLS, persistence, backups. - Enable MagicDNS with
base_domainclawql.local(or your choice). - Enroll nodes with
tailscale up --login-server https://…(Headscale docs). - After the mesh works, replace permissive ACLs — starter
headscale-acls-clawql.hujson(#213) and ACL section.
Example URLs: http://mac-mini.clawql.local:8080/mcp, /healthz — same CLAWQL_MCP_URL / mcp.json hygiene as Part A.
Kubernetes *.clawql.local ≠ Headscale MagicDNS (same suffix)
Helm / Ingress examples use something.clawql.local resolved by cluster DNS (or hosts → cluster IP). Headscale *.clawql.local resolves on enrolled Tailscale nodes only when Headscale MagicDNS is set up. Same string, different resolvers — see docs/clawql-ecosystem.md.
Security checklist
- Never commit live pre-auth keys, MCP bearer tokens, or bridge secrets.
- Prefer HTTPS for MCP where clients expect TLS; restrict host firewalls to 100.64.0.0/10 or ACL tags when binding
0.0.0.0. - Treat public MCP as a separate product decision —
docs/enterprise-mcp-tools.md.
HIPAA, SOC 2, GDPR / CCPA (how this pattern helps)
Not legal or compliance advice. Frameworks need your BAAs, DPAs, SCCs, policies, logging, DPIAs, and attestation—a tailnet is one technical layer.
- Segmentation & least privilege: MCP and
executetargets stay on private mesh paths with ACLs, instead of a default-public listener—supports access-control narratives for SOC 2 (e.g. CC6) and reasonable security expectations (CCPA / CPRA). - Encryption in transit: WireGuard between nodes; add HTTPS (Serve / proxy) for app-layer TLS where required—relevant to HIPAA Security Rule transmission safeguards and GDPR Art. 32 when documented as part of TOMs.
- Vendors & residency: Managed Tailscale is a subprocessor (metadata, control plane)—put it in your DPA / transfer analysis (GDPR Ch. V). Headscale can support in-region control-plane ownership if you run it securely.
- HIPAA: supports technical safeguards only alongside administrative/physical controls, BAAs, minimum necessary, and breach processes—especially if tools can reach ePHI systems.
- Evidence: document data flows (agent → MCP → each
BASE_URL), ACL owners, and what logs retain—pair with appaudit/ SIEM as inenterprise-mcp-tools.md.
Full tables, auditor checklist, and disclaimers: tailscale-and-headscale-for-clawql.md § Regulatory and compliance.
Troubleshooting
- No DNS → MagicDNS off, wrong domain, or client not using tailnet DNS.
- Timeout → ACL too tight, UDP mesh blocked, or wrong port.
- Only server can use MCP → laptops still pointed at
localhost— switch to MagicDNS / Serve URL. executestill public →BASE_URLnot repointed to tailnet hostnames.
Next steps
- Deployment — ports,
/metrics, Cloud Run, Kubernetes. - Repo guide (full tables + issue index):
tailscale-and-headscale-for-clawql.md.
