Skip to content

[cli] resume_conversation: apply per-thread mcp_servers and env to workers #1754

Closed

Description

@inference-gateway-maintainer

Summary

The desktop (PR inference-gateway/desktop#458, issue inference-gateway/desktop#415) sends two optional fields on the resume_conversation frame of the daemon binding protocol when a thread opens as a Markdown agent with an AgentMail inbox:

"mcp_servers": [{ "name": "agentmail", "url": "https://mcp.agentmail.to/mcp", "headers": { "x-api-key": "am_us_..." } }],
"env": { "AGENTMAIL_API_KEY": "am_us_..." }

The frame shape is agreed with the desktop side: mcp_servers is an array of per-thread MCP servers (name, url, static headers) and env is a map of extra worker environment variables. Today workers ignore both, so the agent's inbox exists but its chat cannot mail until the worker applies the frame.

Acceptance Criteria

  • resume_conversation accepts optional mcp_servers (name, url, headers) and env; older clients that omit them are unaffected.
  • A session worker starts its infer headless child with the frame's env merged over the daemon's environment (here AGENTMAIL_API_KEY, so the agentmail skill also works).
  • A session worker brings up the named MCP servers for that thread on top of its configured ones, headers merged over configured defaults for a reused name.
  • Subagent threads the worker opens (subagent-<parent>-<child>) carry the same per-thread MCP servers and env, so a run the agent spawns mails as the same identity.
  • The fields stay optional and are never sent on any other binding frame.

Links: desktop PR inference-gateway/desktop#458, desktop issue inference-gateway/desktop#415.

Activity

  1. edenreich commented on Nov 8, 2026

    @edenreich
    Contributor

    Closing in favour of configuration instead of a frame extension.

    Why not the frame: ThreadOptions names what a thread is (model, mode, prompt, agent), not how the tools context connects. mcp_servers with url and headers would make the desktop own a second copy of the MCP server schema, and env would reverse the rule that ThreadOptions.Env never travels on the wire (it is json:"-", filled daemon-side as teleport does). The frame is also carried by relays, teleports, A2A peers and five client-side frame structs, so a secret on it has many more readers than the one worker. The agent is already resolved on the daemon from its name, so its wiring belongs with the computer it runs on.

    Replacement:

  2. moved this from Todo to Done in 2026on Nov 8, 2026
  3. edenreich commented on Nov 8, 2026

    @edenreich
    Contributor

    Correction to the close comment: ~/.infer/auth.yaml does not reach a daemon's workers. Only the gateway and A2A supervisors read it, and ${VAR} in mcp.yaml expands from the process environment. A daemon-kind workspace gets the key from the environment its infer daemon runs with, and a Kubernetes workspace from its secrets (#1756). inference-gateway/desktop#473 is updated to match.

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

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions