Repository navigation
Description
Problem or Motivation
The jobs of the roadmap pipeline (planning, implementation, review) get their tools from code that runs inside the job container. The planner has nine read-only Python tools (StageTools), and the runner image carries only git, gh, curl, jq, promtool and the devops venv. A job that needs another tool (a scanner, kubectl, helm, a web search, a cluster read) has to have the tool built into its image, or it cannot use it. The owner wants MCP tool sets that depend on the job that runs, such as planning or implementation, so a job can use those functions without staging them in its own container.
devops mcp serve cannot serve this today. I read main (24ef67ac):
- It has two transports,
stdioandsse. There is no streamable HTTP. - A non-loopback bind is refused unless
--allow-remoteis given, and the server has no authentication. The only middleware areDomainGateMiddleware(advertises the eager domains) andArgumentContractMiddleware. - The set of advertised tools is process-wide state (
_HYDRATED_DOMAINSinai/mcp/server.py), so one caller'shydrate_tool_domainchanges what every caller sees. It cannot give two jobs two different tool sets. - 141 tools are exposed, and 44 of them are not read-only (
gh issues create/edit/close,k8s deploy-stack,k8s teardown-stack,argo fleet sync,docker sign, among others).
Proposed Solution & Architectural Design
- Role-scoped tool sets. Name the sets
planning,implementation,reviewandops. Each is a list of tools fromCONST_MCP_EXPOSURE_TABLE, with theread_onlyflag deciding what a role may hold.planningandreviewhold read-only tools only.opsis the only set with the mutating tools, and no job role gets it. The set is chosen per connection and not per process, for example one mounted path for each role (/planning,/implementation), so two jobs never share state. - Authentication. A request carries the projected ServiceAccount token of the calling pod (an audience set for the MCP server). The server checks it with the Kubernetes
TokenReviewAPI, and maps the ServiceAccount and the Job labels to a role. No shared secret is stored, and a token cannot be reused for another role. - Transport. Add streamable HTTP next to
stdioandsse.ssekeeps its loopback rule. The remote transport refuses to start without an auth setting. - Keep workspace tools in the job. A tool that reads or edits the job's checkout (the planner's
read_file,search_code,repo_map, the implement step's edit and command tools) must stay in the job, because the files are in the job's container. Moving those tools to a server would need the repository there, and adds a network hop to each call. Only tools that do not depend on the job's files move: scanners, cluster reads, documentation and web search, GitHub reads. - Audit and limits. Each call is logged with the role and the Job name, has a timeout from the exposure table, and counts against the job's tool-call limit.
Open questions for the refine step: whether FastMCP's mount or its auth providers cover the per-connection role and the TokenReview check, or this needs custom middleware; whether the roles should be tags on the exposure table or a separate table; and how a tool that needs a binary (kubectl) runs on the server, which is the manifest issue.
Target Subsystem
src/devops_cli/ai/mcp/server.py, src/devops_cli/commands/mcp.py, src/devops_cli/config/constants.py (CONST_MCP_EXPOSURE_TABLE), SECURITY.md (rule 11 on MCP tool inputs).
Existing Tool Considered
FastMCP supports authentication providers, server composition (mount), and the streamable HTTP transport, so most of the work should use it. The Kubernetes TokenReview API checks a ServiceAccount token with no secret. Cost to build: about 200k tokens and 10 hours. To keep: the role table, which changes when a tool is added. This adds a network listener, so a person must approve the design before it is built.
Related: the issues for the MCP deployment and for the client in the jobs; #3204 (scaffold, which adds a command to the MCP lists); #3066.
Activity
dan-petty commentedon Nov 2, 2026
Design notes from the owner's questions, for the refine step. They are proposals, not decisions.
1. Put LiteLLM in front of the MCP server. The cluster runs LiteLLM Proxy (
k8s/llm/gateway/deployment.yaml, imageghcr.io/berriai/litellm:v1.103.0), and the gateway config has no MCP section today. From the LiteLLM documentation as I know it (not checked against v1.103.0), the proxy has an MCP gateway: MCP servers are listed in its config, a virtual key can be limited to some servers or tools, and the proxy has budgets and logs for each key. If that holds in the pinned version, the layers would be:The refine step must check in the v1.103.0 documentation: the endpoint and transport, the per-key tool list, and how a client passes an upstream credential. LiteLLM keys are not Kubernetes identities, so the server cannot use
TokenReviewfor a caller that comes through LiteLLM.2. No secret as a tool parameter. The model writes the arguments of a tool call, so a secret in a parameter passes through the model context. It would reach the prompt, the provider, the LLM cache, the run trace (
RunTrace, and the trace comment planned in #3032), and the model could send it to another tool.SECURITY.mdrule 11 already treats a host or URL given by a model as untrusted. Carry the credential outside the model's view instead:headers; LiteLLM can pass a header on to the upstream server, to verify), never in the tool schema;credential_refthat the server resolves from a secret store (Vault is already integrated). It never takes the value.These two items are separate: who may call a tool (authentication and role), and as whom the tool acts on the systems it calls (the delegated credential).
Generated by Claude Code
dan-petty commentedon Nov 2, 2026
Decisions recorded from the owner, 2026-11-02. They replace the
TokenReviewproposal in the body of this issue:TokenReview.credential_refresolved on the server. A rule is added toSECURITY.mdand a test guards the tool schemas (see the new issue for it).opsrole stays off. No job role gets the mutating tools.Work order for this issue: (a) the refine step checks LiteLLM v1.103.0 for the MCP gateway (endpoint and transport, per-key tool list, header passthrough) from the pinned image's source; (b) role-scoped tool sets per connection and a bearer-token check on the server, with the remote transport refusing to start without a token; (c) streamable HTTP. LiteLLM-specific configuration (the
mcp_serverssection, the key minting by the Service) belongs to the deployment issue #3220.Generated by Claude Code
devops-cli-service commentedon Nov 2, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(mcp)scope of the title gives the scope.It is a prerequisite for #3220 and #3221 but is not a security fix or a production outage.It is the server-side foundation that lets roadmap jobs use external tools without staging them in their images.The body estimates about 200k tokens and 10 hours across transport, auth, role scoping, and audit.Both concern the MCP server for roadmap jobs, but the candidate builds the server code while #3220 adds the k8s deployment manifests for it.