Skip to content

fix(k8s): push-secrets writes the MCP server bearer token - #4360

Merged
dan-petty merged 3 commits into
mainfrom
fix/4354-the-mcp-server-gets-a-bearer-credential
Nov 10, 2026
Merged

dan-petty merged 3 commits into
mainfrom
fix/4354-the-mcp-server-gets-a-bearer-credential

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The MCP server refuses to start without mcp.token, and no row of the secret table made it, so the pod crash-loops. Add Secret devops/mcp-server and the stage and implement client keys of devops/devops-cli, all from one keyring entry. Wire the Deployment with a secretKeyRef. Set roadmap.mcp.url in the ConfigMap example. A person runs push-secrets after the merge.

Closes #4354

Change: openspec/changes/archive/2026-11-10-4354-push-secrets-writes-the-mcp-server/

The MCP server refuses to start without mcp.token, and no row of the secret table made it. Add Secret devops/mcp-server and the stage and implement client keys of devops/devops-cli, all from one keyring entry, wire the Deployment with a secretKeyRef, and set roadmap.mcp.url in the ConfigMap example.
Fix the tests that list the table rows and the bandit B105 finding on the variable name.
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Nov 10, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Steps for a person, after the merge

Nothing in this pull request writes a Secret. A person does these steps.

Apply order

  1. Merge. Argo CD syncs Deployment mcp-server with the new secretKeyRef. Until Secret devops/mcp-server exists, the pod waits in CreateContainerConfigError instead of the crash loop.
  2. Apply the ConfigMap from k8s/devops/configmap.example.yaml (your own copy) with the new roadmap.mcp.url. The order against the image does not matter: the image of release 0.107.0 already knows roadmap.mcp.url, and the settings model ignores unknown keys. Both client switches stay off.
  3. Push the Secrets (unlock the keyring first: devops devcontainer unlock-keyring). Look first, with no cluster request and then with read-only requests:
uv run devops k8s push-secrets --only devops/mcp-server --only devops/devops-cli --dry-run
uv run devops k8s push-secrets --only devops/mcp-server --only devops/devops-cli --plan
uv run devops k8s push-secrets --only devops/mcp-server --only devops/devops-cli

The push generates mcp_token in the keyring (token_urlsafe(32)), creates Secret devops/mcp-server, and adds the keys DEVOPS_CLI_MCP_STAGE_TOKEN and DEVOPS_CLI_MCP_IMPLEMENT_TOKEN to Secret devops/devops-cli. The changed devops-cli Secret restarts deployment/roadmap-service. A new Secret restarts nothing, so start the server pod at once (or wait for the next kubelet retry):

kubectl -n devops rollout restart deploy/mcp-server

Check

kubectl -n devops rollout status deploy/mcp-server
kubectl -n devops get pod -l app.kubernetes.io/name=mcp-server

The pod must show 1/1 Running. Then check the token without printing it. Run the port-forward in a second terminal: kubectl -n devops port-forward svc/mcp-server 8001:8001.

body='{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
# No token: expect 401
curl -s -o /dev/null -w '%{http_code}\n' -X POST -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -d "$body" http://127.0.0.1:8001/planning/mcp
# With the token: expect 200. The token goes to curl on stdin, not in an argument, and is not printed.
TOKEN=$(kubectl -n devops get secret mcp-server -o jsonpath='{.data.DEVOPS_CLI_MCP_TOKEN}' | base64 -d)
printf 'header = "Authorization: Bearer %s"\n' "$TOKEN" | curl -s -o /dev/null -w '%{http_code}\n' -K - -X POST -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -d "$body" http://127.0.0.1:8001/planning/mcp
unset TOKEN

Check that the two client keys exist, by key name only: kubectl -n devops get secret devops-cli -o json | jq -r '.data | keys[]' | grep MCP.

Not verified here

  • The live cluster: no request went to it. The CrashLoopBackOff cause is read from the pod log that the task gave, the key names of Secret devops/devops-cli, and the code.
  • Whether the probes pass under devops-default-perimeter plus mcp-server-ingress. The node probe path depends on the CNI. The probes are TCP 8001, as the container port.
  • The clients stay off (roadmap.stage.mcp, roadmap.implement.mcp). A Job of the Service cannot reach the server until fix(k8s): MCP server policies miss the Service runner Jobs #4355 is fixed.

Checks run locally

@dan-petty
dan-petty marked this pull request as ready for review November 10, 2026 13:02
@dan-petty
dan-petty merged commit 273e4c9 into main Nov 10, 2026
26 checks passed
@dan-petty
dan-petty deleted the fix/4354-the-mcp-server-gets-a-bearer-credential branch November 10, 2026 13:11
dan-petty pushed a commit that referenced this pull request Nov 10, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.107.1](v0.107.0...v0.107.1)
(2026-11-10)


### Bug Fixes

* **k8s:** push-secrets writes the MCP server bearer token
([#4360](#4360))
([273e4c9](273e4c9))
* **roadmap:** return a refused repair revision to the planner
([#4365](#4365))
([89f6be4](89f6be4))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(k8s): push-secrets writes the MCP server bearer token

1 participant