Skip to main content
Glama
README.md
# Gesher · גשר

English | [עברית](README.he.md)

**The bridge between AI and your devices.**

**In plain words:** today every device has its own app: one for the water heater, one for the AC, one for the solar panels. With Gesher you tell an AI assistant what you want, in your own words, and it takes care of the devices for you, always within safety limits you set.

Think of a good maintenance team in a building. You say "make sure there's hot water tonight, but don't waste electricity," and they handle the rest. Gesher gives the AI that job, and it asks you before it does anything that matters.

**For developers:** an open source [Model Context Protocol](https://modelcontextprotocol.io) server that connects AI assistants (Claude, ChatGPT, Cursor, any MCP client) to the devices actually installed in homes, offices and workplaces: the water heater relay, the AC controller, the solar inverter on the roof, and more. It starts with the brands common in Israel, many of which are sold worldwide.

> "When the solar panels produce more than the house uses, heat the boiler for 45 minutes."
> "It's 28° in the living room — cool it to 24 before I get home."
> "How much did the roof produce today?"

Every vendor has its own app. None of them talk to each other, and none of them talk to AI. This project is the one layer in between: **one connector per vendor, one safety model for all of them, in English and Hebrew.**

---

## Supported devices

| Category | Vendor | Connection | Status |
|---|---|---|---|
| Boiler / relays / lights | **Shelly** Gen2+ (Plus, Pro, Gen3) | Local HTTP RPC | ✅ v0.1 |
| Split AC | **Sensibo** (Sky, Air, Air Pro) | Cloud API v2 | ✅ v0.1 |
| Solar | **SolarEdge** | Monitoring API (read only) | ✅ v0.1 |
| Boiler / heavy loads | **Switcher** (Touch, V2/V4, Mini, plugs) | Local, via the [switcher_webapi](docs/connectors/switcher.md) bridge | ✅ v0.2 |
| Central / VRF AC (Tadiran, Electra, Daikin…) | **CoolAutomation** | Cloud REST / local TCP | 🔜 planned |
| Shutters | **Somfy** TaHoma | Overkiz / local developer API | 🔜 planned |
| Solar | Enphase, Sungrow, Huawei | Cloud APIs / Modbus-TCP | 🔜 planned |
| Gates & parking | **PalGate** | Cloud API | 🔜 planned (critical) |
| Locks | Nuki, Yale | Web / bridge API | 🔜 planned (critical) |
| Alarm | RISCO, Visonic | Cloud / IP module | 🔜 planned (critical) |

Want your device here? See [Adding a connector](docs/CONNECTOR_GUIDE.md) — it's one folder and one line of registration.

---

## Safety first

Physical devices are not chat messages. Every call goes through the same pipeline, whatever the vendor:

```mermaid
flowchart LR
  A[AI model] --> B{Loop guard}
  B -- "same call 3x / min" --> X[Blocked]
  B --> C{Permission}
  C -- deny --> H[Tool hidden from model]
  C -- ask --> D[User must confirm]
  C -- allow --> E{Hard limits}
  D --> E
  E -- outside limits --> Y[Refused]
  E --> F[Vendor API]
```

- **Risk levels per tool.** `read` (temperatures, power) is allowed, `write` (switch the boiler, change the AC) asks the user first, `critical` (gates, locks, alarms) is denied by default — and can never be configured to run without confirmation.
- **Hard limits the AI cannot override.** Maximum boiler runtime (enforced with the Shelly's own hardware auto-off timer, so it switches off even if the server dies), allowed AC temperature range.
- **Loop protection.** An agent repeating the same command (relay or compressor cycling) is stopped.
- **Secrets stay out of the model.** API keys come from environment variables and are redacted from every error message.
- **Plans are visible.** Each confirmation tells the user exactly which device and which values will change.

---

## Languages

Bilingual from day one: **English and Hebrew**. Tool titles, confirmations, safety messages and errors appear in the language you choose (`"language": "he"` in the config). All text lives in one file per language (`locales/<lang>/messages.tsv`), checked automatically for missing keys, placeholders and gender-neutral Hebrew. Details: [docs/I18N.md](docs/I18N.md).

---

## Quick start

Requires Node.js 20+.

```bash
git clone https://github.com/<owner>/gesher.git
cd gesher
npm install
npm run build
cp config.example.json config.json   # edit devices, IPs, limits
```

Add it to Claude Desktop (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "gesher": {
      "command": "node",
      "args": ["/path/to/gesher/dist/src/index.js"],
      "env": {
        "GESHER_CONFIG": "/path/to/gesher/config.json",
        "SENSIBO_API_KEY": "…",
        "SOLAREDGE_API_KEY": "…",
        "SOLAREDGE_SITE_ID": "…"
      }
    }
  }
}
```

Only connectors that have a section in `config.json` are enabled. Shelly is reached on your local network, so the server must run on a machine in the same network as the device.

### Configuration

```jsonc
{
  "language": "he",                                                   // "en" (default) or "he"
  "limits": { "boilerMaxMinutes": 90, "acMinTempC": 16, "acMaxTempC": 30 },
  "policy": { "sensibo_*": "allow", "shelly_set_switch": "ask" },  // pattern -> allow | ask | deny
  "connectors": {
    "shelly":    { "devices": [{ "id": "boiler", "name": "Dud shemesh", "host": "192.168.1.50", "role": "boiler" }] },
    "sensibo":   { "apiKey": "${SENSIBO_API_KEY}" },
    "solaredge": { "apiKey": "${SOLAREDGE_API_KEY}", "siteId": "${SOLAREDGE_SITE_ID}" },
    "switcher":  { "bridgeUrl": "http://192.168.1.10:8000",
                   "devices": [{ "id": "dud", "name": "Dud shemesh", "type": "touch", "deviceId": "a1b2c3", "ip": "192.168.1.60", "role": "boiler" }] }
  }
}
```

Switcher setup (bridge, finding device ids): [docs/connectors/switcher.md](docs/connectors/switcher.md).

---

## Tools (v0.2)

| Tool | Risk | What it does |
|---|---|---|
| `shelly_list_devices` | read | Configured relays and their role |
| `shelly_get_status` | read | On/off, live watts, voltage, energy |
| `shelly_set_switch` | write | On/off with automatic hardware off-timer |
| `sensibo_list_acs` | read | All ACs, state, room temperature and humidity |
| `sensibo_set_ac` | write | On/off, mode, target temperature, fan |
| `solaredge_power_now` | read | Live solar production, consumption, grid, surplus |
| `solaredge_overview` | read | Energy today / month / year / lifetime |
| `switcher_list_devices` | read | Configured Switcher devices |
| `switcher_get_status` | read | On/off, watts, amps, time left |
| `switcher_set_power` | write | On with Switcher's own auto-off timer, or off |

---

## Architecture

```
src/
  core/          types, permission policy + loop guard, config, i18n, http helper
  connectors/
    index.ts     registry: one line per vendor
    shelly/      one folder per vendor, self-contained
    sensibo/
    solaredge/
    switcher/
  server.ts      wraps every connector tool in the safety pipeline
  index.ts       stdio entry point
locales/
  en/messages.tsv   all English text (source)
  he/messages.tsv   all Hebrew text
docs/            I18N, Hebrew style guide, connector guide, per-vendor setup
test/            end-to-end and translation tests with mocked vendor APIs (no devices needed)
```

Design rules: connectors only translate between a vendor API and simple tools; all safety decisions live in `core/` so they are the same for every vendor; all text lives in `locales/`; every connector is testable without hardware.

---

## Roadmap

1. **v0.1** — Shelly, Sensibo, SolarEdge, safety pipeline ✅
2. **v0.2** — Switcher, English + Hebrew ✅
3. **v0.3** — CoolAutomation; solar-surplus water heater routine as a ready-made prompt; remote (Streamable HTTP) transport with authentication; Somfy, Enphase
4. **v0.4** — Critical-category connectors (PalGate, locks, alarms) with mandatory confirmation and audit log
5. **Hosted version** — for people who don't want to run a server: managed credentials, multi-site, WhatsApp interface

---

## Contributing

Contributions are welcome, especially connectors and Hebrew reviews. Read [CONTRIBUTING.md](CONTRIBUTING.md), [docs/CONNECTOR_GUIDE.md](docs/CONNECTOR_GUIDE.md) and, for AI-assisted work, [AGENTS.md](AGENTS.md). Please open an issue first to claim a vendor so two people don't build the same connector.

## Disclaimer

This software controls physical equipment, including high-load electrical devices. Use it at your own risk, keep the safety limits conservative, and never use it as the only protection for safety-critical systems. Not affiliated with any of the vendors listed.

## License

[Apache 2.0](LICENSE) © Yonatan Langer