- Install the
codexpackage
npm install -g @openai/codexbrew install codex-
Obtain your
APTOS_BOT_KEYby following the instructions here. -
Navigate to your project
cd your-awesome-project- Add the Aptos MCP server to Codex:
codex mcp add aptos-mcp --env APTOS_BOT_KEY=<your_bot_api_key> -- npx -y @aptos-labs/aptos-mcpReplace <your_bot_api_key> with the key you generated in step 2.
Note: You can add more --env NAME=VALUE pairs as needed.
- Verify the MCP server was added successfully:
codex mcp listYou should see aptos-mcp in the list of configured MCP tools.
- Start Codex:
codex- Verify the connection inside codex:
/mcpYou should see aptos-mcp in the list of configured MCP tools.
- Verify the connection by prompting:
what aptos mcp version are you using?
The agent should reply with something like:
Running Aptos MCP server version 0.0.16.
If you encounter issues with the CLI approach, you can use the TOML method:
- Open
~/.codex/config.tomlin your editor. (In the IDE, click the gear icon → MCP settings → Open config.toml.) - Add an MCP server table like the following:
# ~/.codex/config.toml
[mcp_servers.aptos-mcp]
command = "npx"
args = ["-y", "@aptos-labs/aptos-mcp"]
[mcp_servers.aptos-mcp.env]
APTOS_BOT_KEY = "<your_bot_api_key>"- Save the file and restart Codex (or reload the IDE).