Skip to content

fix: enforce JSON-API headers via httpx event hook#41

Merged
sylvainkalache merged 3 commits intomainfrom
fix/enforce-jsonapi-headers-via-event-hook
Feb 6, 2026
Merged

fix: enforce JSON-API headers via httpx event hook#41
sylvainkalache merged 3 commits intomainfrom
fix/enforce-jsonapi-headers-via-event-hook

Conversation

@sylvainkalache
Copy link
Contributor

Summary

  • Fixes HTTP 415 (Unsupported Media Type) errors on all API calls when running with newer fastmcp versions (>=2.10)
  • Root cause: newer fastmcp calls client.send() instead of client.request(), bypassing our header override. The __getattr__ delegation silently forwarded send() to the inner httpx client without applying Content-Type: application/vnd.api+json
  • Adds an httpx event hook (_enforce_jsonapi_headers) that enforces correct headers at the transport level before every outgoing request, regardless of how it was initiated
  • Adds explicit send() proxy and fixes base_url property for newer fastmcp compatibility

Test plan

  • All 244 existing tests pass
  • Deploy and verify listTeams, getCurrentUser, and other tools no longer return 415
  • Verify hosted mode with MCP client (Claude Desktop / Claude Code)

Change auto_promote condition from 'main' to 'master' to match
the actual branch name used in Semaphore CI.
Newer fastmcp versions (>=2.10) call client.send() instead of
client.request(), bypassing our header override in request(). The
__getattr__ delegation silently forwarded send() to the inner httpx
client without applying Content-Type: application/vnd.api+json.

Add an httpx event hook that enforces the correct headers at the
transport level before every outgoing request, regardless of how
it was initiated. Also add an explicit send() proxy and fix base_url
to return the httpx URL object for newer fastmcp compatibility.
@greptile-apps
Copy link

greptile-apps bot commented Feb 6, 2026

Greptile Overview

Greptile Summary

  • Moves JSON:API header enforcement from a client.request() override to an httpx request event hook so headers apply even when client.send() is used (newer fastmcp behavior).
  • Adds explicit send() proxy and adjusts base_url property handling for compatibility with newer fastmcp/httpx client usage.
  • Updates uv.lock to reflect dependency/lock changes related to the httpx/fastmcp compatibility fix.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • Changes are tightly scoped to httpx request header enforcement and compatibility with newer fastmcp calling patterns, and do not introduce new control flow outside the client wrapper. No definite runtime errors or security regressions were identified in the modified code.
  • No files require special attention

Important Files Changed

Filename Overview
src/rootly_mcp_server/server.py Adds an httpx request event hook to enforce JSON:API headers on every outgoing request, plus explicit send() proxy and base_url handling for newer fastmcp behavior; no correctness issues found in the changes.
uv.lock Lockfile updated to align dependency resolution with the header enforcement changes; no code-level issues to address.

@sylvainkalache sylvainkalache merged commit c7153c3 into main Feb 6, 2026
12 checks passed
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.

1 participant