Skip to content

Use plugin-service MCP as the hosted plugin runtime - #27198

Merged
jif-oai merged 4 commits into
mainfrom
jif/external-plugins-3
Jun 10, 2026
Merged

Use plugin-service MCP as the hosted plugin runtime#27198
jif-oai merged 4 commits into
mainfrom
jif/external-plugins-3

Conversation

@jif-oai

@jif-oai jif-oai commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Stack

Why

#27191 moves the host-owned Apps MCP registration behind an extension contributor, but deliberately preserves the existing endpoint-selection feature while that contribution contract lands. App-server can therefore resolve the server through extensions, yet the hosted plugin endpoint is still selected through temporary apps_mcp_path_override plumbing.

That is not the long-term plugin model. A plugin can bundle skills, connectors, MCP servers, and hooks, and those components do not all need the same source or execution environment. In particular, an authenticated HTTP MCP server can expose plugin capabilities directly from a backend without an executor or an orchestrator filesystem.

This PR completes that hosted vertical. App-server's MCP extension now owns the aggregate hosted plugin runtime at /ps/mcp. Connector actions continue to arrive as MCP tools, while backend-provided skills arrive as MCP resources and use Codex's existing resource list/read paths. No second backend client, skill filesystem, or generic plugin activation framework is introduced.

The backend route remains the hosted implementation. This change replaces Codex's temporary endpoint-selection mechanism, not the service behind the endpoint.

What changed

Hosted plugin runtime

The MCP extension now contributes codex_apps as the hosted plugin runtime rather than as a configurable Apps endpoint:

  • https://chatgpt.com resolves to https://chatgpt.com/backend-api/ps/mcp;
  • a bare custom ChatGPT base resolves to /api/codex/ps/mcp;
  • the existing product-SKU header and ChatGPT authentication behavior are preserved;
  • executor availability is never consulted for this streamable HTTP transport.

The same MCP connection carries both component shapes supported by the hosted endpoint:

  • connector actions are discovered and invoked as MCP tools;
  • hosted skills are enumerated and read as MCP resources through the existing list_mcp_resources and read_mcp_resource paths.

This keeps component access in the subsystem that already owns the protocol instead of downloading backend skills into an orchestrator filesystem or inventing a parallel hosted-skill client.

Explicit runtime ordering

McpManager now resolves the reserved codex_apps entry in three ordered phases:

  1. install the legacy Apps fallback for compatibility;
  2. apply ordered extension Set or Remove overlays;
  3. apply the final ChatGPT-auth gate without synthesizing the server again.

This ordering is important:

  • an ordinary configured or plugin MCP server cannot claim the auth-bearing codex_apps name;
  • an extension-contributed hosted runtime wins over the fallback;
  • an extension Remove remains authoritative;
  • a host without the MCP extension retains the legacy Apps endpoint and current local-only behavior.

The temporary legacy_apps_mcp_loader_enabled coordination flag is no longer needed.

Remove the path override

The apps_mcp_path_override feature and its runtime plumbing are removed, including:

  • the feature registry entry and structured feature config;
  • Config and McpConfig fields;
  • config schema output;
  • config-lock materialization;
  • URL override handling in codex-mcp.

Existing boolean and structured forms still deserialize as ignored compatibility input. They are omitted from new serialized config, and config-lock comparison normalizes the removed input so older locks remain replayable.

App-server coverage

App-server MCP fixtures now serve the hosted route at /api/codex/ps/mcp. Existing resource-read and tool/elicitation flows therefore exercise the extension-owned endpoint rather than succeeding through the legacy fallback.

The stack also adds the missing codex_chatgpt::connectors re-export for the manager-backed connector helper introduced in #27191.

Compatibility

  • App-server installs the extension and uses /ps/mcp for the hosted runtime.
  • CLI and other hosts that do not install the extension retain the legacy Apps endpoint.
  • Apps disabled or non-ChatGPT authentication removes codex_apps from the effective runtime view.
  • Existing local plugins, local skills, executor-selected skills, configured MCP servers, and MCP OAuth behavior are otherwise unchanged.
  • Backend plugin enablement remains account/workspace state owned by the hosted endpoint; this PR does not add thread-local backend plugin selection.

Architectural fit

The stack now proves two independent runtime shapes:

  1. Load selected executor skills through extensions #27184 resolves filesystem-backed skills through the executor that owns a selected root.
  2. Route hosted Apps MCP through extensions #27191 and this PR resolve a backend-hosted HTTP MCP through an extension with no executor.

Together they preserve the intended separation:

  • selection identifies a plugin/root when explicit selection is needed;
  • each component's owning extension resolves its concrete access mechanism;
  • execution stays with the runtime required by that component;
  • existing skills, MCP, connector, and hook subsystems remain the downstream consumers.

Planned follow-ups

  1. Executor stdio MCP: selecting an executor plugin registers a manifest-declared stdio MCP server and executes it in the environment that owns the plugin.
  2. Optional backend selection: only if CCA needs thread-local selection distinct from backend account/workspace enablement, add a concrete backend-owned capability location and surface those selected skills through the skills catalog.
  3. Connector metadata and hooks: activate those plugin components through their existing owning subsystems, with executor hooks remaining environment-bound.
  4. Propagation and persistence: define explicit resume, fork, subagent, refresh, and environment-removal semantics once selected roots have multiple real consumers.
  5. Local convergence: migrate legacy local skill, MCP, connector, and hook paths behind their owning extensions one vertical at a time, then remove duplicate core managers and compatibility plumbing after parity.

Verification

Coverage in this change exercises:

  • extension-owned /backend-api/ps/mcp registration without an executor;
  • preservation of the legacy endpoint in hosts without the extension;
  • extension Set and Remove precedence over the legacy fallback;
  • ChatGPT-auth gating for the reserved server;
  • hosted MCP resource reads with and without an active thread;
  • connector tool invocation and MCP elicitation through the hosted route;
  • ignored boolean and structured forms of the removed path override;
  • config-lock replay compatibility for the removed feature.

cargo check -p codex-features -p codex-mcp-extension -p codex-app-server passes. Tests and Clippy were not run locally under the current development instruction; CI provides the full validation pass.

@jif-oai
jif-oai requested a review from a team as a code owner June 9, 2026 15:05

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2902b0f638

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/features/src/lib.rs
@jif-oai
jif-oai force-pushed the jif/external-plugins-3 branch from 2902b0f to 27a1e56 Compare June 9, 2026 15:14
@jif-oai
jif-oai force-pushed the jif/external-plugins-2 branch from 13012c9 to 20b507e Compare June 9, 2026 17:54
Base automatically changed from jif/external-plugins-2 to main June 9, 2026 20:44
@jif-oai
jif-oai force-pushed the jif/external-plugins-3 branch from ed65ea2 to fa313ba Compare June 9, 2026 20:46
@jif-oai

jif-oai commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19a14a0810

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/ext/mcp/src/lib.rs
Comment thread codex-rs/core/config.schema.json
Comment thread codex-rs/ext/extension-api/src/contributors/mcp.rs
@jif-oai

jif-oai commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jif-oai
jif-oai merged commit 9cd11e9 into main Jun 10, 2026
30 checks passed
@jif-oai
jif-oai deleted the jif/external-plugins-3 branch June 10, 2026 10:54
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant