Syntax
Description
Themcp command manages external MCP servers that extend Codex’s capabilities. MCP servers can provide additional tools, data sources, and integrations.
Subcommands
list- List configured MCP serversget- Show details for a specific serveradd- Add a new MCP serverremove- Remove an MCP serverlogin- Authenticate with an MCP server (OAuth)logout- Remove MCP server credentials
codex mcp list
List all configured MCP servers.Output server list as JSON.
Examples
codex mcp get
Show detailed configuration for a specific MCP server.Name of the MCP server to display.
Output server details as JSON.
Examples
codex mcp add
Add a new MCP server configuration.Name for the MCP server. Must contain only letters, numbers, hyphens, and underscores.
For stdio servers:
Command to launch the MCP server.
Environment variables in KEY=VALUE format (repeatable).
For HTTP servers:
URL for a streamable HTTP MCP server.
Environment variable name containing a bearer token for authentication.
Examples
codex mcp remove
Remove an MCP server configuration.Name of the MCP server to remove.
Examples
codex mcp login
Authenticate with an MCP server using OAuth.Name of the MCP server to authenticate with.
Comma-separated list of OAuth scopes to request.
OAuth login is only supported for streamable HTTP servers.
Examples
codex mcp logout
Remove OAuth credentials for an MCP server.Name of the MCP server to deauthenticate.
Examples
Configuration
MCP servers are stored in~/.codex/config.toml:
MCP Server Types
stdio Servers
Local servers that communicate via stdin/stdout:- Local tools and utilities
- File system access
- Development and testing
Streamable HTTP Servers
Remote servers over HTTP:- Cloud services
- Shared team tools
- OAuth-authenticated APIs
Troubleshooting
Server Won’t Start
Check server configuration:Environment Variables Not Set
Ensure environment variables are available:config.toml:
OAuth Issues
For OAuth authentication problems:-
Verify server supports OAuth:
-
Check credentials:
-
Re-authenticate: