Add alwaysLoad to AgentConfig MCP servers

KN
3d ago
+204-12

What type of PR is this?

/kind api

What this PR does / why we need it:

Claude Code defers MCP tool definitions behind tool search and only loads a server's tools when the agent asks for them with ToolSearch. An agent that uses one server on nearly every run pays a ToolSearch call for it every time, and with some model providers that load also invalidates the prompt cache for the rest of the run.

MCPServerSpec gets an optional alwaysLoad field. When it is true, the server's entry in KELOS_MCP_SERVERS includes "alwaysLoad": true, and Claude Code loads that server's tools at session start. Other servers stay deferred. Codex builds its config from named fields, so it never sees the key. Cursor and Gemini copy each server entry into their own config unchanged.

The field exists only in v1alpha2. v1alpha1 is still served, so conversion to v1alpha1 records each flagged server in the kelos.dev/v1alpha2-mcp-always-load annotation, and conversion back restores it by index and name. This works the same way as the other v1alpha2-only MCP and skills settings. Without it, reading and saving an AgentConfig through v1alpha1 would drop the flag.

Which issue(s) this PR is related to:

N/A

Special notes for your reviewer:

N/A

Does this PR introduce a user-facing change?

AgentConfig MCP servers accept `alwaysLoad`. When `true`, Claude Code loads that server's tools at session start instead of deferring them behind tool search.

Summary by cubic

Adds an optional alwaysLoad field to MCP servers in AgentConfig so Claude Code loads a flagged server's tools at session start instead of deferring them behind tool search. v1alpha1 conversion records the flag in the kelos.dev/v1alpha2-mcp-always-load annotation and restores it by index and name; Codex builds its config from named fields and never sees the key.