Skip to main content
Glama
README.md
# ridgehop

<!-- mcp-name: io.github.Joaquincuevas/ridgehop -->

[![CI](https://github.com/Joaquincuevas/ridgehop/actions/workflows/ci.yml/badge.svg)](https://github.com/Joaquincuevas/ridgehop/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/ridgehop)](https://pypi.org/project/ridgehop/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Python 3.10–3.13](https://img.shields.io/badge/python-3.10%E2%80%933.13-blue.svg)](pyproject.toml)

**Will your LoRa link reach? If not, where to hop.**

Ask your AI agent whether a LoRa / Meshtastic link will reach, and where to put the repeater when it won't. Real terrain,
real propagation model, no guessing.

ridgehop is an [MCP](https://modelcontextprotocol.io) server. It gives Claude (or any MCP client) Copernicus GLO-30
terrain (30 m) and the Longley-Rice / ITM propagation model, with presets for every Meshtastic region and modem preset.
It runs locally: no backend, no API keys.

![ridgehop answering a link question](docs/demo/placeholder.svg)

<sub>Placeholder with real tool output; the GIF of a full Claude Code session is generated by
[`docs/demo/make_demo.sh`](docs/demo/).</sub>

## Quickstart

```bash
git clone https://github.com/Joaquincuevas/ridgehop && cd ridgehop
claude mcp add ridgehop -- uvx --from "$PWD" ridgehop
claude "Does a Meshtastic node at -33.4261,-70.6106 reach -33.3497,-70.5178? If not, where do I put a repeater?"
```

Needs [uv](https://docs.astral.sh/uv/). Once ridgehop is on PyPI, `uvx ridgehop` is all you need (no clone).

## Tools

| Tool | What it answers |
|---|---|
| `link_check(a, b, preset \| freq_mhz, tx_power_dbm, antenna_gain_a_dbi, antenna_gain_b_dbi, height_a_m, height_b_m)` | Does A reach B? Verdict (`reachable` ≥ 10 dB margin, `marginal` 0–10 dB, `unreachable`), margin, ITM path loss, received power, first Fresnel zone clearance and every obstruction (distance, height above the line). The preset gives defaults; explicit parameters override them. |
| `suggest_repeater(a, b, preset, search_radius_km?)` | Searches high points around the path and ranks repeater sites by the weaker of the two hops (A→R, R→B). |
| `coverage(point, radius_km, preset, height_m)` | Radial ITM sweep: area per margin band, farthest reachable point, a GeoJSON file (one MultiPolygon per band) and an optional transparent PNG overlay. 10 km in ~1 s. |
| `elevation_profile(a, b, samples)` | Terrain profile between two points. |

Points are `{"lat": …, "lon": …}` (WGS84).

**Presets:**
- `meshtastic/<REGION>/<MODEM_PRESET>`: every region in the Meshtastic firmware (US, EU_868, ANZ, IN, BR_902, …)
  and every modem preset (LONG_FAST, LONG_SLOW, MEDIUM_FAST, SHORT_TURBO, …). Frequency is the band centre; TX power
  is `min(region limit, 22 dBm)`, like the firmware does with `tx_power = 0` on SX126x radios.
- `lorawan/AU915/DR0`–`DR6`.
- `meshcore/firmware_default`.

Every value cites its source in [`src/ridgehop/presets.yaml`](src/ridgehop/presets.yaml). Sensitivity uses Semtech's
formula with a 6.5 dB noise figure, which reproduces the official Meshtastic link-budget table
([test](tests/test_radio.py)).

Example, what the agent gets back from `link_check` (abridged):

```json
{
  "verdict": "unreachable",
  "margin_db": -20.1,
  "summary": "unreachable: margin -20.1 dB (terrain blocks the line by 157 m at 8.95 km from A).",
  "line_of_sight": false,
  "main_obstruction": {"distance_km": 8.95, "terrain_m": 938.5, "above_line_m": 156.9},
  "radio": {"preset": "meshtastic/ANZ/LONG_FAST", "frequency_mhz": 921.5, "tx_power_dbm": 22, "sensitivity_dbm": -131.0}
}
```

## Try it on Glama

[![ridgehop MCP server](https://glama.ai/mcp/servers/Joaquincuevas/ridgehop/badges/card.svg)](https://glama.ai/mcp/servers/Joaquincuevas/ridgehop)

The [Glama listing](https://glama.ai/mcp/servers/Joaquincuevas/ridgehop) lets you browse the tools, check the quality
score and call them from the [MCP Inspector](https://glama.ai/mcp/inspector) before installing anything.

## Setup

**Claude Code**

```bash
claude mcp add ridgehop -- uvx --from /path/to/ridgehop ridgehop   # from a checkout
claude mcp add ridgehop -- uvx ridgehop                             # once published on PyPI
```

**Claude Desktop** (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "ridgehop": {
      "command": "uvx",
      "args": ["--from", "/path/to/ridgehop", "ridgehop"]
    }
  }
}
```

With the PyPI release, use `"args": ["ridgehop"]`.

The first query in a new area downloads one ~40 MB terrain tile (1°×1°) to `~/.cache/ridgehop`
(override with `RIDGEHOP_CACHE`). Coverage GeoJSON/PNG files go to `~/.cache/ridgehop/coverage/`.

## How it differs

ridgehop was called **lorascope** before its first release. It was renamed so it wouldn't be confused with two
unrelated projects:

- **[LoRascope · Meshsight](https://github.com/fsaritome/LoRascope-Meshsight)**: a browser app for planning
  MeshCore/Meshtastic links on a map (line of sight, Fresnel, coverage). Good if you want to click around a map;
  ridgehop has no UI and is meant to be called by an agent.
- **[CORIOTLAB/LoRaScope](https://github.com/CORIOTLAB/LoRaScope)**: open hardware for LoRaWAN coverage mapping and
  GNSS quality measurements. It measures coverage in the field; ridgehop predicts it from terrain.

| | ridgehop | [Meshtastic Site Planner](https://site.meshtastic.org) | [CloudRF](https://cloudrf.com) | [SPLAT!](https://www.qsl.net/kd2bd/splat.html) | [Radio Mobile](https://www.ve2dbe.com/english1.html) |
|---|---|---|---|---|---|
| Interface | MCP tools for AI agents | Web app | Web app + paid API | CLI | Windows desktop app |
| Model | ITM (Longley-Rice), same as Site Planner | ITM via SPLAT! | Several (ITM, ITU, …) | ITM / ITWOM | Longley-Rice |
| Terrain | Copernicus GLO-30 (30 m DSM), auto-download | SRTM (AWS Terrain Tiles) | Global, high-res, clutter | SRTM files you prepare | SRTM and others |
| Repeater search | ✅ ranks hilltops by weakest hop | Highest point near a site | ✅ Best Site Analysis (paid) | ❌ | Manual |
| Meshtastic presets | All regions and modem presets | Per-device profiles | Generic | Manual | Manual |
| Cost / license | Free, MIT | Free, GPL-3 | Commercial | Free, GPL-2 | Freeware |

ridgehop does not try to replace these tools. Its job is to let an agent get a checked answer in the middle of a
conversation ("is this link viable? where's the best hill?"), instead of guessing a range from memory.

## Accuracy and limitations

- ridgehop's ITM engine (pure-Python [itmlogic](https://github.com/edwardoughton/itmlogic)) matches SPLAT!'s
  `point_to_point_ITM` (the engine behind the Meshtastic Site Planner) and the NTIA reference implementation within
  0.01 dB on real Santiago profiles, and within 0.42 dB on 60 synthetic profiles. Method:
  [`tests/README.md`](tests/README.md); decision record: [`docs/decisions.md`](docs/decisions.md).
- That comparison validates the propagation model, not the terrain. GLO-30 is a surface model: rooftops and tree
  canopy are included at 30 m resolution, while individual buildings, foliage loss and interference are not modeled.
- The 10 dB `reachable` threshold is a rule of thumb, not a calibration
  ([#25](https://github.com/Joaquincuevas/ridgehop/issues/25)).
- One repeater at a time; multi-hop chains are planned
  ([#18](https://github.com/Joaquincuevas/ridgehop/issues/18)).

Treat the output as a prediction and confirm with a range test.

## Development

```bash
uv sync
uv run pytest                     # first run downloads ~80 MB of terrain
uv run pytest -m "not network"    # offline subset
uv run ruff check . && uv run ruff format --check .
uv run python scripts/smoke_stdio.py
```

See [CONTRIBUTING.md](CONTRIBUTING.md). Good first issues:
[link](https://github.com/Joaquincuevas/ridgehop/labels/good%20first%20issue).

## Attribution and licenses

- **ridgehop:** MIT ([LICENSE](LICENSE)).
- **Terrain:** Copernicus DEM GLO-30. *© DLR e.V. 2010-2014 and © Airbus Defence and Space GmbH 2014-2018, provided
  under COPERNICUS by the European Union and ESA; all rights reserved.* Read at runtime from
  [AWS Open Data](https://registry.opendata.aws/copernicus-dem/); ridgehop does not redistribute terrain data.
- **Propagation model:** the Irregular Terrain Model (Longley-Rice) by NTIA/ITS. At runtime ridgehop uses
  [itmlogic](https://github.com/edwardoughton/itmlogic) (MIT). The [NTIA reference code](https://github.com/NTIA/itm)
  (a U.S. Government work) and SPLAT! (GPL) are compiled only locally by `tests/reference/` to validate results;
  neither is distributed.
- Radio parameters come from the Meshtastic firmware and docs, The Things Stack and MeshCore, cited per value.

Full notices: [NOTICE](NOTICE). Español: [README.es.md](README.es.md).

TDQS

A3.6/5.0

Scored across 4 tools

Disambiguation5/5

Each tool targets a clearly distinct analysis: terrain profile, point-to-point link budget, repeater site search, and area coverage. The two A-to-B tools (elevation_profile and link_check) differ clearly in output (terrain vs. radio verdict), and suggest_repeater/coverage are unambiguous.

Naming Consistency3/5

Names mix noun phrases (elevation_profile, link_check, coverage) with a verb_noun form (suggest_repeater). All are readable and snake_case, but there is no single predictable pattern across the set.

Tool Count5/5

Four tools is well-scoped for a LoRa propagation analysis server; each tool covers a distinct workflow step (profile, link check, repeater siting, coverage) with no filler.

Completeness4/5

The surface covers the core lifecycle of link planning: inspect terrain, test a link, find a repeater, and map coverage. Minor gaps exist, such as batch/multi-link comparisons or network-level planning, but agents can work around these.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues