Repository navigation
feat(orchestrator): give spec.mcp.servers names and headers in the pod's mcp.yaml - #324
Merged
Merged
Conversation
…to the pod's mcp.yaml
spec.mcp.hostedServers gives the pod MCP servers by URL under a name of
their own, with the headers they authenticate by. Header values reach
the ConfigMap as given, so a ${VAR} stays a reference the infer CLI in
the pod expands from its environment.
The pod's mcp.yaml is rendered and mounted whenever MCP is enabled and a
static or hosted server is listed, with or without service discovery. A
YAML encoder writes it, and every entry carries url and headers beside
the split scheme, host, port and path older CLIs read.
Closes #321
This was referenced Nov 8, 2026
…ad of a second list
spec.mcp.servers becomes a list of {name, url, headers}, the shape a
Gateway's servers take, and hostedServers is gone. Plain URL strings are
no longer accepted.
The pod's mcp.yaml carries only name, enabled, url and headers, since the
CLI reads url since v0.248.0, so the split scheme, host, port and path go
with the URL parsing behind them.
inference-gateway-releaser Bot
added a commit
that referenced
this pull request
Nov 8, 2026
## [0.33.0](v0.32.0...v0.33.0) (2026-11-08) ### ✨ Features * **gateway:** tune MCP health polling with spec.mcp.healthCheck ([#328](#328)) ([ff0867c](ff0867c)) * **orchestrator:** give spec.mcp.servers names and headers in the pod's mcp.yaml ([#324](#324)) ([56f4ff8](56f4ff8)), closes [#321](#321) * **orchestrator:** pass through binding Service annotations and labels ([#320](#320)) ([d543db8](d543db8)) ### ♻️ Improvements * **orchestrator:** export the status contract from api/v1alpha1 ([#330](#330)) ([4b5d854](4b5d854)) ### 🐛 Bug Fixes * **examples:** serve the example MCP servers over stateless MCP 2026-07-28 ([#325](#325)) ([6d34978](6d34978)), closes [#323](#323) * **samples:** make the Gateway and MCP samples pass CRD validation ([#329](#329)) ([e2e5d2a](e2e5d2a)) ### 👷 CI * **deps:** bump the gomod group with 4 updates ([#319](#319)) ([67f1bde](67f1bde))
Contributor
|
🎉 This PR is included in version 0.33.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
edenreich
added a commit
to inference-gateway/cli
that referenced
this pull request
Nov 8, 2026
…1767) ## Summary A Kubernetes workspace names the hosted MCP servers of this machine's `~/.infer/mcp.yaml` its pods get, and the adapter writes them into each new Orchestrator: ```yaml # ~/.infer/mcp.yaml servers: - name: agentmail enabled: true url: https://mcp.agentmail.to/mcp headers: x-api-key: ${AGENTMAIL_API_KEY} # ~/.infer/daemon.yaml workspaces: - name: code-reviewer kind: kubernetes namespace: agents image: ghcr.io/inference-gateway/cli:latest secrets: - code-reviewer-credentials mcp_servers: - agentmail ``` - `mcp_servers` is accepted on a Kubernetes workspace, also one placed on a cluster through `compute`. Any other kind fails validation, like `secrets`. - When a session's Orchestrator is created, each named server goes into `spec.mcp.servers` with its name, URL and headers, and `spec.mcp.enabled` is set. - `mcp.yaml` is read as written (`LoadMCPForEdit`), so a header stays a `${VAR}` reference the pod expands from its own `secrets`. A header that holds a value rather than a reference is refused with an error naming the server and the header, never the value, so no secret lands in a Kubernetes object. - A name `mcp.yaml` lacks and a container server (`run: true`) fail with an error naming the server before the Orchestrator is created. - An older operator types `spec.mcp.servers` entries as strings and refuses the create as invalid. That now also reads as the existing "may predate ..., upgrade it" error, naming v0.33.0. - The servers are read when the Orchestrator is created, like `secrets`, so running sessions keep theirs. Closes #1760 ## Draft: waiting on the operator This writes `spec.mcp.servers` entries with a `name`, a `url` and `headers`, the shape inference-gateway/operator#324 gives the field, which no operator release has yet. Until it ships, a workspace with `mcp_servers` fails its teleport with the upgrade error and every other workspace is unaffected. `newFieldsOperatorVersion` is v0.33.0, the next operator release, which `binding_service` already needs. It has to follow the release operator#324 actually lands in. ## Tests - `TestCreateGivesThePodTheNamedMCPServersAsWritten` runs `create` against a fake cluster: no servers leaves `spec.mcp` unset, named servers carry their URLs and header references (a URL built from scheme, host, port and path included), and a missing name, a container server and a header holding a value fail without creating anything. The header's variable is set in the test's environment, and its value never reaches the Orchestrator. - `TestCreateNamesTheOperatorVersionMCPServersNeed` checks the upgrade error when an older operator refuses the entries as invalid. The 422 there is modeled on the apiserver's schema error, not captured from a live older operator. - Config tests cover `mcp_servers` on a local workspace and on a workspace placed through `compute`. - `task test:e2e`, `task precommit:run` and `go test ./...` pass. The e2e suite does not run Kubernetes workspaces, and no cluster with an operator that renders hosted servers exists yet. ## Example and docs - `examples/session-teleport` gains a `k8s-mcp` workspace. It gets the demo MCP server from `examples/mcp`, deployed into the cluster with `task mcp:install`, behind an `x-api-key: ${DEMO_MCP_KEY}` header the pod fills from the `demo-mcp-credentials` Secret. `task mcp:status` runs `infer mcp status` in the pod. The walkthrough states it needs operator v0.33.0 or newer. - `docs/daemon.md` documents `mcp_servers` beside `secrets`, with the AgentMail example. ## Known gaps - A refusal fails after the session's TLS Secret exists, as a missing `secrets` entry already does. A retry reuses it. - A `${VAR}` in a server's `port` still cannot be read as written, the gap noted in #1765. ## Cross-repo impact - `operator`: inference-gateway/operator#324 renders `spec.mcp.servers` into the pod's `mcp.yaml`. This PR depends on it. - `desktop`: inference-gateway/desktop#480 writes `mcp_servers` under a workspace in `daemon.yaml`, the shape this reads. - `docs`: inference-gateway/docs#1146 documents `mcp_servers` on Kubernetes workspaces.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An Orchestrator gives its pod MCP servers by URL with the headers they authenticate by, through
spec.mcp.servers:spec.mcp.serversbecomes a list of{name, url, headers}, the shape a Gateway's servers take. It is a list map keyed onname, so the API server refuses two servers with one name.mcp.yamlis rendered and its ConfigMap mounted wheneverspec.mcp.enabledis true and a server is listed, with or without service discovery.${VAR}stays a reference the infer CLI in the pod expands from its environment, whichspec.envfills from a Secret. The operator never resolves a secret into the ConfigMap or the Orchestrator.name,enabled,urlandheaders. The splitscheme/host/port/pathand the URL parsing behind them are gone, since the CLI readsurlsince v0.248.0.sigs.k8s.io/yaml) rather than string concatenation, so a header value cannot break or inject YAML.mcp.yamlchanges, on both the Deployment and the Sandbox runtime.Closes #321
spec.mcp.serversno longer takes plain URL strings. An Orchestrator listing them fails validation until each entry has anameand aurl.url. Older images no longer find the split fields.mcp.yamlthrough discovery roll their pod once after the upgrade.Tests
buildMCPsYAMLspecs strictly decode the rendered document into the CLI's field names, so a key the CLI does not declare fails. They cover the empty document, servers with headers kept as given (a value that looks like YAML included), and the order: servers in spec order, then discovered MCPs by name with their status, TLS and fallback URLs.task test, the strict decode of every example and a cleantask generateandtask manifestspass.Verified on a cluster
On a throwaway k3d cluster with the controller from this branch's first revision and
ghcr.io/inference-gateway/cli:latest(infer v0.249.0). That revision named the listhostedServersand also wrote the split fields, the rendering is otherwise the same:<name>-mcpsConfigMap and the pod's mounted~/.infer/mcp.yamlheld the header as${MCP_TIME_API_KEY}. The Secret's value was in neither the ConfigMap nor the Orchestrator.infer mcp statusin the pod reported the server connected with its 4 tools.X-Api-Key: demo-key-from-the-secret, so the pod expands the reference from its Secret.The check used the demo server of inference-gateway/cli (
examples/mcp/mcp-server). The operator's own example servers do not connect, see the known gap below.Example and docs
examples/orchestratorliststime-directunderspec.mcp.servers: anMCPCR without a discovery label, reached by URL with anx-api-keyheader read from themcp-time-credentialsSecret throughspec.env.spec.mcp.serversbeside Orchestrator-side discovery.Known gaps
metoro-io/mcp-golang, which does not speak MCP2026-07-28, so the example's servers do not connect until [BUG] Example MCP servers don't speak MCP 2026-07-28, so neither the Gateway nor infer connects to them #323 moves them to the official go-sdk.Cross-repo impact
cli: feat(workspaces): Kubernetes workspaces give their pods MCP servers cli#1767 writesspec.mcp.serverswith this shape for Kubernetes workspaces and names v0.33.0 as the operator release it needs.docs: [DOCS] Operator Orchestrator MCP servers with names and headers in spec.mcp.servers docs#1145 documentsspec.mcp.servers.