Skip to content

Agent Plugins: mcp.json loader + PLUGIN_ROOT/PLUGIN_DATA expansion #4451

Closed

Description

@VascoSch92

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 stdio and streamable-http transports (MCPTransport already includes both as literals — mcp/config.py:493); sse is 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 to args / env values / cwd only — never command, 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-SecretStr conflict — 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.json disables 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

  1. added
    enhancement
    plugins
    on Aug 10, 2026
  2. added a commit that references this issue on Sep 16, 2026
    7713a32
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

    Needs Designenhancementmcpplugins

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions