Skip to content

Technical Specifications (pages.astrophysics.fans)

This page documents the infrastructure and technical design of pages.astrophysics.fans (in development). For a non-technical overview and step-by-step guide, see the pages.astrophysics.fans Guide. Specifications are subject to change.

Infrastructure & Architecture

pages.astrophysics.fans runs inside an Incus container on a dedicated KVM VPS (Los Angeles / Debian / 1 Core, 1 GB RAM, 30 GB SSD), isolated from other laboratory services and development environments. AI client access is unified through LabPortal (on a separate host), while public pages run on open-compute (a self-hosted Workers / D1 / R2 compatible runtime). This VPS cannot connect to the on-campus network.

Dedicated KVM VPS (Los Angeles / Debian / 1 Core, 1 GB RAM, 30 GB SSD)Incus Container (Isolated pages Environment)open-compute (Workers / D1 / R2 Compatible)AI Clientclaude.ai / chatgpt.comLabPortalSeparate Host / OAuthVisitorNo Login RequiredCloudflare DNSSubdomain Delegationpages-mcp-gatewayNode.js / Verify, MCP & Cleanupgateway.sqliteUsers, Pages, Audit, 7-Day UndoManagement APILocal OnlyPublic GatewayHTTPS TerminationPage WorkerUser ES Modulestorage--brokerPrivate BrokerD1DB & LedgerR2Objectsnftables: Blocks egress & DNS / No access to on-campus network (TLS via acme-proxy only)HTTPSWireGuardEd25519SQLIsolated TokenDeployQuery / DeleteLookupHTTPS (*.pages.astrophysics.fans)FILESDBLedger

Server Specs & Network Isolation

ItemConfiguration
HostDedicated KVM VPS for pages (Los Angeles, US)
OS / SpecsDebian / 1 Core / 1 GB RAM / 30 GB SSD
Container IsolationIsolated Incus container running the pages stack
On-Campus NetworkNo access (does not join the lab VPN; no outbound connections to campus machines or LabPortal)
  • Point-to-Point WireGuard + Per-Request Signatures: AI tool calls enter via LabPortal and are relayed over a dedicated two-host WireGuard link to pages-mcp-gateway. LabPortal never forwards its own user tokens; instead, every request carries a short-lived Ed25519-signed assertion with body hash and replay protection.
  • Worker Egress Blocking: Outbound connections and DNS from page Workers are blocked via nftables to prevent SSRF and data exfiltration. Only TLS certificate issuance is permitted via an authenticated dedicated relay (acme-proxy) restricted to Let’s Encrypt.
  • Credential Isolation: open-compute management credentials stay strictly within the gateway and administrator CLI and are never exposed to page code or AI clients.

MCP Connector & Authorization Flow

LabPortal acts as the OAuth 2.1 (PKCE S256) authorization server and Streamable HTTP MCP endpoint (/mcp).

    sequenceDiagram
    actor User as Lab Member (AI Client)
    participant LP as LabPortal (OAuth 2.1 / MCP)
    participant GW as pages-mcp-gateway
    participant OC as open-compute

    User->>LP: OAuth 2.1 Consent (pages / pages_write)
    LP-->>User: Issue Access Token
    User->>LP: Call MCP Tool (Manual Approval for Writes)
    LP->>LP: Verify Token, Scope, Rate Limit (60 / 10 min)
    LP->>GW: Relay over WireGuard (Ed25519-Signed Assertion)
    GW->>GW: Verify Signature, TTL, Body Hash, Nonce & Ownership
    GW->>OC: Manage Worker / D1 / Files via Management API
    OC-->>GW: Result
    GW-->>LP: MCP JSON Response
    LP-->>User: Return Tool Output
  
  • Supported Clients: Primarily targeting claude.ai custom connectors (LabPortal’s OAuth connector supports both claude.ai and chatgpt.com by default).
  • Explicit OAuth Scopes:
    • pages: Read-only access to page lists, source code, response data, and edit history
    • pages_write: Read/write access including deploying, updating, deleting pages, and editing/undoing response data
  • Ownership Isolation: MCP operations are strictly restricted to pages owned by the authenticated member.
Submissions on public pages are untrusted data for the AI. To guard against prompt injection, review and approve every write MCP tool call manually and do not select “Always Allow” in your AI client.

MCP Tools (9 Tools)

Read Tools (pages scope)

ToolInputsDescription
list_pagesNoneList your pages, statuses, current usage, and quota limits
get_pageslugFetch metadata and current Worker source code
read_page_dataslug, sql, params?, limit?Execute read-only single SELECT / WITH queries against your page DB (up to 200 rows)
list_page_data_editsslugList undoable response data edits (values omitted)
get_templatekind (poll / rsvp / form)Retrieve reference Worker templates to customize

Write Tools (pages_write scope)

ToolInputsDescription
deploy_pageslug, module_code, with_database, with_storage?, ttl_days?Create or update a page. Omitting ttl_days or with_storage on update preserves current settings (ttl_days: null removes expiration)
delete_pageslugDelete a page along with its DB and stored files (unavailable while suspended)
edit_page_dataslug, table, action, row_ids, values?Update or delete up to 20 rows without raw SQL; keeps original rows for 7 days
undo_page_data_editslug, edit_idRevert a prior edit within 7 days (rejected if subsequent changes conflict)

Runtime & Brokered File Storage

Pages run as single ES module Workers (export default required) with no build step. Only two bindings are provided: DB (D1-compatible per-page SQLite) and FILES (scoped file storage API). Custom bindings, environment variables/secrets, outbound fetch, Cron triggers, and multi-file/npm builds are disabled.

Brokered File Storage (FILES Binding)

Because exposing R2 directly to page code would bypass quota enforcement, file access is routed through a private internal broker Worker (storage--broker) exposed via the FILES service binding. Owner and page identifiers are pinned in binding props and cannot be altered by page code.

    flowchart LR
    Worker["Page Worker"] -->|"env.FILES (Pinned Owner & Page)"| Broker["storage--broker (Private Broker Worker)"]
    Broker -->|"1. Atomic Quota Reservation & Metadata"| Ledger[("Ledger D1")]
    Broker -->|"2. Store / Fetch Object"| R2[("R2 Bucket")]
    GW["pages-mcp-gateway (Delete, Usage, Cleanup)"] --> Ledger
    GW --> R2
  
  • Provided API: env.FILES.put(name, data, { contentType }) / get(name) / list({ after }) / delete(name) / usage() (custom API, not raw R2 API).
  • Deleting a page or reaching its expiration removes all files associated with that page.

Planned Quotas & Defaults

ItemDefault
slug Pattern^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$ (no consecutive hyphens or reserved words)
Pages / Member10
Page DBs (D1) / Global32
Module Size256 KiB
Storage / Member (across all pages)512 MiB
Max File Size10 MiB
Files / Member5,000
Storage / Global5 GiB
read_page_data Row Limit200 rows (max 256 KiB response)
Auto-Expiration (ttl_days)1–3,650 days (no expiration if omitted on creation)
MCP Rate Limit60 calls per 10 minutes per member

Comparison with Cloudflare Workers

Despite a similar Worker syntax, pages does not run on Cloudflare—it runs on self-hosted open-compute with a distinct operating model.

Aspectpages.astrophysics.fansCloudflare Workers
InterfaceAI clients via MCP (9 tools)Wrangler CLI, dashboard, REST API
InfrastructureIncus container on a dedicated KVM VPS (Los Angeles / Debian / 1 Core, 1 GB RAM, 30 GB SSD; open-compute)Cloudflare global edge network
CodeSingle ES module (up to 256 KiB, no build step)Multi-module, npm, TypeScript build
BindingsDB and FILES onlyD1, R2, KV, Durable Objects, Queues, etc.
Outbound Network / Secrets / CronDisabledSupported
Auto-ExpirationBuilt-in (ttl_days)Not built-in
Availability & DDoS ProtectionSingle server, no SLADistributed network & built-in protection
Best ForQuickly publishing polls/RSVP pages via AI without CLI or billingProduction apps, external integrations, high availability

Security & Operational Notes

  • Poll and RSVP templates rely on HttpOnly (__Host- on HTTPS) cookies and do not perform strict identity verification.
  • Visitor uploads count against the page owner’s file storage quota.
  • Backups and service continuity are not guaranteed; keep local copies of important data.
  • Administrators may suspend (503) or delete problematic pages. Report abuse via the Abuse Contact (abuse [at] astrophysics.fans).