Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

sse_client fails if URL is not on the root path #563

Copy link
Copy link
@michaelpoluektov

Description

@michaelpoluektov
Issue body actions

Describe the bug
This line is the problem:

endpoint_url = urljoin(url, sse.data)

urljoin discards the whole path, meaning that if url is http://localhost:8000/mcp/sse and sse.data is /messages/?session_id=123 we get endpoint_url == "http://localhost:8000/messages/?session_id=123" instead of http://localhost:8000/mcp/messages/?session_id=123

To Reproduce

  • Launch an MCP server with SSE on a path different from the root of the application.
app = FastAPI()
mcp = FastMCP("my-mcp-server")
app.mount("/mcp", mcp.sse_app())
  • Try to connect to it using sse_client as per the tutorial

Expected behavior

endpoint_url should contain the suffix of url with /sse stripped instead of the whole path being stripped.

Reactions are currently unavailable

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.