Skip to content

Added new auth-related methods and events to mcp server - #2496

Merged
etraut-openai merged 12 commits into
mainfrom
auth_status_logout
Aug 21, 2025
Merged

etraut-openai merged 12 commits into
mainfrom
auth_status_logout

Conversation

@etraut-openai

Copy link
Copy Markdown
Contributor

This PR adds the following:

  • A getAuthStatus method on the mcp server. This returns the auth method currently in use (chatgpt or apikey) or none if the user is not authenticated. It also returns the "preferred auth method" which reflects the preferred_auth_method value in the config.
  • A logout method on the mcp server. If called, it logs out the user and deletes the auth.json file — the same behavior in the cli's /logout command.
  • An authStatusChange event notification that is sent when the auth status changes due to successful login or logout operations.
  • Logic to pass command-line config overrides to the mcp server at startup time. This allows use cases like codex mcp -c preferred_auth_method=apikey.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

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 that is ready for review, or mark a draft as ready for review. You can also ask for a review by commenting "@codex review".

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

Comment thread codex-rs/protocol/src/mcp_protocol.rs Resolved
Comment thread codex-rs/protocol/src/mcp_protocol.rs Resolved
Comment thread codex-rs/protocol/src/protocol.rs Resolved
Comment thread codex-rs/protocol/Cargo.toml Resolved
Comment thread codex-rs/mcp-server/src/main.rs Resolved
Comment thread codex-rs/mcp-server/src/lib.rs Resolved
Comment thread codex-rs/mcp-server/src/lib.rs Resolved
Comment thread codex-rs/mcp-server/src/lib.rs Resolved
@etraut-openai

Copy link
Copy Markdown
Contributor Author

@bolinfest, ready for another round of review. I incorporated feedback from your last round:

  1. Added ServerNotification enum and updated send_notification to accept it.
  2. Reversed the dependency between the protocol and logon crates by moving AuthMode from the latter to the former.
  3. Precompute Config with overrides and pass it to mcp server rather than threading config overrides down the call chain.

@etraut-openai

Copy link
Copy Markdown
Contributor Author

@bolinfest, I incorporated your latest round of feedback. The serialization code is now much simpler and cleaner! The key was to use the serde content = "data" directive. This isolates the payload from the "type" discriminator field, which makes serialization much simpler.

I think it's ready for another (hopefully final) round of review.

@bolinfest bolinfest left a comment

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.

Nice work, but please address comments before submitting!

Comment thread codex-rs/protocol/src/mcp_protocol.rs Resolved
Comment thread codex-rs/protocol/src/mcp_protocol.rs Resolved
@etraut-openai
etraut-openai merged commit dacff96 into main Aug 21, 2025
@etraut-openai
etraut-openai deleted the auth_status_logout branch August 21, 2025 03:36
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants