servers icon indicating copy to clipboard operation
servers copied to clipboard

mcp-server-fetch on Mac throws error 'AnyUrl' object has no attribute 'decode'

Open paulrobello opened this issue 2 years ago • 8 comments

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

  1. npx @modelcontextprotocol/inspector uvx mcp-server-fetch
  2. Open inspector url in my case http://localhost:5173/
  3. Click the "Tools" tab
  4. Click "List Tools" button
  5. Select fetch tool
  6. 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

paulrobello avatar Dec 01 '24 19:12 paulrobello

Came across this bug as well and had a hell of a time troubleshooting until I found your post. Thanks for the fix!

al-how avatar Dec 01 '24 20:12 al-how

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.

andybrandt avatar Dec 03 '24 16:12 andybrandt

Appears to have regressed? Maybe the most recent merged PR?

sobri909 avatar Dec 04 '24 01:12 sobri909

This has just released in package version 0.6.2. Let me know if you are still having issues.

jackadamson avatar Dec 04 '24 16:12 jackadamson

It works perfectly now with version 0.6.2 (here on Windows).

mlegdev avatar Dec 04 '24 18:12 mlegdev

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?

sobri909 avatar Dec 05 '24 02:12 sobri909

Run this in a terminal to update: uvx mcp-server-fetch@latest

Then ctrl-C to kill, then restart Claude.

wolfmanstout avatar Dec 05 '24 06:12 wolfmanstout

0.6.2 works ok under Windows (with pip - I don't use uv/uvx).

andybrandt avatar Dec 05 '24 09:12 andybrandt