rmcp (official Rust MCP SDK): default Streamable HTTP client never follows spec-permitted redirects - redirecting MCP servers hard-fail with Err(UnexpectedServerResponse)
Maintainer antworten meist innerhalb von 3 Tagen
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 45/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- rust
- Bereich
- api, networking
Rechercherichtung
Beginne in crates/rmcp/src/transport/common/reqwest/streamable_http_client.rs bei StreamableHttpClientTransport::default_http_client(), und prüfe anschließend den bestehenden Unit-Test, der das Durchsickern benutzerdefinierter Header bei Weiterleitungen abdeckt. Reproduziere den 307-Fall aus dem Issue und ermittle, ob eine sichere Weiterleitungsrichtlinie oder eine konfigurierbare Richtlinie vorgesehen ist. Als erledigt gilt die Aufgabe, wenn Weiterleitungen von MCP-Servern funktionieren, ohne benutzerdefinierte Header unsicher erneut zu senden, und das bestehende Verhalten sowie die relevanten Tests entsprechend aktualisiert sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
rmcp (official Rust MCP SDK): default Streamable HTTP client never follows spec-permitted redirects
Type: functional / MCP conformance
Component: crates/rmcp/src/transport/common/reqwest/streamable_http_client.rs — StreamableHttpClientTransport::default_http_client()
Summary
The official Rust SDK's default Streamable HTTP client is built with:
reqwest::Client::builder()
.pool_max_idle_per_host(0)
.redirect(reqwest::redirect::Policy::none())
.build()
so it never follows HTTP redirects. The MCP spec explicitly permits servers to respond to transport requests with 301/302/307/308 (load balancing, canonical URL / trailing-slash normalization — see e.g. https://github.com/IBM/mcp-context-forge#4441 for a real 307 on /mcp/). Against any redirecting server, every request degrades to:
Err(StreamableHttpError::UnexpectedServerResponse("HTTP 307: ..."))
and the client cannot talk to that server at all.
The truncation is deliberate (there is a unit test asserting no custom-header leak to a redirect target — sensible given reqwest's default policy would replay custom headers), but the consequence is that a spec-compliant redirecting MCP server is unsupported out of the box.
Repro (no build needed)
Point any rmcp StreamableHttpClientTransport (default client) at a server that answers POST /mcp with 307 Location: <same-origin>/v2/mcp. Every post_message returns UnexpectedServerResponse("HTTP 307: ...") instead of issuing a follow-up request to the new Location.
A self-contained crate reproducing this (and the goose-side contrast) is at https://github.com/trickyfalcon/cve-hunt/blob/main/poc-goose-rust/ — scenario B prints the Err(UnexpectedServerResponse("HTTP 307: ...")) directly.
Suggested direction
Follow redirects safely rather than never: only follow cross-host/cross-lo*...* leftovers to be trimmed — or, at minimum, make redirect policy configurable on StreamableHttpClientTransportConfig while keeping the default strict (no-follow) for backwards compatibility. An explicit redirect policy override (as an associated constructor option) would let security-conscious users opt in to same-origin redirect following.
Environment
- rmcp via modelcontextprotocol/rust-sdk (checked out 2026-08-22, rmcp crate 3.x)
- Reproducible with the PoC referenced above
Happy to be credited in the advisory/release notes as: Mo (@trickyfalcon, https://trickyfalcon.com)
- Vorherrschende Sprache
- Rust
- Sterne
- 4.1k
- Forks
- 680
- Ø Merge
- 3 T. 20 Std.
- Gemergte PRs (30 T.)
- 32
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/rust-sdk
-
auth: refresh_token() requests offline_access that was never granted, so refreshes fail with invalid_scopeEvtl. vergeben @jstar0 hat das vor 20 Tagen übernommen. Offenbug P1 ready for work T-security T-transport
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
modelcontextprotocol/rust-sdk#1330 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Enterprise-managed auth: ID-JAG `resource` claim should be optionalEvtl. vergeben @gocamille hat das heute übernommen. Offenbug P1 ready for work T-security T-transport
modelcontextprotocol/rust-sdk#1404 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Auto discovery timeout rejects a late probe response during legacy initializationEvtl. vergeben @gocamille hat das vor 1 Tag übernommen. Offenbug P1 ready for work T-service
modelcontextprotocol/rust-sdk#1400 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
URL mode elicitation requires elicitationId, which the 2026-07-28 schema removedEvtl. vergeben @gocamille hat das vor 2 Tagen übernommen. Offenbug P1 ready for work T-model
modelcontextprotocol/rust-sdk#1399 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
stdio transport: a request over the maximum line length gets no answerEvtl. vergeben @gocamille hat das vor 2 Tagen übernommen. Offenbug P1 ready for work T-transport
modelcontextprotocol/rust-sdk#1395 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in modelcontextprotocol/rust-sdk
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
swc-project/swc-next#1165 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
Alive24/shea-symphony#574 ·
-
bug tests Windows
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
documentation good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
dev-five-git/devup-ui#879 ·
Maintainer antworten meist innerhalb von 11 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
farion1231/cc-switch#9038 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag