17 Commits

Author SHA1 Message Date
f11a23fb00 fix: re-pull the repo on every rebuild instead of reusing the stale clone
Some checks failed
CI / test (push) Has been cancelled
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
7b6e1b5855 feat: support host bind-mount volumes per installation
Some checks failed
CI / test (push) Has been cancelled
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
c918b32e72 feat: support publishing a container's port to host loopback
Some checks failed
CI / test (push) Has been cancelled
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
1efba2461a feat: support an explicit start command override per installation
Some checks failed
CI / test (push) Has been cancelled
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
fb59d422a2 feat: support optional per-installation Basic Auth on the MCP proxy
All checks were successful
CI / test (push) Successful in 31s
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
021fa2220e fix: pass NIXPACKS_NODE_VERSION as a CLI flag, not a process env var
All checks were successful
CI / test (push) Successful in 33s
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
9f88769922 fix: default unhinted Node repos to Node 20 instead of Nixpacks' own default
All checks were successful
CI / test (push) Successful in 40s
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
8eaccfbc47 fix: scope express.json() to /api so the MCP proxy stops hanging
All checks were successful
CI / test (push) Successful in 31s
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
1019672981 fix: allow disabling per-container memory/CPU caps (CONTAINER_*=0)
All checks were successful
CI / test (push) Successful in 37s
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
359d4369e8 fix: session cookie secure flag was never true-to-request
All checks were successful
CI / test (push) Successful in 52s
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
bd299187d6 fix: exclude test files from the tsc build output
All checks were successful
CI / test (push) Successful in 34s
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
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
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
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
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
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
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