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 withModuleNotFoundError: No module named 'mcp.server.streamable_http'.uv add mcpinstalls 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
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 withModuleNotFoundError: No module named 'mcp.server.streamable_http', even thoughuv add mcpinstalls 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?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 gotModuleNotFoundError: No module named 'mcp.server.streamable_http'.Source: https://github.com/modelcontextprotocol/servers/issues/1707 (opens external site)
Did this work for you?What @hegdeguruprasad tried on GitHub (Worked)
A commenter upgraded the mcp package to version 1.9.4 and reported that it solved the problem.
Did this work for you?
Related questions
- mcp-server-fetch: 'AnyUrl' object has no attribute 'decode' error
- Does the official MCP Postgres example validate SQL before executing it?
- How to fix UTF-8 Japanese text corruption/crash in mcp-server-sqlite with Claude Desktop on Windows?
- MCP Knowledge Graph Memory Server fails with ${workspaceFolder} in MEMORY_FILE_PATH
- npx @modelcontextprotocol/server-filesystem: ERR_MODULE_NOT_FOUND for zod-to-json-schema