使用Pipenv配置Cursor的MCP服务器时创建客户端失败求助
关于使用Pipenv替代UV搭建Anthropic MCP天气服务时出现“Failed to create client”错误的问题
根据Anthropic官方文档,天气MCP示例使用uv作为工具创建虚拟环境并搭建服务,步骤如下:
# Create a new directory for our project uv init weather cd weather # Create virtual environment and activate it uv venv source .venv/bin/activate # Install dependencies uv add "mcp[cli]" httpx # Create our server file touch weather.py
随后按照文档要求创建weather.py文件,最后在Cursor设置中配置mcp.json文件:
{ "mcpServers": { "weather": { "command": "uv", "args": [ "--directory", "/ABSOLUTE/PATH/TO/PARENT/FOLDER/weather", "run", "weather.py" ] } } }
我尝试使用pipenv替代uv搭建项目,安装了所需依赖并使用相同的weather.py文件,操作步骤如下:
# Create a directory for the project mkdir weather cd weather # Create virtual environment pipenv install --python=3.11 # Install dependencies pipenv install "mcp[cli]" httpx # Create our server file touch weather.py
完成项目搭建、依赖下载和代码编写后,我配置了如下mcp.json文件:
{ "mcpServers": { "weather": { "command": "pipenv", "args": ["run","python","weather.py"] } } }
配置完成后,在Cursor的MCP服务器设置中出现“Failed to create client”错误。我已确保Python版本和依赖与官方示例一致,仅替换了uv为pipenv,请问无法使用pipenv配合MCP的原因是什么?
内容的提问来源于stack exchange,提问作者Raymond Yu




