Skip to main content
Glama
README.md
<p align="center">
  <img src="src/web/favicon.svg" alt="" width="80" height="80">
</p>

<h1 align="center">OFI OFO</h1>

<p align="center">
  <strong>One foot in, one foot out.</strong><br>
  A self-hosted MCP gateway for the devices on your network.
</p>

<p align="center">
  <a href="https://github.com/Sh3nron/ofi-ofo/actions/workflows/ci.yml"><img src="https://github.com/Sh3nron/ofi-ofo/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
  <a href="#quick-start">Quick start</a> ·
  <a href="docs/operations.md">Operator guide</a> ·
  <a href="docs/design.md">Architecture &amp; API</a> ·
  <a href="CONTRIBUTING.md">Contributing</a> ·
  <a href="SECURITY.md">Security</a>
</p>

Run OFI OFO on a spare mini-PC, a NAS, or a Proxmox container. Pair devices in the dashboard, give each agent a scoped key, and connect over standard [MCP](https://modelcontextprotocol.io/) or REST. An optional [OpenTunnel](https://opentunnel.xyz) connection lets cloud clients reach the gateway without inbound port forwarding.

> **Pre-release.** The one-line installers require anonymous access to the repository. The [operator guide](docs/operations.md#option-d--authenticated-checkout) also covers installation from an authenticated checkout or a local archive.

## What you can connect

| Device or service | What an agent can do |
| --- | --- |
| **Android** via ADB | Check status, launch allowed apps, send input, and separately grant screen reads, screenshots, or camera photo imports. |
| **Home Assistant** | Read entity states and history, or call a service to control a device. |
| **Printers, routers, and NAS devices** | Call HTTP APIs and check DNS or TCP reachability from the gateway. |
| **Wake-on-LAN hosts** | Wake a sleeping machine on the local network. |
| **Private OpenSSH servers** | Run fixed, owner-approved [SSH actions](docs/ssh-access.md) with separately granted read, run, and sudo access. |
| **Workspaces and paired desktops** | Use [workspace tools](docs/local-workstation.md) or supervise a time-limited [remote desktop share](docs/remote-desktop.md). |

The dashboard manages devices, keys, per-tool access, and the audit log. See the [full tool list](docs/operations.md#tools).

Use [Home access](docs/home-tools.md) to give an assistant named rooms and
devices, read room state and recent changes, run scenes, capture still images,
control playback, announce a message, submit a print job, or find a document
on an approved NAS mount.

## Quick start

### Docker on Linux

With Docker Engine and the Compose plugin installed, clone using a GitHub SSH key with access to the repository. The same commands work from an existing authorized checkout; skip `git clone` in that case.

```sh
git clone git@github.com:Sh3nron/ofi-ofo.git
cd ofi-ofo
docker compose up -d --build --wait
docker compose exec -T ofi-ofo node src/main.ts setup-token
```

Open **`http://<gateway-ip>:7420/`** from your LAN. Enter the setup token and create your admin account. Compose uses host networking and stores keys, devices, and tunnel identity in a named volume.

Compose enables OpenTunnel on first run. For a fresh LAN-only install, prefix `docker compose up` with `OFIOFO_TUNNEL=0`. For an existing installation, change the tunnel setting in the dashboard.

### Run directly from source

Use Node.js **22.18+ on the 22.x line, 24.x, or 26.x**. Install `adb` if you want to pair Android devices. In your authenticated checkout, run:

```sh
npm ci --omit=dev
npm start -- --bind 127.0.0.1
```

Open **<http://127.0.0.1:7420/>** on the gateway and use the setup token printed in the terminal. The source install starts with the tunnel off and persists state in `~/.ofi-ofo` by default. For an existing Debian or Ubuntu systemd LXC, run these commands inside the guest. See the [operator guide](docs/operations.md#installing) for LAN binding and the separate Proxmox node wrapper.

## Connect an MCP client

1. In the dashboard, go to **Agents → Create key**. Start with a `viewer` key scoped to `system_info` and copy the token when it appears.
2. Add a **Streamable HTTP** MCP server in your client. Use `http://<gateway-ip>:7420/mcp` on the LAN, or copy the HTTPS MCP URL from the dashboard’s **Tunnel** section for a remote client.
3. Set the `Authorization` header to `Bearer ofo_<keyId>.<secret>`, using your full token.

For a quick check from the gateway host, the same key works against REST:

```sh
curl --fail --silent --show-error \
  -H "Authorization: Bearer $OFIOFO_KEY" \
  http://127.0.0.1:7420/v1/tools
```

Here `OFIOFO_KEY` is a shell variable containing the copied token. See [Alia setup](docs/operations.md#connecting-alia) and the [HTTP contract](docs/design.md#http-contract) for more.

## Where traffic goes

| Listener | Serves | Available from |
| --- | --- | --- |
| Dashboard, `:7420` | Dashboard, admin API, MCP, REST | The configured bind address. Keep this on your trusted LAN or loopback. |
| Tunnel listener, `127.0.0.1:7421` | Key-authenticated MCP and REST, credential-scoped desktop companion endpoints, and a public health check | Loopback, and remote clients when OpenTunnel is enabled. |

OpenTunnel carries encrypted traffic to the gateway; dashboard, setup, and login routes stay off the tunneled listener. `viewer` keys can call only read tools, `operator` keys can also call write tools, and both can be scoped to specific tools and revoked. The tunnel URL itself grants no access. See the [security model](docs/design.md#security-model).

## Development

```sh
nvm use            # optional; .nvmrc selects Node 26
npm ci
npm run check      # JavaScript and Bash syntax, TypeScript checks, and tests
```

Node runs the TypeScript directly; there’s no compile step. Start with [`src/app.ts`](src/app.ts) for gateway wiring, [`src/tools/`](src/tools/) for device integrations, or [`src/web/`](src/web/) for the dashboard. The [contributor guide](CONTRIBUTING.md) covers isolated development, CI, and where to make changes.

## License

[MIT](LICENSE)