core-agent-ide/codex-rs/app-server/src
blevy-oai bdc4742bfc
Add MCP server scopes config and use it as fallback for OAuth login (#9647)
### Motivation
- Allow MCP OAuth flows to request scopes defined in `config.toml`
instead of requiring users to always pass `--scopes` on the CLI.
CLI/remote parameters should still override config values.

### Description
- Add optional `scopes: Option<Vec<String>>` to `McpServerConfig` and
`RawMcpServerConfig`, and propagate it through deserialization and the
built config types.
- Serialize `scopes` into the MCP server TOML via
`serialize_mcp_server_table` in `core/src/config/edit.rs` and include
`scopes` in the generated config schema (`core/config.schema.json`).
- CLI: update `codex-rs/cli/src/mcp_cmd.rs` `run_login` to fall back to
`server.scopes` when the `--scopes` flag is empty, with explicit CLI
scopes still taking precedence.
- App server: update
`codex-rs/app-server/src/codex_message_processor.rs`
`mcp_server_oauth_login` to use `params.scopes.or_else(||
server.scopes.clone())` so the RPC path also respects configured scopes.
- Update many test fixtures to initialize the new `scopes` field (set to
`None`) so test code builds with the new struct field.

### Testing
- Ran config tooling and formatters: `just write-config-schema`
(succeeded), `just fmt` (succeeded), and `just fix -p codex-core`, `just
fix -p codex-cli`, `just fix -p codex-app-server` (succeeded where
applicable).
- Ran unit tests for the CLI: `cargo test -p codex-cli` (passed).
- Ran unit tests for core: `cargo test -p codex-core` (ran; many tests
passed but several failed, including model refresh/403-related tests,
shell snapshot/timeouts, and several `unified_exec` expectations).
- Ran app-server tests: `cargo test -p codex-app-server` (ran; many
integration-suite tests failed due to mocked/remote HTTP 401/403
responses and wiremock expectations).

If you want, I can split the tests into smaller focused runs or help
debug the failing integration tests (they appear to be unrelated to the
config change and stem from external HTTP/mocking behaviors encountered
during the test runs).

------
[Codex
Task](https://chatgpt.com/codex/tasks/task_i_69718f505914832ea1f334b3ba064553)
2026-01-26 14:13:04 -08:00
..
bespoke_event_handling.rs Feat: add isOther to question returned by request user input tool (#9890) 2026-01-26 09:52:38 -08:00
codex_message_processor.rs Add MCP server scopes config and use it as fallback for OAuth login (#9647) 2026-01-26 14:13:04 -08:00
config_api.rs s/mcp_server_requirements/mcp_servers (#9212) 2026-01-14 18:41:52 +00:00
dynamic_tools.rs feat: dynamic tools injection (#9539) 2026-01-26 10:06:44 +00:00
error_code.rs fix: separate codex mcp into codex mcp-server and codex app-server (#4471) 2025-09-30 07:06:18 +00:00
filters.rs [app-server] feat: add filtering on thread list (#9897) 2026-01-26 21:54:19 +00:00
fuzzy_file_search.rs feat: move file name derivation into codex-file-search (#8334) 2025-12-19 12:50:55 -08:00
lib.rs [app-server] feat: add filtering on thread list (#9897) 2026-01-26 21:54:19 +00:00
main.rs feat(app-server): add an --analytics-default-enabled flag (#9118) 2026-01-13 11:59:39 -08:00
message_processor.rs feat: add auto refresh on thread listeners (#9105) 2026-01-14 16:26:01 +00:00
models.rs feat(tui) /personality (#9718) 2026-01-25 21:59:42 -08:00
outgoing_message.rs Another round of improvements for config error messages (#9746) 2026-01-23 20:11:09 -08:00