Clara Docs
All docs

The hosted board

Guides6 min readEdit on GitHub

On this page

The same board, on the web, for a team: anyone with access to the repository signs in with GitHub and works on it, and agents reach it over MCP. The repository is still the only storage. The server keeps nothing: every read and every write is a GitHub API call made with the token of whoever asked, so permissions are exactly their access to the repository, and every commit carries their name.

The hosted board never runs agents, checks or any command. Those run on a developer's machine (clara work) or in the GitHub Action.

Deploying it on Vercel

The repository has what Vercel needs: vercel.json (generated from the server's own security headers, so the two cannot drift) and api/index.mjs, which hands every request to the built handler in dist/hosted.js. The web app is served as static files from dist/web.

  1. Create a GitHub OAuth app (GitHub → Settings → Developer settings → OAuth Apps). Set its callback URL to https://<your-deployment>/api/auth/callback.
  2. Import the repository into Vercel. Leave the build settings as vercel.json sets them.
  3. Set the environment variables below, then deploy.

LAUNCH-CHECKLIST.md has the same steps as a list.

Any host that runs a Web fetch handler can run it instead:

JavaScript
import { hostedHandler } from './dist/hosted.js';
export default { fetch: hostedHandler(process.env, { web: './dist/web' }) };

web makes the handler serve the web app too, for a host that does not serve static files.

Settings

Variable Needed What it is
CLARA_REPO yes owner/name of the repository that holds the board
CLARA_BRANCH no the branch the board lives on; main when unset
CLARA_PATH no the board's folder in the repository; .clara when unset
GITHUB_CLIENT_ID yes the OAuth app's client id
GITHUB_CLIENT_SECRET yes the OAuth app's client secret
CLARA_SECRET yes at least 32 random characters, which seal the session cookie: openssl rand -base64 32. Changing it signs everyone out.
CLARA_PUBLIC_READ no true lets anyone read the board without signing in, through the server's anonymous calls to GitHub, so only for a public repository. Nobody can change it without signing in. See Reading without signing in.
CLARA_URL no the deployment's address, such as https://board.example.com, when the host's own address is not what people open

When one is missing or wrong, every request answers 500 with a page naming it (never its value), and the host's log says the same.

Signing in

Sign in with GitHub sends the person to GitHub, which asks them to let the OAuth app act for them, with the repo scope. GitHub sends them back with a code, which the server exchanges for their token. Before it lets them in, it reads the board with that token: an account that cannot reach the repository is told so, and is not signed in.

The token then lives only in the person's browser, in a cookie the server sealed:

  • encrypted and authenticated with AES-GCM, under a key made from CLARA_SECRET, and bound to the cookie's name, so one cookie cannot stand in for another;
  • HttpOnly, so the page's scripts cannot read it; SameSite=Lax; and over HTTPS Secure, with the __Host- prefix, so no other site or subdomain can set it;
  • for eight hours, after which the person signs in again. Sign out clears it.

A sign-in in progress is held in a second sealed cookie for ten minutes, with a random state GitHub must send back, so nobody can finish a sign-in someone else started.

Every change the page asks for must come from the board's own page (its Origin), so another site cannot make a signed-in browser change the board.

Agents over MCP

The hosted board answers MCP at /api/mcp, over Streamable HTTP, with the same tools as clara mcp (MCP.md). Each request carries a GitHub token as Authorization: Bearer <token>:

JSON
{
  "mcpServers": {
    "clara": {
      "type": "http",
      "url": "https://<your-deployment>/api/mcp",
      "headers": { "Authorization": "Bearer ${CLARA_GITHUB_TOKEN}" }
    }
  }
}

Make the token a fine-grained personal access token with:

  • Repository access: only the board's repository.
  • Repository permissions: Contents: Read and write. GitHub adds Metadata: Read.
  • An expiry as short as you can live with.

What Clara does with it, exactly: it asks GitHub whose token it is (GET /user), reads the board's branch, its trees and its files, and writes the board by making blobs, a tree and a commit and moving the branch to it. It touches no other repository and no other part of this one, and it never stores the token: each request brings it, and the server forgets it when the answer is sent. It remembers for five minutes whose token a fingerprint of it belongs to, so each call does not ask GitHub again.

What the token can do anywhere else, though, is what GitHub allows it: with Contents: Read and write, someone who has it can change any file in that repository, not only the board. Keep it out of the repository and out of anything you share, as you would any credential.

The agent's actions are recorded as the agent (agent:claude, from its MCP client's name) and committed as the token's owner, so the history says who ran it.

Later: MCP's own sign-in. MCP defines an OAuth flow where the client discovers the server's authorisation server and gets a token itself. The endpoint is built so it can come without changing the tools: the route reads a bearer token, turns it into a session for that token (sessionFor in server/hosted.ts), and hands the MCP server that session. A token issued by MCP's flow would be turned into a session the same way.

Live updates

The page follows the board through /api/events. On a hosted board, the server looks at the branch every 15 seconds with a conditional request (GitHub answers 304 when nothing moved, which does not count against a signed-in person's rate limit), and sends the page what changed.

Vercel ends a function's response after maxDuration (60 seconds in vercel.json). So each stream ends itself after 50 seconds with an again event, and the page opens another at once, starting from the whole board. Nobody sees it.

Reading without signing in

With CLARA_PUBLIC_READ, a guest's reads are calls to GitHub with no token. GitHub allows 60 of those an hour for each address the calls come from, and on Vercel that address is shared by every guest, and by other sites on the same servers. A 304 counts too, when no token is sent.

So guests share one look at the branch, taken at most every two minutes, and see changes up to two minutes late. What changed is read once and kept by its hash for everyone. A quiet board read by a few people fits in the allowance; a busy one, or many readers at once, will meet GitHub's limit, and guests are then told when it lifts. People who sign in read with their own token and their own, much larger, allowance.

Working both ways

The hosted board and a clone are two views of one branch.

  • A developer works locally and pushes. The hosted board sees the branch move at its next look, within about 15 seconds, and every page shows it.
  • A teammate works on the hosted board. Each change is a commit on the branch. The developer runs git pull (or clara sync, which only ever fast-forwards) to have it.
  • Both at once. A change on the hosted board is made on the newest commit: when the branch moved while it was being made, Clara reads it again and runs the change again on top, up to five times. A push from a clone that is behind is refused by git, as any push is: pull and push again. The activity log merges by itself. The rare conflict is one ticket changed on both sides, or two tickets made with one number: clara doctor names the file, and clara doctor --fix keeps the newer version of a ticket changed twice (with status, assignee and sprint from the log), or gives the newer of two tickets the next free number. FORMAT.md has the details.

Direct mode

Not built in this version. See D-140 for why, and what would make it fit.