Thursday, December 3, 2026 | London 10°C · Drizzle
DailyGlimpse

AI

Step-by-Step: Setting Up MCP Servers in Codex CLI

Nicholas Renotte 1 min read

In this tutorial, you'll learn how to set up the Model Context Protocol (MCP) in Codex CLI and connect powerful external tools to enhance your coding workflow. Follow along as we walk through the installation and configuration process, enabling your AI assistant to interact with files, databases, and APIs seamlessly.

What You'll Need

  • Codex CLI installed on your system
  • Basic familiarity with the command line

Step 1: Install MCP Server

Run the following command to install the MCP server package:

npm install -g @modelcontextprotocol/server-filesystem

Step 2: Configure Codex CLI

Edit your Codex configuration file (usually ~/.codex/config.json) and add the MCP server entry:

{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory"]
}
}
}

Step 3: Test the Connection

Restart Codex CLI and verify the server is active:

codex mcp list

You should see your configured servers listed.

Step 4: Use MCP in Your Workflow

Now you can ask Codex to read, write, or list files directly. For example:

"List all files in the current directory, then read the contents of README.md"

Codex will use the MCP server to fulfill these requests without manual file operations.

Conclusion

You've successfully integrated MCP with Codex CLI, unlocking powerful new capabilities for your AI-assisted development.

React