Skip to content

HttpClientStreamableHttpTransport does not support redirect (status code 301) #729

@Pasichniuk

Description

@Pasichniuk

Bug description
HttpClientStreamableHttpTransport does not support redirect (status code 301) - exception is thrown.
Use-case: docker image 'mcp/atlassian' handles requests to '/mcp' with 301/redirect to '/mcp/'.

Environment
Java 17 + io.modelcontextprotocol.sdk:mcp:0.17.0

Steps to reproduce
Run MCP server based on 'mcp/atlassian' docker image and try to access it using McpClient with '/mcp' endpoint configured.

Expected behavior
McpSyncClient successfully handles 301/redirect instead of throwing exception.

Minimal Complete Reproducible example

var builder = HttpClientStreamableHttpTransport.builder(baseUrl)
                .endpoint("/mcp")
                .build();
var client = McpClient.sync(builder).build();
client.initialize(); // exception is thrown

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions