Setting up Aptos MCP with Codex
- Install OpenAI Codex.
npm install -g @openai/codexOn macOS you can also run brew install codex.
-
Obtain your
APTOS_BOT_KEYfrom Geomi (Bot Keys in the account menu). See Aptos MCP for the full steps. -
Navigate to your project:
cd your-awesome-project- Add the Aptos MCP server:
codex mcp add aptos-mcp --env APTOS_BOT_KEY=<your_bot_key> -- npx -y @aptos-labs/aptos-mcpReplace <your_bot_key> with the key from step 2. You can pass additional --env NAME=VALUE pairs if needed.
- Confirm the server is registered:
codex mcp listYou should see aptos-mcp in the list.
- Start Codex:
codex-
Run
/mcpinside Codex and confirmaptos-mcpis listed. -
Prompt the agent with
what aptos mcp version are you using?to verify the connection. It should report the currently published@aptos-labs/aptos-mcpversion from the MCP Server Card.
Alternative: TOML configuration
Section titled “Alternative: TOML configuration”If the CLI command fails, edit ~/.codex/config.toml (in the IDE: gear icon → MCP settings → Open config.toml) and add:
[mcp_servers.aptos-mcp]command = "npx"args = ["-y", "@aptos-labs/aptos-mcp"]
[mcp_servers.aptos-mcp.env]APTOS_BOT_KEY = "<your_bot_key>"Save the file and restart Codex. Do not commit the Bot Key.