Skip to content

MCP CLI should expose validation, tool listing, and enable/disable management #20195

Description

@Hmbown

Summary

codex mcp can add/list/get/remove/login/logout MCP server entries, but it does not expose the rest of the management operations users need for a practical MCP setup: validate a server, inspect discovered tools/resources, enable/disable a server, or self-register the local codex mcp-server entry.

Evidence

Observed in local checkout /Volumes/VIXinSSD/codex-main at 2be9fd5a93.

codex-rs/cli/src/mcp_cmd.rs defines only these subcommands:

  • list
  • get
  • add
  • remove
  • login
  • logout

The underlying config/runtime already has several pieces needed for richer management:

  • McpServerConfig.enabled exists and the connection manager filters on it.
  • enabled_tools / disabled_tools, default_tools_approval_mode, required, startup/tool timeouts, OAuth fields, and streamable HTTP transport are represented in config.
  • The runtime can list tools, list/read resources, and list resource templates through McpConnectionManager and the list_mcp_resources / list_mcp_resource_templates / read_mcp_resource helper tools.

Because the CLI does not expose validation or toggles, users have to hand-edit ~/.codex/config.toml and start a full session to discover whether a server starts and which tools/resources it exposes.

Expected behavior

Add focused MCP management commands such as:

  • codex mcp validate <name>: start the configured server, perform initialize/list calls, and report auth/startup/tool discovery failures.
  • codex mcp tools <name> or codex mcp inspect <name>: list discovered tools, resources, and resource templates without starting an agent turn.
  • codex mcp enable <name> / codex mcp disable <name>: mutate the existing enabled flag instead of requiring manual TOML edits.
  • Optional: codex mcp add-self to register codex mcp-server as a local stdio MCP server for other clients.

Acceptance criteria

  • Users can validate a configured MCP server from the CLI without launching an interactive session.
  • Users can inspect discovered MCP tools/resources/templates from the CLI.
  • Users can toggle configured MCP servers on/off through codex mcp.
  • Config writes preserve existing MCP server options such as approval settings, timeouts, OAuth fields, and tool filters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIenhancementNew feature or requestmcpIssues related to the use of model context protocol (MCP) servers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions