Skip to content

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

@SockingPanda

Description

@SockingPanda

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmcpsdkIssues related to the Codex SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions