feat(mcp): host BookStack MCP as Streamable HTTP service on Vega (#283) #284

Merged
nimmo merged 1 commit from feat/issue-283-bookstack-mcp-http-service into main 2026-10-07 15:56:48 +01:00
Owner

Context

Ref #283 (Milestone: Nix Idioms and Architecture Hygiene)

Following the migration of Forgejo MCP, KiwiFS MCP, and Navidrome MCP to hosted HTTP services over Nebula mesh on Vega, this PR moves BookStack MCP from local per-machine stdio wrapper scripts to a native Streamable HTTP daemon (bookstack-mcp.service) on Vega listening on 10.10.0.2:8782/mcp.

Changes

  • Vega Service Module (modules/services/bookstack-mcp.nix):
    • Implements systemd service bookstack-mcp running packages/bookstack-mcp (ttpears/bookstack-mcp v5.1.0).
    • Configures MCP_TRANSPORT=http, MCP_HTTP_HOST=10.10.0.2, MCP_HTTP_PORT=8782, MCP_HTTP_PATH=/mcp, BOOKSTACK_BASE_URL=http://127.0.0.1, BOOKSTACK_ENABLE_WRITE=true.
    • Loads token credentials (bookstack/api-token-id and bookstack/api-token-secret) from Vega's secrets/bookstack.yaml via systemd LoadCredential.
    • Opens TCP 8782 on Vega's nebula.mesh firewall interface.
    • Enabled on Vega via nixosConfig.bookstackMcp.enable = true;.
  • Fleet Client Configuration:
    • modules/common/default-config.nix: sets nixosConfig.mcp.bookstack.url defaulting to http://10.10.0.2:8782/mcp and enable = true.
    • modules/mcp/bookstack.nix: exports type = "http" and url = config.nixosConfig.mcp.bookstack.url;.
    • Removed local secrets requirements for BookStack MCP on client hosts.
    • Deleted obsolete modules/common/bookstack-mcp-launcher.nix and removed dead mcpBaseUrl/mcpEnableWrite options in modules/services/bookstack.nix.
  • Documentation:
    • Updated secrets/README.md secret scope table.
    • Updated KiwiFS memory at pages/projects/nixos-config/mcp-modular-architecture.md.

Validation

  • nix flake check passed cleanly (all checks passed! flake check OK).
  • Verified MCP evaluation on Electra:
    • Antigravity CLI: { serverUrl = "http://10.10.0.2:8782/mcp"; }
    • OpenCode: { type = "remote"; url = "http://10.10.0.2:8782/mcp"; }
    • Pi (standardMcpServers): { url = "http://10.10.0.2:8782/mcp"; }
    • Codex CLI: ensure_http_mcp "bookstack" "http://10.10.0.2:8782/mcp"
    • MCP client sops secrets on Electra require 0 BookStack secrets.
  • Verified Vega evaluation:
    • systemd.services.bookstack-mcp loaded and bound to credentials and nebula device.
    • Port 8782 present in networking.firewall.interfaces."nebula.mesh".allowedTCPPorts.
  • Dry run builds passed for electra, vega, lena, and lyra.
## Context Ref #283 (Milestone: Nix Idioms and Architecture Hygiene) Following the migration of Forgejo MCP, KiwiFS MCP, and Navidrome MCP to hosted HTTP services over Nebula mesh on Vega, this PR moves BookStack MCP from local per-machine stdio wrapper scripts to a native Streamable HTTP daemon (`bookstack-mcp.service`) on Vega listening on `10.10.0.2:8782/mcp`. ## Changes - **Vega Service Module (`modules/services/bookstack-mcp.nix`)**: - Implements systemd service `bookstack-mcp` running `packages/bookstack-mcp` (`ttpears/bookstack-mcp` v5.1.0). - Configures `MCP_TRANSPORT=http`, `MCP_HTTP_HOST=10.10.0.2`, `MCP_HTTP_PORT=8782`, `MCP_HTTP_PATH=/mcp`, `BOOKSTACK_BASE_URL=http://127.0.0.1`, `BOOKSTACK_ENABLE_WRITE=true`. - Loads token credentials (`bookstack/api-token-id` and `bookstack/api-token-secret`) from Vega's `secrets/bookstack.yaml` via systemd `LoadCredential`. - Opens TCP 8782 on Vega's `nebula.mesh` firewall interface. - Enabled on Vega via `nixosConfig.bookstackMcp.enable = true;`. - **Fleet Client Configuration**: - `modules/common/default-config.nix`: sets `nixosConfig.mcp.bookstack.url` defaulting to `http://10.10.0.2:8782/mcp` and `enable = true`. - `modules/mcp/bookstack.nix`: exports `type = "http"` and `url = config.nixosConfig.mcp.bookstack.url;`. - Removed local secrets requirements for BookStack MCP on client hosts. - Deleted obsolete `modules/common/bookstack-mcp-launcher.nix` and removed dead `mcpBaseUrl`/`mcpEnableWrite` options in `modules/services/bookstack.nix`. - **Documentation**: - Updated `secrets/README.md` secret scope table. - Updated KiwiFS memory at `pages/projects/nixos-config/mcp-modular-architecture.md`. ## Validation - `nix flake check` passed cleanly (`all checks passed! flake check OK`). - Verified MCP evaluation on Electra: - Antigravity CLI: `{ serverUrl = "http://10.10.0.2:8782/mcp"; }` - OpenCode: `{ type = "remote"; url = "http://10.10.0.2:8782/mcp"; }` - Pi (`standardMcpServers`): `{ url = "http://10.10.0.2:8782/mcp"; }` - Codex CLI: `ensure_http_mcp "bookstack" "http://10.10.0.2:8782/mcp"` - MCP client sops secrets on Electra require 0 BookStack secrets. - Verified Vega evaluation: - `systemd.services.bookstack-mcp` loaded and bound to credentials and nebula device. - Port 8782 present in `networking.firewall.interfaces."nebula.mesh".allowedTCPPorts`. - Dry run builds passed for `electra`, `vega`, `lena`, and `lyra`.
feat(mcp): host BookStack MCP as Streamable HTTP service on Vega (#283)
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m41s
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 1m46s
24a1373a60
- Add modules/services/bookstack-mcp.nix hosting ttpears/bookstack-mcp
  over Nebula mesh at 10.10.0.2:8782/mcp.
- Load BookStack API token credentials exclusively on Vega via systemd
  LoadCredential, removing client-side secrets requirement.
- Configure nixosConfig.mcp.bookstack as a remote HTTP server across
  all mesh clients (Codex, OpenCode, Antigravity CLI, Pi).
- Remove obsolete modules/common/bookstack-mcp-launcher.nix and dead
  mcpBaseUrl/mcpEnableWrite options from modules/services/bookstack.nix.
- Update secrets/README.md and Vega configuration.
Author
Owner

Automated code review

Reviewed commit: 24a1373a60cce0493f7893cc5106903cf5f55265

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

The PR migrates the BookStack MCP integration from a local stdio launcher to a native Streamable HTTP service hosted on Vega. It introduces modules/services/bookstack-mcp.nix which runs the daemon over Nebula mesh, centralizes credential loading via systemd LoadCredential, and updates client configurations in modules/mcp/bookstack.nix and modules/common/default-config.nix to point to the new HTTP endpoint. Obsolete local launcher scripts and dead options are removed.

Blocking findings

None.

Important findings

  • Missing firewall port for localhost BookStack API access (modules/services/bookstack-mcp.nix:95; high confidence)
    The service sets BOOKSTACK_BASE_URL = cfg.bookstackUrl; with a default of http://127.0.0.1. The systemd unit does not open any firewall ports for this traffic, and it binds to the loopback interface implicitly by using 127.0.0.1.
    Impact: If the BookStack MCP service on Vega cannot reach the local BookStack application (e.g., if BookStack is bound to a different interface or if the default changes), the MCP server will fail to authenticate or fetch data, causing client-side MCP errors.
    Suggested fix: Verify that the local BookStack instance (nginx/phpfpm) is accessible on 127.0.0.1. If BookStack is configured to listen only on a specific interface, ensure cfg.bookstackUrl reflects that or adjust BookStack's binding.

Suggestions

  • Hardcoded dependency ordering in systemd unit (modules/services/bookstack-mcp.nix:85; medium confidence)
    The after list includes nginx.service and phpfpm-bookstack.service. While these are likely correct for the BookStack backend, they are hardcoded rather than derived from a service dependency or socket activation.
    Impact: If the BookStack backend services change names or are replaced by containers (e.g., Docker/Podman), this unit may fail to start correctly or start too early. It also couples the MCP service tightly to specific host-level services.
    Suggested fix: Consider using After=bookstack.service if such a composite service exists, or ensure the dependency names are robust against future refactoring of the BookStack hosting method.

  • Default listen address relies on nebula overlay IP (modules/services/bookstack-mcp.nix:35; medium confidence)
    listenAddress defaults to config.nixosConfig.nebula.overlayIp. This assumes Nebula is always active and configured when the service starts.
    Impact: If Nebula fails to start or is disabled, the service might bind to an invalid address or fail to start if the IP is not yet assigned. The wants and after clauses for nebula help, but a fallback or explicit error check might be safer.
    Suggested fix: Ensure that nebula@mesh.service is strictly required (After= and Wants= are present) and consider adding a condition to prevent starting if the Nebula interface is not up, though systemd's device dependencies often handle this.

Tests and validation

  • No configured deterministic checks.

Questions

  • Does the local BookStack instance (nginx/phpfpm) listen on 127.0.0.1 by default, or is it bound to a specific interface that might require updating cfg.bookstackUrl?
  • Are there any other hosts besides Vega that currently run the old bookstack-mcp-launcher.nix script? If so, this PR removes the client-side secrets and launcher, which might break those hosts if they are not updated to use the new HTTP endpoint.

Review limitations

  • I cannot verify the live connectivity between Vega's MCP service and the local BookStack application.
  • I cannot confirm that all client hosts (Electra, Lena, Lyra) have been successfully updated to use the new http type MCP configuration in their respective host files, as only the module changes were provided.
  • The diff does not show the full content of modules/common/default-config.nix or other host-specific configurations, so I cannot verify if any host-specific overrides conflict with the new defaults.

Diff coverage

  • hosts/vega/default.nix: reviewed — included in a context-limited batch
  • modules/common/bookstack-mcp-launcher.nix: reviewed — included in a context-limited batch
  • modules/common/default-config.nix: reviewed — included in a context-limited batch
  • modules/mcp/bookstack.nix: reviewed — included in a context-limited batch
  • modules/services/bookstack-mcp.nix: reviewed — included in a context-limited batch
  • modules/services/bookstack.nix: reviewed — included in a context-limited batch
  • secrets/README.md: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: qwen3.6:35b-a3b-q8_0
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 1
  • Previous automated review: none found
  • Findings: 3
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `24a1373a60cce0493f7893cc5106903cf5f55265` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment The PR migrates the BookStack MCP integration from a local stdio launcher to a native Streamable HTTP service hosted on Vega. It introduces `modules/services/bookstack-mcp.nix` which runs the daemon over Nebula mesh, centralizes credential loading via systemd `LoadCredential`, and updates client configurations in `modules/mcp/bookstack.nix` and `modules/common/default-config.nix` to point to the new HTTP endpoint. Obsolete local launcher scripts and dead options are removed. ### Blocking findings None. ### Important findings - **Missing firewall port for localhost BookStack API access** (modules/services/bookstack-mcp.nix:95; high confidence) The service sets `BOOKSTACK_BASE_URL = cfg.bookstackUrl;` with a default of `http://127.0.0.1`. The systemd unit does not open any firewall ports for this traffic, and it binds to the loopback interface implicitly by using `127.0.0.1`. Impact: If the BookStack MCP service on Vega cannot reach the local BookStack application (e.g., if BookStack is bound to a different interface or if the default changes), the MCP server will fail to authenticate or fetch data, causing client-side MCP errors. Suggested fix: Verify that the local BookStack instance (`nginx`/`phpfpm`) is accessible on `127.0.0.1`. If BookStack is configured to listen only on a specific interface, ensure `cfg.bookstackUrl` reflects that or adjust BookStack's binding. ### Suggestions - **Hardcoded dependency ordering in systemd unit** (modules/services/bookstack-mcp.nix:85; medium confidence) The `after` list includes `nginx.service` and `phpfpm-bookstack.service`. While these are likely correct for the BookStack backend, they are hardcoded rather than derived from a service dependency or socket activation. Impact: If the BookStack backend services change names or are replaced by containers (e.g., Docker/Podman), this unit may fail to start correctly or start too early. It also couples the MCP service tightly to specific host-level services. Suggested fix: Consider using `After=bookstack.service` if such a composite service exists, or ensure the dependency names are robust against future refactoring of the BookStack hosting method. - **Default listen address relies on nebula overlay IP** (modules/services/bookstack-mcp.nix:35; medium confidence) `listenAddress` defaults to `config.nixosConfig.nebula.overlayIp`. This assumes Nebula is always active and configured when the service starts. Impact: If Nebula fails to start or is disabled, the service might bind to an invalid address or fail to start if the IP is not yet assigned. The `wants` and `after` clauses for nebula help, but a fallback or explicit error check might be safer. Suggested fix: Ensure that `nebula@mesh.service` is strictly required (`After=` and `Wants=` are present) and consider adding a condition to prevent starting if the Nebula interface is not up, though systemd's device dependencies often handle this. ### Tests and validation - No configured deterministic checks. ### Questions - Does the local BookStack instance (`nginx`/`phpfpm`) listen on `127.0.0.1` by default, or is it bound to a specific interface that might require updating `cfg.bookstackUrl`? - Are there any other hosts besides Vega that currently run the old `bookstack-mcp-launcher.nix` script? If so, this PR removes the client-side secrets and launcher, which might break those hosts if they are not updated to use the new HTTP endpoint. ### Review limitations - I cannot verify the live connectivity between Vega's MCP service and the local BookStack application. - I cannot confirm that all client hosts (Electra, Lena, Lyra) have been successfully updated to use the new `http` type MCP configuration in their respective host files, as only the module changes were provided. - The diff does not show the full content of `modules/common/default-config.nix` or other host-specific configurations, so I cannot verify if any host-specific overrides conflict with the new defaults. ### Diff coverage - `hosts/vega/default.nix`: **reviewed** — included in a context-limited batch - `modules/common/bookstack-mcp-launcher.nix`: **reviewed** — included in a context-limited batch - `modules/common/default-config.nix`: **reviewed** — included in a context-limited batch - `modules/mcp/bookstack.nix`: **reviewed** — included in a context-limited batch - `modules/services/bookstack-mcp.nix`: **reviewed** — included in a context-limited batch - `modules/services/bookstack.nix`: **reviewed** — included in a context-limited batch - `secrets/README.md`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: qwen3.6:35b-a3b-q8_0 - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md - Commits considered: 1 - Previous automated review: none found - Findings: 3 </details>
nimmo merged commit cc67dae7d4 into main 2026-10-07 15:56:48 +01:00
nimmo deleted branch feat/issue-283-bookstack-mcp-http-service 2026-10-07 15:56:49 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/nixos-config!284
No description provided.