codex - ✅(Solved) Fix Config schema exposes unsupported MCP `bearer_token` field [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19275Fetched 2026-04-24 10:39:32
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
0
Timeline (top)
labeled ×4closed ×1commented ×1cross-referenced ×1

Error Message

A narrow fix might be to keep the raw field internally only for compatibility/error reporting, but hide it from the generated schema or mark it clearly as unsupported/deprecated.

Fix Action

Fixed

PR fix notes

PR #19294: Hide unsupported MCP bearer_token from config schema

Description (problem / solution / changelog)

Summary

Fixes #19275.

Codex runtime rejects inline MCP bearer_token config entries and asks users to configure bearer_token_env_var instead, but the generated config schema still advertised mcp_servers.<name>.bearer_token as a supported field. That made editor/schema validation disagree with runtime validation.

This keeps bearer_token in RawMcpServerConfig so Codex can continue producing the targeted runtime error for recent or existing configs, but skips the field during schemars generation. The checked-in core/config.schema.json fixture now exposes bearer_token_env_var without exposing unsupported inline bearer_token.

Verification

  • Added config_schema_hides_unsupported_inline_mcp_bearer_token to assert the generated schema hides bearer_token while preserving bearer_token_env_var.
  • Ran cargo test -p codex-config.
  • Ran cargo test -p codex-core config_schema.

Changed files

  • codex-rs/config/src/mcp_types.rs (modified, +6/-1)
  • codex-rs/core/config.schema.json (modified, +1/-4)
  • codex-rs/core/src/config/schema_tests.rs (modified, +20/-0)

Code Example

"bearer_token": {
  "type": "string"
}

---

[mcp_servers.docs]
url = "https://example.com/mcp"
bearer_token = "secret"
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

codex-cli 0.124.0

What subscription do you have?

ChatGPT Pro

Which model were you using?

N/A - config schema/runtime validation issue

What platform is your computer?

Darwin 25.3.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

N/A - config schema/runtime validation issue

What issue are you seeing?

The generated/editor-facing Codex config schema accepts mcp_servers.<name>.bearer_token as a valid MCP server config field, but the runtime rejects that field.

In the local generated schema, RawMcpServerConfig includes:

"bearer_token": {
  "type": "string"
}

The published schema currently appears to expose the same field:

However, runtime config parsing rejects bearer_token for MCP configs and uses bearer_token_env_var instead.

This is related to #5011, but not the same issue. #5011 covered documentation for bearer_token vs bearer_token_env_var. This report is about the generated/editor-facing config schema still accepting bearer_token even though the runtime rejects it.

What steps can reproduce the bug?

Use an MCP streamable HTTP config like:

[mcp_servers.docs]
url = "https://example.com/mcp"
bearer_token = "secret"

The config schema accepts bearer_token as a string property, but runtime validation rejects it.

Code references:

  • codex-rs/config/src/mcp_types.rs: RawMcpServerConfig includes bearer_token, but TryFrom<RawMcpServerConfig> rejects it for streamable HTTP.
  • codex-rs/config/src/mcp_edit.rs: inline bearer_token is rejected with guidance to use bearer_token_env_var.
  • codex-rs/config/src/mcp_types_tests.rs: deserialize_rejects_inline_bearer_token_field.
  • codex-rs/core/src/config/config_tests.rs: load_global_mcp_servers_rejects_inline_bearer_token.
  • codex-rs/core/config.schema.json: RawMcpServerConfig.properties.bearer_token.

What is the expected behavior?

The editor-facing/generated config schema should not present bearer_token as a valid supported MCP config field if the runtime rejects it.

A narrow fix might be to keep the raw field internally only for compatibility/error reporting, but hide it from the generated schema or mark it clearly as unsupported/deprecated.

Additional information

Validated against local repo state and the published schema on April 24, 2026.

I’m happy to help with a focused schema/docs PR if maintainers think this is the right scope and invite a contribution, following the repo’s invitation-only contribution policy.

extent analysis

TL;DR

The fix likely involves updating the generated config schema to exclude or deprecate the bearer_token field for MCP server configurations.

Guidance

  • Review the codex-rs/config/src/mcp_types.rs and codex-rs/core/config.schema.json files to understand how the bearer_token field is currently handled.
  • Consider modifying the RawMcpServerConfig struct to exclude the bearer_token field or mark it as deprecated.
  • Update the generated config schema to reflect the changes, ensuring that it no longer presents bearer_token as a valid field for MCP server configurations.
  • Verify that the updated schema is correctly validated by the runtime, using tests such as deserialize_rejects_inline_bearer_token_field and load_global_mcp_servers_rejects_inline_bearer_token.

Example

No code snippet is provided, as the issue requires a schema update rather than a code change.

Notes

The fix may require coordination with the maintainers, given the repository's invitation-only contribution policy. Additionally, care should be taken to ensure backwards compatibility and proper error reporting for existing configurations that use the bearer_token field.

Recommendation

Apply a workaround by manually excluding the bearer_token field from MCP server configurations, using the bearer_token_env_var field instead, until a formal fix is implemented. This approach allows for continued use of the Codex CLI while avoiding the schema validation issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING