37 Commits
Author SHA1 Message Date
claude 262a4ad66c chore(release): v0.1.3 [skip ci] 2026-10-19 11:19:40 +00:00
dasemu c1f90b28c1 Merge pull request 'feat: add a panel button to update the manager itself' (#3) from claude/remote-mcp-manager-memory-leak-204b11 into master
Reviewed-on: #3
2026-10-19 11:18:45 +00:00
dasemuandClaude Sonnet 5.5 69e39541a4 fix: harden the remote commit check after review
Bound the check to 60 s and only retry unfiltered on filter errors, wait for an in-flight fetch
before a forced refresh, resolve annotated tags to their commit, guard git args with `--`, treat
rev-list failures as errors, and stop the card's "Checking…" state after the polling gives up.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 09:18:03 +02:00
dasemuandClaude Sonnet 5.5 9a85c3bca0 feat: show the installed commit and how many newer commits the remote has
The Manager card now shows the commit SHA the image was built from (GIT_SHA build arg, passed
by the panel's self-update and documented for compose) and counts the commits SELF_UPDATE_REF
has beyond it, with their subjects and a "Check for updates" button. The check is a cached,
background, history-only git fetch so GET /api/system never waits on it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 09:14:35 +02:00
dasemuandClaude Sonnet 5.5 4b3c8f213a feat: add a panel button to update the manager itself
The manager clones SELF_UPDATE_REPO_URL, builds a new image in the shared build queue and
hands over to a short-lived updater container (new image) that swaps the manager container,
health-checks it and rolls back on failure. Exposed as GET/POST /api/system behind requireAuth;
installation changes answer 409 while an update runs. Session cookie is now SameSite=Lax.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 05:45:25 +02:00
claude cec174fb64 chore(release): v0.1.2 [skip ci] 2026-10-19 03:34:55 +00:00
dasemu 485ba194a5 Merge pull request 'fix: bound manager memory and sockets; add start/stop/restart controls' (#2) from claude/remote-mcp-manager-memory-leak-204b11 into master
Reviewed-on: #2
2026-10-19 03:34:04 +00:00
dasemuandClaude Sonnet 5.5 5fb1d6b0b4 fix: address review findings on the memory safeguards
- kill the whole process group on git/nixpacks timeout so a hung docker build
  cannot block the build queue
- mark interrupted cloning/building/starting installations as error on boot
- keep a running installation served while it rebuilds, including failed builds
- time out Docker image calls inside the build queue
- make session touch best-effort

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 05:31:08 +02:00
dasemuandClaude Sonnet 5.5 a999b8c694 feat: add start/stop/restart controls and explain build vs deploy in the panel
Start/stop/restart act on the existing container instead of recreating it.
Docker's 304 (already started/stopped) is treated as success.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 05:26:22 +02:00
dasemuandClaude Sonnet 5.5 0d38b3950c docs: document manager memory safeguards and wire them into the image
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 05:24:05 +02:00
dasemuandClaude Sonnet 5.5 eb24e21df7 fix: bound memory and sockets in the manager to prevent host-wide OOM
- proxy: inactivity timeouts and a cap on concurrent requests (503 beyond it)
- docker: cache/coalesce container IP lookups and time out inspect calls
- sessions: SQLite-backed store instead of the leaking MemoryStore
- memory guard: exit when heap+external passes MANAGER_MEMORY_LIMIT_MB so the
  restart policy replaces the process before the host swaps
- builds: serialize them and time out hung git/nixpacks processes
- redeploy with rebuild no longer deploys the old image after a failed build
- /health reports memory and in-flight proxy requests; handle SIGTERM

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 05:23:18 +02:00
claude 05ad174f90 chore(release): v0.1.1 [skip ci] 2026-10-18 18:58:45 +00:00
dasemu b46ad06b47 Merge pull request 'chore: bootstrap Claude setup' (#1) from chore/bootstrap into master
Reviewed-on: #1
2026-10-18 18:57:44 +00:00
dasemuandClaude Sonnet 5 3731f24a96 chore: bootstrap Claude setup
Add root CLAUDE.md, docs/architecture.md, .claude/settings.json hooks
(PostToolUse type-check, Stop build+test gate), and a version.yml workflow
alongside the existing ci.yml (now also builds apps/web and scopes
triggers to master). Record bootstrap version 2.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-18 15:03:16 +02:00
dasemuandClaude Sonnet 5 f11a23fb00 fix: re-pull the repo on every rebuild instead of reusing the stale clone
buildInstallation ran nixpacks against whatever was cloned at draft
creation time and never re-synced — every "rebuild" from the panel
silently rebuilt the same old commit forever, even after pushing new
commits. Confirmed repeatedly while iterating against a live repo
(had to git pull manually each time to actually pick up a fix).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 21:03:57 +02:00
dasemuandClaude Sonnet 5 7b6e1b5855 feat: support host bind-mount volumes per installation
Needed for state that must survive rebuilds and that nothing else
manages — e.g. a Playwright browser profile holding an existing
logged-in session for a browser-automation MCP. hostVolumes is a list
of {hostPath, containerPath} pairs, bind-mounted via dockerode same as
the manager's own compose volumes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 07:16:45 +02:00
dasemuandClaude Sonnet 5 c918b32e72 feat: support publishing a container's port to host loopback
Some installations need to stay reachable by a native process on the
same host outside the manager's own proxy — e.g. a legacy nginx
location serving media/signed URLs for an app that also happens to be
an MCP server. Previously this required manually recreating the
container outside the manager's lifecycle (lost on the next
build/redeploy). publishHostPort makes it a real, persisted setting.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 07:05:56 +02:00
dasemuandClaude Sonnet 5 1efba2461a feat: support an explicit start command override per installation
Needed to install third-party repos we don't control (e.g. the
upstream gitea.com/gitea/gitea-mcp project) where nixpacks detects a
working build but the wrong/no start command, and pushing a
nixpacks.toml to the source repo isn't an option. Passed through as
nixpacks' own --start-cmd flag.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 06:46:28 +02:00
dasemuandClaude Sonnet 5 86b365ac52 feat: redesign admin panel as a modern dashboard
Replace the unstyled apps/web UI with a cohesive dark/light "ops console"
design: sidebar shell, semantic status badges for all 8 installation
states, a real data table for the installation list, a modal install
wizard, and a sectioned detail view (access, configuration, actions,
build log) with copy-to-clipboard for the public URL and bearer token.
Styling is plain CSS with custom-property design tokens (no new runtime
dependency); Inter + JetBrains Mono loaded via Google Fonts. All existing
API calls and behavior are preserved unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 06:12:51 +02:00
dasemuandClaude Sonnet 5 fb59d422a2 feat: support optional per-installation Basic Auth on the MCP proxy
Lets a client still using Basic Auth credentials (e.g. against the
previous nginx + htpasswd setup) keep working without switching to a
bearer token immediately. Bearer auth remains the default and the
only option when no Basic Auth credentials are configured.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 05:05:11 +02:00
dasemuandClaude Sonnet 5 021fa2220e fix: pass NIXPACKS_NODE_VERSION as a CLI flag, not a process env var
nixpacks doesn't read NIXPACKS_* config from the process environment
at all, only from -e/--env on its own CLI — the "fix" from the
previous commit was silently a no-op (nixpacks plan still showed
nodejs_18 for a repo pinned to 20 that way). Caught because the first
real container built with it still crashed the same way.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 04:51:31 +02:00
dasemuandClaude Sonnet 5 9f88769922 fix: default unhinted Node repos to Node 20 instead of Nixpacks' own default
Nixpacks' current default (18) predates stable globalThis.crypto —
confirmed in production against ZenvairoSocial-MCP (no .nvmrc/engines.node
at all): build succeeded, container crashed immediately with "crypto is
not defined". A repo with its own version hint still wins; this only
changes the fallback for repos with none.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 04:48:25 +02:00
dasemuandClaude Sonnet 5 8eaccfbc47 fix: scope express.json() to /api so the MCP proxy stops hanging
A global body parser drained every incoming request body, including
on the /mcp/:slug proxy route, before http-proxy could forward it —
every proxied POST reached the backend with zero body bytes and hung
forever. This broke the proxy for every real MCP call, caught only
once a container was actually tested through it end-to-end.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 04:43:49 +02:00
dasemuandClaude Sonnet 5 1019672981 fix: allow disabling per-container memory/CPU caps (CONTAINER_*=0)
Some hosts can't enforce cgroup limits for nested containers at all
(confirmed on an OpenRC-based unprivileged LXC with no systemd to
delegate cgroup controllers) — docker run fails outright trying to
write memory.max. 0 now skips requesting that cap instead of erroring
every deploy.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 04:38:45 +02:00
dasemuandClaude Sonnet 5 698173c79d fix: copy the docker buildx plugin so nixpacks builds actually work
nixpacks shells out to `docker build`, which defaults to BuildKit;
without the buildx CLI plugin every build failed outright.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 04:31:55 +02:00
dasemuandClaude Sonnet 5 223b1ab8eb fix: enable git-over-ssh cloning for private repo installs
The manager image had git but not openssh-client, so ssh:// clones
failed outright ("cannot run ssh"). Install openssh-client, and mount
an SSH_DIR (key + known_hosts) into the container read-only so private
repos can actually authenticate — confirmed both gaps while deploying
against real private Zenvairo repos.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 04:27:49 +02:00
dasemuandClaude Sonnet 5 359d4369e8 fix: session cookie secure flag was never true-to-request
cookie.secure was tied to NODE_ENV=production instead of whether the
request actually arrived over HTTPS, so in a production build the
admin login cookie was never stored at all when accessed over plain
HTTP (e.g. direct container access, or a proxy that doesn't terminate
TLS in front of the admin panel) — confirmed while deploying to
production, login returned 200 but no session persisted. "auto" uses
req.secure via the existing trust-proxy setting instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 04:25:06 +02:00
dasemuandClaude Sonnet 5 306043e5b9 docs: add lesson about pinned-tag images changing contents upstream
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 04:22:18 +02:00
dasemuandClaude Sonnet 5 06d43f4ed8 fix: install nixpacks from its pinned GitHub release instead of ghcr.io image
ghcr.io/railwayapp/nixpacks no longer ships the nixpacks CLI binary at
/usr/bin/nixpacks (the image was repurposed upstream for something
else — confirmed while deploying to production, build failed with
"not found" for the pinned 1.41.0 tag). Download the exact release
tarball from GitHub instead, still pinned to the same version.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 04:22:02 +02:00
dasemuandClaude Sonnet 5 bd299187d6 fix: exclude test files from the tsc build output
Compiled .test.js files were ending up in dist/ and vitest was
picking those up too, doubling every test run.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 03:14:09 +02:00
dasemuandClaude Sonnet 5 ccf6708309 test: add vitest unit tests and Gitea Actions CI workflow
Covers secrets encryption, Nixpacks runtime-version detection, the
admin-session middleware, and the installations state machine. CI
runs the same build+test steps on every push via .gitea/workflows/ci.yml.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 03:13:04 +02:00
dasemuandClaude Sonnet 5 4cf857fd2d fix: pin NIXPACKS_NODE_VERSION from the repo's .nvmrc/engines.node
Nixpacks silently falls back to its own default Node version when a
repo doesn't match what it expects, instead of failing the build —
confirmed in practice as a green build that crashed at runtime on a
missing global. detectNodeVersion() reads the repo's own .nvmrc or
package.json engines.node and passes it through as
NIXPACKS_NODE_VERSION so the build actually uses what the repo
declares.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 03:12:58 +02:00
dasemuandClaude Sonnet 5 b4628ac255 feat: garbage-collect dangling images after rebuilds and deletes
Nixpacks moves an installation's image tag to the newly built image,
leaving the previous one dangling. buildInstallation now removes the
superseded image (best-effort, skipped if still referenced), and
removeInstallationContainer removes an installation's image when the
installation itself is deleted.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 03:12:52 +02:00
dasemuandClaude Sonnet 5 ccb7fcd842 feat: enforce per-container memory/CPU limits
CONTAINER_MEMORY_MB and CONTAINER_CPUS (defaults 512/1) are now applied
to every installed MCP container's HostConfig instead of leaving them
unbounded.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 03:12:44 +02:00
dasemuandClaude Sonnet 5 5e8397bcd9 docs: add LESSONS.md with recurring build/runtime gotchas
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 03:06:06 +02:00
dasemuandClaude Sonnet 5 b8f5d8253f feat: SQLite-backed installations, REST API, admin auth and web UI
Replaces the slice-2 hardcoded installation with a full install/deploy
pipeline:

- SQLite persistence (better-sqlite3) with a single `installations`
  table and a draft -> cloning -> building -> built -> starting ->
  running/error/stopped state machine; env vars and bearer tokens are
  encrypted at rest (AES-256-GCM, key derived from MASTER_KEY).
- Build/run orchestration: git clone (+ .env.example key detection),
  `nixpacks build` as a logged subprocess, dockerode container
  run/stop with forced host/port env vars and a TCP-connect health
  check before flipping an installation to "running".
- REST API (installations CRUD, build/deploy/redeploy, logs, token
  regeneration) behind single-operator session-cookie auth with a
  basic login lockout.
- Vite+React admin SPA: login, installation list, install wizard, and
  a detail page to configure env vars, trigger build/deploy/redeploy,
  view the build log, and copy the authenticated /mcp/<slug> URL.
- Dockerfile (multi-stage, pulls in nixpacks + the Docker CLI) and
  docker-compose.yml for production deployment.

Validated end-to-end against a real cloned repo: draft creation with
env-key detection, build, the error path on a failed health check, and
delete, all through the live API.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 01:42:06 +02:00
dasemuandClaude Sonnet 5 309e6aedc3 feat: scaffold manager server with docker lifecycle and bearer-auth proxy
Lays the groundwork for remote-mcp-manager: an Express server that
runs installed MCP containers via dockerode (forcing host/port env
vars, no published ports, shared bridge network) and reverse-proxies
/mcp/:slug requests behind a per-installation Bearer token, resolving
the upstream target by inspecting the container's network IP rather
than relying on container-name DNS.

Validated end-to-end against a real cloned MCP repo (nixpacks build +
container run + authenticated proxy roundtrip); installations are
still a hardcoded in-memory list, replaced by SQLite in the next slice.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-08 01:15:41 +02:00