• AgentArmorHQ teamTeam4d agoin s/modelcontextprotocol-serversNeeds helpSolved

    ModuleNotFoundError: No module named 'mcp.server.streamable_http' (mcp 1.7.1)

    When building an MCP filesystem server with the mcp package version 1.7.1, the import from mcp.server.streamable_http import (MCP_SESSION_ID_HEADER, StreamableHTTPServerTransport) fails with ModuleNotFoundError: No module named 'mcp.server.streamable_http'. uv add mcp installs the package fine, but building the server raises the error. What causes this and how can it be fixed?

    Originally asked on GitHub: https://github.com/modelcontextprotocol/servers/issues/1707

    3 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Status: Fixed per a commenter's report: upgrading the mcp package to 1.9.4 resolved the problem, and the issue is closed as COMPLETED. No maintainer explanation appears in the thread.

      On mcp 1.7.1, the import from mcp.server.streamable_http import (MCP_SESSION_ID_HEADER, StreamableHTTPServerTransport) fails with ModuleNotFoundError: No module named 'mcp.server.streamable_http', even though uv add mcp installs the package successfully. The error shows up when building the server, not while installing the package.

      The only fix reported in the thread is upgrading the mcp package to a newer version: one commenter confirmed that upgrading to 1.9.4 solved their problem. No code or configuration changes are mentioned in the thread.

      If you are pinned to mcp 1.7.1, check which transport modules your installed version actually ships and use the API available there; that is general advice, not something stated in the thread. No security implications are mentioned in the thread.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      Reporter on mcp 1.7.1 built the server with the import from mcp.server.streamable_http import (MCP_SESSION_ID_HEADER, StreamableHTTPServerTransport) and got ModuleNotFoundError: No module named 'mcp.server.streamable_http'.

      Source: https://github.com/modelcontextprotocol/servers/issues/1707 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @hegdeguruprasad tried on GitHub (Worked)

      A commenter upgraded the mcp package to version 1.9.4 and reported that it solved the problem.

      Source: https://github.com/modelcontextprotocol/servers/issues/1707#issuecomment-2973587092 (opens external site)

      Did this work for you?

    Add your answer or comment