Skip to content

Add alwaysLoad to AgentConfig MCP servers - #1852

Open
knechtionscoding wants to merge 1 commit into
kelos-dev:mainfrom
datagravity-ai:hans/mcp-always-load
Open

knechtionscoding wants to merge 1 commit into
kelos-dev:mainfrom
datagravity-ai:hans/mcp-always-load

Conversation

@knechtionscoding

@knechtionscoding knechtionscoding commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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.

Written for commit 7de85c4. Summary will update on new commits.

View guided diff

Claude Code defers MCP tool definitions behind tool search and loads a
server's tools on demand. An agent that uses one server on nearly every
run pays a ToolSearch call for it, and on some providers that load
breaks the prompt cache for the rest of the run.

MCPServerSpec gains an optional alwaysLoad. When true it is written into
the server's entry in KELOS_MCP_SERVERS, and Claude Code loads that
server's tools at session start while other servers stay deferred.
Codex builds its config from named fields, so it never sees the key.

v1alpha1 is still served and has no alwaysLoad, 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, as the other v1alpha2-only MCP and skills
settings do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added kind/api Categorizes issue or PR as related to API changes needs-triage needs-priority needs-actor release-note labels Oct 28, 2026
@knechtionscoding
knechtionscoding marked this pull request as ready for review October 28, 2026 10:35

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 8 files

You’re at about 96% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

View guided diff | Re-trigger cubic

This branch is waiting to be deployed

1 waiting deployment
ok-to-test — 7de85c4d Waiting Oct 28, 2026 by knechtionscoding via fork-e2e / e2e-with-environment #1978
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/api Categorizes issue or PR as related to API changes needs-actor needs-priority needs-triage release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant