Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ jobs:
with:
# Build output is written into the `src/` package (see package.json).
path: ./src/dist
# The RFC 9727 API catalog lives at `.well-known/api-catalog`, and this
# action drops dot-files and dot-directories by default — so the file is
# built and validated but never reaches GitHub Pages, and the edge Worker
# then faithfully propagates the origin's 404. `true` ships hidden files
# (it still excludes `.git`/`.github`).
include-hidden-files: true

deploy:
needs: build
Expand Down
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,6 @@ src/src/data/projects/<id>.yml` against a clone of its repository.
| API catalog (RFC 9727) | `src/src/lib/discovery/api-catalog.ts` (ADR 0017), `/.well-known/api-catalog` |
| Discovery `Link` headers (RFC 8288 / RFC 9727 §3) | `worker/src/links.ts`, `worker/src/index.ts` (ADR 0018) |
| Agent registration (Auth.md) | `src/src/lib/discovery/auth-md.ts`, `/auth.md` (ADR 0019) |
| A2A / OAuth / ACP discovery | `src/src/lib/discovery/{agent-card,oauth,acp}.ts`, `/.well-known/{agent-card.json,oauth-authorization-server,oauth-protected-resource,acp.json}` (ADR 0020) |
| Agent Skills, MCP and Web Bot Auth discovery | `src/src/lib/discovery/{agent-skills,mcp-server-card,web-bot-auth}.ts`, `src/src/scripts/webmcp.ts`, `/mcp` (edge Worker `worker/src/mcp.ts`), `/.well-known/{agent-skills/index.json,mcp/server-card.json,http-message-signatures-directory}` (ADR 0021) |
| Architecture decisions | `docs/decisions/*.md` |
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,11 @@ generated discovery layer: a partitioned sitemap (`/sitemap-index.xml` →
is derived from the project catalogue, the docs manifest and the release cache —
there is no hand-maintained URL list. The homepage response advertises that
surface through HTTP `Link` headers (RFC 8288 / RFC 9727 §3), added by the edge
Worker, and a self-contained `/auth.md` records that the site has no login (so
there is no agent registration to complete). After a successful deployment,
Worker, and `/auth.md` plus the A2A Agent Card, OAuth and ACP discovery documents
(`/.well-known/agent-card.json`, `oauth-authorization-server`,
`oauth-protected-resource`, `acp.json`) record that the site has no login, no
authorization server and no commerce (ADR 0019, ADR 0020). After a successful
deployment,
IndexNow notifies participating engines about changed URLs only.

```shell
Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0019-auth-md.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ADR 0019 — `/auth.md` for a site with no login

- Status: accepted
- Status: accepted (superseded in part by [ADR 0020](./0020-agent-and-oauth-discovery.md))
- Date: 2026-04-12

## Context
Expand Down
97 changes: 97 additions & 0 deletions docs/decisions/0020-agent-and-oauth-discovery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# ADR 0020 — Agent and OAuth discovery for a site with no login

- Status: accepted
- Date: 2026-04-12

## Context

Agent-readiness tooling (isitagentready.com) probes a set of standard `.well-known`
paths beyond the RFC 9727 API catalog (ADR 0017) and `/auth.md` (ADR 0019):

- `/.well-known/agent-card.json` — the A2A Agent Card (A2A protocol, "Agent Discovery");
- `/.well-known/oauth-authorization-server` — OAuth 2.0 Authorization Server Metadata (RFC 8414);
- `/.well-known/oauth-protected-resource` — OAuth 2.0 Protected Resource Metadata (RFC 9728);
- `/.well-known/acp.json` — the Agentic Commerce Protocol discovery document.

`purview.dev` is a **public, read-only static site with no login**: no accounts, no
hosted API, no protected resource, no authorization server and no commerce
(ADR 0001). For every one of these paths the *absence* is the truth, and ADR 0019
published nothing, letting `/auth.md` state the absence in prose — its rejected
alternatives called a published OAuth document "fabrication".

Two facts changed that judgement:

1. **A 404 is a worse answer than a stub.** An agent that probes a standard path and
gets a 404 cannot tell "no such surface" from "not implemented yet". A small,
well-formed document that says *"public resource, no credential required, no
commerce here"* is a truthful, machine-readable answer; the 404 is not.
2. **The `_comment` makes it explicit.** The site already publishes a no-op surface
on principle: the API catalog and `/auth.md` exist to describe what the origin
serves without inventing APIs (ADR 0017, 0019). These documents are the same
pattern, one path further, provided they say what they are in band.

## Decision

Generate the four documents at build time (from `src/src/lib/discovery/`) and write
them into `dist/.well-known/`, exactly like the API catalog and `/auth.md`:

- `agent-card.ts` — an A2A Agent Card for the read-only documentation surface: the
required `name`/`version`/`description`, a `supportedInterfaces` entry pointing at
the origin over `HTTP+JSON`, `capabilities`, and one fully-described `skills` entry.
- `oauth.ts` — RFC 8414 authorization-server metadata and RFC 9728 protected-resource
metadata. The resource metadata names the origin, self-references the origin as its
authorization server, and points `resource_documentation` at `/auth.md`.
- `acp.ts` — an ACP discovery document shaped to the spec (protocol name and version,
API base URL, transports, services).

**Every document is explicitly a stub — that is the honesty rule.** Each carries a
top-level `_comment` stating, in band, that the origin has no task server, no
authorization server and no commerce, that the endpoints it names are reserved and
non-operational, and that nothing requires a credential. The paths the OAuth metadata
names (`/oauth/authorize`, `/oauth/token`, `/.well-known/jwks.json`) serve nothing;
the ACP `capabilities.services` value describes the shape of the document, not a
working integration. The documents are "explicit rather than implied" (ADR 0019) and
they agree with `/auth.md`.

Serving:

- The `.json` paths (`agent-card.json`, `acp.json`) are typed `application/json` by the host.
- The extension-less OAuth paths are typed `application/octet-stream` by a static host,
which an agent that checks the media type skips, so the edge Worker sets
`application/json` (`worker/src/index.ts`), exactly as it does for the API catalog
(ADR 0016, ADR 0017).

`discovery:validate` fails the build when any document is missing or malformed, so a
half-formed surface never ships.

## Consequences

- `a2aAgentCard`, `oauthDiscovery`, `oauthProtectedResource` — and the commerce `acp`
surface — resolve to well-formed documents instead of 404s, so an agent gets a
truthful machine-readable answer.
- The documents are generated, so they track the site identity and version and cannot
drift; each has unit, dist and Worker test coverage, and `check-generated` requires
all four in `dist/`.
- Four more generated artifacts, and two more Worker-special-cased paths to maintain.
- **The stubs describe surfaces the origin does not serve.** That is a deliberate,
documented trade: the alternative — a bare 404 — is *less* honest to a machine
client, because it cannot distinguish "none" from "not yet". If Purview ever ships an
authenticated API or a commerce flow, these documents become real and their
`_comment` is removed; nothing else in the discovery layer changes.
- If the readiness ecosystem ever treats these documents as proof that the *flows*
work, this decision must be revisited: the documents state plainly that they do not.

## Alternatives considered

- **Publish nothing and let `/auth.md` state the absence in prose** (ADR 0019). A
machine client does not read prose before deciding; the 404 is indistinguishable from
an unimplemented surface. Superseded.
- **Point the OAuth metadata at a real third-party authorization server.** Fabrication
with a real victim: the site would name an issuer it has no relationship with.
Rejected.
- **Implement a real authorization server in the Worker.** Adds an interactive login to
a site that must not have one, plus a credential store to a static site. Rejected.
- **A hand-written static file per path.** Simple, but it would sit outside the
discovery model, its validator and its version source, and could drift. Rejected in
favour of generation.

123 changes: 123 additions & 0 deletions docs/decisions/0021-skills-mcp-and-web-bot-auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# ADR 0021 — Skills, MCP, WebMCP and Web Bot Auth discovery

- Status: accepted
- Date: 2026-12-04

## Context

Agent-readiness tooling (isitagentready.com) probes four further standard
surfaces beyond the A2A card, OAuth metadata and ACP document of ADR 0020, plus a
DNS-based discovery mechanism:

- `/.well-known/agent-skills/index.json` — the Agent Skills Discovery index
([cloudflare/agent-skills-discovery-rfc](https://github.com/cloudflare/agent-skills-discovery-rfc), v0.2.0);
- `/.well-known/mcp/server-card.json` — an MCP Server Card
([SEP-1649](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2127));
- WebMCP — in-browser tools registered on
`document.modelContext` / `navigator.modelContext`
([WebMCP](https://webmachinelearning.github.io/webmcp/));
- `/.well-known/http-message-signatures-directory` — a Web Bot Auth JWKS directory
([WebBotAuth WG](https://datatracker.ietf.org/wg/webbotauth/about/));
- `_agents` DNS records — DNS for AI Discovery (DNS-AID).

ADR 0020 established the pattern: a standard path that an agent probes should
resolve to a **truthful, machine-readable answer** rather than a 404, and the
document must say what it is in band. This ADR applies that pattern to the four
HTTP surfaces, and — where a surface can be *real* — makes it real rather than a
stub. purview.dev genuinely publishes Agent Skills and genuinely serves its
documentation, so the Agent Skills index and the MCP server are real features,
not stubs; Web Bot Auth is real for the one bot request the site sends.

## Decision

Generate the discovery documents at build time (from `src/src/lib/discovery/`,
written by `emit.ts`), serve the runtime behaviour from the edge Worker
(`worker/`), and validate every artifact in `discovery:validate`.

### Agent Skills discovery index

`agent-skills.ts` builds `/.well-known/agent-skills/index.json` from the
`SKILL.md` files themselves: the `description` from each file's front matter and
the `digest` (`sha256:{hex}`) from its bytes, so the index cannot drift from what
is served. It lists two sets, deduplicated by name (this repository's own skills
first):

- **this repository's own skills** (`skills/<name>/SKILL.md`), copied by the
build to `/.well-known/agent-skills/<name>/` — the location the RFC's authors
conventionally use — so the `url` is same-origin. These are committed with the
site, so the index is never empty;
- the **mirrored project skills** (ADR 0010) already served at
`/skills/<project>/<name>/SKILL.md`.

### MCP Server Card and a read-only MCP server

`mcp-server-card.ts` publishes `/.well-known/mcp/server-card.json` for the
endpoint `https://purview.dev/mcp`. Because a card that advertises a server the
origin does not run would be dishonest, `worker/src/mcp.ts` implements a
**dependency-free, read-only** MCP server (Streamable HTTP, JSON-RPC 2.0) that
exposes the catalogue as tools (`search_projects`, `list_projects`,
`get_project`) and the site's machine-readable documents as resources. The card's
`capabilities` states the truth — `tools` and `resources` are served, `prompts`
are not. The server only ever fetches the origin; it writes nothing and needs no
credential.

### Web Bot Auth

`web-bot-auth.ts` publishes the JWKS directory and signs the site's outbound bot
request. The **public** Ed25519 key is committed (so the directory always
resolves); the **private** key is the `WEB_BOT_AUTH_PRIVATE_JWK` deploy secret,
generated with `bun run web-bot-auth:key`. `discovery:indexnow` signs its
`POST /indexnow` with `Signature-Agent`, `Signature-Input` and `Signature`
headers (RFC 9421 / HTTP Message Signatures). With no secret set the request is
still sent, simply unsigned.

### WebMCP

`src/src/scripts/webmcp.ts` registers read-only tools (`search-projects`,
`list-projects`, `open-page`) on page load through
`document.modelContext.registerTool()` (falling back to
`navigator.modelContext`), under one `AbortController`. It is loaded by both the
site layout and the Starlight pages, and it no-ops on a browser without the API.

### DNS for AI Discovery (DNS-AID)

DNS records are outside this repository (the zone is controlled separately), so
they are documented as a one-time operator step in `docs/discovery.md` rather
than generated. The records are `SVCB`/`HTTPS` records under `_agents` with
`alpn` and port parameters, DNSSEC-signed.

## Consequences

- `agentSkills`, `mcpServerCard`, `webMcp` and `webBotAuth` resolve to real,
truthful surfaces instead of 404s.
- The Agent Skills index, the MCP card and the JWKS directory are generated from
their sources, so they track the skills, the site version and the key and
cannot drift; each has unit, dist and Worker coverage, and `check-generated`
requires all three in `dist/`.
- The MCP server is a new runtime surface in the Worker; it is isolated to
`POST /mcp` and its own tests, and passes every other request through as
before. It is deployed with the Worker, so it needs
`CLOUDFLARE_API_TOKEN`/`CLOUDFLARE_ACCOUNT_ID` like the rest of the edge
behaviour (the site itself needs neither).
- Web Bot Auth makes the site's IndexNow request verifiable. The committed public
key is a real Ed25519 key; rotating it means regenerating the pair and updating
both the constant and the secret.
- DNS-AID remains an operator action; nothing in the build can pass it alone.

## Alternatives considered

- **Stub the MCP card** (declare no capabilities, point at the origin), as ADR
0020 does for OAuth and ACP. Rejected: the site *can* serve documentation over
MCP cheaply, and a card that claims a capability the origin does not have — or
omits one it could provide — is less useful than a small real server.
- **List only the mirrored project skills.** Rejected: a checkout without a data
sync would publish an empty index, and this repository's own skills are
published by this origin too. Both sets belong.
- **Serve the repository's skills from their GitHub URLs.** Rejected: same-origin
URLs are simpler, verifiable against the digest, and need no second host.
- **Generate the Web Bot Auth key at build time.** Rejected: the build must not
hold a private key, and the public directory must exist without a secret. A
committed public key plus a deploy secret keeps the key private.
- **Sign nothing (publish the directory only).** Rejected: Web Bot Auth is only
meaningful if the request is signed; the directory without a signature proves
nothing.
Loading
Loading