ModuleNotFoundError: No module named 'mcp'
- Spec
2026-07-28- Evidence
- E2Reproducedarm64
- Python SDK
mcp@2.3.0- Verified
What it means
Section titled “What it means”The server’s first import failed:
ModuleNotFoundError: No module named 'mcp'We got this by running import mcp with the system python3, while the SDK was installed only in the project’s virtual environment. The process exits right away, so the client usually shows Connection closed, and this line is in the server’s log.
If the message names a submodule, such as mcp.server.fastmcp, the SDK is installed but its version does not match your code: see No module named ‘mcp.server.fastmcp’.
The client starts a different Python
Section titled “The client starts a different Python”"command": "python" means whichever python is first on the client’s PATH. That is rarely your project’s virtual environment. Use one of these instead:
-
uv (recommended): let uv pick the project’s environment.
{ "command": "uv", "args": ["run", "--directory", "/absolute/path/to/project", "python", "server.py"] } -
The virtual environment’s interpreter, by full path:
/absolute/path/to/project/.venv/bin/pythonon macOS and Linux,C:\path\to\project\.venv\Scripts\python.exeon Windows.
If uv itself cannot be found, the client reports spawn uv ENOENT; use the full path of uv too.
The SDK is not installed yet
Section titled “The SDK is not installed yet”In the project directory:
uv add mcp # or: pip install mcpThen run the exact command from the client config in a terminal. It should start and wait silently.
Related
Section titled “Related”MCPDev is community documentation. It is not affiliated with the Model Context Protocol project or with the vendors of the clients it covers.