Feature request: support MCP server names with special characters (, , ) used by npm package identifiers

Open 💬 0 comments Opened Jun 17, 2026 by DivyaMaddipudi

What version of Codex CLI is running?

0.140.0.177 (stable)

What subscription do you have?

Bedrock

Which model were you using?

openai.gpt-5.4

What platform is your computer?

Darwin 25.5.0 arm64 arm

What terminal emulator are you using?

iTerm2 3.6.6

What issue are you seeing?

codex mcp add rejects MCP server names that contain :, @, or /, with the error:

Error: invalid server name 'npm:@modelcontextprotocol/server-sequential-thinking' (use letters, numbers, '-', '_')

This prevents MCP manager tooling from programmatically installing npm-based MCP servers into Codex using the npm package identifier as the server name (npm:@scope/package-name). The same name is accepted without issue by JSON-based MCP clients (e.g. Claude Code via ~/.claude.json) since JSON has no key character restrictions, but fails for Codex because TOML bare keys cannot contain those characters.

Steps to reproduce

codex mcp add "npm:@modelcontextprotocol/server-sequential-thinking" -- mcp-server-sequential-thinking

Fails immediately with the name validation error.

Expected behavior

One of the following:

  1. Accept the name as-is — serialize it in config.toml as a quoted TOML key: [mcp_servers."npm:@modelcontextprotocol/server-sequential-thinking"]
  2. Add a --name / --alias flag to codex mcp add so callers can pass a sanitized name separately from the package identifier
  3. Sanitize internally — replace invalid characters when writing to config.toml, preserving the original as metadata

Additional information

  • JSON-based MCP clients accept arbitrary string keys with no identifier restrictions, so this is a Codex-specific gap.
  • The npm package naming convention (npm:@scope/package) naturally produces names that are invalid TOML bare keys.
  • The workaround is manually adding a sanitized entry to ~/.codex/config.toml, but this breaks automated MCP install flows.

Codex doctor report

{"schemaVersion":1,"codexVersion":"0.140.0","overallStatus":"warning"}

View original on GitHub ↗