fastmcp icon indicating copy to clipboard operation
fastmcp copied to clipboard

An issue connecting to Claude when importing the python requests library

Open aevo98765 opened this issue 9 months ago • 2 comments

Conditions

python uv project. fastmcp server with the requests library added. The dev MCP Inspector can run the server. However, when I install the server to use with Claude it shuts down the serve immediately after startup saying no requests library found.

Requests is in the pyproject.toml and uv.lock file. I have replaced the requests library with httpx and it works fine now.

aevo98765 avatar Mar 30 '25 23:03 aevo98765

Hi, I faced a similar issue, what worked for me was, i installed uv via brew and removed the entire cache folders present in the claude directory and try again. Let me know if that works for you

VivekSinghDS avatar Apr 06 '25 17:04 VivekSinghDS

Same problem

requests package is exists in my conda environment, but "no module named requests" occured.

kdh-awraw1019 avatar Apr 08 '25 06:04 kdh-awraw1019

are you putting the dependency in FastMCP(..., dependencies=[...]) or how are you expecting your deps to get there?

zzstoatzz avatar Apr 11 '25 16:04 zzstoatzz

it doesn't work with requests, the fastmcp only recognizes uv @kdh-awraw1019

VivekSinghDS avatar Apr 14 '25 06:04 VivekSinghDS

Claude does not run your local environment. It is an entirely isolated environment. You need to either use dependencies as @zzstoatzz indicated (which works with FastMCP only), or use uv or fastmcp install with --with <dependency> or --with-editable <your local repo> to get Claude to run with specific dependencies.

httpx works because it is included with FastMCP, and FastMCP automatically adds --with fastmcp to all Claude installations.

jlowin avatar Apr 14 '25 12:04 jlowin