Files
superbrain/deploy/federated/mcpserver-superbrain.Dockerfile
Andrew S Erwin 922cb46596
release gate / check (push) Canceled after 4m12s
MCP hub: per-user bearer auth + call-time scoping (interim image 1.8.9)
Implements DESIGN_MCP_HUB_AUTH.md phase 1, executed on erwin:
- hub_entrypoint.py override: _AuthMiddleware authenticates every /sse
  and /messages/ request against hash-only mhub_ tokens (hub_tokens.json,
  mtime-cached, revocation without restart), binds sessions to the
  credential that opened them, and keeps ?as_user= as an admin-only
  override; legacy Basic-auth (traefik) and container loopback map to a
  legacy admin identity during the transition (HUB_ALLOW_LEGACY_BASIC).
- _guarded_call_tool: non-admin tokens refused nextcloud_admin_*,
  superbrain_*, gitea_* and superpanel mutations; nextcloud_user_* pinned
  to the token's own user; per-call audit log without arguments.
- mcphub-token CLI: add/list/revoke, Superpanel user verification, admin
  from group membership, --with-nextcloud mints the DAV app token too.
- Dockerfile COPYs the hub override; STRATEGY.md records the rollout,
  the Traefik v3 HeaderRegexp spelling, and the nc_tokens.json directory
  bug fixed en passant.

Verified on the public endpoint: invalid/revoked tokens 401, operator
232 tools, non-admin scoping refusals, own-user reads, cross-token
session riding 401.
2026-11-25 01:22:31 -06:00

38 lines
1.5 KiB
Docker

# Interim MCP gateway image: upstream federatedcomputer/mcpserver PLUS the
# superbrain MCP server, until the mcpserver repo bakes it in officially
# (apps_registry.py entry + package install in its own Dockerfile).
# 1.8.9 adds per-user hub auth (DESIGN_MCP_HUB_AUTH.md): hub_entrypoint.py
# is overridden with the bearer-token middleware + call-time scoping build.
#
# Build from the repo root:
# docker buildx build --platform linux/amd64,linux/arm64 --push \
# -f deploy/federated/mcpserver-superbrain.Dockerfile \
# -t federatedcomputer/mcpserver-superbrain:1.8.9 .
#
# The suite's mcpserver service file then uses
# CONTAINER=federatedcomputer/mcpserver-superbrain (VERSION_RX stays
# digits-only). Published 2026-11-05 (1.8.8) for the erwin attach; delete
# once upstream ships superbrain support and the service CONTAINER moves
# back to federatedcomputer/mcpserver.
FROM federatedcomputer/mcpserver:1.8.8
COPY deploy/federated/hub_entrypoint.py /app/hub_entrypoint.py
COPY mcp/ /src/superbrain-mcp/
RUN pipx install /src/superbrain-mcp \
&& rm -rf /src/superbrain-mcp \
&& python3 - <<'PY'
p = "/app/apps_registry.py"
s = open(p).read()
entry = ''' "superbrain": {
"required_env": "SUPERBRAIN_API_URL",
"command": "superbrain-mcp",
"args": [],
},
'''
assert '"superbrain"' not in s, "registry already has superbrain"
assert s.count(' "plausible": {') == 1
s = s.replace(' "plausible": {', entry + ' "plausible": {', 1)
open(p, "w").write(s)
print("apps_registry patched: superbrain entry added")
PY