Skip to content

fix: accept wildcard patterns in Accept header per RFC 7231 §5.3.2#2442

Open
VrtxOmega wants to merge 1 commit intomodelcontextprotocol:mainfrom
VrtxOmega:fix/rfc-7231-accept-wildcard
Open

fix: accept wildcard patterns in Accept header per RFC 7231 §5.3.2#2442
VrtxOmega wants to merge 1 commit intomodelcontextprotocol:mainfrom
VrtxOmega:fix/rfc-7231-accept-wildcard

Conversation

@VrtxOmega
Copy link
Copy Markdown

Added wildcard pattern matching to the Accept header parser. The server now correctly handles */*, type/*, and exact media type matches in order of specificity per the RFC.

Motivation and Context

The Streamable HTTP transport rejects requests with Accept: */* or Accept: application/* headers, returning an error instead of matching against supported media types. This violates RFC 7231 §5.3.2 which requires servers to honor wildcard Accept values.

Fixes #1641

How Has This Been Tested?

  • Added tests for */* wildcard acceptance
  • Added tests for application/* partial wildcard
  • Added tests for exact match still working
  • All 62 existing tests pass locally

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

N/A

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.

MCP Server won't work with wildcard in "Accept" header and therefore is non‑compliant with HTTP spec

1 participant