Skip to content

feat(model): preserve tool authentication scheme metadata - #1398

Open
starsy wants to merge 1 commit into
modelcontextprotocol:mainfrom
starsy:feat/tool-security-schemes
Open

starsy wants to merge 1 commit into
modelcontextprotocol:mainfrom
starsy:feat/tool-security-schemes

Conversation

@starsy

@starsy starsy commented Oct 27, 2026

Copy link
Copy Markdown

ChatGPT-compatible MCP tools need to advertise top-level securitySchemes. The current typed Tool model cannot emit this field, and deserialization drops it. Applications therefore need a local SDK patch to preserve the declaration.

This change adds optional Tool.security_schemes and a matching builder. It preserves noauth and OAuth scope objects through typed tool catalogs. Existing constructors leave the field unset, so tools without this extension retain their JSON representation. Application _meta remains independent.

The field follows draft SEP-1488. It describes authentication requirements only. It does not validate credentials, change permissions, or alter transport behavior. This implements interoperability support while the proposal remains a draft.

Verification on macOS ARM64 with Rust 1.98.0:

  • 227 library tests and 34 focused integration tests pass, including four new metadata tests.
  • Changed production line coverage is 7/7, or 100% of compiler-mapped executable lines.
  • Stable cargo fmt --all --check passes. The existing nightly-only formatting options produce warnings under stable.
  • Server-only (server,transport-io) and client-only feature checks pass without compiler warnings.
  • cargo clippy -p rmcp --lib --features client -- -D warnings reports 13 result_large_err diagnostics. The same command reports the same 13 locations on unmodified 3.8.0. This PR includes no unrelated lint fixes. The upstream pinned 1.96 toolchain and nightly formatter were not installed for this local check.

The patch is based on rmcp-v3.8.0 (cd88056ffdc97756fbd98e5a12bbeb41758f0ce8).

Design discussion: SEP-1488 already discusses this wire field. This draft proposes the narrow SDK change for review. Please advise if the SDK should expose general descriptor extensions instead while the SEP remains a draft.

An existing downstream integration uses this field for ChatGPT custom MCP connections. OpenAI's authenticated server example also emits it. No downstream application code or credentials are included.

Add the optional securitySchemes field and a matching Tool builder for clients that consume draft SEP-1488 metadata. Omit the field when unset and retain separate application metadata. The declarations describe authentication requirements and do not change credential or permission enforcement.

Verify legacy payload compatibility, noauth and OAuth scope round trips, default constructors, typed tool catalogs, and trait-based tool construction. Focused tests pass. Rust 1.98 Clippy reports the same 13 result_large_err diagnostics on the unmodified 3.8.0 base; no unrelated lint changes are included.
@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-handler Handler implementation changes T-model Model/data structure changes labels Oct 27, 2026
@github-actions
github-actions Bot requested a review from gocamille October 27, 2026 08:57
@github-actions

Copy link
Copy Markdown
Contributor

@gocamille is on triage rotation this week and is the reviewer for this one.

Labels come from the PR labeler. Please review the change.

Automated triage. Labels are a first pass and the assigned maintainer has the final say.

@starsy starsy changed the title [BU-163]feat(model): preserve tool authentication scheme metadata feat(model): preserve tool authentication scheme metadata Oct 27, 2026
@starsy
starsy marked this pull request as ready for review October 27, 2026 18:34
@starsy
starsy requested a review from a team as a code owner October 27, 2026 18:34
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-27T18:34:42.500997Z a3fe58e Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

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

Labels

T-core Core library changes T-handler Handler implementation changes T-model Model/data structure changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant