Skip to main content
Glama
README.md
# letterboxd-mcp

[![Tests](https://github.com/chi-li-peppers/letterboxd-mcp/actions/workflows/tests.yml/badge.svg)](https://github.com/chi-li-peppers/letterboxd-mcp/actions/workflows/tests.yml)
[![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![MCP](https://img.shields.io/badge/MCP-stdio-orange.svg)](https://modelcontextprotocol.io)

> Give your AI agent a taste in cinema.

An unofficial [MCP](https://modelcontextprotocol.io) server that gives AI agents (Claude Desktop, Cursor,
and any other MCP client) structured access to your own Letterboxd data: watch history, ratings, watchlist
and recent activity. It returns **facts** — counts, averages, lists — so the agent can do the interpretation
and the recommendations itself.

**Unofficial MCP server. Not affiliated with or endorsed by Letterboxd.**

![letterboxd-mcp demo](docs/demo.svg)

## What it does

Six tools, nothing else:

| Tool | Source | What you get |
|---|---|---|
| `get_recent_activity` | public RSS | latest watches and reviews, with rating and date |
| `get_watchlist` | local export | your watchlist as rows (title, year, link, position) |
| `filter_watchlist` | local export + TMDB | filter by runtime, release year, genres |
| `analyze_taste` | local export | counts, unique films, average/median rating, years, tags, activity |
| `compare_watchlists` | two local exports | shared films, per-user exclusives, ambiguity flags |
| `export_recommendations_csv` | local filesystem | `Title,Year,tmdbID` CSV that Letterboxd can import |

Every tool returns the same envelope:

```json
{
  "success": true,
  "data": {},
  "error": null,
  "metadata": {"source": "local_export", "cached": false, "partial": false, "files": ["watchlist.csv"]}
}
```

On failure `data` is `null`, `error` is `{"code": "...", "message": "..."}` and the code is one of:
`EXPORT_NOT_FOUND`, `INVALID_EXPORT`, `INVALID_PROFILE`, `RSS_UNAVAILABLE`, `TMDB_UNAVAILABLE`,
`TMDB_RATE_LIMITED`, `INVALID_ARGUMENT`, `FILE_ACCESS_DENIED`, `FILE_ALREADY_EXISTS`, `INTERNAL_ERROR`.

## Example prompts

Once connected to your MCP client, you can ask things like:

- *"Analyze my Letterboxd taste — what decades and tags show up most in my high ratings?"*
- *"Pick 5 films from my watchlist from the 1990s under 110 minutes in Crime or Thriller."*
- *"Compare my watchlist with `friend` and export our shared picks to `weekend.csv` for Letterboxd import."*
- *"What have I logged recently on Letterboxd?"*

## What it does not do

- No Letterboxd login, cookies, sessions, scraping or private endpoints. Export + public RSS only.
- No HTML parsing, no browser automation, no bypassing of blocks or rate limits.
- No server-side recommendations: the connected agent does that from the data.
- No web UI, no database of users, no telemetry.

## Get your Letterboxd export

Letterboxd → **Settings → Data → Export your data**. You get a ZIP with `diary.csv`, `ratings.csv`,
`watched.csv`, `watchlist.csv`, `reviews.csv`. Unzip it or point the server at the ZIP directly.

## Install

Requires Python 3.11+.

```bash
git clone https://github.com/chi-li-peppers/letterboxd-mcp
cd letterboxd-mcp
uv venv && uv pip install -e .        # or: python -m venv .venv && .venv/bin/pip install -e .
```

Run it:

```bash
LETTERBOXD_EXPORT_PATH=~/Downloads/letterboxd-export.zip letterboxd-mcp
```

Or without installing, via [uvx](https://docs.astral.sh/uv/guides/tools/):

```bash
uvx --from git+https://github.com/chi-li-peppers/letterboxd-mcp letterboxd-mcp
```

## Configuration

All configuration is environment variables (see `.env.example`):

| Variable | Default | Meaning |
|---|---|---|
| `LETTERBOXD_EXPORT_PATH` | — | path to the export ZIP, the unzipped folder, or one CSV |
| `LETTERBOXD_PROFILES` | — | extra local profiles, JSON `{"friend": "/path/friend.zip"}` or `friend=/path/friend.zip` |
| `LETTERBOXD_EXPORT_DIR` | `~/letterboxd-exports` | the only directory `export_recommendations_csv` may write to |
| `LETTERBOXD_USERNAME` | — | default Letterboxd username for RSS (public profile only) |
| `TMDB_API_KEY` | — | optional; needed only for runtime/genre filtering |
| `CACHE_DIR` | `~/.cache/letterboxd-mcp` | SQLite cache location |

Exports you read and CSVs you write are kept in separate directories on purpose.

### Claude Desktop

`~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or
`%APPDATA%\Claude\claude_desktop_config.json` (Windows):

```json
{
  "mcpServers": {
    "letterboxd": {
      "command": "/absolute/path/to/letterboxd-mcp/.venv/bin/letterboxd-mcp",
      "env": {
        "LETTERBOXD_EXPORT_PATH": "/Users/you/Downloads/letterboxd-export.zip",
        "TMDB_API_KEY": "optional"
      }
    }
  }
}
```

### Cursor

`.cursor/mcp.json` in your project, or the global MCP settings:

```json
{
  "mcpServers": {
    "letterboxd": {
      "command": "/absolute/path/to/.venv/bin/letterboxd-mcp",
      "env": {"LETTERBOXD_EXPORT_PATH": "/absolute/path/export.zip"}
    }
  }
}
```

Transport is stdio. The server logs to stderr only, so stdout stays clean for the protocol.

## Tool reference

### `get_recent_activity(username=None, limit=20)`

Public RSS (`https://letterboxd.com/<username>/rss/`), cached for 24 hours.
Returns `{"username", "count", "activities": [{title, year, type, rating, rewatch, date, link}]}`.
`type` is `watch` or `review`. If the profile has no public RSS, you get `RSS_UNAVAILABLE` — there is no
fallback, by design.

### `get_watchlist(username=None, use_local_export=true)`

`username` selects a configured **profile** (default: `default`). Returns
`{"movies": [{title, year, letterboxd_uri, tmdb_id, position}], "count"}` and metadata with
`files` + `export_modified`. This is a snapshot of your last export, not live data.

### `filter_watchlist(username=None, max_runtime=None, min_year=None, max_year=None, genres=None, limit=50)`

Year filtering works offline. Runtime and genre filtering need `TMDB_API_KEY`; without it you get
`TMDB_UNAVAILABLE` instead of invented values. Response reports `checked`, `matched`, `unenriched`
(films TMDB could not identify — never guessed) and whether metadata was partial or cached.
At most 60 films are enriched per call to stay inside TMDB limits. If every TMDB lookup fails (bad key,
outage) the tool returns `TMDB_UNAVAILABLE` instead of an empty partial list.

### `analyze_taste(username=None)`

Statistics from `diary.csv`, `ratings.csv` and `watched.csv`:
watched rows vs unique films, diary entries vs unique films, rewatches, average and median rating, rating
distribution, top release years and decades, activity by month, average rating per year, top tags.
Genres, directors and actors are reported as `available: false` — a Letterboxd export contains no such data,
and the server does not invent it.

### `compare_watchlists(user1, user2)`

Both arguments are locally configured profile names. Returns `shared`, `only_first`, `only_second`,
`counts`, and `ambiguous` (same title+year appearing more than once — reported, never silently merged).
No access to anyone else's account.

### `export_recommendations_csv(movies, output_path, overwrite=false)`

`movies` is a list of `{"Title": str, "Year": int, "tmdbID": int}`. Writes `Title,Year,tmdbID` with
CRLF-safe quoting, refuses to leave `LETTERBOXD_EXPORT_DIR`, refuses symlinks, refuses to overwrite an
existing file unless `overwrite=true` (published with an atomic link, so parallel calls cannot race), and
writes atomically. Cells starting with `= + - @` are prefixed
with `'` so a spreadsheet cannot execute them as formulas. Import the result in
Letterboxd → Settings → Import.

## Security notes

- ZIPs are read in memory with limits (50 MB archive, 32 MB per member, 128 MB total, 200 members) and
  every member name is checked for absolute paths, `..`, symlinks and encryption. Two files with the same
  name in one archive are rejected; symlinked CSVs inside an export folder are skipped, not followed.
- Output paths are resolved before use; anything outside `LETTERBOXD_EXPORT_DIR` is refused.
- Logs contain operation names, counts and error types — never file contents, film lists or API keys.
- Cached data lives in SQLite with TTLs (RSS and watchlist 24 h, TMDB 30 days) and is invalidated when an
  export's size or mtime changes.

## Limitations

- Watchlist and taste data are as fresh as your last export. Only RSS is live.
- RSS exposes what the public profile exposes; no RSS → no activity.
- TMDB is optional and its free tier is meant for non-commercial use — check TMDB's terms before building
  anything commercial. This project is not affiliated with TMDB either.
- No semantic matching: films are matched by TMDB id, then normalised title + year. Ambiguity is reported,
  not resolved.

## Tests

```bash
pip install -e ".[dev]"
pytest          # no network: all HTTP is mocked with respx
ruff check .
```

`tests/test_server.py` starts the real server over stdio with the MCP client and calls the tools.

## Reporting a problem

Open an issue with: the tool name, the error `code`, your Python version, and whether the export is a ZIP
or a folder. Do not paste your export or your API key.

## License

MIT. See [LICENSE](LICENSE).

TDQS

B3.4/5.0

Scored across 6 tools

Disambiguation4/5

Each tool targets a distinct operation, and the descriptions explicitly separate live RSS activity from local-export watchlist data, which is the main potential confusion point. The only mild overlap is that filter_watchlist is a narrower slice of get_watchlist that an agent could arguably approximate itself, but the boundary is documented.

Naming Consistency5/5

All six tools follow a clean verb_noun snake_case convention (get_, filter_, analyze_, compare_, export_). No mixed styles or vague verbs; the names alone signal the action and object.

Tool Count5/5

Six tools is a tight, well-scoped surface for a read-only Letterboxd data server, with each tool mapping to a distinct workflow (activity, watchlist, filtering, taste stats, comparison, export). Nothing appears redundant or padded.

Completeness4/5

The read-only lifecycle is largely covered: activity, watchlist retrieval, filtering, aggregate stats, comparison, and CSV export. Gaps remain around title/film lookup or search and a direct diary/review listing tool, though analyze_taste partially compensates; write operations are legitimately out of scope given the local-export design.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues