Skip to content

feat(agent): load plugin mcp.json and reload registered MCP sources - #32272

Draft
f0ssel wants to merge 10 commits into
garrett/agent-plugins/08-mcp-same-origin-headersfrom
garrett/agent-plugins/09-plugin-mcp-config
Draft

f0ssel wants to merge 10 commits into
garrett/agent-plugins/08-mcp-same-origin-headersfrom
garrett/agent-plugins/09-plugin-mcp-config

Conversation

@f0ssel

@f0ssel f0ssel commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

ParseSource reads a legacy .mcp.json or a plugin mcp.json (through os.Root at the plugin root) and validates plugin entries individually, so one bad server doesn't take down its siblings. Plugin stdio servers resolve command/cwd inside the plugin and get PLUGIN_ROOT/PLUGIN_DATA; HTTP servers require HTTPS unless loopback.

The Manager now reloads from sources registered with SetSources (ReloadCurrent, config-change reloads, and Reconnect all call it), retrying while the sources keep changing. A plugin source can carry a LoadError, PluginSource builds a plugin's source with its data directory, and a plugin server whose <plugin>/<server> source matches a legacy server name is rejected. The agent registers its .mcp.json files as the sources; #32274 adds plugin sources.

Part 2 of the #29325 split, with the agentmcp API changes from #29326 folded in so the package changes once. Tests follow in the next PR.

Stack (base main, replaces #29321–#30577):

PR Title Size
#32264 feat: carry Agent Plugin fields through context snapshots +542/-213
#32265 feat(agent/agentcontext): discover and validate Agent Plugins manifests +1951/-74
#32296 feat(agent/agentcontext): load skills bundled in Agent Plugins +653/-19
#32266 feat(agent): enable Agent Plugins discovery from the manifest +988/-79
#32267 feat(coderd/x): add plugin skill source and alias grammar +138/-32
#32268 feat: add plugin skill and plugin context resource types +295/-161
#32269 feat(coderd): serve plugin skills in chatd +1338/-386
#32270 feat(agent/x/agentmcp): accept streamable-http MCP type, add plugin data dir helper +92/-0
#32271 feat(agent/x/agentmcp): add a same-origin header HTTP client +547/-4
👉 #32272 feat(agent): load plugin mcp.json and reload registered MCP sources +1262/-228
#32273 test(agent/x/agentmcp): cover plugin mcp.json parsing, reloads, isolation, and env +2044/-2
#32274 feat: run plugin MCP servers discovered by agentcontext +851/-26
#32275 feat(site/src): render Agent Plugin context +1349/-240

Generated by Claude Code

ParseSource reads a legacy .mcp.json or an Agent Plugins mcp.json named
by a ConfigSource. A plugin mcp.json is read through os.Root at the
plugin root and validated per entry: an invalid server is returned with
its error while its siblings still load, and a bad file, scope, or top
level fails the whole plugin. Plugin stdio servers resolve command and
cwd inside the plugin, get PLUGIN_ROOT and PLUGIN_DATA, and expand
${PLUGIN_ROOT} and ${PLUGIN_DATA} in args, env values, and cwd. Plugin
HTTP servers require HTTPS unless the host is loopback and send their
headers through the same-origin client.

Manager.ReloadSources takes ConfigSources, keeps Reload for plain
paths, rejects server names shared across files with an error on the
later entry, and reconnects a server when its plugin scope changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VpiVZBgFqiSdRKrH8dPSPT
f0ssel and others added 4 commits November 16, 2026 11:42
The Manager computes its config sources from a function registered with
SetSources. ReloadCurrent and config-change reloads call it on every
attempt and retry while the sources keep changing; Reconnect reloads
the current sources once the first reload settles. A source position
change or a ConfigSource.LoadError change reloads, a plugin source with
a LoadError reports it instead of loading, and a plugin server whose
<plugin>/<server> source is a legacy server's name is rejected.
PluginSource builds a plugin's mcp.json source with its data directory.

The agent registers its .mcp.json files as the sources and reloads with
ReloadCurrent. The external ParseSource tests move to the test change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VpiVZBgFqiSdRKrH8dPSPT
@f0ssel f0ssel changed the title feat(agent/x/agentmcp): load plugin mcp.json with per-entry isolation feat(agent): load plugin mcp.json and reload registered MCP sources Nov 16, 2026
@f0ssel f0ssel self-assigned this Nov 16, 2026
@f0ssel
f0ssel added this pull request to stack #32278 November 16, 2026 18:37
@f0ssel
f0ssel force-pushed the garrett/agent-plugins/09-plugin-mcp-config branch from db61e5a to d01df9a Compare November 16, 2026 23:25
f0ssel and others added 2 commits November 16, 2026 22:12
@f0ssel f0ssel assigned garrettatcoder and unassigned f0ssel Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants