Tool type: CLI agent Website: openai.com/codex Transport support: stdio, Streamable HTTP Minimum version: 0.2.0+
| Platform | Path |
|---|---|
| User (global) | ~/.codex/config.toml |
| Project | .codex/config.toml at project root (must be a trusted project) |
File format: TOML (not JSON). This is a common source of confusion.
Recommended when PiecesOS and Codex CLI are on the same machine.
Edit ~/.codex/config.toml:
[mcp_servers.pieces]
url = "http://localhost:39300/model_context_protocol/2025-03-26/mcp"
startup_timeout_sec = 10
tool_timeout_sec = 60Use this when Codex CLI is running on a different machine or in a cloud environment. For setup, see: Connecting to PiecesOS from the Outside World via Ngrok.
[mcp_servers.pieces]
url = "https://YOUR_NGROK_URL.ngrok.app/model_context_protocol/2025-03-26/mcp"
startup_timeout_sec = 10
tool_timeout_sec = 60[mcp_servers.pieces]
url = "https://YOUR_NGROK_URL.ngrok.app/model_context_protocol/2025-03-26/mcp"
bearer_token_env_var = "PIECES_TOKEN"
startup_timeout_sec = 10
tool_timeout_sec = 60Set the environment variable before running Codex:
export PIECES_TOKEN=your-tokenTo only expose specific Pieces tools:
[mcp_servers.pieces]
url = "http://localhost:39300/model_context_protocol/2025-03-26/mcp"
enabled_tools = ["ask_pieces_ltm", "workstream_summaries_full_text_search"]Edit ~/.codex/config.toml, update the url, and run a new Codex session.
- Start a Codex session:
codex - Codex announces available MCP tools on startup
- Ask: "What Pieces tools are available?"
| Issue | Solution |
|---|---|
| MCP not recognized | Update Codex CLI to 0.2.0 or later |
| Config file not found | Create ~/.codex/config.toml manually (TOML, not JSON) |
| Server not connecting | Verify PiecesOS is running and URL responds |
| Timeout errors | Increase startup_timeout_sec or tool_timeout_sec |
- Pieces MCP and LTM Tools Reference — Complete reference for all 39 tools available to your agents
- Connecting to PiecesOS via Ngrok — Expose your local Pieces server for remote access
| ← Back to All Agent Setup Guides |