mcp-server-fetch on Mac throws error 'AnyUrl' object has no attribute 'decode'
Describe the bug When using Claude Desktop or the inspector running the fetch tool returns the error "'AnyUrl' object has no attribute 'decode' "
To Reproduce
- npx @modelcontextprotocol/inspector uvx mcp-server-fetch
- Open inspector url in my case http://localhost:5173/
- Click the "Tools" tab
- Click "List Tools" button
- Select fetch tool
- Enter any web address into the "url" input box and click "Run Tool"
Expected behavior Return the markdown content of the page
Logs {"method":"tools/call","params":{"name":"fetch","arguments":{"url":"https://par-com.net"},"_meta":{"progressToken":0}}} {"content":[{"type":"text","text":"'AnyUrl' object has no attribute 'decode'"}],"isError":true}
Additional context Running on latest OSX on Mac M4, Python 3.11
To fix the error, I cloned the repo and changed: url: Annotated[AnyUrl, Field(description="URL to fetch")] to url: Annotated[str, Field(description="URL to fetch")] then run the inspector using local repo invocation to verify it was fixed.
Same error and resolution work for Claude Desktop
Came across this bug as well and had a hell of a time troubleshooting until I found your post. Thanks for the fix!
Same on Windows with version 0.6.1. Thanks a lot @paulrobello for providing solution, was able to get mine working until this will be fixed in the next release.
Appears to have regressed? Maybe the most recent merged PR?
This has just released in package version 0.6.2. Let me know if you are still having issues.
It works perfectly now with version 0.6.2 (here on Windows).
I haven't had the error since yesterday. Though it's hard to know which version of the code I'm running locally in Claude desktop app, given that it's not obvious when/if the uvx install command fetches fresh code from the server.
I've taken to doing uv cache clean, killing any uv processes, and restarting Claude desktop app. But there's no clear logging I can find of what versions of MCP servers are being run, so it's fairly trial and error. Is there a better way? Or way to see running versions?
Run this in a terminal to update: uvx mcp-server-fetch@latest
Then ctrl-C to kill, then restart Claude.
0.6.2 works ok under Windows (with pip - I don't use uv/uvx).