Skip to content

mount_path does not work with sse_app #783

Description

@kinch-tech

while i start mcp server with mcp.run, provided with mount_path, then client get bad response with 404。

the endpoint for handling post message should be normalized_message_endpoint, not the original message_path

        routes.append(
            Mount(
                self.settings.message_path,
                app=sse.handle_post_message,
            )
        )

Activity

  1. adamsaimi commented on Jun 21, 2025

    @adamsaimi

    Hello i opened a merge request, there was no 1.9.x branch available so I targeted main.

  2. added
    bugSomething isn't working
    needs reproneeds additional information to be able to reproduce bug
    on Oct 3, 2025
  3. felixweinberger commented on Oct 3, 2025

    @felixweinberger
    Contributor

    Hi @kinch-tech thanks for this submission could you provide a full code snippet to reproduce the issue so we can debug?

  4. felixweinberger commented on Jan 16, 2026

    @felixweinberger
    Contributor

    Closing this via #1881, which removes the mount_path parameter entirely.

    The mount_path parameter was redundant because the SSE transport already handles sub-path mounting automatically via ASGI's standard root_path mechanism. When you use Starlette's Mount(), it sets root_path in the ASGI scope, and SseServerTransport already uses this to construct the correct message endpoint path (see sse.py lines 148-161).

    The fix: Just remove any mount_path configuration and rely on ASGI's built-in mechanism:

    from starlette.applications import Starlette
    from starlette.routing import Mount
    from mcp.server.fastmcp import FastMCP
    
    github_mcp = FastMCP("GitHub API")
    browser_mcp = FastMCP("Browser")
    
    # This just works - no mount_path needed
    app = Starlette(
        routes=[
            Mount("/github", app=github_mcp.sse_app()),
            Mount("/browser", app=browser_mcp.sse_app()),
        ]
    )

    The SSE transport will automatically return /github/messages/ and /browser/messages/ as the message endpoints to clients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds reproneeds additional information to be able to reproduce bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions