Skip to content

[FEATURE] Orchestrator: render static MCP servers with url and headers into the pod's mcp.yaml #321

Description

@edenreich

Summary

An Orchestrator cannot give its pod a hosted MCP server such as AgentMail (https://mcp.agentmail.to/mcp, authenticated by an x-api-key header). Three things in how the operator renders the pod's mcp.yaml stand in the way.

  1. Static servers never reach the pod without service discovery. reconcileMCPsConfigMap returns early unless spec.mcp.serviceDiscovery.enabled is true, and buildOrchestratorPodTemplate mounts the <orchestrator>-mcps ConfigMap at /home/infer/.infer/mcp.yaml under the same condition. spec.mcp.servers, which the CRD describes as being for externally hosted servers, does nothing on its own. Static A2A agents do not have this gap, because they also reach the pod through INFER_A2A_AGENTS. MCP has no such variable.
  2. A static server is a bare URL. buildMCPsYAML names each one static-mcp-<n> and writes no headers, so a server that authenticates by header cannot be configured.
  3. The renderer splits every URL into scheme/host/port/path, because the CLI's server entry had no url field. [FEATURE] Hosted MCP servers: url and headers in mcp.yaml cli#1755 (PR feat(mcp): reach hosted servers through a url and headers in mcp.yaml cli#1757) adds url and headers to the CLI's mcp.yaml, and expands ${VAR} in it from the process environment.

The delivery path itself is right: a ConfigMap mounted over the pod's mcp.yaml, with a hash annotation that rolls the pod when it changes. A header value written as ${AGENTMAIL_API_KEY} stays a reference in the ConfigMap. The CLI in the pod expands it from its environment, which a workspace's Secret fills through spec.env and secretKeyRef (inference-gateway/cli#1756, PR inference-gateway/cli#1758). That already works, because spec.env passes through to the container unchanged. No secret ever sits in the ConfigMap or the Orchestrator.

Proposed shape: keep spec.mcp.servers as plain URL strings for compatibility, and add a list of named servers with headers beside it.

spec:
  mcp:
    enabled: true
    hostedServers:
      - name: agentmail
        url: https://mcp.agentmail.to/mcp
        headers:
          x-api-key: ${AGENTMAIL_API_KEY}

This is the operator half of inference-gateway/desktop#476, where agents pick the MCP servers they use and a server can be given to an agent's own Kubernetes computer. The CLI half, a workspace passing its MCP servers into its Orchestrator, follows from it.

Acceptance Criteria

  • Static servers render into the pod's mcp.yaml, and its ConfigMap is mounted, whenever spec.mcp.enabled is true and the Orchestrator lists a static server, with or without service discovery.
  • A static server can carry a name, a URL and headers. spec.mcp.servers keeps accepting plain URL strings, so existing Orchestrators keep working.
  • Header values reach the ConfigMap exactly as given, so ${VAR} stays a reference the CLI expands from the pod's environment. The operator never resolves a secret into the ConfigMap.
  • Each entry is written with url and headers, as the CLI reads them since cli#1757, and also with the split scheme/host/port/path, so older CLI images keep connecting.
  • The document is rendered with a YAML encoder rather than string concatenation, so a header value cannot break or inject YAML.
  • The pod still rolls when the rendered mcp.yaml changes, on both the Deployment and the Sandbox runtime.
  • Tests cover an Orchestrator with static servers and no discovery, a server with headers, the plain string form, and the rendered document parsing as the CLI's mcp.yaml.

Activity

  1. added
    enhancement
    on Nov 8, 2026
  2. added theissue type on Nov 8, 2026
  3. moved this to Todo in 2026on Nov 8, 2026
  4. edenreich commented on Nov 8, 2026

    @edenreich
    ContributorAuthor

    CLI half filed: inference-gateway/cli#1760. A Kubernetes workspace names servers from the daemon's mcp.yaml and writes them into each new Orchestrator's spec.mcp, forwarding header values as ${VAR} references.

  5. moved this from Todo to In progress in 2026on Nov 8, 2026
  6. moved this from In progress to QA in 2026on Nov 8, 2026
  7. moved this from QA to Done in 2026on Nov 8, 2026
  8. inference-gateway-releaser commented on Nov 8, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.33.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

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

    enhancementreleased

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions