Repository navigation
Description
Part of #4405.
Add AgentPluginsFormat.load_mcp_config() — read a root-level mcp.json (no dot) with Agent Plugins' variable-expansion semantics.
Blocked on open questions
#4405's Open Questions #6 (PLUGIN_DATA location/lifecycle) and #7 (MCPServer.headers typed as SecretStr, conflicting with plugin-declared headers being literal non-secret data) should be resolved before starting this one.
Current state (verified against main)
The Claude Code loader only reads .mcp.json (format/claude_code.py:118). The existing variable expander (expand_variable_references, skills/utils.py:39-122) recurses into dict keys and falls back to os.environ (check_env=True, utils.py:210) — broader than what the spec allows, so this needs new, narrowly-scoped expansion code rather than an extension of the shared expander. MCPServer.headers is dict[str, SecretStr] (mcp/config.py:512).
Scope
- Vendor
mcp.schema.json; validate the closed top-level document and each server entry independently. - Support
stdioandstreamable-httptransports (MCPTransportalready includes both as literals —mcp/config.py:493);sseis optional per open question Setup Makefile, Pre-commit, and initial Tool and Schema definition #1. - Implement
${PLUGIN_ROOT}/${PLUGIN_DATA}expansion: textual, single-pass, non-recursive, restricted toargs/envvalues /cwdonly — nevercommand, env keys, remote URLs, or headers. Client-controlled values injected last, non-overridable by the plugin. - Define and implement
PLUGIN_DATA: a dedicated writable directory per plugin, persisted across updates. - Resolve the
MCPServer.headers-as-SecretStrconflict — plugin-declared headers need to stay literal/visible, not secrets. - Remote URL/header validation: absolute HTTP(S), no user-info/fragments, non-loopback must be HTTPS, headers are literal (no credentials).
- Failure isolation: invalid
mcp.jsondisables MCP for the plugin only; an invalid/unavailable individual server disables only that entry.
Refs
Agent Plugins specification
This specification context was added by an OpenHands AI agent on behalf of @enyst.
Activity
feat(plugin): add the Agent Plugins mcp.json loader