Skip to content

404 Not Found Error when Establishing SSE Connection via MCP Python SDK #507

Closed

Description

@chi2liu

Describe the bug
A clear and concise description of what the bug is.

Description​​
When attempting to establish SSE connection with MCP Python SDK (v1.6.0), encountering persistent 404 errors on critical endpoints:

mcp = FastMCP("Demo", debug=True, log_level="DEBUG", message_path="/abcd/abcd/messages/")

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

[04/14/25 09:45:51] DEBUG Setting up SSE connection sse.py:87

                DEBUG    session_uri:                             sse.py:106

                          /abcd/abcd/messages/?session_id
                         =b5b93f9d4088442fa3edb1c679a7a922

                DEBUG    Created new session with ID:             sse.py:109
                         b5b93f9d-4088-442f-a3ed-b1c679a7a922

                DEBUG    Starting SSE response task               sse.py:136

                DEBUG    Yielding read and write streams          sse.py:139

INFO: 100.67.30.95:57894 - "GET /sse HTTP/1.1" 200 OK

                DEBUG    Starting SSE writer                      sse.py:116

                DEBUG    Sent endpoint event:                     sse.py:119
                          /abcd/abcd/messages/?session_id
                         =b5b93f9d4088442fa3edb1c679a7a922

                DEBUG    chunk: b'event: endpoint\r\ndata:        sse.py:156
                         /abcd/abcd/messages/?session_id
                         =b5b93f9d4088442fa3edb1c679a7a922\r\n\r\
                         n'

INFO: 10.183.49.44:60168 - "GET /prometheus HTTP/1.1" 404 Not Found

INFO: 100.67.31.17:49088 - "POST /messages/?session_id=b5b93f9d4088442fa3edb1c679a7a922 HTTP/1.1" 404 Not
Found

                DEBUG    Got event: http.disconnect. Stop         sse.py:177

                         streaming.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Activity

  1. rkondra-eightfold commented on Apr 16, 2025

    @rkondra-eightfold

    can you please share

    • How are you running the server?
    • client code

    The url here is incorrect ...

    INFO: 100.67.31.17:49088 - "POST /messages/?session_id=b5b93f9d4088442fa3edb1c679a7a922 HTTP/1.1" 404 Not
    Found
    

    might be related: #524

  2. MarshallEriksen-Neura commented on Apr 21, 2025

    @MarshallEriksen-Neura

    I have same wrong, I use fastapi mount mcpserver

    fastmcp = FastMCP(
                    self.server_config.get("name", "MCP Server"), message_path="/mcp/messages/"
                )
    FastApi.mount(path="/mcp", app=self.main_server.sse_app())``` 
    But client request shows Client error '404 Not Found' for url 'http://localhost:ip/mcp/messages/?session_id=115273056f3b4d11b2ed15010211ecda' 
  3. mpereira commented on May 6, 2025

    @mpereira

    I'm also running into this.

    fast-agent-mcp==0.2.21
    fastapi-mcp==0.3.3
    mcp[cli]==1.7.1
    

    For folks using fastapi-mcp, the cause might be that you're using uvicorn workers: tadata-org/fastapi_mcp#56

  4. felixweinberger commented on Oct 3, 2025

    @felixweinberger
    Contributor

    Closing this as this may have gone stale - if this is still an issue please feel free to reopen - in that case please provide a minimal but complete code snippet we can run to demonstrate the issue.

  5. added
    bugSomething isn't working
    needs reproneeds additional information to be able to reproduce bug
    on Oct 3, 2025
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