feat(mcp): host BookStack MCP as Streamable HTTP service on Vega (#283) #284
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/nixos-config!284
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/issue-283-bookstack-mcp-http-service"
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?
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 on10.10.0.2:8782/mcp.Changes
modules/services/bookstack-mcp.nix):bookstack-mcprunningpackages/bookstack-mcp(ttpears/bookstack-mcpv5.1.0).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.bookstack/api-token-idandbookstack/api-token-secret) from Vega'ssecrets/bookstack.yamlvia systemdLoadCredential.nebula.meshfirewall interface.nixosConfig.bookstackMcp.enable = true;.modules/common/default-config.nix: setsnixosConfig.mcp.bookstack.urldefaulting tohttp://10.10.0.2:8782/mcpandenable = true.modules/mcp/bookstack.nix: exportstype = "http"andurl = config.nixosConfig.mcp.bookstack.url;.modules/common/bookstack-mcp-launcher.nixand removed deadmcpBaseUrl/mcpEnableWriteoptions inmodules/services/bookstack.nix.secrets/README.mdsecret scope table.pages/projects/nixos-config/mcp-modular-architecture.md.Validation
nix flake checkpassed cleanly (all checks passed! flake check OK).{ serverUrl = "http://10.10.0.2:8782/mcp"; }{ type = "remote"; url = "http://10.10.0.2:8782/mcp"; }standardMcpServers):{ url = "http://10.10.0.2:8782/mcp"; }ensure_http_mcp "bookstack" "http://10.10.0.2:8782/mcp"systemd.services.bookstack-mcploaded and bound to credentials and nebula device.networking.firewall.interfaces."nebula.mesh".allowedTCPPorts.electra,vega,lena, andlyra.Automated code review
Reviewed commit:
24a1373a60cce0493f7893cc5106903cf5f55265Verdict: 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.nixwhich runs the daemon over Nebula mesh, centralizes credential loading via systemdLoadCredential, and updates client configurations inmodules/mcp/bookstack.nixandmodules/common/default-config.nixto point to the new HTTP endpoint. Obsolete local launcher scripts and dead options are removed.Blocking findings
None.
Important findings
The service sets
BOOKSTACK_BASE_URL = cfg.bookstackUrl;with a default ofhttp://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 using127.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 on127.0.0.1. If BookStack is configured to listen only on a specific interface, ensurecfg.bookstackUrlreflects that or adjust BookStack's binding.Suggestions
Hardcoded dependency ordering in systemd unit (modules/services/bookstack-mcp.nix:85; medium confidence)
The
afterlist includesnginx.serviceandphpfpm-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.serviceif 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)
listenAddressdefaults toconfig.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
wantsandafterclauses for nebula help, but a fallback or explicit error check might be safer.Suggested fix: Ensure that
nebula@mesh.serviceis strictly required (After=andWants=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
Questions
nginx/phpfpm) listen on127.0.0.1by default, or is it bound to a specific interface that might require updatingcfg.bookstackUrl?bookstack-mcp-launcher.nixscript? 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
httptype MCP configuration in their respective host files, as only the module changes were provided.modules/common/default-config.nixor 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 batchmodules/common/bookstack-mcp-launcher.nix: reviewed — included in a context-limited batchmodules/common/default-config.nix: reviewed — included in a context-limited batchmodules/mcp/bookstack.nix: reviewed — included in a context-limited batchmodules/services/bookstack-mcp.nix: reviewed — included in a context-limited batchmodules/services/bookstack.nix: reviewed — included in a context-limited batchsecrets/README.md: reviewed — included in a context-limited batchReview metadata