-
Couldn't load subscription status.
- Fork 2.7k
Description
Unable to import any python modules that have to be uv pip installed.
Steps to reproduce the behavior:
- Using uv to create a venv
- activate venv
- uv add sqlalchemy
- from sqlalchemy import create_engine
- run server using cli command: uv run mcp install main.py
Expected behavior
I expect the server on claude's desktop app to show me the tools I have in my main.py file after refreshing (ctrl + R)
I do see this when I remove the import polars as pl line, then my functions show up when they're not reliant on any external function. Below is showing that I have the relevant python modules installed in my venv.
Claude log:
2025-04-29T18:25:10.114Z [test2] [info] Initializing server...
2025-04-29T18:25:10.133Z [test2] [info] Server started and connected successfully
2025-04-29T18:25:10.134Z [test2] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
Failed to run server: No module named 'sqlalchemy'
2025-04-29T18:25:12.426Z [test2] [info] Server transport closed
2025-04-29T18:25:12.426Z [test2] [info] Client transport closed
2025-04-29T18:25:12.427Z [test2] [info] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. console.error('...') in JavaScript, print('...', file=sys.stderr) in python) and it will appear in this log.
2025-04-29T18:25:12.427Z [test2] [error] Server disconnected. For troubleshooting guidance, please visit our debugging documentation {"context":"connection"}
2025-04-29T18:25:12.427Z [test2] [info] Client transport closed
claude_desktop_config.json config:
{
"mcpServers": {
"test2": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"mcp",
"run",
"C:\Users\WaqarQ\OneDrive - Trez Capital\Documents\099. Personal Waqar\Python\mcp-trez\main.py"
]
}
}
}
uv pip list
Package Version
annotated-types 0.7.0
anyio 4.9.0
certifi 2025.1.31
click 8.1.8
colorama 0.4.6
greenlet 3.2.1
h11 0.14.0
httpcore 1.0.8
httpx 0.28.1
httpx-sse 0.4.0
idna 3.10
markdown-it-py 3.0.0
mcp 1.6.0
mdurl 0.1.2
numpy 2.2.5
pandas 2.2.3
polars 1.28.1
pydantic 2.11.3
pydantic-core 2.33.1
pydantic-settings 2.9.1
pygments 2.19.1
pyodbc 5.2.0
python-dateutil 2.9.0.post0
python-dotenv 1.1.0
pytz 2025.2
rich 14.0.0
shellingham 1.5.4
six 1.17.0
sniffio 1.3.1
sqlalchemy 2.0.40
sse-starlette 2.2.1
starlette 0.46.2
typer 0.15.2
typing-extensions 4.13.2
typing-inspection 0.4.0
tzdata 2025.2
uvicorn 0.34.2
OS
Windows 10 Enterprise
I also installed sqlalchemy globally to see if that would work and that did not.
