# DRAFT: future API and MCP server for the archive catalogue

Status: **DRAFT. Not built, not hosted, not registered anywhere.** Written 4 Dec 2026.
Nothing here is live. No MCP server has been registered, nothing is deployed, no sign-ups made.

## Why
So people can search the catalogue from Cursor, Claude, or their own code and build stories (scripts, storyboards, shot lists) from real, public-domain archive items, with the source link and rights wording carried along every time.

## Today (static files)
The catalogue is plain static JSON. Any tool that can read a URL or a file can use it:
- `data/catalogue.json`: every item
- `data/types/footage.json`, `photos.json`, `magazines.json`, `adverts.json`: one type each
- `data/sources.json`: item counts per source
- `data/topics.json`: item counts per topic
- `data/archives.json`: directory of free archives
- `llms.txt`: a short plain-text guide for AI tools

## Future read-only HTTP API (proposal)
All GET, no key for basic use, JSON out. Every item always includes `url` (source record) and `rights` (source's own wording).

| Endpoint | Purpose |
|---|---|
| `GET /api/search?q=steam+train&type=Footage&decade=1950&limit=20` | Keyword + meaning search |
| `GET /api/items/{id}` | One item, e.g. `ia:Designfo1956`, `commons:6448924`, `met:285611` |
| `GET /api/sources` | Sources and counts |
| `GET /api/archives` | Directory of free archives |
| `GET /api/topics` | Topics and counts |

Rules: rate-limited, cached, no tracking beyond anonymous counts of empty searches (to learn what is missing).

## Future MCP server (proposal)
Name placeholder: `archive-search` (will carry the AARKIVIST name).
Transport: stdio for local use first (runs on the user's machine against the static JSON), HTTP later if hosted.

Tools:
1. `search_archive(query: string, type?: "Footage"|"Photos"|"Magazines"|"Adverts", decade?: number, limit?: number = 20)`
   Returns `[{id, title, type, year, source, url, thumb, rights}]`.
2. `get_item(id: string)` returns the full item record.
3. `list_sources()` returns sources with item counts.
4. `list_archives(type?: string)` returns the free-archive directory with rights wording.
5. (later) `build_shot_list(story: string, per_beat?: number = 3)` splits a story into beats and runs `search_archive` per beat. Output keeps every source link and rights line.

Guardrails written into the tool descriptions:
- Always show `rights` and `url` with each item; never say "copyright-free" beyond what the source says.
- Do not invent items. If nothing matches, say so and suggest an archive from `list_archives`.

## Open questions
- Hosting for a search API (free static hosting is enough for the JSON; a search API needs a small server or edge function).
- Whether to publish the MCP server as open source.
