Expose MCP management APIs in the TypeScript SDK (codex.mcp.*)

Resolved 💬 2 comments Opened Oct 24, 2025 by SockingPanda Closed Jan 14, 2026

What feature would you like to see?

Background

The CLI already ships codex mcp ... subcommands to list, add/remove, and log into MCP servers. The TypeScript SDK, however, only consumes streamed events and lacks management capabilities. We’d like to reuse the same API surface in Node/plugin environments by exposing MCP controls from the SDK.

Proposal

  • Introduce codex.mcp.* APIs (list / get / add / remove / login / logout / enable / disable / enableOnce / disableOnce) that reuse the existing CLI binary under the hood.
  • Extract shared helpers for resolving the CLI binary and applying --config overrides so both CodexExec and MCP helpers share the same code path.
  • For behaviour not covered by CLI subcommands (e.g. permanently toggling enabled / enabled_tools), mirror the CLI’s TOML write logic inside the SDK to keep semantics aligned.
  • Add documentation and sample code showing typical usage, plus unit tests covering MCP management.

Additional information

Status

A working prototype already lives on my fork: codex.mcp APIs, a sample (samples/mcp_management.ts), and a dedicated test (pnpm test -- mcp.test.ts). Before raising a PR, I’d like to confirm the change fits your roadmap and whether any additional design or compatibility considerations are needed.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗