Skip to main content
Glama
README.md
# traveldex

Finding a place to eat, drink, stay or unwind in an unfamiliar city usually means stitching together half a dozen listings that disagree with each other. traveldex is a small local bridge to the hosted NUM travel directory: it searches a catalogue of more than two and a half million places, opens a single place's full record including how to book it on the venue's own terms, and handles the photo side of the same directory — searching licensable traveller photos of real places, quoting one use of one photo, and reading the photo wallet balance.

Nothing is looked up on your own machine. This package answers `tools/list` locally from the captured tool definitions and forwards every `tools/call` to the hosted service over a streamable-HTTP JSON-RPC session, returning whatever the service sends back unchanged.

This rebuild covers the read surface only: seven of the ten tools in the captured surface. The capture's remaining three tools — one that buys a photo license out of the prepaid wallet, and two that submit business listings and promotions to the directory for publication — are intentionally not part of this rebuild: they are not registered, not implemented, and not presented as available anywhere in this package.

## The tools

- **`num_search_places`** — Searches the directory by destination or country, narrowed with free text, an area inside the destination, and a category such as Restaurant, Bar, Hotel, Spa or Tour. Returns each place's name, category, address, phone, website, coordinates and whether its owner has claimed the listing. Places NUM knows have closed are never returned.
- **`num_list_destinations`** — Lists every destination NUM covers, with its country. A destination's name or slug is what `num_search_places` expects as its city. Free and unmetered.
- **`num_get_place`** — Returns the full record for one place by its `place_id`, including how to book it on the venue's own terms: a request the venue confirms itself, a pre-filled link to the venue's own booking system, a phone number, or a note that booking does not run through NUM. Passing party size, date and time pre-fills the venue's booking page where one exists.
- **`num_list_submissions`** — Lists the businesses and promotions this account has submitted, with the reviewer's decision on each. A read of the account's own history; it submits nothing.
- **`num_search_photos`** — Searches photos of real places taken by NUM travellers and offered for licensing per use. Each result carries a preview, the place it shows, the month it was taken, the photographer's public name, and the price in US cents for each use: social, web, ad and AI training.
- **`num_quote_photo`** — Returns the current price in US cents and the full license terms for one use of one photo. Nothing is charged; it is a price and terms read only.
- **`num_photo_wallet`** — Reads this account's photo wallet balance in US cents (plus any test credit), what it spent today against the daily cap, and the licenses it holds. It buys nothing and tops nothing up.

## Install and run

As an MCP server via npm:

```bash
npx -y @reneturcios/traveldex mcp
```

MCP client configuration:

```json
{
  "mcpServers": {
    "traveldex": {
      "command": "npx",
      "args": ["-y", "@reneturcios/traveldex", "mcp"]
    }
  }
}
```

As a container:

```bash
docker run -i ghcr.io/cloudcorprecords/traveldex
docker run --rm ghcr.io/cloudcorprecords/traveldex num_get_place '{"place_id":"place-1"}'
```

## CLI

One binary serves both the command line and the MCP server. Each tool is a subcommand taking a single JSON string with that tool's arguments:

```bash
traveldex num_search_places '{"city":"Phuket","category":"Restaurant"}'
traveldex num_list_destinations '{}'
traveldex num_get_place '{"place_id":"place-1","party_size":2}'
traveldex num_list_submissions '{"status":"approved"}'
traveldex num_search_photos '{"city":"London","use":"web"}'
traveldex num_quote_photo '{"photo_id":"photo-1","use":"web"}'
traveldex num_photo_wallet '{}'
traveldex --version
```

Exit codes: `0` when the forwarded call succeeds, `1` when the upstream result is an error, and `2` for usage problems such as an unknown subcommand or a malformed JSON argument.

## Configuration

- `ITSNUM_MCP_URL` — Overrides the upstream endpoint. The default is the pinned hosted endpoint, `https://itsnum.com/mcp`. (The override variable is a reconstruction added by this rebuild.)
- `ITSNUM_API_KEY` — When set, its value is sent to the upstream on every request as an `Authorization: Bearer <value>` header. When it is not set, no key header is sent at all, matching the keyless behaviour the tool surface was captured with. (The variable name and the Bearer form are reconstructions; the hosted service's registry record declares an `Authorization` header.)

Upstream failures — a JSON-RPC error from the service, a non-2xx response, an unreadable body, or a request that fails outright — are reported to the caller as an error result whose text starts with `traveldex error:`.

## How forwarding works

The first forwarded call opens a session: an `initialize` request (protocol version `2025-03-26`), followed by a `notifications/initialized` notification, then the `tools/call` itself. If the service answers the initialize request with an `Mcp-Session-Id` header, that value is carried on every later request, and the open session is reused for the rest of the process. Replies are accepted either as plain JSON or as server-sent events. Successful results pass through verbatim, including any `isError` flag and any extra fields the service includes.

## Development

```bash
npm install
npm run build   # tsc -> dist/ (dist/cli.js is the bin)
npm test        # tsx --test test/*.test.ts — stubbed upstream, no network
npm run dev     # run the CLI from source
```

The test suite checks the served tool list against the captured surface tool by tool, asserts that the three omitted tools are absent at the registry, MCP and CLI levels, exercises the session handshake and its reuse, covers both key-header branches, and verifies that arguments go upstream untouched and results come back untouched.

## License

MIT — see `LICENSE`. Copyright (c) 2026 Rene Turcios.