Chainstack Self-Hosted is now available! Launch production-grade blockchain nodes on infrastructure you control.    Get started
  • Pricing
  • Docs

How to connect Chainstack MCP server to Codex

Created May 21, 2026 Updated May 21, 2026
Mcp Codex logo

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:

ServerURLTransportStatus
Chainstack MCP (unified)https://mcp.chainstack.com/mcpStreamable HTTP✅ Current

Available tools

No API key required:

ToolWhat it does
search_docsSearch Chainstack documentation — RPC methods, deployment guides, code examples
get_doc_pageFetch the full content of any documentation page
get_platform_statusCheck platform status, active incidents, and network health
get_chainstack_pricingGet current pricing information
contact_chainstackReach the Chainstack team

API key required (get one at console.chainstack.com/user/settings/api-keys):

ToolWhat it does
get_organizationGet your organization name and ID
get_deployment_optionsList available blockchain, cloud, and region combinations
list_projectsList all your projects
create_projectCreate a new project
list_nodesList all nodes with status and endpoints
get_nodeGet a node’s full details including RPC endpoints
create_nodeDeploy a new blockchain node
delete_nodeDelete a node
request_testnet_fundsRequest testnet tokens

Prerequisites

  1. Codex account — sign up or log in at codex.com.
  2. 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.

OSPath
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.

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 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 on Ethereum mainnet.”
  • “Trace transaction 0xabc…def and 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

ProblemSolution
chainstack not showing in /mcpRun codex mcp list to verify registration. If missing, re-run codex mcp add.
TOML parse errorValidate ~/.codex/config.toml with a TOML linter — a stray quote or missing bracket breaks everything silently.
401 Unauthorized on platform toolsEnsure CHAINSTACK_API_KEY is exported in your current shell session and that the key is active in your Chainstack console.
Bearer token not picked upThe bearer_token_env_var value should be the variable name (e.g., "CHAINSTACK_API_KEY"), not the key value itself.
RPC calls failingChainstack endpoints already embed credentials in the URL — no additional Authorization header is needed for RPC.
Project config not loadingCodex 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

Do I need a paid Codex plan to use Chainstack MCP?

Any Codex plan works. MCP server support is part of the standard Codex CLI and IDE extension.

Do I need a Chainstack API key?

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.

Does my CLI config also work in the IDE extension?

Yes. Codex stores MCP configuration in a single ~/.codex/config.toml shared by both clients. Configure once and it works in both.

What chains does Chainstack MCP support?

All chains available on the Chainstack platform — including Ethereum, Solana, Base, Polygon, Arbitrum, and more. See the full list at chainstack.com/protocols.

Can I scope Chainstack MCP to a single project?

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).

SHARE THIS ARTICLE
Customer Stories

BonusTrade.AI

BonusTrade.AI unlocks real-time crypto market insights with low latency and high-performance Chainstack infrastructure.

Eldarune

Eldarune successfully tackled multichain performance bottlenecks for a superior AI-driven Web3 gaming experience.