Migrate ad-hoc fetch + web_search tools from ampere into lmcp package #22

Closed
opened 2026-05-17 23:26:32 +00:00 by marfrit · 3 comments
Owner

Observed

The mcp__ampere-tools__fetch and mcp__ampere-tools__web_search tools surface on ampere's lmcp endpoint as ad-hoc local additions (likely installed manually on ampere, not via the package). When ampere is powered down, the tools disappear from the fleet — they don't exist on any other host.

Expected

Per the 9(+1)-phase loop closing rule (feedback_dev_process.md Phase 8): once a tool exists and is useful, it goes through marfrit-packageslmcp.deb → available on every host with lmcp installed. Hosts shouldn't accumulate hacks that vanish on shutdown.

Tasks

  • Wake ampere, locate the fetch/web_search tool source (likely /opt/lmcp/*.lua extensions or a custom server.lua patch)
  • Lift into the upstream lmcp tree, as either:
    • core builtin tools (always loaded), OR
    • optional tools.d/-style plugin so hosts can opt in
  • Cut lmcp 1.1.2 with the new tools
  • Publish via marfrit-packages CI → automatic uptake on all hosts that apt-get upgrade
  • Remove the ad-hoc ampere local override after package picks them up

Severity

Low — workaround is to use Claude Code's built-in WebSearch tool (verified on 2026-05-18 toniebox-hack-server lookup). But it's a known-pattern violation worth closing for hygiene.

## Observed The `mcp__ampere-tools__fetch` and `mcp__ampere-tools__web_search` tools surface on ampere's lmcp endpoint as ad-hoc local additions (likely installed manually on ampere, not via the package). When ampere is powered down, the tools disappear from the fleet — they don't exist on any other host. ## Expected Per the 9(+1)-phase loop closing rule ([feedback_dev_process.md](https://git.reauktion.de/marfrit/marfrit-packages/raw/branch/main/...) Phase 8): once a tool exists and is useful, it goes through `marfrit-packages` → `lmcp.deb` → available on every host with lmcp installed. Hosts shouldn't accumulate hacks that vanish on shutdown. ## Tasks - [ ] Wake ampere, locate the fetch/web_search tool source (likely `/opt/lmcp/*.lua` extensions or a custom server.lua patch) - [ ] Lift into the upstream lmcp tree, as either: - core builtin tools (always loaded), OR - optional `tools.d/`-style plugin so hosts can opt in - [ ] Cut lmcp 1.1.2 with the new tools - [ ] Publish via marfrit-packages CI → automatic uptake on all hosts that `apt-get upgrade` - [ ] Remove the ad-hoc ampere local override after package picks them up ## Severity Low — workaround is to use Claude Code's built-in WebSearch tool (verified on 2026-05-18 toniebox-hack-server lookup). But it's a known-pattern violation worth closing for hygiene.
Collaborator

Investigation note (partial — ampere is down, can't audit live).

The packaged lmcp already includes fetch and web_search as built-in tools in server.lua — they shipped in v1.0.0-rc1 (April 2026, commit deb73d1, issues #3 and #4) and are still present in v1.1.0 / v1.1.1. So tasks 1–3 of this issue are effectively done by the v1.0.0-rc1 release — the upstream migration already happened.

Remaining work is entirely on the ampere side:

  1. Audit ampere's lmcp install — which version is dpkg -l lmcp showing, and does it have a redundant /opt/lmcp/server.lua override left over from before v1.0.0-rc1?
  2. Upgrade to v1.1.1 (already in marfrit-packages CI pipeline from PR #24): apt update && apt install lmcp. The packaged /usr/share/lua/5.4/server.lua will already have fetch + web_search; no local override needed.
  3. Remove any leftover /opt/lmcp/server.lua override and let the packaged copy take effect.

Blocker: ampere is a CoolPi GenBook RK3588 laptop with no remote-wake path (no WoL, no smart plug, no hypervisor pct start). Needs a physical lid-open / power-button press to come up. Bringing it on briefly is enough — apt upgrade lmcp + rm /opt/lmcp/server.lua + systemctl restart lmcp finishes the issue in under a minute once it's reachable.

I'll wait for "ampere is up" then run the audit + cleanup in one go.

— claude-noether (paused, ampere offline)

**Investigation note (partial — ampere is down, can't audit live).** The packaged lmcp already includes `fetch` and `web_search` as built-in tools in `server.lua` — they shipped in **v1.0.0-rc1** (April 2026, commit `deb73d1`, issues #3 and #4) and are still present in v1.1.0 / v1.1.1. So tasks 1–3 of this issue are effectively done by the v1.0.0-rc1 release — the upstream migration already happened. Remaining work is entirely on the ampere side: 1. **Audit ampere's lmcp install** — which version is `dpkg -l lmcp` showing, and does it have a redundant `/opt/lmcp/server.lua` override left over from before v1.0.0-rc1? 2. **Upgrade to v1.1.1** (already in marfrit-packages CI pipeline from PR #24): `apt update && apt install lmcp`. The packaged `/usr/share/lua/5.4/server.lua` will already have fetch + web_search; no local override needed. 3. **Remove any leftover `/opt/lmcp/server.lua` override** and let the packaged copy take effect. **Blocker:** ampere is a CoolPi GenBook RK3588 laptop with no remote-wake path (no WoL, no smart plug, no hypervisor `pct start`). Needs a physical lid-open / power-button press to come up. Bringing it on briefly is enough — `apt upgrade lmcp` + `rm /opt/lmcp/server.lua` + `systemctl restart lmcp` finishes the issue in under a minute once it's reachable. I'll wait for "ampere is up" then run the audit + cleanup in one go. — claude-noether (paused, ampere offline)
Collaborator

Progress update — option 2 (compose) execution.

Took the "compose" path (vs. quick surgical hack) — now in flight:

Upstream (commits + tags shipped to gitea):

  • v1.2.0 / e05438ftools.d/ plugin scan in packaged server.lua. Scans LMCP_TOOLS_DIR (default /opt/lmcp/tools.d on POSIX, %ProgramData%\lmcp\tools.d on Windows) for *.lua files. Each file invoked as a function receiving (server, run). Smoke-tested.
  • v1.2.1 / c5375b8LMCP_HOST + LMCP_CONF env-var support, so hosts that need single-interface binding (hertz: .18-only) or conf-file auth drive the packaged entrypoint via systemd env instead of carrying an override.

Combined, these let a host's local config be:

  • /etc/systemd/system/lmcp.service — points at packaged /usr/share/lua/5.4/server.lua, sets LMCP_HOST/LMCP_CONF/LMCP_TOOLS_DIR
  • /opt/lmcp/tools.d/<host>.lua — only the genuine host-specifics, no copy-paste of packaged generics

Packaging (PR): marfrit/marfrit-packages#25lmcp: 1.1.1 -> 1.2.1. Awaiting merge + CI publish.

Hertz pre-staging (already done, dormant):

  • /opt/lmcp/tools.d/hertz.lua — 9756 bytes, 12 hertz-specific tools (lxc_exec/list, fritz, ping_host, network_status, wol_and_wait, pct_exec, ha_cli/api, mqtt_pub/sub, mediagrab). Syntax-verified. Won't activate until packaged server.lua v1.2.1 lands.
  • /opt/lmcp/CUTOVER-v1.2.1.md — atomic cutover script: pacman -Syu lmcp → swap systemd unit → archive /opt/lmcp/server.lua → restart → verify.

After cutover, tools/list on hertz-tools will show 21 tools (9 packaged + 12 hertz). fetch and web_search will then be exposed via hertz-tools, closing the original symptom of this issue. Future apt upgrade lmcp deliveries land automatically — no override drift.

Same pattern will apply to ampere when it's next powered on. Will reference this issue in the ampere migration commit.

**Progress update — option 2 (compose) execution.** Took the "compose" path (vs. quick surgical hack) — now in flight: **Upstream (commits + tags shipped to gitea):** - v1.2.0 / `e05438f` — `tools.d/` plugin scan in packaged server.lua. Scans `LMCP_TOOLS_DIR` (default `/opt/lmcp/tools.d` on POSIX, `%ProgramData%\lmcp\tools.d` on Windows) for `*.lua` files. Each file invoked as a function receiving `(server, run)`. Smoke-tested. - v1.2.1 / `c5375b8` — `LMCP_HOST` + `LMCP_CONF` env-var support, so hosts that need single-interface binding (hertz: .18-only) or conf-file auth drive the packaged entrypoint via systemd env instead of carrying an override. Combined, these let a host's local config be: - `/etc/systemd/system/lmcp.service` — points at packaged `/usr/share/lua/5.4/server.lua`, sets `LMCP_HOST`/`LMCP_CONF`/`LMCP_TOOLS_DIR` - `/opt/lmcp/tools.d/<host>.lua` — only the genuine host-specifics, no copy-paste of packaged generics **Packaging (PR):** https://git.reauktion.de/marfrit/marfrit-packages/pulls/25 — `lmcp: 1.1.1 -> 1.2.1`. Awaiting merge + CI publish. **Hertz pre-staging (already done, dormant):** - `/opt/lmcp/tools.d/hertz.lua` — 9756 bytes, 12 hertz-specific tools (lxc_exec/list, fritz, ping_host, network_status, wol_and_wait, pct_exec, ha_cli/api, mqtt_pub/sub, mediagrab). Syntax-verified. Won't activate until packaged server.lua v1.2.1 lands. - `/opt/lmcp/CUTOVER-v1.2.1.md` — atomic cutover script: `pacman -Syu lmcp` → swap systemd unit → archive `/opt/lmcp/server.lua` → restart → verify. After cutover, `tools/list` on hertz-tools will show 21 tools (9 packaged + 12 hertz). `fetch` and `web_search` will then be exposed via hertz-tools, closing the original symptom of this issue. Future `apt upgrade lmcp` deliveries land automatically — no override drift. Same pattern will apply to ampere when it's next powered on. Will reference this issue in the ampere migration commit.
Author
Owner

Cutover executed on hertz 2026-05-18 by claude-noether. Verified:

  • lmcp 1.1.1 → 1.2.1 via apt upgrade
  • systemd unit pointing at packaged /usr/share/lua/5.4/server.lua with LMCP_HOST=192.168.88.18, LMCP_CONF=/opt/herding/etc/hertz-tools.conf, LMCP_TOOLS_DIR=/opt/lmcp/tools.d
  • old /opt/lmcp/server.lua archived to .pre-tools.d.bak.20260518
  • tools/list shows 21 tools (9 packaged + 12 hertz via /opt/lmcp/tools.d/hertz.lua), zero missing on either side
  • fetch + web_search now exposed via hertz-tools (closes the original symptom)

ampere migration deferred until next power-on. Same recipe applies: apt upgrade lmcp → rewrite systemd unit with LMCP_TOOLS_DIR=/opt/lmcp/tools.d → drop /opt/lmcp/server.lua if present → restart.

Cutover executed on hertz 2026-05-18 by claude-noether. Verified: - lmcp 1.1.1 → 1.2.1 via `apt upgrade` - systemd unit pointing at packaged `/usr/share/lua/5.4/server.lua` with `LMCP_HOST=192.168.88.18`, `LMCP_CONF=/opt/herding/etc/hertz-tools.conf`, `LMCP_TOOLS_DIR=/opt/lmcp/tools.d` - old `/opt/lmcp/server.lua` archived to `.pre-tools.d.bak.20260518` - `tools/list` shows **21 tools** (9 packaged + 12 hertz via `/opt/lmcp/tools.d/hertz.lua`), zero missing on either side - `fetch` + `web_search` now exposed via hertz-tools (closes the original symptom) ampere migration deferred until next power-on. Same recipe applies: `apt upgrade lmcp` → rewrite systemd unit with `LMCP_TOOLS_DIR=/opt/lmcp/tools.d` → drop `/opt/lmcp/server.lua` if present → restart.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marfrit/lmcp#22