For Codex runs in OpenClaw, how are MCP tool calls approved, and what does openclaw mcp configure --approval change?
answer
- follows the session's permission posture
- a per-server override
- auto, prompt, approve
- Allow Always saves a grant
- revoke in the approvals document
basics
~10 sBy default, Codex MCP approvals follow the session's permission posture: full permission never prompts, stricter postures check unannotated tools. openclaw mcp configure <server> --approval auto|prompt|approve writes codex.defaultToolsApprovalMode and overrides that default for one server.
solid answer
~40 sFor Gateway-hosted Codex runs, MCP tool approval follows the session's permission posture: the default full-permission posture does not prompt, `workspace` can use automatic review, and `guarded` or `read-only` can prompt the operator for tools without safety annotations. `openclaw mcp configure tracker --approval prompt` writes `codex.defaultToolsApprovalMode`: `approve` bypasses per-call approval, `prompt` asks every time, `auto` goes by the tool's annotations. Since 2026.9.1, **Allow Always** saves a durable per-agent grant for that exact server and tool, with any arguments, in `agents.<agentId>.mcpTools` of the approvals document. Grants apply under `auto` or an unset mode; explicit `prompt` keeps asking. They load at the next thread preparation, and you revoke one by editing the document via `openclaw approvals get --gateway` and `openclaw approvals set --gateway --file`.
go deeper
Recall that approval asks a human before a call runs, while tool policy decides which tools exist for the agent; they are separate controls.
Explain the three modes behind --approval, what the default full-permission posture does, and where Allow Always grants are stored.
Show the grant lifecycle: when a grant applies, why explicit prompt beats it, why revocation waits for the next session, and the annotation warning from probe.
Set the rule for which servers may ever be set to approve, and whether Allow Always is acceptable for tools that change data in shared systems.
## Two different questions For any MCP tool, OpenClaw answers two questions separately: - **Can the agent see the tool at all?** That is tool policy: profiles, `tools.allow`, `tools.deny`, per-sender limits, the sandbox gate and the server's `toolFilter`. - **Does a specific call need a human's yes?** That is approval, and for MCP tools OpenClaw documents it for **Codex app-server runs** hosted by the Gateway. Approval never makes a hidden tool visible, and policy never asks a human. The settings below live in a server's optional **`codex`** block, which OpenClaw strips before handing the native server config to Codex and which does not affect other runtime adapters. ## The default: the session's posture With no per-server mode, MCP tool approval follows the effective Codex session **permission posture**: | Posture | MCP tool calls | |---|---| | full permission (the default) | No prompt, even for tools without safety annotations | | `workspace` | Can use automatic review | | `guarded`, `read-only` | Can prompt the operator for tools without safety annotations | Interactive turns can approve those prompts in the Control UI, and approval cards can also be delivered as Slack buttons. ## The per-server override `openclaw mcp add <name> --approval <mode>` or `openclaw mcp configure <name> --approval <mode>` writes **`codex.defaultToolsApprovalMode`**, which takes precedence over the posture-derived default: - `approve`: bypasses per-call approval. The docs reserve it for trusted servers. - `prompt`: asks for every call, even when a grant exists. - `auto`: decides from the tool's MCP safety annotations. `openclaw mcp probe` and `openclaw mcp doctor --probe` warn when a server is set to `auto` and none of its tools carries safety annotations, because under a prompting posture every call would then need approval. ## Allow Always and durable grants Since **2026.9.1**, choosing **Allow Always** on a Codex MCP approval can save a **durable, per-agent grant** when durable persistence is offered and OpenClaw can match the approval to one live Gateway-owned tool call unambiguously. The grant: - covers the exact agent, configured server name and tool name, **with any arguments**; - is written to `agents.<agentId>.mcpTools` in the host approvals document, as `server`, `tool`, `source: "allow-always"` and `addedAt`; - applies when the server's mode is `auto` or unset; explicit `prompt` still asks and explicit `approve` already skips approval; - is read at the next thread configuration and hook registration, such as a new session or a restart, not on every call; - is not minted for Codex apps, native plugin servers or computer-use servers. When the operator denies a call, the model only hears Codex's generic message that the user rejected the MCP tool call; the remedy appears on the operator's card. ## Inspecting and revoking 1. `openclaw approvals get --gateway --json` exports the approvals document. 2. Remove the entry from `agents.<agentId>.mcpTools`, keeping every other setting. 3. `openclaw approvals set --gateway --file approvals.json` replaces the document. 4. Start a new session or restart: the current session keeps Codex's remembered decision until then. 5. If the server is also saved in Codex's native config, Codex may hold its own approval; revoke that separately. ## Choosing a mode per server No mode is right for every server; the choice follows what the tools can change and how far you trust the server's annotations: | Server | A reasonable mode | Why | |---|---|---| | Read-only lookups you run yourself | `approve` | Prompts add friction and no protection | | A hosted tracker whose tools file and edit issues | `prompt` | Every write gets a human look, and grants cannot silently widen it | | A well-annotated third-party server | `auto` | Annotations separate safe reads from writes, but they are the server's own claims | Whichever you pick, the approval layer only sees calls the tool policy already allowed. Keeping a server's write tools out with `toolFilter`, or away from some senders with tool policy, is stronger than asking a human about each call.
- You removed a grant from the approvals document, but the running session still calls the tool without asking. Why?Grants are read when OpenClaw prepares the Codex thread configuration and hook registration, not on each call, and the current session keeps Codex's remembered decision. Start a new session or restart to drop it. If the server is also saved in Codex's native config, Codex may have persisted its own approval, which you revoke separately.
- Why would mcp doctor --probe warn about a server whose approval mode is auto?`auto` decides from each tool's MCP safety annotations. When none of the server's tools carries any, there is nothing to decide from, so under a prompting posture every call would require approval. The warning tells you to choose `prompt` or `approve` deliberately, or to accept the prompts.
- Allow Always approves only the exact arguments of that one call.
- A stored grant overrides a server explicitly set to prompt.
- approve is a sensible default mode for any third-party server.
- Revoking a grant takes effect on the next call in the current session.
- The approval mode decides whether the agent can see the tool at all.
Assumes OpenClaw 2026.9.9; durable Allow Always grants for MCP tools on configured servers arrived in 2026.9.1.