Skip to content

fix(mcp): Serve alb-mcp and network-mcp over TLS - #901

Merged
yahyafakhroji merged 2 commits into
mainfrom
fix/mcp-serve-tls
Nov 11, 2026
Merged

yahyafakhroji merged 2 commits into
mainfrom
fix/mcp-serve-tls

Conversation

@yahyafakhroji

Copy link
Copy Markdown
Contributor

Problem
Since milo-os/assistant#169 the assistant refuses to send a user's token over plain http. alb-mcp and network-mcp only served http on port 8080, so on staging the assistant drops the ALB and network tools and logs credential_plaintext_refused for both servers.

Solution
internal/mcpserver gains one TLS option that both binaries use: --tls-cert-file and --tls-key-file turn on https, and the certificate reloads when cert-manager rotates it. Without the flags the servers still serve http for local dev and e2e, and setting only one fails at startup. Both deployments mount a certificate from the datum-control-plane ClusterIssuer through the cert-manager CSI driver and probe over HTTPS, and all 21 URLs in the two capability documents now use https. The assistant already trusts that CA (datum-cloud/infra#8826).

Refs milo-os/assistant#169

alb-mcp and network-mcp answered plain HTTP only, and the assistant now
refuses to send a caller's bearer token to an http endpoint, so it drops
both tool sets. The servers take --tls-cert-file and --tls-key-file (or
ALB_MCP_TLS_* and NETWORK_MCP_TLS_*) and serve HTTPS with a watched
certificate, so a renewal is picked up without a restart. With neither
set they serve plain HTTP as before, and with only one they refuse to
start.
The two MCP deployments served plain HTTP and their capability documents
advertised http URLs, which the assistant no longer forwards a caller's
token to. Each deployment now mounts a datum-control-plane certificate
through the cert-manager CSI driver, passes it to the server and probes
over HTTPS, and every endpoint, knowledge and runbook URL is https.
@yahyafakhroji
yahyafakhroji requested a review from a team as a code owner November 11, 2026 08:56
@yahyafakhroji yahyafakhroji self-assigned this Nov 11, 2026

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve.

alb-mcp and network-mcp both serve https through one shared mcpserver.TLSOptions, and the cert names match the prefixed Service hosts the capability configs now use.

  • SANs: the CSI dns-names are network-services-operator-{alb,network}-mcp[.datum-system.svc[.cluster.local]], matching the https hosts in both capability configs and the prefixed names infra's identity-forwarding patch already lists. The README correctly warns that a different namePrefix or namespace must patch the volume attributes, since kustomize does not rewrite them.
  • Trust: the assistant uses the system root pool plus SSL_CERT_FILE from datum-control-plane-system-bundle (infra#8826, merged), which holds the datum-control-plane CA. The NSO manager in apps/network-services-operator/control-plane/base already uses the same CSI driver and issuer, so both exist where these run.
  • Probes are HTTPS on the unchanged port 8080, so networkpolicy-alb-mcp.yaml and networkpolicy-network-mcp.yaml in infra are unaffected. Pods run as 65532, matching fs-group.
  • Reload and shutdown: certwatcher supplies GetCertificate, a failed re-read keeps the previous cert, and the errgroup cancels the watcher and shuts the server down (20s drain, then Close). tls_test.go covers rotation, plain-HTTP fallback, half-config refusal and unreadable-cert failure.

Follow-ups:

  • Nothing checks that the CSI dns-names agree with the URLs in the assistant configs; add a render-time test so a rename cannot drift.
  • During rollout the assistant config and deployment ship in one bundle, so expect a brief connect failure until the pods mount their certs.

@yahyafakhroji
yahyafakhroji merged commit a888a28 into main Nov 11, 2026
11 checks passed
@yahyafakhroji
yahyafakhroji deleted the fix/mcp-serve-tls branch November 11, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants