Everdoc

Private repositories

Nightlymaina961efe7d646· 2026-12-05

Private repositories

Everdoc works the same on private code: it reads git refs and blobs, analyzes them statically, and writes a static site. This guide covers getting at the code, deciding what gets published, keeping the result private, and gating pull requests on it.

Private Git auth

repo accepts a remote URL, GitHub owner/repo shorthand, a local path, or an object:

TypeScript
repo: {
  url: "https://github.com/acme/platform",   // or [email protected]:acme/platform.git, ssh://git@host/org/repo.git
  tokenEnv: "ACME_GIT_TOKEN",                // name of the variable holding the token, never the token
  webUrl: "https://github.acme.internal/acme/platform", // optional: browsable URL for permalinks
  name: "Platform",
},

HTTPS + token. With tokenEnv, the token is sent as an Authorization: Basic header on git requests to that host only (http.https://<host>/.extraheader, x-access-token for GitHub, oauth2 for GitLab, x-token-auth for Bitbucket; a user:secret value is used as is). The header reaches git through GIT_CONFIG_COUNT/GIT_CONFIG_KEY_n/GIT_CONFIG_VALUE_n, the environment form of git -c, so it is never written to .git/config and never appears on a command line, where other users of the machine could see it with ps. The remote URL is never rewritten.

Without tokenEnv, Everdoc first tries anonymously, exactly as for public repositories. Only if that is refused does it use EVERDOC_GIT_TOKEN (any host), GITHUB_TOKEN (github.com or $GITHUB_SERVER_URL), or GITLAB_TOKEN (GitLab hosts or $CI_SERVER_HOST).

What is guaranteed:

  • Tokens never land in .everdoc/git/*/config, snapshot.json, everdoc.json, HTML, logs, or error messages. Git's stderr is scrubbed of the token, its base64 form, Authorization values, and user:password@ before it is shown.
  • URLs with embedded credentials (https://user:token@host/...) are rejected in the config.
  • Tokens are refused over plain http:// except to loopback hosts.

A fine-grained GitHub token with Contents: read-only on the repository is enough.

SSH. git@host:org/repo.git and ssh://git@host[:port]/org/repo.git are fetched as written with your SSH agent and keys (GIT_SSH_COMMAND works). Permalinks use https://host/org/repo.

GitHub Enterprise and self-hosted GitLab. The web URL is derived from the remote; set repo.webUrl when the browsable host differs from the git host.

In-repo mode

Run Everdoc inside the repository it documents, so CI needs no second clone and no token:

TypeScript
// everdoc.config.ts at the root of the repository

  repo: ".",
  channels: { stable: { tag: /^v\d+\.\d+\.\d+$/ }, main: { branch: "main" } },
  compare: [{ base: "stable", head: "main" }],
});

Paths resolve against the config file (repo: ".." from tools/everdoc.config.ts works). Everdoc finds the git root, reads origin (credentials dropped) for permalinks and the display name, and reads refs and blobs with git ls-tree and git cat-file only: the working tree, index, and current branch are never touched. Add .everdoc/ to .gitignore. In GitHub Actions, check out with fetch-depth: 0 so tags and history (channels, releases, diff evidence) are present.

Privacy and redaction

Everything here is off by default:

TypeScript
privacy: {
  stripSourceLinks: true,          // no links to the git host anywhere
  redactEnvDefaults: "secrets",    // or true (all), or ["^INTERNAL_", "_URL$"] (regexes on the name)
  noindex: true,                   // robots meta tag, X-Robots-Tag, Disallow-all robots.txt
},
  • redactEnvDefaults replaces matching env var defaults with "[redacted]" during extraction, before snapshot.json, llms.txt, Markdown, HTML, diffs, or MCP answers exist. "secrets" matches KEY|SECRET|TOKEN|PASSWORD|PASS|PRIVATE|CREDENTIAL|DSN|WEBHOOK|AUTH and variables read as secrets (for example Effect Config.redacted).
  • stripSourceLinks removes permalinks, commit, PR, tree, and release links from the site, llms.txt, Markdown, and MCP answers, and records the repository by name instead of URL. Repository-relative locations such as apps/server/src/ws.ts:42 stay visible.
  • noindex adds <meta name="robots" content="noindex, nofollow"> to every page, an X-Robots-Tag rule to _headers, and dist/robots.txt with Disallow: /.

The settings are recorded in each snapshot (meta.privacy), so everdoc build --skip-extract, the site, and the MCP server all apply them the same way.

Cloudflare Pages with Access SSO

templates/private-docs-cloudflare.yml builds the atlas in the repository's own CI (in-repo mode) and deploys it with wrangler pages deploy.

  1. People: protect the Pages project with Cloudflare Access (Zero Trust → Access → Applications → Self-hosted, for the custom domain and *.<project>.pages.dev), with a policy for your identity provider or email domain.
  2. Agents: set EVERDOC_TOKEN as a Pages secret (the template syncs it from a repository secret). The generated _worker.js then requires Authorization: Bearer <token> on /mcp and /{channel}/mcp, compared in constant time. Add an Access Bypass policy for those paths so MCP clients authenticate with the token instead of a browser login.
  3. Token everywhere: set EVERDOC_PROTECT_ALL=true both as a Pages variable and in the build environment. _routes.json then sends every request (static files included) through the worker, which requires the token on every route (useful when only agents read the site).

Without EVERDOC_TOKEN the worker stays fully open, as before. Note that the token alone protects only the MCP endpoint; the static files (including snapshots) need Access or EVERDOC_PROTECT_ALL.

Self-hosted Docker

Bash
docker build -f docker/Dockerfile -t everdoc .
everdoc build --config everdoc.config.ts --out dist        # in CI or locally
docker run -d --name atlas -p 4321:4321 \
  -e EVERDOC_TOKEN="$(openssl rand -hex 32)" \
  -v "$PWD/dist:/data:ro" everdoc

The image (Node 24 Alpine, non-root) runs everdoc serve --dir /data --port 4321 --host 0.0.0.0 --require-auth and refuses to start without a token. GET /healthz answers {"ok":true} without auth for Docker and Kubernetes health checks.

everdoc serve --require-auth (token in $EVERDOC_TOKEN, or --token-env <VAR>) protects everything else:

  • Authorization: Bearer <token> opens pages, data files, and MCP.
  • Browsers are redirected to /_auth/login, a sign-in page that sets an HMAC-signed session cookie (HttpOnly; SameSite=Lax; Path=/, plus Secure over HTTPS or behind a proxy sending X-Forwarded-Proto: https). Sessions last 7 days and all end when the token changes; the token itself is never stored in the browser. POST /_auth/logout signs out.
  • Other unauthenticated requests get 401 with WWW-Authenticate: Bearer.

Put TLS in front (a reverse proxy, ingress, or tunnel). Use a long random token.

Private MCP for Claude Code, Cursor, and T3 Code

Any MCP client can reach a protected site two ways. Keep the token in your environment or secret store, not in committed files.

Stdio bridge (works with every client): everdoc mcp --remote sends the token as a Bearer header on every request and fails with a clear 401/403 message (never echoing the token) when it is missing or wrong.

Bash

everdoc mcp --remote https://atlas.acme.dev --token-env EVERDOC_TOKEN

Direct Streamable HTTP to https://atlas.acme.dev/mcp with an Authorization header.

Claude Code:

Bash
claude mcp add --transport http acme-atlas https://atlas.acme.dev/mcp --header "Authorization: Bearer $EVERDOC_TOKEN"
# or the stdio bridge:
claude mcp add acme-atlas -e EVERDOC_TOKEN="$EVERDOC_TOKEN" -- everdoc mcp --remote https://atlas.acme.dev --token-env EVERDOC_TOKEN

Cursor (~/.cursor/mcp.json, or .cursor/mcp.json kept out of git):

JSON
{
  "mcpServers": {
    "acme-atlas": {
      "command": "everdoc",
      "args": ["mcp", "--remote", "https://atlas.acme.dev", "--token-env", "EVERDOC_TOKEN"],
      "env": { "EVERDOC_TOKEN": "<token>" }
    }
  }
}

T3 Code: add an MCP server with command everdoc, arguments mcp --remote https://atlas.acme.dev --token-env EVERDOC_TOKEN, and EVERDOC_TOKEN in its environment; or an HTTP server at https://atlas.acme.dev/mcp with the header Authorization: Bearer <token>.

From code, createRemoteDataSource(url, { token, headers }) in @everdoc/mcp does the same (headers carries extras such as Cloudflare Access service-token headers).

PR diff gate

everdoc pr-check extracts the PR's base and head from the local clone (reusing the per-file fact cache, so only changed files are parsed), diffs them structurally with commit evidence from the base..head range, and writes a PR comment:

Bash
everdoc pr-check --base origin/main --head HEAD --out pr-check.md --fail-on-breaking
Flag Default
--base <ref> / --head <ref> origin/main (else main) / HEAD
--config <file> everdoc.config.ts here or in the repository, else built-in defaults
--local-repo <dir> / --work-dir <dir> . / .everdoc
--format markdown|json, --out <file> Markdown on stdout
--fail-on-breaking, --fail-on-layer-violation, --fail-on-broken-docs report only
--no-cache use the fact cache

Exit codes: 0 pass, 2 a policy gate tripped, 1 unexpected error.

The comment starts with <!-- everdoc:pr-check --> so CI can update one sticky comment. It has a status line, a summary table (Breaking, Notable, Patch, Layer Violations, Broken / Stale Docs, Graph Delta), the enabled gates, then Breaking Changes (field-level diffs, source locations, and the commits that caused them), Notable API & surface changes, Architecture & layer violations (dependencies pointing up the apps → adapters → libraries → contracts stack), and Documentation drift. Long lists end in … and N more, and the comment always stays under GitHub's 65,536-character limit.

everdoc init --with-pr-check writes .github/workflows/everdoc-pr-check.yml (template), which runs it on every pull request through the reusable action (command: pr-check), upserts the comment (job summary for fork PRs, whose token is read-only), and fails the check when a gate trips.