servers
servers copied to clipboard
No Module Error - Adding MCP server inside Claude Desktop
I am trying to add a MCP server in claude desktop. After properly installing required packages, still getting errors. Also, I have added a simple MCP server earlier in the claude desktop that is running properly.
Steps that I did for creating and adding the server to claude destop-
uv add "mcp[cli]"- To add mcp cli in the project folderuv pip install -r requirements.txt- to install all the required packagesuv run mcp install main.py- to add the server inside claude desktop
I am seeing a successful installation message in the terminal, but when I open claude desktop it shows the server fails to run due to a missing module error in the error logs.
ERROR LOGS -
2025-05-19T13:44:08.019Z [TestServer] [info] Initializing server...
2025-05-19T13:44:08.050Z [TestServer] [info] Server started and connected successfully
2025-05-19T13:44:08.052Z [TestServer] [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 'fitz'
2025-05-19T13:44:09.663Z [TestServer] [info] Server transport closed
2025-05-19T13:44:09.664Z [TestServer] [info] Client transport closed
2025-05-19T13:44:09.664Z [TestServer] [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-05-19T13:44:09.664Z [TestServer] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}
2025-05-19T13:44:09.664Z [TestServer] [info] Client transport closed
Can anyone please help on what I might be doing wrong for this one?
I got same error , anyone resolve this please help me
No, still haven't found anything resolves this issue. Any server with no additional packages, are getting added onto Claude Desktop properly and working. But whenever I try to add a server with tools using some packages it gives error while adding it to Claude Desktop.
same issue
I have this same problem. I even tried running with uv run --directory /path/to/my/mcp.py fails.
Looks like the integration of Claude Desktop doesn't really work for python mcp servers that need a virtual environment setup with all the required installed packages.
I'm also facing this issue.
As a workaround, instead of
"my-mcp": {
"command": "/opt/homebrew/bin/uv",
"args": [
"run",
"--with",
"mcp[cli]",
"mcp",
"run",
"/path/to/project/server.py"
],
}
I use:
"my-mcp": {
"command": "/path/to/project/.venv/bin/mcp",
"args": [
"run",
"/path/to/project/server.py"
],
}
unfortunately, that doesn't work for python scripts that are wrapped in click.
my python project generates an executable that needs a command and a config option on the commandline, such as
haminfo mcp-server -c /path/to/my/config.conf --loglevel DEBUG
Claude completely fails to do this correctly.
I am also facing the same issue, the work around is not working either
I ran into the same problem, I was able to address it by adding another "--with", "pyjwt" before the "run" so basically this: "my-mcp": { "command": "/opt/homebrew/bin/uv", "args": [ "run", "--with", "mcp[cli]", "--with", "pyjwt", "mcp", "run", "/path/to/project/server.py" ], }
I ran into the same problem, I was able to address it by adding another "--with", "pyjwt" before the "run" so basically this: "my-mcp": { "command": "/opt/homebrew/bin/uv", "args": [ "run", "--with", "mcp[cli]", "--with", "pyjwt", "mcp", "run", "/path/to/project/server.py" ], }
This worked, but it defeats the whole purpose of having requirements.xt or pyproject.toml file. I am sure anthropic team will have a better solution to this,
This can be done using the correct working directory as seen on https://modelcontextprotocol.io/quickstart/server
So this should be
"my-mcp": {
"command": "/opt/homebrew/bin/uv",
"args": [
"run",
"--directory",
"/path/to/project",
"run",
"/path/to/project/server.py"
],
}
This can be done using the correct working directory as seen on https://modelcontextprotocol.io/quickstart/server
So this should be
"my-mcp": { "command": "/opt/homebrew/bin/uv", "args": [ "run", "--directory", "/path/to/project", "run", "/path/to/project/server.py" ], }
Thank you!, For windows as well, this is working
This can be done using the correct working directory as seen on https://modelcontextprotocol.io/quickstart/server
So this should be
"my-mcp": { "command": "/opt/homebrew/bin/uv", "args": [ "run", "--directory", "/path/to/project", "run", "/path/to/project/server.py" ], }
Can report this worked!