Skip to main content
Glama
README.md
# Weekly recap

[![trivy](https://github.com/visibilityspots/dockerfile-weekly-recap/actions/workflows/trivy.yml/badge.svg)](https://github.com/visibilityspots/dockerfile-weekly-recap/actions/workflows/trivy.yml)
[![docker-hub-description](https://github.com/visibilityspots/dockerfile-weekly-recap/actions/workflows/docker-hub-description.yml/badge.svg)](https://github.com/visibilityspots/dockerfile-weekly-recap/actions/workflows/docker-hub-description.yml)
[![build status](https://github.com/visibilityspots/dockerfile-weekly-recap/actions/workflows/main.yml/badge.svg)](https://github.com/visibilityspots/dockerfile-weekly-recap/actions/workflows/main.yml)
[![gitHub release](https://img.shields.io/github/v/release/visibilityspots/dockerfile-weekly-recap)](https://github.com/visibilityspots/dockerfile-weekly-recap/releases)
[![docker image size](https://img.shields.io/docker/image-size/visibilityspots/weekly-recap/latest)](https://hub.docker.com/r/visibilityspots/weekly-recap)
[![docker pulls](https://img.shields.io/docker/pulls/visibilityspots/weekly-recap.svg)](https://hub.docker.com/r/visibilityspots/weekly-recap/)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

a tiny web page per week, written by an AI agent over [MCP](https://modelcontextprotocol.io).

The agent gets one tool, `publish_report(week, markdown)`, which stores the Markdown recap
of an ISO week (`2026-W49`). The web side lists every week and renders it as a dark,
terminal-style page. The agent's only power is "replace the text of a week": it needs no
key for anything else, and the server needs no key for the agent's systems.

It is a single Python file on top of the MCP Python SDK and markdown-it-py, running as a
non-root user, with the reports as plain `.md` files in `/data`.

## run

```
$ TOKEN=$(openssl rand -hex 32)
$ docker run -d --name weekly-recap -p 8080:8080 -v recap:/data \
    -e MCP_ALLOWED_HOSTS=recap.example.com \
    -e RECAP_PUBLIC_URL=https://recap.example.com/ \
    -e MCP_TOKEN_SHA256="agent=$(printf %s "$TOKEN" | sha256sum | cut -c1-64)" \
    visibilityspots/weekly-recap:latest
```

Point the MCP client at `https://recap.example.com/mcp` with
`Authorization: Bearer $TOKEN`, and open `https://recap.example.com/` in a browser.

### Safety

- **Untrusted text.** A model writes the recap, often from logs and task text. Markdown is
  rendered without raw HTML and without images (a remote image would be a beacon from the
  reader's browser). `javascript:` links are dropped, links open in a new tab with `rel="noopener noreferrer"`,
  and every page carries `Content-Security-Policy: default-src 'none';
  style-src 'unsafe-inline'`, so no script or remote load runs.
- **Sign-in phrases.** Some agent runners treat a sign-in prompt (`not[ ]logged[ ]in`,
  `unauthori[sz]ed`, ...) in any output line as a lost login. `publish_report` refuses text
  that contains one and never echoes the text back. A refused token gets `403 forbidden`,
  never `401`.
- **No auth on the pages.** Put the service behind an IP allowlist or an auth proxy.
- Only `/mcp` needs the bearer token. The server keeps only SHA-256 hashes of the tokens.

## Configuration

| variable | default | meaning |
|---|---|---|
| `MCP_TOKEN_SHA256` | required | comma-separated `<client>=<sha256 hex of token>` |
| `MCP_ALLOWED_HOSTS` | empty | public host names for `/mcp`; other hosts get 421 (DNS rebinding protection); `*` turns it off |
| `RECAP_PUBLIC_URL` | `http://localhost:8080/` | base URL in the tool's answer |
| `RECAP_TITLE` | `weekly recap` | site title |
| `RECAP_DATA_DIR` | `/data` | where the `.md` files live |
| `RECAP_MAX_BYTES` | `204800` | maximum size of one report |
| `RECAP_KEEP_REVISIONS` | `5` | earlier versions kept per week as `<week>.<epoch>.md` |
| `PORT` | `8080` | listen port |

Endpoints: `/` (weeks), `/w/<week>`, `/mcp`, `/healthz` (503 when `/data` is not
writable), `/metrics` (`weekly_recap_reports`,
`weekly_recap_last_publish_timestamp_seconds`).

## build

```
$ docker build -t visibilityspots/weekly-recap:latest .
```

### buildx

```
$ docker buildx build --platform linux/amd64,linux/arm64 -t visibilityspots/weekly-recap:latest .
```

### dgoss

```
$ dgoss run -e MCP_TOKEN_SHA256=goss=4c5dc9b7708905f77f5e5d16316b5dfb425e68cb326dcd55a860e90a7707031e \
    -e MCP_ALLOWED_HOSTS=recap.example.com visibilityspots/weekly-recap:latest
```

### act

```
$ act -j main
```

## License

Distributed under the MIT license