Codex 0.63 introduced first-class support for MCP servers, which means you can wire external tools like PostgreSQL directly into your AI coding workflow. If you want Codex to inspect or query your local Postgres instance, mcp-toolbox is the most convenient way to expose those tools.
This post shows the exact steps required on macOS using Homebrew.
Install mcp-toolbox
brew install mcp-toolbox
This installs the toolbox binary that can expose multiple MCP tools including Postgres, SQLite and other useful utilities.
Create toolbox-tools.yaml
Define your data sources. Place this file at:
~/.codex/toolbox-tools.yaml
Example (credentials redacted):
sources:
my-pg-source:
kind: postgres
host: 127.0.0.1
port: 5432
database: your_database
user: your_user
password: "your_password"
You only need to specify one database here. If the user credentials have permission to access other databases on that same Postgres server, the MCP Postgres tools will be able to switch to and inspect those databases as well. In other words, toolbox isn’t locked to the initial database; it is constrained only by the privileges of the user you authenticate with.
Update Codex MCP Configuration
Edit:
~/.codex/config.toml
Add:
[mcp_servers.postgres] type = "stdio" command = "/opt/homebrew/bin/toolbox" args = [ "--tools-file", "/Users/<your-user>/.codex/toolbox-tools.yaml", "--stdio" ]
Replace <your-user> with your macOS username.
This instructs Codex to spawn the toolbox MCP server over stdio and load the Postgres tools defined in your YAML configuration.
Verify Inside Codex
Launch Codex and run:
/mcp
You should see output similar to:
🔌 MCP Tools
• postgres
• Status: enabled
• Auth: Unsupported
• Command: /opt/homebrew/bin/toolbox --tools-file /Users/<your-user>/.codex/toolbox-tools.yaml --stdio
• Tools: describe_table, list_tables
• Resources: (none)
• Resource templates: (none)
At this point Codex can use the tools automatically or you can call them manually. Examples:
- postgres.list_tables
- postgres.describe_table
Because toolbox uses your actual Postgres role, it will show or hide databases and tables based solely on your permissions.
Codex 0.63’s MCP system makes it straightforward to wire external data sources into your development environment. mcp-toolbox gives you a clean, low-overhead way to expose Postgres, and as long as your credentials allow it, Codex can explore any database on that same server.
Summary
If you want a follow-up post demonstrating real queries, schema introspection or multi-database navigation inside Codex, let me know.
Sample codex prompts:
codex> Show me all the tables in the DB