Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion proofline/_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _decode(response: httpx2.Response, identity: int | None) -> dict[str, Any]:
if response.content:
raise _refused()
return {}
if response.headers.get("content-type", "").split(";")[0].strip() != "application/json":
if response.headers.get("content-type", "").split(";")[0].strip().lower() != "application/json":
raise _refused()
try:
value = response.json()
Expand Down
28 changes: 28 additions & 0 deletions tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -2586,3 +2586,31 @@ def respond(request: Request, index: int) -> Reply:
assert len(exported.rows) == 1
assert exported.rows[0]["claim"] == row["claim"]
assert exported.next_cursor == "next-page"


@MODES
@pytest.mark.parametrize("content_type", ["Application/JSON", "APPLICATION/JSON; charset=utf-8"])
async def test_mcp_accepts_case_insensitive_content_type(mode: str, content_type: str) -> None:
def respond(request: Request, index: int) -> Reply:
body = json.loads(request.body)
if body["method"] == "initialize":
return Reply(
body={"jsonrpc": "2.0", "id": 1, "result": {"protocolVersion": "2025-11-25"}},
headers={"Content-Type": content_type},
)
if body["method"] == "notifications/initialized":
return Reply(status=202, body=b"")
return Reply(
body={
"jsonrpc": "2.0",
"id": 2,
"result": {"content": [{"type": "text", "text": "ok"}]},
},
headers={"Content-Type": content_type},
)

with Server(respond) as server:
async with session(mode, server.url) as client:
mcp_client = client.mcp if mode == "sync" else client.mcp
res = await call(mcp_client, "list_organizations")
assert res["content"] == [{"type": "text", "text": "ok"}]