Skip to content

Codex MCP import misclassifies URL-based servers as stdio #84

@brushax

Description

@brushax

Summary

cc-switch mcp import -a codex appears to misclassify URL-based Codex MCP servers as stdio servers.

As a result, valid Codex entries that use url = "..."
(and optionally bearer_token_env_var = "...") are rejected during import with:

MCP validation failed: stdio MCP server is missing the command field

This seems to affect HTTP/remote MCP servers only. A stdio-based Codex MCP entry imports successfully in the same environment.

Versions

  • cc-switch 5.2.1
  • codex-cli 0.118.0

Minimal reproduction

Use a clean temporary home directory to avoid any existing local state:

TMP_HOME="$(mktemp -d)"
mkdir -p "$TMP_HOME/.codex"

Create a minimal Codex config:

model_provider = "codex"
model = "gpt-5.4"
approval_policy = "on-request"
sandbox_mode = "workspace-write"

[mcp_servers.cloudflare-api]
url = "https://mcp.cloudflare.com/mcp"

[mcp_servers.github]
url = "https://api.githubcopilot.com/mcp/"
bearer_token_env_var = "GITHUB_MCP_TOKEN"

Run:

HOME="$TMP_HOME" cc-switch mcp import -a codex -v

Actual result

The import logs show that url is parsed, but both entries are rejected as if they were stdio servers:

Importing MCP servers from codex live config...
[DEBUG] importing extended field 'url' = "https://mcp.cloudflare.com/mcp"
[WARN ] skipping invalid Codex MCP item 'cloudflare-api': MCP validation failed: stdio MCP server is missing the `command` field
[DEBUG] importing extended field 'bearer_token_env_var' = "GITHUB_MCP_TOKEN"
[DEBUG] importing extended field 'url' = "https://api.githubcopilot.com/mcp/"
[WARN ] skipping invalid Codex MCP item 'github': MCP validation failed: stdio MCP server is missing the `command` field
No new MCP servers found in codex config.

After that:

HOME="$TMP_HOME" cc-switch mcp list -a codex

returns no imported MCP servers.

Expected result

cc-switch mcp import -a codex should import these entries as URL/HTTP-based Codex MCP servers rather than validating them as stdio servers.

Control case

If the Codex config contains a standard stdio MCP entry such as:

[mcp_servers.echo]
command = "echo"
args = ["hello"]

then:

HOME="$TMP_HOME" cc-switch mcp import -a codex -v

imports successfully.

This suggests the issue is specific to URL-based Codex MCP import, not MCP import in general.

Notes

  • I reproduced this with an isolated temporary HOME, so it does not appear to depend on existing local configuration.
  • cc-switch mcp sync -a codex appears to work normally. The problem seems limited to the Codex import path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions