move to generated mcp for econet

This commit is contained in:
2026-07-16 15:02:17 -04:00
parent 18e9cbecea
commit 22137e7ebe
8 changed files with 424 additions and 6 deletions
+10 -2
View File
@@ -24,8 +24,14 @@ Exporter for Rheem EcoNet / Rheemcloud water heaters, built on the
**No MQTT**, so `WiFiSignal` and `Running`/`RunningState` stay zero.
- `pkg/econet/econetgrpc/``EconetService` gRPC impl (`ListDevices`,
`GetDevice`) + `deviceToProto`. Does **not** own a client; it's injected.
- `pkg/econet/econetmcp/` — MCP server at `/api/mcp`; the `list_water_heaters`
tool delegates to the gRPC server.
- `pkg/econet/econetmcpgen/` **active** MCP server at `/api/mcp`. Registers
the tools generated by protoc-gen-go-mcp (`api/econet/v1alpha1/v1alpha1mcp/`)
against our go-sdk `*mcp.Server` via the `runtime/gosdk` adapter, forwarding
in-process to the gRPC server. Exposes the same package API as `econetmcp`.
- `pkg/econet/econetmcp/` — the older hand-written MCP server; a single
`list_water_heaters` tool delegating to the gRPC server. Kept in place as a
fallback. **Switch between the two** with the aliased `econetmcp` import in
`pkg/econet/econet.go` (one line — both packages export identical symbols).
- `pkg/econet/econetmetrics/` — OTEL observable gauges (read the client
snapshot at scrape time; no poller of its own).
@@ -68,6 +74,8 @@ that's all it takes — no extra wiring.
## Workflow
- Regenerate proto: `make proto` (buf; `PROTO_DIRS=proto/econet/v1alpha1/*`).
This also runs the `protoc-gen-go-mcp` plugin (see `buf.gen.yaml`), emitting
the MCP registrars under `api/econet/v1alpha1/v1alpha1mcp/`.
- Regenerate config schema after config changes: `make schema`.
- Build/test: `go build ./... && go test ./...`.
- `econetclient.Device` is a plain struct, so `deviceToProto` and the datapoint