Repository navigation
Description
Problem or Motivation
The planner, the refine investigation, the alternatives check and the implement step use tool classes that run in the job (StageTools, InvestigationTools, AlternativesTools, the implement step tools). Nothing in src/ uses an MCP client. A job cannot use a tool that its image lacks. After the issues for the role-scoped MCP server and its deployment, a job should be able to add the tools of its role from the server, without a new image.
Proposed Solution & Architectural Design
- Add a setting for the MCP server URL and a switch for each job (
roadmap.stage.mcp,roadmap.implement.mcp), off by default. - When on, the job adds the remote tools of its role to the toolset of the agent, next to its local tools, with the MCP client of pydantic-ai (
toolsets=[...], the pattern inai/knowledge_base/.../pydantic_ai.md). The job sends its ServiceAccount token as the credential and asks for its own role. - Local tools win on a name clash. A remote tool never replaces a workspace tool.
- A remote call has its own timeout, counts in the run trace (
RunTrace) and in the tool-call limit, and a failure is a tool error the model sees, not a job crash, except when the server is down at the start: then the job stops with a class that names the server. - Tests use a fake MCP server in process (an edge fake), and no network.
- Measure with the stage and implement evals (
roadmap eval stage): the same cases with and without the remote tools, so the change states its score.
Open questions for the refine step: which remote tools are worth adding first (read-only cluster reads, documentation and web search for the alternatives check, scanner results); and how the runner finds the token and the URL (the Job spec, the ConfigMap).
Target Subsystem
src/devops_cli/roadmap/stage_toolbox.py, src/devops_cli/roadmap/implement_step.py, src/devops_cli/config/settings.py, tests/roadmap/.
Existing Tool Considered
pydantic-ai already has an MCP client and the project's knowledge base documents its use. The change wires it to the settings and the traces of the jobs. Cost to build: about 120k tokens and 6 hours. To keep: the setting and its test.
Related: feat(mcp): serve role-scoped tool sets over authenticated HTTP, feat(k8s): deploy the MCP server for the roadmap jobs, #3207 (the cloud baseline, which should run before this).
Proposed design
Problem statement
The roadmap jobs can use only the tools in their image. This item adds an optional MCP client to the stage and implement jobs. A job can load the read-only tools of its role from the MCP server without a new image. Local tools keep precedence, and remote calls are bounded and traced.
Acceptance criteria
Requirement: MCP settings
The settings SHALL define roadmap.mcp.url, roadmap.stage.mcp and roadmap.implement.mcp, with both switches false by default.
Scenario: Default MCP settings
- WHEN No configuration sets the MCP URL or a switch.
- THEN Both switches load as false and the URL loads as unset.
Requirement: Remote tools join the toolset
When a job's MCP switch is true, the job MUST add its role's remote tools through the pydantic-ai MCP client.
Scenario: Stage job with MCP on
- WHEN
roadmap.stage.mcpis true and the fake MCP server offers a tool. - THEN The stage agent can call that remote tool beside its local tools.
Requirement: Local tools win
A local tool MUST win when a remote tool has the same name.
Scenario: Remote name clash
- WHEN The fake MCP server offers a tool with the name of a local tool.
- THEN The agent calls the local tool and the remote tool is not added under that name.
Requirement: Remote call bounds
Each remote MCP call MUST use roadmap.mcp.timeout_seconds and MUST count in the job's tool-call limit.
Scenario: Remote call exceeds timeout
- WHEN A fake remote tool sleeps past that timeout.
- THEN The call fails as a tool error and the run trace records the timeout.
Requirement: Remote call trace
The run trace MUST record each remote MCP call, its result and its timeout.
Scenario: Trace after a remote call
- WHEN A job with MCP on makes one remote call.
- THEN The
RunTraceholds one entry for that remote call.
Requirement: Remote failure is a tool error
A failure of a remote MCP call MUST reach the model as a tool error and MUST NOT stop the job.
Scenario: Remote tool fails
- WHEN The fake MCP server returns an error for a remote tool call.
- THEN The model receives the error text and the job continues.
Requirement: Server down at start
When the MCP server is unavailable at job start, the job MUST stop with a class that names the MCP server.
Scenario: Server unavailable at start
- WHEN The fake MCP server refuses the first connection.
- THEN The job raises
RoadmapMcpUnavailableErrorwith the server URL.
Requirement: Credential and role
The job MUST send the MCP bearer token for its role.
Scenario: Stage job authenticates
- WHEN The stage job connects with MCP on.
- THEN The fake server receives
mcp.stage_tokenand grants the stage role.
Requirement: Offline tests
The tests MUST use an in-process fake MCP server and MUST make no network request.
Scenario: Offline test run
- WHEN The roadmap MCP tests run with no network.
- THEN The fake server answers every MCP call and no socket opens.
Requirement: Eval score
The change MUST report the stage and implement eval scores with and without the remote tools.
Scenario: Eval comparison
- WHEN The stage and implement evals run with MCP off and on.
- THEN The change records both scores and the difference.
Existing Tool Considered
No alternatives check has run. pydantic-ai's MCP client is the open, maintained tool that covers MCP discovery and calls over streamable HTTP. It lacks the job switches, the per-role credential, local-tool precedence, the run-trace entry, the per-call timeout and the named start-up failure; this change adds those. Cost to build the client instead: about 120k tokens and 6 hours, plus keeping the setting and its test.
Key questions
- Which MCP client and transport should the jobs use?: Use the pydantic-ai MCP client over streamable HTTP. (best practice) [sources: src/devops_cli/config/settings.py, SECURITY.md:38]
- Chosen: pydantic-ai MCP client over streamable HTTP. The project already uses pydantic-ai for agent runs and keeps an MCP bearer token for its streamable HTTP transport.
- Rejected: Custom JSON-RPC client. It duplicates a maintained client and costs about 120k tokens and 6 hours.
- Rejected: No MCP client. A job could not add tools that its image lacks.
- Can the runner use its ServiceAccount token as the MCP credential?: No. The runner pod has no Kubernetes token, so the job needs another credential. [sources: CONTEXT.md]
- How does a job authenticate to the MCP server and name its role?: Use a per-role MCP bearer token from the secret resolver. The token names the role. (best practice) [sources: src/devops_cli/config/settings.py, CONTEXT.md]
- Chosen: Per-role MCP bearer token. The token names the role, and the runner has no Kubernetes token.
- Rejected: Shared MCP token plus role header. The server cannot trust a role that the client states.
- Rejected: ServiceAccount token.
CONTEXT.mdsays the runner pod has no Kubernetes token.
- Where does the job get the MCP URL and token?: The URL comes from
roadmap.mcp.url. The token comes from the secret resolver formcp.stage_tokenormcp.implement_token. The Service passes both to the runner Job as environment variables. (best practice) [sources: src/devops_cli/config/settings.py, docs/adr/0004-ci-is-the-authoritative-gate.md]- Chosen: Settings and secret resolver, passed as Job environment. It uses the existing settings chain and keeps the token out of a ConfigMap.
- Rejected: ConfigMap. A ConfigMap holds no secret.
- Rejected: Hard-coded in the image. A new image would be needed for a change.
- Which remote tools should the jobs add first?: Add read-only cluster reads first. (best practice) [sources: src/devops_cli/roadmap/alternatives.py:259, SECURITY.md:38]
- Chosen: Read-only cluster reads. They add capability that the image lacks and publish no secret parameter.
- Rejected: Documentation and web search.
AlternativesTools.search_webalready covers web search. - Rejected: Scanner results. No scanner result server is defined yet.
- What should happen when the MCP server is down at job start?: The job stops with a dedicated error class that names the server URL. (best practice) [sources: src/devops_cli/roadmap/stage_toolbox.py, src/devops_cli/roadmap/implement_step.py]
- Chosen: Dedicated start-up error class. It names the cause and does not look like a model or tool failure.
- Rejected: A tool error the model sees. No tool exists before the connection starts.
- Rejected: A generic job crash. It hides the server as the cause.
- How should the tests run without network?: Use an in-process fake MCP server. (best practice) [sources: tests/roadmap/test_roadmap_stage_toolbox.py]
- Chosen: In-process fake MCP server. It exercises the client and tool schema with no network.
- Rejected: Mock the client. It does not exercise the MCP protocol.
- Rejected: A real server in CI. It needs network and a deployment.
- How is the change measured?: Run the stage and implement evals on the same cases with MCP off and on. Record both scores. (best practice) [sources: src/devops_cli/roadmap/implement_eval.py]
- Chosen: Eval both settings. The body asks for the score with and without the remote tools.
- Rejected: No eval. The change would state no score.
- Which setting bounds one remote MCP call?: Add
roadmap.mcp.timeout_secondswith a default of 30 seconds. (best practice) [sources: src/devops_cli/config/settings.py]- Chosen: Dedicated
roadmap.mcp.timeout_seconds. A remote tool call has a different bound from a model call or a shell command. - Rejected: Reuse
roadmap.implement.request_timeout_seconds. That setting bounds a model call, not a tool call. - Rejected: No timeout. A dead server would hold the job.
- Chosen: Dedicated
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
Alternatives check of 2026-11-05: partly.
Tool: pydantic/pydantic-ai (https://github.com/pydantic/pydantic-ai), MIT, last activity 2026-11-05, maintained.
Activity
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.(roadmap)scope of the title gives the scope.It depends on the MCP server deployment and cloud baseline, so it is not urgent but is a planned capability.It extends the toolset of roadmap jobs without a new image, but only after the server is deployed.The body estimates about 120k tokens and 6 hours of work across settings, client wiring, and tests.Both target the MCP server for roadmap jobs, but #3220 deploys the server while this candidate wires the client side in the job code.feat(mcp): serve role-scoped tools over streamable HTTP (#3233)
devops-cli-service commentedon Nov 2, 2026
Status set to Ready at f082d5c (see proposed design in issue body).
devops-cli-service commentedon Nov 5, 2026
Alternatives check: partly
Tool: pydantic/pydantic-ai (https://github.com/pydantic/pydantic-ai)
Covers:
Lacks:
Searches run:
Sources:
Checked on 2026-11-05. A person decides what this means for the item. The check changes no label and closes no issue.
feat(roadmap): let a job call the tools of the MCP server
feat(roadmap): let a job call the tools of the MCP server
feat(roadmap): let a job call the tools of the MCP server
devops-cli-service commentedon Nov 8, 2026
Released in v0.96.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.96.0
devops-cli-service commentedon Nov 8, 2026
Live since 2026-11-08 23:37 UTC