Skip to main content
Glama
README.md
# spatial-mcp-worker

Live endpoint: **`https://spatial-mcp-worker.raymond-deoliveira.workers.dev/mcp`** (Discovery card: [`/.well-known/mcp/server-card.json`](https://spatial-mcp-worker.raymond-deoliveira.workers.dev/.well-known/mcp/server-card.json))

Zero-dependency Cloudflare Workers **Streamable HTTP MCP** oracle (`2025-03-26`) exposing the pure-compute Spatial / 3D Display math from `edidsmith` and `glassweave` for any remote AI agent with per-call monetization (HTTP `402` x402 / Stripe MPP, Polar.sh Pro keys, or Bearer API keys).

## Architecture

Strict Ports & Adapters (`src/index.ts` & `src/adapters/` -> `src/core/` -> `src/ports/` -> `src/domain/`), zero runtime npm dependencies, zero module-level mutable state, 256 KB bounded request reader, structured JSON observability logs, and `ctx.waitUntil()` KV metering.

## Local Verification

```bash
npm test
```

## Production Deploy Checklist (Cloudflare Workers)

```bash
wrangler kv namespace create METER_KV
# Add the returned KV id to wrangler.jsonc under kv_namespaces
wrangler secret put API_KEYS_CSV
wrangler secret put X402_PAY_TO_ADDRESS
wrangler secret put X402_FACILITATOR_URL
wrangler secret put X402_FACILITATOR_TOKEN
wrangler deploy
```

## What It Does / Does Not Do

- **Does**: Pure-compute CVT-RB2 link-budgeting, EDID 1.4/CTA-861 binary inspection, VESA-conformant Full-SBS/RGB 4:4:4 EDID patching + macOS plist synthesis, quirk lookups, and slanted-lenticular shader calibration math over Streamable HTTP MCP.
- **Does Not**: Touch local USB-HID glasses, DDC/CI displays, Metal/Vulkan GPUs, or CoreML ANE — install the local `edidsmith`, `xrctl`, `depthpipe`, and `glassweave` binaries for hardware execution.