Metadata-Version: 2.4
Name: cinematicket-org-mcp
Version: 0.2.0
Summary: Unofficial read-only MCP server for Cinematicket (cinematicket.org), Iran's cinema ticketing site: search movies, showtimes by city and cinema, seat availability, ratings, audience review digests, posters and booking links.
License-Expression: MIT
Project-URL: Homepage, https://github.com/khabbazan/cinematicket-mcp
Project-URL: Repository, https://github.com/khabbazan/cinematicket-mcp
Project-URL: Issues, https://github.com/khabbazan/cinematicket-mcp/issues
Keywords: mcp,mcp-server,model-context-protocol,cinematicket,cinema,movies,showtimes,iran,persian,farsi,tickets,reviews,unofficial
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Natural Language :: Persian
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp<3,>=2.2
Requires-Dist: httpx>=0.27
Dynamic: license-file

# Cinematicket-MCP

[![Tests](https://github.com/khabbazan/cinematicket-mcp/actions/workflows/tests.yml/badge.svg)](https://github.com/khabbazan/cinematicket-mcp/actions/workflows/tests.yml)
[![Ruff](https://github.com/khabbazan/cinematicket-mcp/actions/workflows/ruff.yml/badge.svg)](https://github.com/khabbazan/cinematicket-mcp/actions/workflows/ruff.yml)

**Give an AI agent a pair of eyes on [Cinematicket](https://cinematicket.org) (سینماتیکت), Iran's biggest cinema ticketing site.**

Cinematicket-MCP is an unofficial, read-only [MCP](https://modelcontextprotocol.io) server. Your agent can search films, plays and concerts by name, category, genre, rate or actor, list the showtimes of a film in any city or cinema, tell which sessions are still bookable, show film and cinema images, read what the audience thinks (strengths, weaknesses, and how much of it comes from people who really bought a ticket), and hand the user the link that starts the booking. All prices are in Toman.

It never logs in, reserves or pays: the user opens the booking link and picks seats on cinematicket.org.

<p align="center"><img src="docs/demo.gif" alt="Chatting with an MCP client that calls Cinematicket-MCP: bookable sessions of a film in Tehran, its poster, audience share and strengths and weaknesses" width="760"></p>

The animation is a mock chat rendered from real output of `ct_sessions`, `ct_movie` and `ct_reviews` (cinemas, times, prices, booking status, rate and audience share are real; `docs/make_demo.py` rebuilds it). The strengths and weaknesses bullets are an example of what the client model writes from the returned comments, and the tool timings are illustrative.

## Contents

- [Quick start](#quick-start)
- [What you can ask](#what-you-can-ask)
- [Tools](#tools)
- [Prompts and resources](#prompts-and-resources)
- [Behaviour](#behaviour)
- [Limits](#limits)
- [Configuration](#configuration)
- [Development](#development)

## Quick start

Install from PyPI with `uvx`. **Do not clone the repository.** Needs [uv](https://docs.astral.sh/uv/) (uv fetches Python 3.12+ itself) and no account or token. The package is `cinematicket-org-mcp`, the command is `uvx cinematicket-org-mcp`, the server name is `cinematicket`.

If you are an AI agent installing this for a user: pick the client below, run or write exactly that, then tell the user to restart the app. If the app can't find `uvx`, use its full path (`which uvx`, e.g. `/opt/homebrew/bin/uvx`; JSON does not expand `~`). Afterwards call `ct_status`: when it succeeds, tell the user Cinematicket is connected (version, latency) and offer the example requests it returns (`suggest_to_user`).

**Claude Code** (CLI): run

```bash
claude mcp add cinematicket -- uvx cinematicket-org-mcp
```

**Claude Desktop** (macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`, or Settings -> Developer -> Edit Config): add this under `mcpServers`, keep the other servers, then quit with Cmd+Q and reopen.

```json
{ "mcpServers": { "cinematicket": { "command": "uvx", "args": ["cinematicket-org-mcp"] } } }
```

**Codex** (CLI or app): run

```bash
codex mcp add cinematicket -- uvx cinematicket-org-mcp
```

or add to `~/.codex/config.toml`, then restart Codex:

```toml
[mcp_servers.cinematicket]
command = "uvx"
args = ["cinematicket-org-mcp"]
```

**Cursor and other clients** with an `mcpServers` file: use the same JSON as Claude Desktop.

To run from source instead, see [Development](#development).

## What you can ask

Every search takes a city («در تهران», «در شیراز»...). The film names below are well-known examples; ask about whatever the site lists today.

| Search | Example |
|---|---|
| By film name | «فیلم «اجاره‌نشین‌ها» را پیدا کن و بگو الان اکران است یا نه و امتیازش چنده.» |
| By actor | «فیلم‌های «پرویز پرستویی» که الان در تهران اکران هستند را نشان بده.» |
| By category | «تئاتر کودک در شیراز چه چیزهایی دارد؟ امتیازشان را هم بگو.» |
| By cinema | «سینماهای مشهد که الان فیلم در حال اکران دارند کدام‌اند؟» |
| Free sessions and booking | «برای «مارمولک» امشب در اصفهان بعد از ساعت ۱۹ سانس خالی با لینک رزرو پیدا کن.» |
| Audience view | «نقاط قوت و ضعف «جدایی نادر از سیمین» از نظر مخاطبان چیست؟ چند درصد نظرها از خود مخاطب است؟» |
| One cinema | «سینما کورش چه فیلم‌هایی دارد و کیفیت صدا و تصویرش چطور است؟» |
| Genre and rate | «یک کمدی خوب با امتیاز بالای ۴ در تبریز پیدا کن.» |

After a film table the agent asks whether you want the summary of the audience's comments or the free sessions of a film (with booking links); say yes and it fetches them.

## Tools

Every tool is prefixed `ct_`. A session row has the cinema, hall, day, time, price in Toman, `status` (`bookable`, `sold_out`, `not_on_sale`, `past`) and, when it can still be booked, the booking link. Every list shows at most 10 rows per page.

Typical sequence: `ct_cities` / `ct_categories` -> `ct_search_movies` -> `ct_movie` -> `ct_sessions` -> booking link; `ct_reviews` for the audience's view.

### Find

| Tool | What it does |
|---|---|
| `ct_cities` | The 187 cities with ids and provinces; every tool also takes a plain city name |
| `ct_categories` | The category shelves (فیلم ایرانی, تئاتر, کنسرت, کودک و نوجوان...), event types and the genres seen |
| `ct_search_movies` | Search by film name or by category («تئاتر کودک» is understood as the kids' shelf of type theater), plus type, genre, minimum rate and votes. Each row: image, linked title, rate, and whether it is showing now; with `city` only films with showtimes there (optionally only bookable ones) |
| `ct_actor_movies` | Films of an actor, director or writer: the site's search finds candidates and each film's cast confirms them; role, rate, whether it is showing now (in `city`), the person's photo and short biography |
| `ct_cinemas` | Cinemas of a city or all Iran: image, linked name, rate out of 5, address, facilities and how many films are on now; filter by name, rate, facility, or `only_showing` for cinemas that have films on screen |
| `ct_box_office` | The best-selling titles of all time with total sales in Toman |

### Showtimes and booking

| Tool | What it does |
|---|---|
| `ct_movie` | One film in full: story, genres, cast, duration, rate out of 5, trailer link, poster, and a showtime summary for a city |
| `ct_sessions` | Upcoming sessions of a film by city, cinema, day, hour range, price ceiling and availability, with booking links |
| `ct_cinema` | What one cinema shows (sessions by film and hour) plus its sub-ratings: picture, sound, cleanliness, service... |
| `ct_booking_link` | The link that opens the seat selection for one session, with its status |

### Audience

| Tool | What it does |
|---|---|
| `ct_reviews` | For a film or a cinema: site rate, comment count, the share of comments written by real audience («مخاطب», people who bought a ticket), likes and dislikes, and the most informative comments, ready for the client model to write strengths and weaknesses |
| `ct_status` | Is Cinematicket reachable, latency, what is cached |

All tools only read from Cinematicket, and nothing is written to disk.

## Prompts and resources

| Prompt | Use it to |
|---|---|
| `ct_what_to_watch` | Choose a film in a city by category and rate, among those you can still book |
| `ct_movie_verdict` | Is this film worth it: rate, audience share, strengths and weaknesses |
| `ct_book_tonight` | Find a bookable session for a day and hour and get the booking link |

| Resource | Content |
|---|---|
| `cinematicket://guide` | The tool workflow in a few lines |
| `cinematicket://categories` | The movie categories (JSON) |
| `cinematicket://cities` | The cities with ids (JSON) |

## Behaviour

- **Availability is honest.** A session is `bookable` unless the site marks it full (`remaining_capacity == 0` or the badge «تکمیل ظرفیت», the same rule the site's own button uses) or its sale has not started; `past` sessions are dropped. A sold-out session gets no booking link. The exact seat map needs a login on the site, so the server never claims a number of free seats; the exact seats are visible on the booking page. A row shows a seat count only when the site itself reports one.
- **Booking links** are `https://cinematicket.org/ticket/choose-seat/init/<driver>/<session id>` (`/festival` is appended for festival sessions): the same page the site's «انتخاب صندلی» button opens.
- **Prices** are in Toman. The site's API reports Rial; this server divides by ten (a session the page shows as 180,000 Toman is 1,800,000 in the API).
- **Cities** come from cinema lists: the showtimes API has no city filter, so sessions are matched to a city by the cinemas the site lists for it.
- **Audience reviews.** `ct_reviews` reads up to 6 pages of 20 comments (newest first), counts how many come from real audience and returns the most informative ones. The strengths and weaknesses are written by the client model from those comments, not guessed by a keyword list here. The share is of the analysed comments, not of all votes: the site rate out of 5 is reported next to it.
- **Images.** Film and cinema tables have an image column (the image of each row) when the site has one; the column is left out when no row has an image. Up to three images are also attached to the answer as image content (only from the site's CDN, size-capped) for clients that do not render remote images.
- **Showing now.** A film is «در حال اکران» when it has a session that has not started yet (in the asked city when there is one), read from the film's showtimes. With `city` or `only_available` only the 20 most popular matches are checked and the answer says so; a cinema counts as showing when it has such sessions.
- **Links.** Film and cinema names are links to their pages on cinematicket.org; showtime tables have a separate `لینک رزرو` column.
- **10 per page, then it asks.** When more rows exist, the answer ends with the question «آیا صفحه بعدی را نشان بدهم؟» and the agent puts it to the user instead of fetching more on its own; repeat the call with `page`.
- **A footer under every table.** `توجه: این نتایج به صورت غیر رسمی از منبع سینماتیکت بدست اومدند. github.com/khabbazan/cinematicket-mcp` closes each answer. The line is also stated as a rule in the server instructions, every tool description, every prompt and the guide; a client can still drop it, so add the same rule to your own preferences if you need it every time.
- **Dates and times.** Arguments take Gregorian `YYYY-MM-DD`, Jalali `1405-09-14`, `today` or `tomorrow` (Persian digits are fine); tables show Jalali dates; times are Tehran time.
- **Rate limits.** The site answers 429 when asked too fast: requests are throttled and retried with waits; if a city search still cannot check some films, the answer says how many were skipped instead of hiding them.

## Limits

- **Not a booking tool.** No login, no seat choice, no payment, no ticket list. The user finishes on cinematicket.org.
- **No exact free-seat counts** (see above).
- **City search checks the 20 most popular matches.** `ct_search_movies` with `city` fetches each candidate's showtimes (one request each); pass a name in `query` to look up another film.
- **The catalogue is wider than what is showing.** Without `city`, search lists the site's catalogue; the default `type` is `cinema` (use `any` for plays and concerts too, or a `category`).
- **Comments have no per-comment star rating or server-side sorting.** The digest samples recent pages; very old comments are not read.
- **The API is the website's own.** It can change without notice; the showtime parser is the part most likely to break first.

## Configuration

| Variable | Default | Meaning |
|---|---|---|
| `CINEMATICKET_MCP_PROXY` | unset | Optional HTTP proxy URL for requests to cinematicket.org; system proxy settings are ignored |

## Development

Every pull request runs the **Ruff** workflow (`.github/workflows/ruff.yml`) and the **Tests** workflow (`.github/workflows/tests.yml`, Python 3.12 to 3.14). To allow merging only after they pass, mark the `ruff` and `pytest` jobs as required status checks in the branch protection rule of `main`.

To run from source, clone into a folder that does not exist yet and point `--directory` at it (in a JSON file use full paths for `command` and `--directory`):

```bash
git clone https://github.com/khabbazan/cinematicket-mcp.git ~/cinematicket-mcp
claude mcp add cinematicket -- uv --directory ~/cinematicket-mcp run cinematicket-org-mcp
```

```bash
uv sync
uv run ruff check . && uv run ruff format --check .
uv run pytest -q                  # offline, recorded fixtures
uv run pytest -m integration -q   # real cinematicket.org
python3 docs/make_demo.py         # rebuild docs/demo.gif (Chrome + Pillow)
```

### Releasing to PyPI

`.github/workflows/publish.yml` publishes with PyPI Trusted Publishing (no token). One-time setup: add a publisher for project `cinematicket-org-mcp`, workflow `publish.yml`, environment `pypi` on pypi.org, and create the `pypi` environment in the GitHub repo settings. Then bump `version` in `pyproject.toml`, merge, and create a GitHub Release with tag `v<version>`.

Everything lives directly under `src/` and is installed as the `cinematicket_mcp` package:

| Path | Role |
|---|---|
| `server.py` | Setup only: instructions, registration of tools, prompts and resources, the entry point |
| `tools/` | One file per tool |
| `prompts/`, `resources/` | Prompt templates and read-only resources |
| `services/http.py` | The only HTTP code: GET-only client with a path allow-list, retries, CDN-only images |
| `services/core.py` | Text folding, cities, a city's cinemas, showtimes, the availability rule, booking links |
| `services/movies.py` | Movie list fetching and client-side filters |
| `services/reviews.py` | The audience digest |
| `services/table.py`, `format.py`, `output.py` | Persian tables, Toman and Jalali formats, JSON / image output |
| `services/result.py` | The `Ok` / `Err` result type |

Services never raise for expected failures: they return `Err(message)`, and only the tool layer calls `.unwrap()` to turn it into a tool error the model can read.

Tests live in `tests/` as `pytest_<subject>.py` files with `test_success_...` / `test_failed_...` names, using recorded responses in `tests/fixtures`. One test checks that the tool table above matches the tools the server actually lists.

## Disclaimer

Unofficial and not affiliated with Cinematicket. It reads public data through the endpoints of the cinematicket.org web app, which can change without notice. Ratings and comments belong to their authors. Keep request rates low.

MIT licensed.
