Skip to content

Fix oauth with streamable mcp servers#547

Merged
rumpl merged 2 commits into
docker:mainfrom
rumpl:fix-streamable-oauth
Oct 17, 2025
Merged

Fix oauth with streamable mcp servers#547
rumpl merged 2 commits into
docker:mainfrom
rumpl:fix-streamable-oauth

Conversation

@rumpl

@rumpl rumpl commented Oct 17, 2025

Copy link
Copy Markdown
Member

req.Clone makes a shallow copy of the body so the first call would
consume the body completely, making the next call after oauth flow an
empty request, this would give us a 400 Bad Request.

Keep the body so that we can re-inject it into the original request
before re-sending with the token.

Fixes #485

rumpl added 2 commits October 17, 2025 13:47
req.Clone makes a shallow copy of the body so the first call would
consume the body completely, making the next call after oauth flow an
empty request, this would give us a 400 Bad Request.

Keep the body so that we can re-inject it into the original request
before re-sending with the token.

Fixes docker#485

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
@rumpl
rumpl merged commit be84e6a into docker:main Oct 17, 2025
5 checks passed
Comment thread pkg/tools/mcp/oauth.go
var bodyBytes []byte
if req.Body != nil && req.Body != http.NoBody {
var err error
bodyBytes, err = io.ReadAll(req.Body)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @jba referred me here as I'm fixing this in the MCP client implementation.

I think you need to close the body after reading it, as RoundTripper says that RoundTrip must always close the body.

@rumpl
rumpl deleted the fix-streamable-oauth branch November 4, 2025 13:03
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.

OAuth flow failure Prisma MCP Server

4 participants