Skip to content

feat(k8s): deploy the MCP server for the roadmap jobs #3220

Closed

Description

@dan-petty

Problem or Motivation

There is no manifest for an MCP server. k8s/ and tf/ hold none, and the service image holds only git, gh, Node and openspec, so most MCP tools would fail in it (kubectl, helm, the scanners and bubblewrap are not there). The issue feat(mcp): serve role-scoped tool sets over authenticated HTTP adds the server side: role-scoped tool sets, streamable HTTP and token authentication. A cluster deployment has to be made so that the jobs can reach it, and so that nothing else can.

Proposed Solution & Architectural Design

  • Add k8s/devops/mcp-server/ next to k8s/devops/roadmap-service/: a Deployment, a Service, a ServiceAccount, a Role with the least rights the enabled tools need, and a NetworkPolicy. The NetworkPolicy allows ingress only from the pods of the roadmap runner Jobs and the roadmap Service (label selectors), and the egress it needs. It is the control that stops other pods in the cluster from calling the server.
  • Add an image target for the server with the tools of the enabled roles (kubectl, helm and the scanners, pinned and scanned like the runner image, see the Dockerfile runner target). It is a new target, so the roadmap service image stays small.
  • Read-only roles first. The ops role, with the mutating tools, is off by default and has its own switch in the config.
  • Settings and an admission policy: the server pod runs non-root with a read-only root filesystem, like the roadmap Service, and the Role is checked by a test the way role.yaml is.
  • Add the telemetry the other Services have (OTEL_SERVICE_NAME), and an alert for the server being down.
  • Document the rollout order in k8s/README.md: the server first, then the jobs that call it. A job that calls a server that is not up must fail with a clear class (see the failure taxonomy of feat(roadmap): a failure taxonomy, and one action for each class #3065) and not hang.

Open questions for the refine step: one replica or more (SSE sessions are stateful; streamable HTTP can be stateless); the cost in image size of the scanners; and whether kubectl-based tools should run with the server's ServiceAccount or with a per-call identity.

Target Subsystem

k8s/devops/mcp-server/, Dockerfile, .github/workflows/ (the image build and scan), k8s/README.md.

Existing Tool Considered

The roadmap Service manifests in k8s/devops/roadmap-service/ are the pattern to copy (Deployment, NetworkPolicy, Role, admission policy). No other project in the cluster serves MCP. Cost to build: about 150k tokens and 8 hours, plus the cluster checks that need kubectl, which this sandbox lacks. A person has to apply the manifests.

Related: feat(mcp): serve role-scoped tool sets over authenticated HTTP, and the issue for the MCP client in the jobs.

Alternatives check of 2026-11-05: partly.
Tool: stacklok/toolhive (https://github.com/stacklok/toolhive), Apache-2.0, last activity 2026-11-04, maintained.

Proposed design

Problem statement

The repository has no image target for the MCP server, so a deployment cannot run the pinned scanners, kubectl or helm. The live Deployment also waits on the MCP server entrypoint from the related issue. This change adds the mcp-server image target and its gate. It defers the live manifest set until the MCP server implementation lands.

Acceptance criteria

Requirement: MCP server image target

The Dockerfile SHALL add an mcp-server target that inherits the runner stage.

Scenario: Target inherits runner

  • WHEN A test parses the stages of the Dockerfile.
  • THEN The stage mcp-server exists and its FROM line names runner.

Requirement: Pinned cluster tools

The mcp-server target SHALL install kubectl and helm at the versions that tools.lock pins.

Scenario: Tool pins match

  • WHEN The image build runs the tool version check.
  • THEN Each installed version equals its pin, and a mismatch fails the build and names the tool.

Requirement: Runtime user and directories

The mcp-server target SHALL run as user 1000:1000 and SHALL keep the data and uv cache directories under HOME.

Scenario: Runtime user is non-root

  • WHEN A test reads the USER and ENV lines of the mcp-server stage.
  • THEN USER is 1000:1000 and DEVOPS_CLI_DATA_DIR and UV_CACHE_DIR start with HOME.

Requirement: MCP server image gate

The mcp-server image SHALL pass the HIGH and CRITICAL vulnerability scan and SHALL stay at or below 3,000,000,000 bytes.

Scenario: Image gate passes

  • WHEN CI builds the mcp-server image.
  • THEN trivy image exits 0 and docker image inspect reports at most 3,000,000,000 bytes.

Requirement: Default Docker build stays on service

The service stage SHALL stay the last stage of the Dockerfile.

Scenario: Service stage is last

  • WHEN A test lists the stages of the Dockerfile.
  • THEN The last stage is service and mcp-server comes before it.

Existing Tool Considered

ToolHive (https://github.com/stacklok/toolhive, Apache-2.0, maintained) partly covers the deployment. It deploys an MCP server from an MCPServer resource, creates a ServiceAccount and RoleBinding, customises the pod template and documents NetworkPolicy restrictions. It lacks the project image target, the plain kustomize manifest set of Deployment, Service, ServiceAccount, Role and NetworkPolicy, the label-selector ingress restriction to devops-cli-job and roadmap-service pods, OTEL_SERVICE_NAME, the McpServerDown alert, the k8s/README.md rollout order and failure class, and it runs a proxy pod per server. Cost to build the image target and the deferred plain manifests: about 150k tokens and 8 hours, plus cluster checks that need kubectl; a person applies the manifests.

Key questions

  • Does the repository hold an MCP server manifest set or image target at the staging commit?: No. k8s/README.md lists no mcp-server directory, and the Dockerfile has no mcp-server target. The related MCP server issue supplies the entrypoint. [sources: k8s/README.md]
  • Which parts can this change deliver while the MCP server entrypoint is absent?: Add the image target and its gate in this change. Defer the live manifest set, the NetworkPolicy, the Role, the telemetry, the alert and the rollout documentation to a new issue. The new issue waits on the MCP server entrypoint. (best practice) [sources: k8s/README.md, tests/invariants/test_runner_image.py]
    • Chosen: Image target only. The target builds and passes its gate without a server entrypoint.
    • Rejected: Whole deployment now. The Deployment would start a container with no server process.
    • Rejected: Manifests with a placeholder command. Static tests would pass, but the pod would crash and the gate would hide the missing entrypoint.
  • Which tools go into the MCP server image?: Inherit the runner stage and add kubectl and helm at the pins in tools.lock. The runner stage already holds the pinned scanners and dev tools, so the image reuses them and stays under the 3,000,000,000-byte gate. (best practice) [sources: k8s/README.md, tests/invariants/test_runner_image.py]
    • Chosen: Inherit runner and add kubectl and helm. This reuses the pinned scanners and keeps one set of tool pins.
    • Rejected: Start from builder and install each scanner. This duplicates the scanner pins and the build logic.
    • Rejected: Start from the service image. The service image stays small and lacks the scanners.
  • Should this change use ToolHive for the MCP server image or deployment?: Use the project image target for this change. ToolHive partly covers the deployment, but it has no image target and runs a proxy pod. The deferred manifest issue keeps the plain kustomize manifest set because ToolHive lacks the tested plain manifest set and project telemetry. (best practice) [sources: k8s/README.md]
    • Chosen: Project image target and plain manifests. This keeps the project image, the tested manifest set, the telemetry and the alert.
    • Rejected: ToolHive operator. It adds an operator and a CRD, and it does not produce the plain manifest set that the tests read.
    • Rejected: ToolHive proxy only. It runs a proxy pod and does not carry the project scanners or telemetry.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    scope/k8s
    status/new
    value/medium
    effort/medium
    on Nov 2, 2026
  2. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P2-Medium. It is a required dependency for the MCP server to be reachable by jobs, but it is not a security fix or a blocking defect.
    • Value: Medium. It makes the MCP server reachable by roadmap jobs and restricts access to authorised pods only.
    • Effort: Medium. The body estimates about 8 hours of work plus cluster checks, covering manifests, a Dockerfile target, and docs.
    • Related: feat(k8s): the roadmap service runs in the cluster's devops namespace, reachable from outside only on /webhooks/github #1083, which asks for a different change. Both deploy a service in the devops namespace, but #1083 deploys the roadmap service while this item deploys the MCP server.
  3. added
    status/ready
    and removed
    status/new
    on Nov 2, 2026
  4. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 4571d5f (see proposed design in issue body).

  5. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    The stage job returned the item to New. The premise of the issue does not hold at the staging commit, so the job planned no change and opened no pull request.

    Evidence:

    Placeholder

  6. added
    status/new
    and removed
    status/ready
    on Nov 2, 2026
  7. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Tool: stacklok/toolhive (https://github.com/stacklok/toolhive)

    • License: Apache-2.0
    • Last activity: 2026-11-04
    • Maintained: yes

    Covers:

    • Deploys an MCP server into a Kubernetes cluster from an MCPServer resource, and the operator creates the Deployment that runs it plus the Service in front of it.
    • Creates the server's ServiceAccount and the RoleBinding that binds it to a Role, so the server gets a scoped Kubernetes identity instead of running with none.
    • Lets the MCP server pod be customised through podTemplateSpec (security context, resources) and documents restricting which pods and namespaces may reach the server with NetworkPolicy.
    • Supports authenticated MCP endpoints and tool permission profiles, which fits serving role-scoped, read-only tool sets to the roadmap jobs.

    Lacks:

    • No image target: the mcp-server image with kubectl, helm and the scanners still has to be added to the project Dockerfile.
    • Requires the ToolHive operator and its MCPServer CRD in the cluster; it does not produce the plain kustomize manifest set (Deployment, Service, ServiceAccount, Role, NetworkPolicy) that the acceptance criteria test reads.
    • The cross-namespace ingress NetworkPolicy is written by hand from the documented example; the operator does not generate the label-selector ingress restriction to devops-cli-job and roadmap-service pods.
    • No project telemetry wiring (OTEL_SERVICE_NAME), no McpServerDown alert rule, and no k8s/README rollout order or failure class for jobs that cannot reach the server.
    • Adds a proxy pod per server rather than running the project's server container directly, which changes the Deployment shape the issue describes.

    Searches run:

    • ToolHive Kubernetes operator deploy MCP server manifests network policy RBAC
    • helm chart deploy MCP server kubernetes with token authentication
    • ToolHive MCPServer custom resource networkPolicy egress permissionProfile reference
    • toolhive operator MCPServer networkPolicy ingress allow from pods docs.stacklok.com

    Sources:

    Checked on 2026-11-05. A person decides what this means for the item. The check changes no label and closes no issue.

  8. added
    status/ready
    and removed
    status/new
    on Nov 5, 2026
  9. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at d254410 (see proposed design in issue body).

    Moved to new items: #3600.

  10. added
    status/in-progress
    and removed
    status/ready
    on Nov 8, 2026
  11. added
    status/in-review
    and removed
    status/in-progress
    on Nov 8, 2026
  12. removed
    status/in-review
    on Nov 8, 2026
  13. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 22:36 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/k8stype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions