Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Fix Streamable HTTP Accept header quality-factor handling

Open
#3,154 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
api, backend

Research direction

Start by tracing Streamable HTTP request handling and the check_accept_headers example in the issue, focusing on how Accept parameters are parsed. Verify behavior with the provided application/json;q=0 and text/event-stream;q=1.0 request, and consider additional quality-factor cases; done means explicitly unacceptable media types are not treated as accepted under RFC 7231 semantics.

Written by the indexing model from the issue text.

Description

bug needs confirmation P3 v1 v2
Initial Checks
Description

Streamable HTTP currently ignores q=0 values in the Accept header, so requests that explicitly mark a media type as unacceptable can still be accepted. This violates RFC 7231 semantics for content negotiation and can cause clients and servers to disagree about which response format is actually allowed.

Example Code
from starlette.requests import Request

def check_accept_headers(request: Request) -> tuple[bool, bool]:
    accept_header = request.headers.get("accept", "")
    accept_types = [media_type.strip().split(";")[0].strip().lower() for media_type in accept_header.split(",")]

    has_wildcard = "*/*" in accept_types
    has_json = has_wildcard or any(t in ("application/json", "application/*") for t in accept_types)
    has_sse = has_wildcard or any(t in ("text/event-stream", "text/*") for t in accept_types)

    return has_json, has_sse

# Example: client explicitly rejects JSON
request = Request({"type": "http", "method": "GET", "headers": [(b"accept", b"application/json;q=0, text/event-stream;q=1.0")]})

print(check_accept_headers(request))
# -> (True, True)
Python & MCP Python SDK
Python 3.12.10
MCP Python SDK: 1.28.1
Dominant language
Python
Stars
24.3k
Forks
4k
Avg merge
1d 11h
Merged PRs (30d)
30

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/python-sdk

All issues in modelcontextprotocol/python-sdk

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.