Skip to content

Support Always Allow for MCP app messages#21231

Open
leoshimo-oai wants to merge 1 commit intomainfrom
leoshimo/mcp-app-always-allow
Open

Support Always Allow for MCP app messages#21231
leoshimo-oai wants to merge 1 commit intomainfrom
leoshimo/mcp-app-always-allow

Conversation

@leoshimo-oai
Copy link
Copy Markdown
Contributor

@leoshimo-oai leoshimo-oai commented May 5, 2026

Adds config support for “Always allow” on MCP App follow-up messages, scoped to the tool that produced the MCP App interface.

This is modeled after the existing approval_mode flag for "Always Allow" tool calls. It also exposes MCP server provider metadata over app-server status so clients can distinguish Codex Apps, standalone MCP servers, and plugin-owned MCP servers when writing approval config.

mcp_app_message_approval_mode = "auto" keeps the default approval prompt behavior. "approve_in_thread" skips the follow-up approval speed bump when the MCP app sends a message to the current thread.

Config examples

# Codex Apps:
[apps.<app_id>.tools.<tool_name>]
mcp_app_message_approval_mode = "approve_in_thread"

# Standalone MCP server:
[mcp_servers.<server_name>.tools.<tool_name>]
mcp_app_message_approval_mode = "approve_in_thread"

# Plugin-owned MCP server:
[plugins."<plugin_id>".mcp_servers.<server_name>.tools.<tool_name>]
mcp_app_message_approval_mode = "approve_in_thread"

Testing

just write-config-schema
just write-app-server-schema
just fmt
just fix -p codex-config -p codex-core -p codex-app-server-protocol -p codex-app-server
cargo test -p codex-config
cargo test -p codex-core blocking_replace_mcp_servers_serializes_tool_approval_overrides
cargo test -p codex-app-server write_value_supports_custom_mcp_server_message_approval_mode
cargo test -p codex-app-server-protocol schema_fixtures
cargo test -p codex-tui --no-run
env HOME=/private/tmp/codex-bazel-home just argument-comment-lint

Validated against the Codex app branch in openai/openai#890933 using local standalone and plugin MCP servers.

@leoshimo-oai leoshimo-oai requested a review from mzeng-openai May 5, 2026 19:26
@leoshimo-oai leoshimo-oai requested a review from a team as a code owner May 5, 2026 19:26
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

if let Some(approval_mode) = config.approval_mode {
entry["approval_mode"] = value(match approval_mode {
AppToolApproval::Auto => "auto",
AppToolApproval::Prompt => "prompt",
AppToolApproval::Approve => "approve",
});
}

P1 Badge Serialize mcp_app_message_approval_mode in MCP tool config

ConfigEdit::ReplaceMcpServers drops the new per-tool message-approval setting. serialize_mcp_server_tool only emits approval_mode, so rewrites of [mcp_servers] strip mcp_app_message_approval_mode from config.toml. This loses persisted “Always allow” message approvals after subsequent config edits/reloads.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@mzeng-openai
Copy link
Copy Markdown
Collaborator

💡 Codex Review

if let Some(approval_mode) = config.approval_mode {
entry["approval_mode"] = value(match approval_mode {
AppToolApproval::Auto => "auto",
AppToolApproval::Prompt => "prompt",
AppToolApproval::Approve => "approve",
});
}

P1 Badge Serialize mcp_app_message_approval_mode in MCP tool config
ConfigEdit::ReplaceMcpServers drops the new per-tool message-approval setting. serialize_mcp_server_tool only emits approval_mode, so rewrites of [mcp_servers] strip mcp_app_message_approval_mode from config.toml. This loses persisted “Always allow” message approvals after subsequent config edits/reloads.

ℹ️ About Codex in GitHub

Seems legit @leoshimo-oai

Comment thread codex-rs/app-server-protocol/src/protocol/v2.rs Outdated
Comment thread codex-rs/app-server-protocol/src/protocol/v2.rs Outdated
@leoshimo-oai leoshimo-oai force-pushed the leoshimo/mcp-app-always-allow branch 2 times, most recently from 2bf9a37 to 3952b10 Compare May 5, 2026 21:33
@leoshimo-oai leoshimo-oai marked this pull request as draft May 5, 2026 21:34
@leoshimo-oai leoshimo-oai force-pushed the leoshimo/mcp-app-always-allow branch from 3952b10 to f8502a4 Compare May 5, 2026 22:20
@leoshimo-oai leoshimo-oai marked this pull request as ready for review May 5, 2026 23:34
@leoshimo-oai
Copy link
Copy Markdown
Contributor Author

leoshimo-oai commented May 5, 2026

@mzeng - updated.

I also added McpServerProvider to McpServerStatus since you last saw - it allows clients to differentiate where the running MCP came to target config edits correctly.

lmkwyt

@leoshimo-oai leoshimo-oai force-pushed the leoshimo/mcp-app-always-allow branch from f8502a4 to d943eb4 Compare May 5, 2026 23:48
@leoshimo-oai leoshimo-oai force-pushed the leoshimo/mcp-app-always-allow branch from d943eb4 to dd6239a Compare May 6, 2026 00:07
}
}
}
if effective_servers.contains_key(CODEX_APPS_MCP_SERVER_NAME) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tech debt is on me, but we really shouldn't be doing hardcoded server name check anymore, I'm getting #20649 in to stop this so hopefully you can rebase and remove this check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's great - lmk once it's in 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed McpServerProvenance in the other PR, which reminds me of McpServerProvider. Maybe some dots to connected there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants