Feature Description
Give Foreman's coder and reviewer agents a built-in MCP (Model Context
Protocol) client so they can look things up at run time (documentation via
context7, web search via Brave) instead of relying solely on the model's
training memory. This is an epic tracking the capability across phases.
Problem Statement
Foreman agents hallucinate facts that live outside the model: exact metric
names, current API groups, library function signatures, config syntax. Recent
runs show the pattern concretely:
#409 — coder invented a vLLM metric/label (vllm:request_failure_total)
that does not exist.
#850 — coder wrote the wrong API group (inference.defilante.tech instead
of inference.llmkube.dev).
#809 — coder fabricated behavior it could have grounded against real docs.
As a Foreman operator, I want my agents to consult authoritative sources
(docs, search) during a run, so that they ground claims in real information
and stop confidently emitting wrong names/syntax.
The same instinct works well interactively: an agent with a docs/search MCP
server makes up far less because it can go read the real thing.
Proposed Solution
An in-agent MCP client, wired into the existing tool loop so MCP tools appear
as ordinary tools named mcp/<server>/<tool>, subject to the same
Agent.spec.tools whitelist, loop, and transcript as native tools. Opt-in per
agent; opt-out per Workload (for clean benchmark control runs).
apiVersion: foreman.llmkube.dev/v1alpha1
kind: Agent
spec:
role: coder
tools: [read_file, write_file, str_replace, grep, bash, fetch_issue, submit_result]
mcp:
enabled: true # per-agent gate; default off (opt-in)
callTimeout: 30s
maxResultBytes: 32768
servers:
- name: context7
transport: http
url: https://mcp.context7.com/mcp
allowedTools: ["*"]
Phases
Validation
A/B the MCP-enabled coder against the un-MCP baseline on #409 and #850:
success = the MCP-on run cites the real vLLM metric and the correct
inference.llmkube.dev API group where the MCP-off run hallucinated.
Alternatives Considered
- Prompt-only grounding (paste docs into the system prompt): stale, bloats
context, doesn't scale across topics.
- A bespoke docs/search tool instead of MCP: reinvents an ecosystem that
already exists; MCP lets us adopt maintained servers (context7, Brave) rather
than build and maintain fetchers ourselves.
- RAG index of docs: heavier infra; MCP servers already do retrieval and
stay current without us maintaining an index.
Additional Context
Priority
Willingness to Contribute
Feature Description
Give Foreman's coder and reviewer agents a built-in MCP (Model Context
Protocol) client so they can look things up at run time (documentation via
context7, web search via Brave) instead of relying solely on the model's
training memory. This is an epic tracking the capability across phases.
Problem Statement
Foreman agents hallucinate facts that live outside the model: exact metric
names, current API groups, library function signatures, config syntax. Recent
runs show the pattern concretely:
#409— coder invented a vLLM metric/label (vllm:request_failure_total)that does not exist.
#850— coder wrote the wrong API group (inference.defilante.techinsteadof
inference.llmkube.dev).#809— coder fabricated behavior it could have grounded against real docs.The same instinct works well interactively: an agent with a docs/search MCP
server makes up far less because it can go read the real thing.
Proposed Solution
An in-agent MCP client, wired into the existing tool loop so MCP tools appear
as ordinary tools named
mcp/<server>/<tool>, subject to the sameAgent.spec.toolswhitelist, loop, and transcript as native tools. Opt-in peragent; opt-out per Workload (for clean benchmark control runs).
Phases
over the official Go SDK (HTTP/streamable transport); tool adapter;
Connectentry point; CRD fields (
Agent.spec.mcp,Workload.spec.mcpEnabled,AgenticTask.spec.mcpEnabled); wiring in the tool-registry factory;secret-sourced auth headers; best-effort (a server/secret failure is logged
and skipped, never fails a run); UTF-8-safe result cap; per-call timeout.
Audit is the existing run transcript. ← this PR.
stdio→HTTP bridge (e.g. mcp-proxy / supergateway), so search-capable stdio
servers are reachable over the same HTTP path.
local stdio servers), plus streaming/large-result handling as needed.
Validation
A/B the MCP-enabled coder against the un-MCP baseline on
#409and#850:success = the MCP-on run cites the real vLLM metric and the correct
inference.llmkube.devAPI group where the MCP-off run hallucinated.Alternatives Considered
context, doesn't scale across topics.
already exists; MCP lets us adopt maintained servers (context7, Brave) rather
than build and maintain fetchers ourselves.
stay current without us maintaining an index.
Additional Context
repo); this epic captures the public-facing summary.
MCP results are treated as untrusted model-facing data; results size-capped.
Priority
Willingness to Contribute