Register GitLab OAuth MCP across shared AI clients #349
No reviewers
Labels
No labels
area:authentication
area:flake-utilities
area:performance
area:tbd
host:chaos
host:cosmos
host:electra
host:fleet
host:lena
host:lyra
host:mass-storage
host:media1
host:nimmog-de
host:nova
host:pangolin
host:pangolin-vps
host:phone
host:router
host:vega
investigation
phase:cutover
phase:deploy
phase:mcp
phase:module
phase:packaging
phase:prep
phase:validation
priority:high
priority:medium
project:attic-postgres-lyra-rollout
project:auto-update-reliability
project:auto-update-remediation
project:declarative-purity-cleanup
project:external-review
project:fleet-boundary-cleanup
project:host-facts-refactor
project:lyra-nixos-deploy
project:lyra-service-stack-migration
project:nebula-mesh-network
project:nix-idioms-hygiene
project:nixos-build-deployment-pipeline
project:security-hardening
project:service-stack-migration
project:vega-sillytavern-cutover
project:wiki-rebuild
repo:numtide/flake-utils
repo:numtide/nix-auth
repo:numtide/nixos-passthru-cache
repo:numtide/nix-relay
service:auto-update
service:gitlab
service:hermes
service:mem0
service:nix
service:sillytavern
service:slskd
service:synthseek
service:tdarr
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/nixos-config!349
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/gitlab-mcp-registry"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Register the existing GitLab MCP endpoint alongside Forgejo for Codex, OpenCode and Pi across Electra, Lena, Vega and Lyra. Enable and URL options remain configurable; Antigravity and Hermes retain the existing OAuth exclusions.
OAuth consent remains an explicit per-client/host action outside unattended activation. No shared administrator credentials or Pocket-ID application secret are introduced. README covers normal/headless authorization and Pi's /mcp-auth flow.
Validation: full nix flake check and current-head CI run 1314 pass. Registry checks cover enabled, disabled and custom-URL cases, client exclusions and Pi OAuth. A separate evaluation with all hosts disabling GitLab and changing their endpoint also passes. Public MCP OAuth discovery was checked without credentials. The user previously confirmed Codex and Pi authorization on Electra; fleet activation and other per-client authorization remain operator steps.
All current-head feedback has been assessed. Review #121's sole null-semantics finding was disproved by direct evaluation and dismissed with evidence; valid earlier advisory findings are implemented. No actionable review feedback remains.
Closes #344. No host deployment was performed.
Automated code review
Reviewed commit:
ed276482eb9171908cf52210f88532fc12ceef84Verdict: Requires further work
Resolve the blocking or important findings and investigate failed deterministic checks before merging.
Overall assessment
The GitLab MCP registration follows the existing Cloudflare pattern (new
nixosConfig.mcp.gitlabenable/url options inmodules/common/default-config.nix, amodules/mcp/gitlab.nixserver module aggregating inmodules/mcp/default.nix, README documentation, and a newchecks.x86_64-linux.gitlab-mcpgate inflake.nix:314-316). One concrete problem: the newscripts/check-gitlab-mcp.nixasserts thatgitlabis absent fromagyMcpServersandhermesMcpServers, but the registry's suppression filter is a no-op for an explicitlynullentry, so those assertions do not hold against the evaluated registry and the added flake check — the repository's authoritative gate for Nix module changes — would fail. No files were edited and nothing was executed.Blocking findings
scripts/check-gitlab-mcp.nix:35-36assert!(registry.agyMcpServers ? gitlab)and!(registry.hermesMcpServers ? gitlab)for a module that setsagy = null; hermes = null;(modules/mcp/gitlab.nix:13-14). Inmodules/mcp/default.nixthe two client sets are built withlib.filter (s: (s.agy or { }) != null) enabledServers(line 120) andlib.filter (s: (s.hermes or { }) != null) enabledServers(line 202). Nix'sorreturns the right operand when the left isnull/false, sos.agy or { }evaluates to{ }and{ } != nullis true: the filter never removes anything. The value branch then takesif s ? agy then s.agy(line 97/180), solistToAttrsbindsgitlab = null, makingregistry.agyMcpServers ? gitlabtrue and the assertion fail, which failschecks.x86_64-linux.gitlab-mcpatflake.nix:314.Impact:
nix flake check— the gate AGENTS.md requires for Nix module/configuration changes — is expected to fail at the newly addedgitlab-mcpcheck, so the change cannot be validated as claimed. Independently of the check, the same no-op filter meansgitlab: null(and the pre-existingcloudflare: null) is emitted into the Antigravity~/.gemini/config/mcp_config.json(modules/profiles/ai-agents.nix:47inheritsmcp.agyMcpServers) and into Hermes'smcpServers(modules/services/hermes.nix:192), so the documented 'agy: attrs | null ... or suppress this client' contract in the registry header (modules/mcp/default.nix:21-22) and the README claim that 'Antigravity CLI and Hermes are excluded' are not honoured.Suggested fix: Make the suppression effective in
modules/mcp/default.nix, e.g. filter on the actual value (lib.filter (s: (if s ? agy then s.agy else { }) != null) ...and the equivalent forhermes), or build the attrsets and drop null entries withlib.filterAttrs (_: v: v != null). Then re-runnix flake check. If the null leak is instead considered acceptable, the check must assertregistry.agyMcpServers.gitlab == nullrather than absence, and the client-side effect of anullentry should be verified.Important findings
None.
Suggestions
toStandardMcpServerinmodules/mcp/default.nix:171emitsoauth = falseonly vialib.optionalAttrs ((entry.oauth or null) == false) { oauth = false; };modules/mcp/gitlab.nix:16-20passesopencode = { ...; oauth = { }; }, sostandardMcpServers.gitlabmust carry nooauthkey for the README's/mcp-auth gitlabflow to be exercised. The check asserts the url (:33) and!(registry.standardMcpServers.gitlab ? headers)(:34) but never asserts the absence ofoauth = false, unlikescripts/check-redview-mcp.nix:44-49, which pinsoauth = falsefor a token-backed server.Impact: A later change that set
oauth = false(asmodules/mcp/redview.nixdoes) would silently disable Pi's OAuth authorization for GitLab without any flake check catching it, making the README's/mcp-auth gitlabinstructions wrong. No defect exists in the current state.Suggested fix: Add
assert !(registry.standardMcpServers.gitlab ? oauth);alongside the existing url/headers assertions inscripts/check-gitlab-mcp.nix.Tests and validation
Questions
nix flake checkat this head commit? The addedgitlab-mcpcheck asserts absence ofgitlabinagyMcpServers/hermesMcpServers, which the current registry filter does not produce foragy = null/hermes = null.modules/mcp/cloudflare.nix:10-11)?https://forge.nimmog.uk/api/v4/mcpappears only in the changed files (README.md:209, modules/common/default-config.nix:217, scripts/check-gitlab-mcp.nix:30); no service, route, or domain for that host is configured elsewhere in the flake. Is the host provisioned outside this repository, and is/api/v4/mcpthe intended Free-tier MCP route?Review limitations
modules/mcp/default.nix,modules/mcp/gitlab.nix,modules/mcp/cloudflare.nix,modules/common/default-config.nix,modules/profiles/ai-agents.nix,modules/services/hermes.nix,scripts/check-redview-mcp.nix,flake.nix).pi-mcp-adapter/mcp-authflow, its headless callback handling and credential-store requirement, and GitLab's Pocket-ID consent screen cannot be verified from supplied material; the README statements about them are unverified.Diff coverage
README.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchmodules/common/default-config.nix: reviewed — included in a context-limited batchmodules/mcp/default.nix: reviewed — included in a context-limited batchmodules/mcp/gitlab.nix: reviewed — included in a context-limited batchscripts/check-gitlab-mcp.nix: reviewed — included in a context-limited batchReview metadata
Review #108 follow-up before publishing prepared head
d6bffa833619d4053030ee22eeb096d1fbb21c6e:orsupplies a default for an absent attribute; it does not replace an explicitly present null. Direct evaluation oflet entry = { agy = null; }; in { explicitNull = entry.agy or {}; absent = entry.missing or {}; excluded = (entry.agy or {}) == null; }returned{ explicitNull = null; absent = {}; excluded = true; }. The registry's existing filters correctly suppress GitLab and Cloudflare for those clients. The all-host registry checks pass without changing the filter.assert !(registry.standardMcpServers.gitlab ? oauth);now guards against accidentally emittingoauth = falseand disabling the documented authorization flow.Rebased onto merged main containing #351 and #348. Full
nix flake checkpasses, including default/custom/disabled registry checks on all four AI-client hosts and the new OAuth assertion; formatting and whitespace pass. Existing upstream stdenv deprecation warnings are unrelated. No activation or fleet authorization was performed. Publishing this validated follow-up next to obtain a fresh current-head review; the old blocking review is dismissed with the execution evidence above.Nix evaluation disproves the blocking claim: attribute-selection
orpreserves explicitly present null, and the existing client-exclusion flake assertions pass. Valid advisory Pi OAuth assertion is implemented and full flake checks pass. See detailed execution evidence in the MR follow-up; a new-head review will run after publication.ed276482ebd6bffa8336Automated code review
Reviewed commit:
d6bffa833619d4053030ee22eeb096d1fbb21c6eVerdict: Ready to merge
No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.
Overall assessment
The GitLab registration mirrors the established Cloudflare pattern exactly (same
agy = null/hermes = nullsuppression, sameopencoderemote+oauth = { }shape, sametype = "http"Codex path), and the option names/defaults inmodules/common/default-config.nixmatch the README text. I checked the initial review's blocking claim and rejected it:modules/mcp/default.nix:120/202filter with(s.agy or { }) != null/(s.hermes or { }) != null, and the header contract atmodules/mcp/default.nix:21-22documentsagy/hermes=attrs | nullas 'suppress this client'. The same file relies on the identical select-with-default idiom in a form that is exercised by the pre-existingcheck-redview-mcp.nixassertionregistry.standardMcpServers.redview == { ...; oauth = false; ... }(line 44-48), which only holds ifentry.oauth or nullreturns the presentfalserather than the default (default.nix:171). That is consistent withs.agy or { }returning the explicitnulland the entry being filtered out, so the new assertions atcheck-gitlab-mcp.nix:37/38and the README's 'Antigravity CLI and Hermes are excluded' claim are supported by the supplied code. The Codex assertions also matchcodexEnsureSnippet's http branch (default.nix:250-257emitsensure_http_mcp 'gitlab' '<url>'with no token argument and nomcp login), andforge.nimmog.ukis the GitLab host per pre-existing README text (lines 327/332), so the initial review's host-name question is resolved. No defect was found in the changed files; one check-design coupling remains as a suggestion.Blocking findings
None.
Important findings
None.
Suggestions
mcp.gitlab.enableinstead of forcing it, coupling the gate to a documented per-host override (scripts/check-gitlab-mcp.nix:26; medium confidence)check-gitlab-mcp.nix:26assertssystem.config.nixosConfig.mcp.gitlab.enable, i.e. the host's own option value, and builds the enabled registry withregistryFor { }(line 20). The comparable existing checkscripts/check-redview-mcp.nix:11-13instead forces the value inside its own override (mcp.redview.enable = true) and never asserts the host value.modules/common/default-config.nix:209-212definesenableas a normal boolean option, and README.md:225 documents 'OverridenixosConfig.mcp.gitlab.enable... as needed'. No host inhosts/currently overrides it, so this is not a defect in the current tree.Impact: A future per-host disable of GitLab - the override the README advertises - would make
checks.x86_64-linux.gitlab-mcp(flake.nix:377-379) fail, turning the authoritativenix flake checkgate red for a configuration choice rather than a code defect. This diverges from the repo's own convention for testing the enabled path.Suggested fix: Build the enabled case with an explicit override (
registryFor { enable = true; }) and drop the assertion on the host's own value, keeping the existingregistryFor { enable = false; }negative case; or scope the assertion to hosts that intentionally opt in.Tests and validation
Questions
nix flake checkoutput at head be shared forchecks.x86_64-linux.gitlab-mcp? The suppression assertions atcheck-gitlab-mcp.nix:37/38depend ons.agy or { }returning the explicitnull(attribute present) rather than the{ }default; my reading of the supplied code says it does, but no Nix evaluation was available to confirm it.https://forge.nimmog.uk/api/v4/mcpconfirmed to answer Streamable HTTP with OAuth discovery, and isopencode.oauth = { }the accepted OpenCode shape for that server (the same shapemodules/mcp/cloudflare.nix:12-17emits, which has no check script of its own)?Review limitations
or-with-select behaviour, the passing ofcheck-gitlab-mcp.nix, and the emitted client configuration are static readings of the suppliedmodules/mcp/default.nix,modules/mcp/gitlab.nixandscripts/check-redview-mcp.nix, not observed results./mcp-authbehaviour, the OS credential-store requirement on headless Linux, GitLab OAuth consent through Pocket-ID, and the headless Codex callback tunnel are documentation claims only.nix flake checkoutput at the current head commit was supplied; the PR text's claim of green validation is unverified.gitlaboverrides (none found inhosts/), but unchanged host and profile modules were not fully audited.Diff coverage
README.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchmodules/common/default-config.nix: reviewed — included in a context-limited batchmodules/mcp/default.nix: reviewed — included in a context-limited batchmodules/mcp/gitlab.nix: reviewed — included in a context-limited batchscripts/check-gitlab-mcp.nix: reviewed — included in a context-limited batchReview metadata
Review #119 follow-up before publishing prepared head
cd0cbc84012b9b8b569bfb6ce5b1418d0963d165:enable = true; disabled fixtures explicitly set false. Removed the assertion that each host must itself enable GitLab. The normal URL expectation follows the evaluated host setting, so supported URL overrides also remain valid.nix flake checkpasses again across all four hosts. A separate evaluation replaced every host's base GitLab settings withenable = falseand a different endpoint, then ran this same check; it returned true. Formatting and whitespace checks pass. This change affects only regression assertions, not runtime configuration.oauthsetting as an object with optional client fields and automatic OAuth when authentication is required; the empty object is consistent with that configuration: https://opencode.ai/docs/mcp-servers/#oauth . Existing user-confirmed Electra Codex/Pi authorization remains the runtime acceptance evidence.Publishing this reviewed improvement next for fresh current-head review and CI. The previous head's CI remains queued behind the main-branch cache build on Nova; no failing check is being bypassed.
CI scheduling retry: final-head run 1312 remained queued for over ten minutes after earlier runs completed, with Nova's runner active and no job child process. I cancelled only that queued run to requeue it. The connector's rerun endpoint is unsupported on this Forgejo version, so I am briefly closing/reopening this same MR to trigger normal pull-request checks again at unchanged head
cd0cbc84012b9b8b569bfb6ce5b1418d0963d165. No source changes, validation bypass or merge are involved.Automated code review
Reviewed commit:
cd0cbc84012b9b8b569bfb6ce5b1418d0963d165Verdict: Requires further work
Resolve the blocking or important findings and investigate failed deterministic checks before merging.
Overall assessment
The GitLab MCP module, option, registry import, README text, and flake check wiring follow the existing Cloudflare pattern. One defect is visible in the supplied material: the new check script asserts that GitLab is absent from
agyMcpServersandhermesMcpServers, but the registry filter inmodules/mcp/default.nixdoes not suppress entries whoseagy/hermesattribute isnull— it keeps them and stores the literalnullas the value. The two assertions would therefore fail andnix flake checkwould error on this branch.Blocking findings
scripts/check-gitlab-mcp.nixlines 39-40 assert!(registry.agyMcpServers ? gitlab)and!(registry.hermesMcpServers ? gitlab).modules/mcp/gitlab.nixsetsagy = null;andhermes = null;. Inmodules/mcp/default.nix, the agy registry is built withlib.listToAttrs (map (...) (lib.filter (s: (s.agy or { }) != null) enabledServers)): for gitlab,s.agyisnull, sonull or { }yields{ }, which is!= null, so gitlab passes the filter; the value branchif s ? agy then s.agythen yieldsnull, solistToAttrsproduces the keygitlabwith valuenull.registry.agyMcpServers ? gitlabis thereforetrueand the assertion fails. The hermes registry uses the identical(s.hermes or { }) != nullfilter, so line 40 fails the same way. The module header comment inmodules/mcp/default.nixdocumentsagy: attrs | null ... or suppress this client, i.e. the intended behaviour differs from the implemented filter.Impact:
flake.nixwires this script intochecks.x86_64-linux.gitlab-mcpvia anassert, sonix flake check(and any CI that runs it) fails on this branch; the check as written does not validate the intended suppression. It also means agitlab: nullentry is emitted into the Antigravity~/.gemini/config/mcp_config.json(modules/profiles/ai-agents.nixline 47 serializesmcp.agyMcpServersdirectly) and into the Hermesmcp_serverslist (modules/services/hermes.nixline 199).Suggested fix: Make the assertions match the actual registry output (
registry.agyMcpServers.gitlab == nullandregistry.hermesMcpServers.gitlab == null), or fix the filters inmodules/mcp/default.nixto genuinely drop null entries (e.g.lib.filter (s: !(s ? agy) || s.agy != null) enabledServersand the equivalent forhermes) and re-validate the existing Cloudflare entry, which uses the sameagy = null/hermes = nullpattern.Important findings
None.
Suggestions
None.
Tests and validation
Questions
nix flake checkactually run against the final state of this branch (gitlab module imported intomodules/mcp/default.nixplusscripts/check-gitlab-mcp.nix), or only against an intermediate commit?gitlabkey entirely (filter fix), or is anullvalue acceptable to those clients? The current filter behaviour is shared with the pre-existing Cloudflare entry, so this affects that entry too.Review limitations
listToAttrscode path and Nixorsemantics fornull, not from execution.Diff coverage
README.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchmodules/common/default-config.nix: reviewed — included in a context-limited batchmodules/mcp/default.nix: reviewed — included in a context-limited batchmodules/mcp/gitlab.nix: reviewed — included in a context-limited batchscripts/check-gitlab-mcp.nix: reviewed — included in a context-limited batchReview metadata
Final current-head review #121 assessed at
cd0cbc84012b9b8b569bfb6ce5b1418d0963d165. Its sole finding repeats the already-disproved select-with-default claim from #108; there are no other findings or suggestions.Direct Nix execution was repeated at this final head:
let entry = { agy = null; }; in { explicitNull = entry.agy or {}; absent = entry.missing or {}; excluded = (entry.agy or {}) == null; }returns{ explicitNull = null; absent = {}; excluded = true; }. Attribute-selectionordefaults only an absent attribute; explicit null remains null. Thus the existing filter excludes GitLab and Cloudflare, and the absence assertions are correct. Review #119 independently reached the same correct reading. Changing the assertions to expect null-valued entries would break the actual contract.The final-head full flake check passed locally, and actual runner CI https://git.nimmog.uk/nimmo/nixos-config/actions/runs/1314 passed at the same head, including its Nix check gate. This answers the review's final-state validation question with a current, completed CI result. Client exclusion is intentional; no shared credentials or runtime client expansion is introduced.
The request-changes review is dismissed with this execution evidence. No actionable current-head feedback remains; the two valid advisory regression improvements from earlier reports are implemented and validated. Proceeding with the user-authorized merge. No host activation or per-host OAuth login is claimed.
Sole finding is disproved by repeated Nix evaluation and passing final-head CI 1314: attr selection
orpreserves explicit null, so the filters correctly suppress those client entries. Evidence is in the MR discussion; no actionable feedback remains.