
What if Codex could check a wallet balance, deploy an Ethereum node, or pull Chainstack docs — all without leaving your terminal?
With the Chainstack MCP server, it can. MCP (Model Context Protocol) is an open standard that lets AI agents talk directly to external tools and APIs. Connect it to Chainstack and Codex gets live access to 70+ blockchain networks, your node infrastructure, and the full Chainstack documentation — right inside your coding workflow.
This guide walks you through setup for Codex CLI and the Codex IDE extension.
What is the Chainstack MCP server
MCP (Model Context Protocol) is an open standard that gives AI agents secure, structured access to external tools and APIs. It was created by Anthropic and has since been adopted across the AI ecosystem — including OpenAI Codex.
Chainstack is a blockchain infrastructure provider offering RPC nodes for 70+ networks: Ethereum, Solana, Base, Polygon, Arbitrum, and more. The Chainstack MCP server lets Codex:
- Search Chainstack documentation
- Deploy and manage Global Nodes via natural language
- Make direct JSON-RPC calls to Ethereum, Solana, and all other supported chains
| Server | URL | Transport | Status |
|---|---|---|---|
| Chainstack MCP (unified) | https://mcp.chainstack.com/mcp | Streamable HTTP | ✅ Current |
Available tools
No API key required:
| Tool | What it does |
|---|---|
search_docs | Search Chainstack documentation — RPC methods, deployment guides, code examples |
get_doc_page | Fetch the full content of any documentation page |
get_platform_status | Check platform status, active incidents, and network health |
get_chainstack_pricing | Get current pricing information |
contact_chainstack | Reach the Chainstack team |
API key required (get one at console.chainstack.com/user/settings/api-keys):
| Tool | What it does |
|---|---|
get_organization | Get your organization name and ID |
get_deployment_options | List available blockchain, cloud, and region combinations |
list_projects | List all your projects |
create_project | Create a new project |
list_nodes | List all nodes with status and endpoints |
get_node | Get a node’s full details including RPC endpoints |
create_node | Deploy a new blockchain node |
delete_node | Delete a node |
request_testnet_funds | Request testnet tokens |
Prerequisites
- Codex account — sign up or log in at codex.com.
- Codex CLI — install via npm:
bash
npm install -g @openai/codex
Check your install with: codex --version 3. Node.js ≥ 18 — required for npm. Check with: node -v. 4. Chainstack account — sign up at console.chainstack.com/user/account/create. Create an API key under Settings → API Keys (shown only once — save it somewhere safe).
Where Codex stores MCP configuration
Codex stores all MCP configuration in a single TOML file. The CLI and the IDE extension share this configuration, so you only need to set things up once.
| OS | Path |
|---|---|
| macOS / Linux | ~/.codex/config.toml |
| Windows | %USERPROFILE%\.codex\config.toml |
| Project-scoped | .codex/config.toml (in trusted projects only) |
To open the config from the IDE extension: select the gear icon → Codex Settings → Open config.toml.
Connecting Chainstack MCP to Codex
Chainstack runs a cloud-hosted unified server at mcp.chainstack.com/mcp — no local installation needed.
Option 1: Register via CLI (recommended)
The quickest way. Run one command and Codex handles the rest:
bash
codex mcp add chainstack --url https://mcp.chainstack.com/mcp
To also pass your Chainstack Platform API key as a bearer token (required for node deployment and project management):
bash
codex mcp add chainstack \
--url https://mcp.chainstack.com/mcp \
--bearer-token-env-var CHAINSTACK_API_KEY
Then export your key in your shell profile:
bash
export CHAINSTACK_API_KEY=your_api_key_here
Verify the server is registered:
bash
codex mcp list
Option 2: Edit config.toml directly
For more control, add the following block to ~/.codex/config.toml:
Without API key (documentation search and platform status only):
toml
[mcp_servers.chainstack]
url = "https://mcp.chainstack.com/mcp"
With API key (full access including node management):
toml
[mcp_servers.chainstack]
url = "https://mcp.chainstack.com/mcp"
bearer_token_env_var = "CHAINSTACK_API_KEY"
Then set the environment variable:
bash
export CHAINSTACK_API_KEY=your_api_key_here
To make the key persistent across sessions, add the export line to your ~/.bashrc, ~/.zshrc, or equivalent.
Verify the connection
Open the Codex TUI and run:
/mcp
You should see chainstack listed with a connected status. You’re ready.
Example prompts
Once connected, Codex can query blockchain data, manage your infrastructure, and search Chainstack’s documentation inline.
EVM queries:
- “Get the ETH balance of
0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045on Ethereum mainnet.” - “Trace transaction
0xabc…defand explain what happened step by step.” - “What’s the latest block number on Ethereum?”
Solana queries:
- “What’s the SOL balance of
Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr?” - “Get recent prioritization fees and recommend a priority fee for a swap.”
Documentation:
- “How do I enable the Yellowstone gRPC Geyser plugin on my Chainstack Solana node?”
- “What chains on Chainstack support archive data?”
- “Show me the Chainstack pricing tiers.”
Platform operations (requires API key):
- “Deploy a new Chainstack Global Node on Ethereum mainnet in the us-east region.”
- “List all my active nodes and their endpoints.”
- “Scan my repo for hardcoded RPC URLs and suggest Chainstack replacements.”
Project-scoped configuration
If you want Chainstack MCP enabled only for a specific repository, use a project-level config instead of the global one. Create .codex/config.toml in your project root:
toml
[mcp_servers.chainstack]
url = "https://mcp.chainstack.com/mcp"
bearer_token_env_var = "CHAINSTACK_API_KEY"
Note: Codex only loads project-scoped config from trusted projects. To mark a project as trusted, run codex from that directory and confirm the trust prompt.
Troubleshooting
| Problem | Solution |
|---|---|
chainstack not showing in /mcp | Run codex mcp list to verify registration. If missing, re-run codex mcp add. |
| TOML parse error | Validate ~/.codex/config.toml with a TOML linter — a stray quote or missing bracket breaks everything silently. |
| 401 Unauthorized on platform tools | Ensure CHAINSTACK_API_KEY is exported in your current shell session and that the key is active in your Chainstack console. |
| Bearer token not picked up | The bearer_token_env_var value should be the variable name (e.g., "CHAINSTACK_API_KEY"), not the key value itself. |
| RPC calls failing | Chainstack endpoints already embed credentials in the URL — no additional Authorization header is needed for RPC. |
| Project config not loading | Codex only loads .codex/config.toml from trusted projects. Run codex from the project root and accept the trust prompt. |
Conclusion
Once connected, Chainstack MCP turns Codex into a live blockchain development assistant — you can query on-chain data, deploy and manage nodes, and search Chainstack’s documentation without leaving your terminal or IDE. The unified server at mcp.chainstack.com/mcp requires no local setup and works across both the Codex CLI and the Codex IDE extension.
The CLI and IDE extension share the same ~/.codex/config.toml, so you configure once and it works everywhere. For node management and platform operations, grab your API key at console.chainstack.com/user/settings/api-keys — public tools like documentation search and platform status work without one.
FAQ
Any Codex plan works. MCP server support is part of the standard Codex CLI and IDE extension.
Not for documentation search, platform status, or pricing lookups. You do need one for node deployment and project management. Get it at console.chainstack.com/user/settings/api-keys.
Yes. Codex stores MCP configuration in a single ~/.codex/config.toml shared by both clients. Configure once and it works in both.
All chains available on the Chainstack platform — including Ethereum, Solana, Base, Polygon, Arbitrum, and more. See the full list at chainstack.com/protocols.
Yes. Create .codex/config.toml in your project root with the [mcp_servers.chainstack] block. Codex loads it only for that project (requires trusting the project on first run).
