Back to build guides
Integration4 min read· Nov 18, 2026

Give your Codex agent a phone number

Add the AgentPhone MCP server to OpenAI Codex with codex mcp add or a config.toml entry, and the agent can text and call from the CLI, the IDE extension and the desktop app. Notes on Codex Cloud too.

AgentPhone TeamFounders
Give your Codex agent a phone number

OpenAI's Codex runs in the terminal, in the IDE extension, in a desktop app and in the cloud. The local surfaces all read the same MCP configuration, so one block gives Codex a phone across all of them. This page covers the command, the config file, the skill and the one caveat about Codex Cloud.

Setup with the CLI

bash
codex mcp add agentphone --url https://mcp.agentphone.ai/mcp
codex mcp login agentphone

The second command runs OAuth in the browser. If you would rather authenticate with an API key, edit the config instead.

Setup with config.toml

Codex keeps MCP servers in ~/.codex/config.toml, or .codex/config.toml in a trusted project. The remote form points at the hosted server and reads the key from an environment variable, so nothing secret sits in the file.

toml
[mcp_servers.agentphone]
url = "https://mcp.agentphone.ai/mcp"
bearer_token_env_var = "AGENTPHONE_API_KEY"

Export AGENTPHONE_API_KEY in your shell and restart Codex. For a local process instead:

toml
[mcp_servers.agentphone]
command = "npx"
args = ["-y", "agentphone-mcp"]
env_vars = ["AGENTPHONE_API_KEY"]

env_vars forwards the named variables from your environment into the server.

The skill

Codex follows the agentskills.io standard and looks in .agents/skills in the repo and ~/.agents/skills for you. The AgentPhone skill gives Codex the REST and MCP reference behind a /agentphone command:

bash
npx skills add AgentPhone-AI/skills

Pick Codex in the installer. The skill is instructions, not a server, so pair it with one of the MCP configs above if you want Codex to act on its own.

What to ask it

The phone numbers in the examples are placeholders from the reserved 555 range. Replace each with the number you actually mean: your own mobile for the text test, the real business for a call.

  • "Set up a phone for this project: create an agent, buy a US number, point the webhook at my dev tunnel."
  • "Text me at +1 415 555 0123 when the test suite is green." Codex finishes the run and sends the message.
  • "Someone replied on the support number. Read the conversation and draft an answer."
  • "Call the restaurant at +1 415 555 0199 and book a table for two at seven." Hosted calls carry an AI disclosure at the start.

Number purchases ask for confirmation first. Calls and messages run as soon as the tool is called.

Codex Cloud

Codex Cloud and the ChatGPT web surface do not read your local config.toml. Remote tools there come through plugins, and local MCP transports may not be available. For cloud runs, either use the plugin route your workspace supports, or call the REST API directly from a script Codex writes, with the key provided as a secret in the cloud environment.

Things to know

  • $5 of credit on signup, no card. Numbers are $3 a month, SMS $0.02 a segment.
  • Inbound SMS works immediately. Outbound on US numbers needs 10DLC registration, which we submit for you.
  • Verify the connection by asking for an account overview; a 401 means the key or login did not take.

FAQ

Which file holds the MCP config for Codex? ~/.codex/config.toml for your user, or .codex/config.toml inside a trusted project. Entries live under [mcp_servers.<name>].

How do I avoid putting the key in config.toml? Use bearer_token_env_var = "AGENTPHONE_API_KEY" for the remote server, or env_vars = ["AGENTPHONE_API_KEY"] for the local one, and export the variable in your shell. Or run codex mcp login agentphone for OAuth.

Does it work in Codex Cloud? Not through local config. Codex Cloud gets tools from plugins and may not support local MCP transports. Use a plugin if your workspace has one, or have Codex call the REST API with a secret from the cloud environment.

Can Codex receive replies? Yes. Ask it to watch a number and the next inbound message is delivered as a notification, or read the conversation on demand.

What does the first experiment cost? Nothing beyond the $5 signup credit: a $3 number and about 100 two-cent messages.

Ready to give your AI Agent a phone number?