Do you actually need an MCP server?
For ordinary web development, review the minimal Codex setup for web development before adding another connection. A working project environment, concise AGENTS.md and reliable checks may be enough. You can start with zero plugins.
What is MCP?
You can think of as a USB standard for AI tools. It gives Codex a standard way to connect to things such as development documentation, GitHub, browsers, databases and project-management systems.
You do not need to memorize the protocol before you begin. The practical point is simple: MCP is one way to give Codex access to an external tool. It is not a bundle that everyone must install.
Read the full plain-English explanation of MCP →
How MCP works in Codex
Codex acts as the : it understands the task and decides when a tool may help. The MCP server supplies a specific capability.
Adding an MCP server does not install another AI model inside Codex. It is closer to adding an external tool interface. What Codex can do still depends on the server's capabilities and the permissions you grant.
Source: official Codex MCP documentation.
Check these three things first
Is the Codex CLI available?
A lets you operate software through commands. Open your terminal and run:
codex --versionIf the command is unavailable, complete the official Codex installation before configuring MCP. Use the Codex CLI entry in the official documentation; this guide does not invent a separate installation process.
Does the server need another runtime?
A runtime is the software needed to start a program. Depending on the server, that might be Node.js, Python, Docker or another command-line program. Not every MCP server requires Node.js. Check the requirements for the server you chose.
Have you read that server's official instructions?
MCP servers do not all start the same way. Do not reuse one project's command for a different server. Check its runtime, data-access scope and authorization requirements first.
Method 1: use codex mcp add
For most first-time users, adding one server through the CLI is the clearest approach. The basic format for a local stdio server is:
codex mcp add <server-name> -- <server-command>If the server needs environment variables, the official form is:
codex mcp add <server-name> --env VAR1=VALUE1 --env VAR2=VALUE2 -- <stdio-server-command>- server-name: the name you assign to this MCP server for list, get and remove commands.
- --env: passes a configuration value to the server when it requires an environment variable.
- --: marks the point after which the MCP server's own launch command begins.
- stdio-server-command: the command that actually starts the server.
stdio is a common way for Codex and a local server to exchange messages through standard input and output. The text inside angle brackets is a placeholder to replace, not something to run literally.
Source: official CLI configuration format.
Official example: Context7
The Codex documentation uses this example:
codex mcp add context7 -- npx -y @upstash/context7-mcpThen list your configuration:
codex mcp listSource: official Codex Context7 example.
Another real example: Playwright MCP
The Playwright project's README gives this Codex example:
codex mcp add playwright npx "@playwright/mcp@latest"Then check it:
codex mcp listThis preserves the example exactly as published by Playwright. The earlier form with -- remains the general stdio syntax.
Source: Playwright MCP official README.
Which MCP servers have I configured?
codex mcp listThis lists the MCP servers in your current Codex configuration. To see all MCP subcommands supported by your installed Codex version, run:
codex mcp --helpThis page does not invent sample output. What you see should come from your actual configuration and Codex version.
Inspect one MCP server
codex mcp get <server-name>For example:
codex mcp get playwrightUse this to inspect a single configured server. Output fields may change between versions, so your result does not need to match an old screenshot line for line.
Source: Codex CLI MCP subcommand implementation.
What if the MCP server needs browser sign-in?
In plain English, OAuth lets you approve access on the service's own website instead of handing your password directly to Codex.
For a configured server that supports OAuth, use:
codex mcp login <server-name>For example, after configuring a Linear server:
codex mcp login linearSome remote servers open a browser so you can sign in and approve access. Check the website domain and requested permissions before accepting. Not every MCP server needs login, and typing an arbitrary server name cannot create a valid login flow.
Source: official OAuth login guidance.
An MCP server does not have to run on your computer
Local MCP: Codex starts a local command, such as a server launched through npx, python or docker.
Remote MCP: Codex connects to a network address. The current CLI supports --url, for example:
codex mcp add linear --url https://mcp.linear.app/mcpIf a remote server supports OAuth, authenticate when required:
codex mcp login linearSources: official supported MCP features and the CLI URL argument implementation.
Method 2: edit config.toml directly
For manual configuration, the default user-level Codex file is:
~/.codex/config.tomlCodex also supports a project-level file:
.codex/config.tomlProject-level configuration is loaded only for trusted projects. The CLI and IDE extension share the Codex configuration layer. The ChatGPT website does not read this local file.
Back up the file before editing it. Change only the intended MCP entry and preserve other settings. This site never reads, uploads or rewrites your config.toml.
Source: Codex configuration basics.
Local stdio example
[mcp_servers.example]
command = "npx"
args = ["-y", "example-mcp-server"]Codex uses mcp_servers, not the mcpServers key common in some JSON clients. TOML and JSON are different formats. Do not paste an entire JSON object into a TOML file.
Example with environment variables
[mcp_servers.example]
command = "example-server"
args = ["--port", "4000"]
env = { "API_KEY" = "YOUR_KEY" }The two TOML blocks are separate examples. Do not define [mcp_servers.example] twice in one file.
Source: official stdio configuration fields.
Should MCP configuration be global or project-specific?
- User-level
~/.codex/config.tomlworks for configuration you use across projects. - Project-level
.codex/config.tomlworks when only one trusted project should use it.
Our editorial advice is simple: when you can limit the scope, do not make a connection global by default. This is not a mandatory Codex rule.
The two configuration levels have precedence; they are not separate installation folders. Running an add command from a project directory does not automatically guarantee project-scoped configuration. Follow the official configuration-layer guidance when scope matters.
Source: configuration scope and precedence.
How do I know the connection really works?
Confirm the configuration exists
codex mcp listMake sure the server appears in your configuration.
Restart or reopen Codex
Start a new Codex session so it can load the configuration.
Try one low-risk task
For a documentation server, ask it to find the official documentation for a public API.
For Playwright, ask it to open example.com and report the page title.
Confirm that Codex actually used the relevant MCP tool instead of answering from prior knowledge. Do not make deletion, email sending or production-database changes your first test.
A configuration entry does not prove every tool works
Seeing a server in list does not guarantee every tool is available. The server may fail to start, a runtime may be missing, OAuth may be incomplete, an environment variable may be absent, or a network or compatibility problem may remain.
After configuration, complete one real but low-risk task. This guide does not promise a “100% successful installation,” and we have not tested your environment.
How do I remove an MCP server?
If you can add it, you should also know how to remove it.
codex mcp remove <server-name>For example:
codex mcp remove playwrightThen verify the result:
codex mcp listNormally, remove deletes the MCP entry from Codex configuration. It does not mean a third-party account or its data has been deleted. Check that service's own policies separately.
If the same name still appears, inspect other configuration layers rather than deleting the entire .codex directory.
Source: Codex MCP remove implementation.
Do not install ten MCP servers at once
Codex best practices recommend adding tools that solve a real workflow problem, starting with one or two that clearly reduce repetitive work, and expanding only when needed.
That matches our editorial principle. Do not connect everything from a “20 must-have MCP servers” list:
- More configuration makes failures harder to diagnose.
- Capabilities may overlap, and many tools may go unused.
- can grow and affect usage; the actual effect depends on the tool and client, so there is no honest universal percentage.
- Every external connection adds another set of permissions to review and maintain.
Install less. Keep what actually helps.
MCP setup failed? Check these six things
Is the MCP name correct?
Use codex mcp list to find the configured name, and codex mcp get <server-name> when you need to inspect one entry. Do not confuse your custom name with a package name.
Can the server command run on its own?
Only after verifying the source and understanding its permissions should you run the official npx, python or docker command in your own terminal. This executes third-party software; it is not a read-only check. This site never runs it for you.
Is the required runtime available?
Check Node.js, Python, Docker or another runtime according to that server's documentation. Do not install every runtime just to troubleshoot one server.
Are the required environment variables present?
Pay special attention to API keys and authentication tokens. An authentication token is a credential, not the token unit used to measure model input. Confirm names and values against the server documentation, and never post secrets in a public support thread.
Have you completed OAuth login?
For servers that support OAuth, check whether codex mcp login <server-name> is required. Do not repeatedly try browser login for a local server that has no authentication flow.
Does your Codex version match the documentation?
Run codex --version, then compare your version with current official documentation and relevant issues. MCP support changes over time; one old tutorial screenshot is not enough to diagnose a current setup.
Notes for Windows users
PowerShell, cmd and other shells can parse commands differently. Check the environment you are actually using:
- Is npx, Node.js or another required program available on PATH?
- Can the official server command run in that terminal?
- Does a path with spaces or special characters cause a problem for that specific server?
- Are Codex and your terminal using the same runtime environment?
These are diagnostic directions, not a claim that MCP is generally broken on Windows. This guide does not provide unsupported one-size-fits-all repair commands or recommend disabling security checks.
What not to do
Install everything that looks popular
Identify the purpose first. Popularity is not a requirement.
Give an unfamiliar server an API key
Verify the source and requested permissions before sharing any credential. A server being easy to add does not make it trustworthy.
Keep reinstalling after configuration breaks
Use list and get to inspect the current state. If you need a clean reconfiguration, remove the intended entry and confirm the result before adding it again. Do not create duplicate entries around an unresolved error.
Treat MCP as “more tools must be better”
More tools do not automatically improve the work. The goal is a smoother workflow, not a longer tool list.
A 30-second setup flow
- Find an MCP server you actually need
- Read its official requirements
- Run codex mcp add
- Check codex mcp list
- Complete one low-risk test
A server earns its place only when it helps after installation.
Frequently asked questions
Does Codex support MCP?
Yes. Codex CLI includes commands for configuring and managing MCP servers, including supported local stdio and remote servers.
Do Codex Desktop, the IDE extension and the CLI share MCP configuration?
This guide covers the local CLI and IDE path: they share the Codex configuration layer. The official MCP documentation also explains that the desktop application on the same Codex host can use that configuration. Do not assume a remote host reads the same file.
The ChatGPT website does not read your local Codex config.toml. Do not confuse web plugin settings with a file on your computer.
Where is the MCP configuration file?
The user-level file is ~/.codex/config.toml. The project-level file is .codex/config.toml, and it loads only for trusted projects.
How many MCP servers should I install?
There is no universal number. Start with one or two that have a clear purpose, and add another only when a real need appears.
Does removing an MCP server delete my account with that service?
Normally, codex mcp remove removes the server from Codex configuration. It is not an instruction to delete a third-party account. Review that service's rules for data, authorization and account removal.
Are MCP and plugins the same thing?
Not exactly. MCP describes a way to connect tools, while a plugin may package several kinds of capabilities. Start with What is MCP? rather than deciding from the label alone.
Related published content
- What is MCP?
- What is a CLI?
- What is an API?
- What is AI context?
- Is Playwright MCP worth installing?
- Playwright MCP vs CLI
- A minimal Codex setup for web development
This is a setup guide, not an automatic installer. The site does not read your configuration, collect credentials or start an MCP server.
Related terms
Continue with these published explanations.
Sources & last checked
Checked against official documentation. Editorial recommendations are distinguished from vendor positioning; no runtime benchmark was performed.
Official documentation
01Last checked: September 3, 2026
official-docs