Skip to content
333 changes: 333 additions & 0 deletions .github/workflows/mcpx-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,333 @@
name: mcpx release

# Cuts an mcpx release from the monorepo (decision 0005 §2.1-§2.3, §3, §5;
# #1881). It produces channel 1 (release binaries + checksums), exercises
# channel 2 (the curl|sh installer) against them, and builds channel 3 (the
# container image) from the same version stamp -- publishing the image to
# GHCR on a tag, building it only on a snapshot.
#
# mcpx lives in pkgs/mcpx of a monorepo, so its releases need a scheme that
# cannot collide with another package's: tags are `mcpx/vX.Y.Z`, and this
# workflow triggers on exactly that prefix.
#
# The version's single source is pkgs/mcpx/VERSION. A tag that disagrees with
# it is refused before anything is built -- a release whose name and whose
# `mcpx --version` differ is the failure this workflow exists to prevent.
#
# A manual run (workflow_dispatch) is a snapshot: it builds the same three
# artifacts with the same script and uploads them as a workflow artifact,
# without publishing a release. That run is the proof the release path works,
# and it is how a person checks a change before tagging.
on:
push:
tags:
- "mcpx/v*"
workflow_dispatch:
inputs:
version:
description: "Version to build (default: pkgs/mcpx/VERSION)"
required: false
type: string

permissions:
contents: write
packages: write

# CI tier policy: see .github/ci-policy.md
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
artifacts:
name: "release: build artifacts"
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/setup-go@v7
with:
go-version-file: pkgs/mcpx/go.mod
cache: true
# Monorepo: setup-go looks for go.sum at the repository root unless
# told otherwise (same reason as .github/workflows/mcpx.yml).
cache-dependency-path: pkgs/mcpx/go.sum

- name: Resolve the version, and refuse a tag that disagrees with it
id: version
working-directory: pkgs/mcpx
env:
EVENT: ${{ github.event_name }}
REF_NAME: ${{ github.ref_name }}
INPUT_VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
file_version=$(tr -d '\n' <VERSION)
if [ "$EVENT" = "push" ]; then
# mcpx/v1.2.3 -> 1.2.3
tag_version=${REF_NAME#mcpx/v}
if [ "$tag_version" != "$file_version" ]; then
echo "::error::tag $REF_NAME says $tag_version, pkgs/mcpx/VERSION says $file_version"
echo "Bump pkgs/mcpx/VERSION in the commit the tag points at, then re-tag."
exit 1
fi
version=$file_version
else
# A snapshot builds VERSION unless a version is given; it never
# publishes, so a mismatch here is a request, not a release.
version=${INPUT_VERSION:-$file_version}
version=${version#v}
fi
echo "version=$version" >>"$GITHUB_OUTPUT"
echo "tag=mcpx/v$version" >>"$GITHUB_OUTPUT"
echo "building mcpx $version"

- name: Build the three static artifacts and their checksums
working-directory: pkgs/mcpx
run: ./scripts/release-artifacts.sh "$RUNNER_TEMP/artifacts" "${{ steps.version.outputs.version }}"

- name: Smoke-test the host binary's reported version
# The version stamp is the whole point of the ldflags wiring, so read
# it back off the artifact this runner can execute.
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/smoke"
tar -C "$RUNNER_TEMP/smoke" -xzf "$RUNNER_TEMP/artifacts/mcpx-${{ steps.version.outputs.version }}-x86_64-linux.tar.gz"
got=$("$RUNNER_TEMP/smoke/mcpx" --version)
echo "mcpx --version: $got"
case "$got" in
*"${{ steps.version.outputs.version }}"*) ;;
*) echo "::error::artifact reports '$got', expected ${{ steps.version.outputs.version }}"; exit 1 ;;
esac

- uses: actions/upload-artifact@v7
with:
name: mcpx-${{ steps.version.outputs.version }}
path: |
${{ runner.temp }}/artifacts/*.tar.gz
${{ runner.temp }}/artifacts/SHA256SUMS
if-no-files-found: error
retention-days: 30

installer:
name: "release: installer exercise"
# The curl|sh installer (decision 0005 §2.2, §6.5) consumes the artifacts
# built above, so it is exercised here against a snapshot: install into a
# temp prefix and read the version back. A tag release also runs it, and
# `publish` waits for it, so a release cannot ship an installer that no
# longer works against the tarballs it just built.
needs: artifacts
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7

- uses: actions/download-artifact@v8
with:
name: mcpx-${{ needs.artifacts.outputs.version }}
path: ${{ runner.temp }}/artifacts

- name: Install the snapshot into a temp prefix
env:
MCPX_VERSION: ${{ needs.artifacts.outputs.version }}
MCPX_BASE_URL: ${{ runner.temp }}/artifacts
MCPX_PREFIX: ${{ runner.temp }}/prefix
run: |
set -euo pipefail
sh pkgs/mcpx/scripts/install.sh
got=$("$MCPX_PREFIX/mcpx" --version)
echo "installed binary reports: $got"
case "$got" in
*"$MCPX_VERSION"*) ;;
*) echo "::error::installed binary reports '$got', expected $MCPX_VERSION"; exit 1 ;;
esac

- name: Resolve the default version past another package's release
# The default (no MCPX_VERSION) resolution must not use
# /releases/latest: that is the newest release of the whole repo,
# and other packages publish here too. Feed the installer a fixture
# releases list whose newest entry is a graph release, followed by
# an mcpx prerelease, followed by the real mcpx release.
env:
MCPX_BASE_URL: ${{ runner.temp }}/artifacts
MCPX_PREFIX: ${{ runner.temp }}/prefix-default
run: |
set -euo pipefail
version="${{ needs.artifacts.outputs.version }}"
cat >"$RUNNER_TEMP/releases.json" <<EOF
[
{
"tag_name": "graph/v9.9.9",
"draft": false,
"prerelease": false
},
{
"tag_name": "mcpx/v9.9.9",
"draft": false,
"prerelease": true
},
{
"tag_name": "mcpx/v$version",
"draft": false,
"prerelease": false
}
]
EOF
MCPX_RELEASES_URL="file://$RUNNER_TEMP/releases.json" sh pkgs/mcpx/scripts/install.sh
got=$("$MCPX_PREFIX/mcpx" --version)
echo "default-resolved install reports: $got"
case "$got" in
*"$version"*) ;;
*) echo "::error::default resolution installed '$got', expected $version"; exit 1 ;;
esac

- name: Install system-wide with --system
# docs/install.md promises `sh -s -- --system` for /usr/local/bin.
# The runner owns /usr/local/bin, so no sudo is needed to prove the
# flag selects that prefix; an unknown argument must be refused
# before anything is downloaded or installed.
env:
MCPX_VERSION: ${{ needs.artifacts.outputs.version }}
MCPX_BASE_URL: ${{ runner.temp }}/artifacts
run: |
set -euo pipefail
if sh pkgs/mcpx/scripts/install.sh --bogus 2>"$RUNNER_TEMP/err"; then
echo "::error::the installer accepted an unknown argument"
exit 1
fi
grep -q "unknown argument" "$RUNNER_TEMP/err" || {
echo "::error::unknown-argument refusal gave the wrong error:"
cat "$RUNNER_TEMP/err"
exit 1
}
rm -f /usr/local/bin/mcpx
sh pkgs/mcpx/scripts/install.sh --system
got=$(/usr/local/bin/mcpx --version)
echo "system-wide install reports: $got"
case "$got" in
*"$MCPX_VERSION"*) ;;
*) echo "::error::system-wide install reports '$got', expected $MCPX_VERSION"; exit 1 ;;
esac

- name: Refuse a tampered artifact
# The installer verifies the checksum; prove it by breaking one. An
# installer that only *says* it verifies teaches the wrong habit.
env:
MCPX_VERSION: ${{ needs.artifacts.outputs.version }}
MCPX_PREFIX: ${{ runner.temp }}/tampered-prefix
run: |
set -euo pipefail
cp -r "$RUNNER_TEMP/artifacts" "$RUNNER_TEMP/tampered"
asset="$RUNNER_TEMP/tampered/mcpx-$MCPX_VERSION-x86_64-linux.tar.gz"
printf 'x' >>"$asset"
if MCPX_BASE_URL="$RUNNER_TEMP/tampered" sh pkgs/mcpx/scripts/install.sh 2>"$RUNNER_TEMP/err"; then
echo "::error::the installer accepted an artifact whose checksum does not match"
exit 1
fi
grep -q "checksum mismatch" "$RUNNER_TEMP/err" || {
echo "::error::installer failed for the wrong reason:"
cat "$RUNNER_TEMP/err"
exit 1
}
echo "tampered artifact refused, as it must be"

container:
name: "release: container image"
# Channel 3 (decision 0005 §2.3, §6.6): the Containerfile already builds a
# working image; this wires it to the release version so the image cannot
# carry a fifth hand-synced copy of the string. A tag pushes it to GHCR;
# a snapshot builds it and reads `mcpx --version` back, proving the
# build-arg path without publishing anything.
needs: artifacts
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7

- name: Log in to GHCR
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the image at the release version, and read it back
env:
VERSION: ${{ needs.artifacts.outputs.version }}
# Lowercased: GHCR rejects uppercase, and an owner or repo name can
# carry it. The image sits under the repository, so it cannot
# collide with another package's image in the same org.
IMAGE: ghcr.io/${{ github.repository }}/mcpx
run: |
set -euo pipefail
image=$(printf '%s' "$IMAGE" | tr '[:upper:]' '[:lower:]')
tags=(--tag "$image:$VERSION")
if [ "$GITHUB_EVENT_NAME" = "push" ]; then
tags+=(--tag "$image:latest")
fi
docker build \
--file pkgs/mcpx/Containerfile \
--build-arg "VERSION=$VERSION" \
"${tags[@]}" \
pkgs/mcpx
got=$(docker run --rm "$image:$VERSION" --version)
echo "image mcpx --version: $got"
case "$got" in
*"$VERSION"*) ;;
*) echo "::error::image reports '$got', expected $VERSION"; exit 1 ;;
esac
if [ "$GITHUB_EVENT_NAME" = "push" ]; then
docker push "$image:$VERSION"
docker push "$image:latest"
echo "published $image:$VERSION"
else
echo "snapshot: built $image:$VERSION, not pushed"
fi

publish:
name: "release: publish"
# Only a tag publishes. A snapshot run stops at the artifacts and the
# installer exercise above.
if: github.event_name == 'push'
needs: [artifacts, installer]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/download-artifact@v8
with:
name: mcpx-${{ needs.artifacts.outputs.version }}
path: dist

- name: Publish the GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ needs.artifacts.outputs.tag }}
VERSION: ${{ needs.artifacts.outputs.version }}
run: |
set -euo pipefail
cd dist
sha256sum -c SHA256SUMS
cat >notes.md <<EOF
Static mcpx $VERSION binaries for x86_64-linux, aarch64-linux and
aarch64-darwin (CGO_ENABLED=0), with SHA256SUMS. Verify before use:

sha256sum -c SHA256SUMS

A bare binary has no JavaScript runtime: \`mcpx run\` and \`mcpx exec\`
need Deno, Bun or Node on PATH until you install one (\`mcpx doctor\`
says which it found). On Linux the static build's pure-Go os/user
parses /etc/passwd instead of asking NSS, and its resolver does not
honour nsswitch.conf. See pkgs/mcpx/docs/decisions/0005-release-pipeline.md.
EOF
gh release create "$TAG" \
--repo "$GITHUB_REPOSITORY" \
--title "mcpx $VERSION" \
--notes-file notes.md \
./*.tar.gz SHA256SUMS
10 changes: 5 additions & 5 deletions pkgs/mcpx/docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ exist**; everything else is designed but not built (that work is
| Channel | Command | Status |
| --- | --- | --- |
| nix | `nix run github:developing-today/code#mcpx -- ls` to try it; `nix profile install github:developing-today/code#mcpx` to keep it | **Available** — the flake builds `pkgs/mcpx/package.nix` and exposes it as an app; the wrapper puts `git`, `deno`, `bun` and `node` on `PATH`, so a nix install is complete with no other prerequisites |
| container | from the repository root: `docker build -f pkgs/mcpx/Containerfile -t mcpx pkgs/mcpx` (or podman), then run the image — see [container](./container.md) | **Partly** — the Containerfile builds a working image locally (bun as its runtime; deliberately no `git`, see [container](./container.md)); no image is published anywhere yet |
| container | from the repository root: `docker build -f pkgs/mcpx/Containerfile -t mcpx pkgs/mcpx` (or podman), then run the image — see [container](./container.md) | **Available locally** — the Containerfile builds a working image (bun as its runtime; deliberately no `git`, see [container](./container.md)); the release workflow now builds the same image at the release version and pushes it on an `mcpx/v*` tag, and no tag has been cut yet |
| just the plugin | copy `pkgs/mcpx/plugin/opencode/` into `~/.config/opencode/plugin/` (the plugin README's "Install") | **Available** as a manual copy — and it is not an install of mcpx: the plugin needs **no mcpx binary on its machine**, because it finds a daemon over the unix socket or an `endpoint`; it still needs a daemon running somewhere, and as copied it exposes no tools and injects no guidance until you set `tools: true` / `MCPX_PLUGIN_TOOLS=1` (and `instructions: true` for the prompt) |
| bash installer | per-user: `curl -fsSL <short> \| sh`; system-wide: `curl -fsSL <short> \| sh -s -- --system` (fallback: `curl -fsSL <short> \| sudo sh`) | Not yet — there are no releases for it to download |
| bash installer | per-user: `curl -fsSL <short> \| sh`; system-wide: `curl -fsSL <short> \| sh -s -- --system` (fallback: `curl -fsSL <short> \| sudo sh`) | **Shipped, waiting on the first tag** — `pkgs/mcpx/scripts/install.sh` is in this repository and CI installs a snapshot artifact with it (checksum verified, refusal of a tampered tarball proven); it downloads a GitHub release, and no `mcpx/v*` tag has been cut yet, so the commands above do not work until one is |
| agent prompt | a prompt you paste to your agent, with the `llms.txt` URL | Not yet |
| pwsh (install.ps1) | `irm <short>/install.ps1 \| iex` | **Blocked** — mcpx does not build for Windows today; WSL is the Windows answer |
| rpm / deb | `dnf install ./mcpx-<version>.rpm` | Not yet |
| flatpak | — | Not recommended (decided in the release design, #1881) |
| pkg | — | Not yet — and still an open question: macOS `.pkg`, FreeBSD `pkg`, or Homebrew |
| docker (published) | `docker run … ghcr.io/<owner>/mcpx` | Not yet — local builds only, see the container row |
| docker (published) | `docker run --rm ghcr.io/developing-today/code/mcpx ls` | **Wired, not yet published** — an `mcpx/v*` tag pushes `ghcr.io/developing-today/code/mcpx:<version>` and `:latest`; no tag has been cut yet, so pull the local build in the container row until one is |

Nix caveats, stated plainly: the flake is a large monorepo flake, so
installing one package from it fetches and evaluates a lot (the cost
Expand All @@ -48,8 +48,8 @@ lives on the machine. Every row except the service is shipped today.
| Mode | What to do | Status |
| --- | --- | --- |
| Just run the binary | Nothing. Any command that needs the daemon starts one (`daemon.autostart`, default true), and an auto-started daemon exits after 4 hours idle (`autostart.idleExit`) | Shipped |
| Per-user | Binary in `~/.local/bin`; config at `~/.config/mcpx/config.json` | Config shipped; the binary location arrives with the installer (#1881) |
| Per-host | Binary in `/usr/local/bin` (the installer's `--system`); config at `/etc/mcpx/config.json`, the last stop on the config search path | Config shipped but was undocumented until this page; binary location awaits #1881 |
| Per-user | Binary in `~/.local/bin`; config at `~/.config/mcpx/config.json` | Config shipped; the installer ships and places the binary there once a release exists (#1881) |
| Per-host | Binary in `/usr/local/bin` (the installer's `--system`); config at `/etc/mcpx/config.json`, the last stop on the config search path | Config shipped but was undocumented until this page; the installer's `--system` form places the binary once a release exists (#1881) |
| Local host (a daemon other machines reach) | `mcpx daemon --address <ip> --port <n>` on that host; clients set `daemon.endpoint` / `MCPX_DAEMON_ENDPOINT` — a client with an endpoint set never autostarts a local daemon. Remember: the API is unauthenticated, the network is the access control | Shipped |
| Persistent daemon | `mcpx daemon` (foreground) or `mcpx daemon --detached`; a deliberately started daemon's `daemon.idleExit` defaults to `0` — it never idle-exits | Shipped |
| System service | A launchd plist or systemd unit running `mcpx daemon`, with `daemon.autostart` false on clients so no stray second daemon starts | **Proposed**, not shipped — until then, the on-demand daemon above is the supported path |
Expand Down
Loading
Loading