headcode

Docs · Start here

Set up by your agent

Headcode pairs a single-tenant Rust MCP backend (built on mstack with embedded Turso) with a plain Next.js site and shared zero-PII auth. Your coding agent sets it up; people and agents edit the same draft.

Start here/Introduction

What you get

  • Your website: plain Next.js with 'use cache', Vercel Image Optimization from /media/**, ?md Markdown views on every page, and /llms.txt.
  • An admin UI at /admin for Content, Images, Publish, and Zero-PII Team & Invites.
  • A single-tenant MCP server at /mcp with 23 tools and built-in MCP Skills (skills-fs) for OpenCode, Claude, ChatGPT, and your own agents.

How it is built

  • Backend (apps/backend): one Rust binary on mstack using axum, rmcp 3.11 (the official Rust SDK for MCP, the protocol from Anthropic), and native embedded turso 0.9. Boots in ~14 ms in ~8 MB RAM, stores media on a local volume, and validates every write against your JSON Schema.
  • Site (apps/base): plain Next.js + shadcn/ui. Sections are Zod schemas in headcode/sections.ts. Publishing triggers an HMAC-signed webhook to /api/revalidate.
  • Auth (mstack/services/auth): shared Better Auth server (Magic Link default, OAuth 2.1 with dynamic client registration). Deployed once per cluster, or bundled with compose.yaml --profile with-auth for standalone setups.

What you need

A coding agent that can read skills and run CLI commands. OpenCode, Claude Code, and Codex all work well.

npm install -g @anthropic-ai/claude-code

Pick where it runs

  • Local: backend with embedded Turso and Next.js site with one command. No Docker, no database server.
  • Uncloud & Vercel: Rust backend on a €4 ARM64 server with Uncloud, Next.js frontend on Vercel. Recommended for production.
  • Self-hosted: backend, bundled auth, and Next.js in Docker Compose or Uncloud on your own server.

Technical details

Every CLI flag, environment variable, and agent playbook is in the README on GitHub and in skills/headcode-init/SKILL.md.