feat(mcp): shared MCP gateway stack at mcp.ginnoir.com
mcp-proxy runs the 9 homelab MCP servers (arr, bookstack, ntfy, uptime-kuma, portainer, gitea, authentik, freshrss, vault) once on valhalla and exposes each at /servers/<name>/mcp behind a bearer token, so agents on any machine connect by URL instead of each spawning its own npx/uvx processes with copied secrets. Image baked with pinned server versions, built by Gitea Actions to registry.ginnoir.com/ginnoir/mcp-gateway (Portainer never builds). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
87800f8553
commit
be95108ed7
7 files changed
+262
No files matched your search
@@ -0,0 +1,80 @@
|
||||
name: Build mcp-gateway image
|
||||
|
||||
# mcp-proxy + every homelab MCP server baked in at pinned versions (see
|
||||
# stacks/mcp/gateway/Dockerfile). Portainer only pulls, never builds, so the
|
||||
# image is built here and pushed to the self-hosted registry, same as the
|
||||
# romhacks orchestrator and urbackup. Compose (stacks/mcp) pulls :latest.
|
||||
#
|
||||
# Bump a server: edit its pin in the Dockerfile (or servers.json) and push.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- stacks/mcp/gateway/**
|
||||
- .gitea/workflows/build-mcp-gateway.yml
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: build-mcp-gateway
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Ensure docker CLI + buildx
|
||||
run: |
|
||||
# See build-romhacks-orchestrator.yml: Debian's docker.io has no buildx plugin.
|
||||
if docker buildx version >/dev/null 2>&1; then
|
||||
docker version
|
||||
docker buildx version
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq ca-certificates curl gnupg
|
||||
install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
||||
chmod a+r /etc/apt/keyrings/docker.asc
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
|
||||
> /etc/apt/sources.list.d/docker.list
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq docker-ce-cli docker-buildx-plugin
|
||||
docker version
|
||||
docker buildx version
|
||||
|
||||
- name: Login to registry
|
||||
run: |
|
||||
# Only the two REGISTRY_PUSH_* keys from the committed .env (it also holds
|
||||
# vault unseal keys); password goes via stdin, never argv or the log.
|
||||
eval "$(grep -E '^REGISTRY_PUSH_(USERNAME|PASSWORD)=' ./.env | sed 's/^/export /')"
|
||||
if [ -z "${REGISTRY_PUSH_USERNAME:-}" ] || [ -z "${REGISTRY_PUSH_PASSWORD:-}" ]; then
|
||||
echo "REGISTRY_PUSH_USERNAME/PASSWORD missing from .env" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf '%s' "$REGISTRY_PUSH_PASSWORD" | docker login registry.ginnoir.com \
|
||||
--username "$REGISTRY_PUSH_USERNAME" \
|
||||
--password-stdin
|
||||
|
||||
- name: Set up buildx
|
||||
run: |
|
||||
docker buildx create --name mcp-gateway-builder --use 2>/dev/null || docker buildx use mcp-gateway-builder
|
||||
docker buildx inspect --bootstrap
|
||||
|
||||
- name: Build and push image
|
||||
env:
|
||||
IMAGE: registry.ginnoir.com/ginnoir/mcp-gateway
|
||||
CACHE: registry.ginnoir.com/ginnoir/mcp-gateway:buildcache
|
||||
run: |
|
||||
SHA_TAG="sha-$(printf '%s' "$GITHUB_SHA" | cut -c1-7)"
|
||||
docker buildx build \
|
||||
--push \
|
||||
--tag "${IMAGE}:latest" \
|
||||
--tag "${IMAGE}:${SHA_TAG}" \
|
||||
--cache-from "type=registry,ref=${CACHE}" \
|
||||
--cache-to "type=registry,ref=${CACHE},mode=max" \
|
||||
stacks/mcp/gateway
|
||||
@@ -658,6 +658,16 @@ docs.ginnoir.com {
|
||||
reverse_proxy bookstack:80
|
||||
}
|
||||
|
||||
# MCP gateway (stacks/mcp). Bearer-token auth is enforced by mcp-proxy itself
|
||||
# (MCP_PROXY_AUTH_TOKEN); no Authentik — agents can't do a browser login.
|
||||
# flush_interval -1 so SSE / streamable-HTTP responses aren't buffered.
|
||||
mcp.ginnoir.com {
|
||||
import internal_only
|
||||
reverse_proxy mcp-gateway:8096 {
|
||||
flush_interval -1
|
||||
}
|
||||
}
|
||||
|
||||
# =============================================================
|
||||
# FILES / DOCUMENTS — internal only
|
||||
# files.ginnoir.com is the primary domain; nextcloud.ginnoir.com is an alias.
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
<DT><A HREF="https://dbx.ginnoir.com">dbx</A>
|
||||
<DT><A HREF="https://vault.ginnoir.com">vault</A>
|
||||
<DT><A HREF="https://docs.ginnoir.com">docs [internal]</A>
|
||||
<DT><A HREF="https://mcp.ginnoir.com">mcp [internal]</A>
|
||||
<DT><A HREF="https://nextcloud.ginnoir.com">nextcloud [internal]</A>
|
||||
<DT><A HREF="https://office.ginnoir.com">office [internal]</A>
|
||||
</DL><p>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
# mcp stack — one shared MCP gateway for every agent on every machine.
|
||||
#
|
||||
# Before: each agent session (Claude Code, Codex, Gemini/Antigravity, ...) on
|
||||
# each machine spawned its own 9 npx/uvx/Go processes, with API tokens copied
|
||||
# into ~/.claude.json, ~/.codex/config.toml, ~/.gemini/... by hand.
|
||||
# Now: mcp-proxy runs those servers once here and exposes each over
|
||||
# streamable HTTP at https://mcp.ginnoir.com/servers/<name>/mcp
|
||||
# (SSE at .../sse for older clients). Clients hold a URL + one bearer token.
|
||||
#
|
||||
# Servers: arr, bookstack, ntfy, uptime-kuma, portainer, gitea, authentik,
|
||||
# freshrss, vault (list: gateway/servers.json; pins: gateway/Dockerfile).
|
||||
# Obsidian is NOT here: its Local REST API MCP runs inside the Obsidian app
|
||||
# itself (desktop-local, and valhalla's instance binds 127.0.0.1 only).
|
||||
#
|
||||
# Auth: MCP_PROXY_AUTH_TOKEN (stack.env) — every request, /status included,
|
||||
# needs `Authorization: Bearer <token>`; mcp-proxy strips it from the child
|
||||
# env. Caddy additionally keeps it internal-only (LAN + tailnet). Not behind
|
||||
# Authentik forward_auth: agents can't do a browser login.
|
||||
#
|
||||
# The token is effectively admin over the lab (Portainer, Vault, Gitea,
|
||||
# Authentik writes). Treat it like the Portainer API key.
|
||||
#
|
||||
# Upstreams are the public https://*.ginnoir.com names (same as the clients
|
||||
# used before); container -> Caddy hairpin passes internal_only (172.16/12).
|
||||
#
|
||||
# Image is built by .gitea/workflows/build-mcp-gateway.yml; no build: key here
|
||||
# (Portainer never builds — see portainer-never-builds-only-pulls).
|
||||
|
||||
services:
|
||||
mcp-gateway:
|
||||
image: registry.ginnoir.com/ginnoir/mcp-gateway:latest
|
||||
pull_policy: always
|
||||
container_name: mcp-gateway
|
||||
restart: unless-stopped
|
||||
networks: [edge]
|
||||
env_file:
|
||||
- stack.env
|
||||
command:
|
||||
- --named-server-config=/app/servers.json
|
||||
- --pass-environment
|
||||
- --host=0.0.0.0
|
||||
- --port=8096
|
||||
- --allowed-host=mcp.ginnoir.com
|
||||
- --allowed-host=mcp-gateway:8096
|
||||
- --log-level=INFO
|
||||
# No published port: only reachable through Caddy on edge.
|
||||
healthcheck:
|
||||
# /healthz needs the bearer token too.
|
||||
test: ["CMD-SHELL", "python -c \"import os,urllib.request as u;u.urlopen(u.Request('http://127.0.0.1:8096/healthz',headers={'Authorization':'Bearer '+os.environ['MCP_PROXY_AUTH_TOKEN']}),timeout=5)\""]
|
||||
interval: 60s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
|
||||
networks:
|
||||
edge:
|
||||
name: edge
|
||||
external: true
|
||||
@@ -0,0 +1,48 @@
|
||||
# MCP gateway image: mcp-proxy + every homelab MCP server preinstalled at a
|
||||
# pinned version. Clients (Claude Code, Codex, Gemini, Hermes, ...) connect to
|
||||
# https://mcp.ginnoir.com/servers/<name>/mcp instead of each spawning 9 local
|
||||
# npx/uvx processes per session.
|
||||
#
|
||||
# Built by .gitea/workflows/build-mcp-gateway.yml -> registry.ginnoir.com.
|
||||
# Portainer only pulls, never builds (see stacks/romhacks note).
|
||||
#
|
||||
# Bump a server: change its pin below, push. Nothing resolves at runtime: no
|
||||
# `npx -y` / `uvx --refresh`, so a broken upstream release can't take a tool
|
||||
# down until we choose to pull it in.
|
||||
|
||||
FROM hashicorp/vault-mcp-server:0.2.0 AS vault
|
||||
|
||||
FROM ghcr.io/sparfenyuk/mcp-proxy:v0.15.2-debian-node
|
||||
|
||||
# --- Node servers -----------------------------------------------------------
|
||||
RUN npm install -g --omit=dev \
|
||||
@dodwmd/mcparr@0.1.1 \
|
||||
bookstack-mcp@5.7.3 \
|
||||
ntfy-me-mcp@1.5.0 \
|
||||
@davidfuchs/mcp-uptime-kuma@0.7.0 \
|
||||
&& npm cache clean --force
|
||||
|
||||
# --- Python servers (uv tools, binaries land in /usr/local/bin) -------------
|
||||
ENV UV_TOOL_DIR=/opt/uv-tools \
|
||||
UV_TOOL_BIN_DIR=/usr/local/bin \
|
||||
UV_PYTHON_PREFERENCE=only-system
|
||||
RUN uv tool install "mcp-portainer~=2.42.0" \
|
||||
&& uv tool install --extra-index-url https://nikitatsym.github.io/gitea-mcp/simple "gitea-mcp==1.0.76" \
|
||||
&& uv tool install --extra-index-url https://nikitatsym.github.io/authentik-mcp/simple "authentik-mcp==1.0.27" \
|
||||
&& uv tool install --with "mcp<2" \
|
||||
"git+https://github.com/darknight/freshrss-mcp-server@d6b3c4c342fc493b95d20a14be8284004e3312aa" \
|
||||
&& rm -rf /root/.cache/uv
|
||||
|
||||
# --- Go server --------------------------------------------------------------
|
||||
COPY --from=vault /bin/vault-mcp-server /usr/local/bin/vault-mcp-server
|
||||
|
||||
COPY servers.json /app/servers.json
|
||||
|
||||
# Fail the build (not the deploy) if any entrypoint is missing.
|
||||
RUN for b in mcparr bookstack-mcp ntfy-me-mcp mcp-uptime-kuma mcp-portainer \
|
||||
gitea-mcp authentik-mcp freshrss-mcp vault-mcp-server; do \
|
||||
command -v "$b" >/dev/null || { echo "missing $b" >&2; exit 1; }; \
|
||||
done
|
||||
|
||||
EXPOSE 8096
|
||||
# ENTRYPOINT (catatonit -- mcp-proxy) is inherited; args come from compose.
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"arr": { "command": "mcparr" },
|
||||
"bookstack": { "command": "bookstack-mcp" },
|
||||
"ntfy": { "command": "ntfy-me-mcp" },
|
||||
"uptime-kuma": { "command": "mcp-uptime-kuma" },
|
||||
"portainer": { "command": "mcp-portainer" },
|
||||
"gitea": { "command": "gitea-mcp" },
|
||||
"authentik": { "command": "authentik-mcp" },
|
||||
"freshrss": { "command": "freshrss-mcp", "args": ["--transport", "stdio"] },
|
||||
"vault": { "command": "vault-mcp-server", "args": ["stdio"] }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
# mcp stack env — every var is passed to all 9 MCP servers (--pass-environment).
|
||||
# Values copied from the per-machine client configs this stack replaces.
|
||||
|
||||
# Gateway bearer token (clients send Authorization: Bearer <this>).
|
||||
MCP_PROXY_AUTH_TOKEN=sYfgLZgfPHxZ2hwAa1oyOH1ABQjM6LotqFe1395LZgQ
|
||||
|
||||
# arr
|
||||
RADARR_API_KEY=94159a19beef48f185bd3e330f8dde3a
|
||||
SONARR_API_KEY=383c9489253e445baf8514013a4e37a4
|
||||
PROWLARR_URL=https://prowlarr.ginnoir.com
|
||||
PROWLARR_API_KEY=a02364e8ce5b4a3aa7396d41b189e9f8
|
||||
BAZARR_URL=https://bazarr.ginnoir.com
|
||||
BAZARR_API_KEY=4273a73be71259b95d1eedf933a4a1df
|
||||
RADARR_URL=https://radarr.ginnoir.com
|
||||
OVERSEERR_API_KEY=MTY2NzgxNTk0Mzk1MGIzNWE5ZmE2LTRjYzAtNDI2Yy05NDFhLTY0NDY3OTYzMmM2NCk=
|
||||
SONARR_URL=https://sonarr.ginnoir.com
|
||||
OVERSEERR_URL=https://requests.ginnoir.com
|
||||
|
||||
# bookstack
|
||||
BOOKSTACK_ENABLE_WRITE=true
|
||||
BOOKSTACK_TOKEN_ID=T6LYOXe4PQ0Hw2gz2VL2cZWdlJkzdrtY
|
||||
BOOKSTACK_BASE_URL=https://docs.ginnoir.com
|
||||
BOOKSTACK_TOKEN_SECRET=XvW1V5W6LwGa3Vs1SalQCa7zPykDeSj3
|
||||
|
||||
# ntfy
|
||||
NTFY_TOPIC=homelab
|
||||
NTFY_URL=https://ntfy.ginnoir.com
|
||||
|
||||
# uptime-kuma
|
||||
UPTIME_KUMA_URL=https://uptime.ginnoir.com
|
||||
|
||||
# portainer
|
||||
PORTAINER_API_KEY=ptr_Ep2pXkdoT6y2Pn8AAt4gRdUr7NFMyE06S8WYR+ciNq4=
|
||||
PORTAINER_URL=https://portainer.ginnoir.com
|
||||
PORTAINER_EXPOSE_ENV_VALUES=1
|
||||
|
||||
# gitea
|
||||
GITEA_TOKEN=54ea93904439c2919f1d8dab1ba545e54a2a3e86
|
||||
GITEA_URL=https://gitea.ginnoir.com
|
||||
|
||||
# authentik
|
||||
AUTHENTIK_TOKEN=ZeactSoXSFtz0CYyS0ZENAzvCKyBKS3r297yaoUvsAmqODSVZyIvYSOAmK0C
|
||||
AUTHENTIK_URL=https://auth.ginnoir.com
|
||||
|
||||
# freshrss
|
||||
FRESHRSS_API_PASSWORD=d0fet0th3x
|
||||
FRESHRSS_API_URL=https://freshrss.ginnoir.com/api/greader.php
|
||||
FRESHRSS_USERNAME=ginnoir
|
||||
|
||||
# vault
|
||||
VAULT_ADDR=https://vault.ginnoir.com
|
||||
VAULT_TOKEN=hvs.QmhZvkXnFfebbRC7JVFLcNPn
|
||||
Reference in new issue
Block a user