servers icon indicating copy to clipboard operation
servers copied to clipboard

MCP servers fail to connect with `npx` on Windows

Open naif0s opened this issue 2 years ago • 113 comments

image

I am on Windows with the latest desktop version, I have enabled developer mode and I am in Europe

naif0s avatar Nov 25 '24 21:11 naif0s

Can you share your %APPDATA%\Claude\claude_desktop_config.json? (In case this doesn't make sense, I'm referring to step 2 in the Windows quickstart guide here: https://modelcontextprotocol.io/quickstart#installation)

sean-lynch avatar Nov 25 '24 21:11 sean-lynch

image

naif0s avatar Nov 25 '24 21:11 naif0s

The docs are a bit confusing, and I had a similar issue. You should add the individual MCP servers under the mcpServers key in the JSON like so.

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        ...
      ]
    },
    "memory": {
      "command": "npx",
      "args": [...]
    }
  }
}

They should then show up correctly in the Developer config.

image

jwross24 avatar Nov 25 '24 21:11 jwross24

image

Thank you, it works! Now, how do I integrate Github?

naif0s avatar Nov 25 '24 21:11 naif0s

You should use the github config that you had before, instead of the filesystem and memory configs that I have. You can add it as another key after filesystem and memory, though those configs won't work exactly as I have written since I omitted the args key for brevity.

You can try:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y",  "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
      }
    }
  }
}

jwross24 avatar Nov 25 '24 21:11 jwross24

OK Thanks, it's super cool for your help. But well... it's not working. I entered the key correctly but when I ask Claude, for example to create an issue, it won't do it

image

naif0s avatar Nov 25 '24 21:11 naif0s

Are you able to get the GitHub server working with the MCP Inspector? That will help narrow down whether this is a desktop app issue, or a problem with the server setup.

jspahrsummers avatar Nov 25 '24 22:11 jspahrsummers

I've got almost the exact same situation. I have two servers configured:

{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": ["mcp-server-sqlite", "--db-path", "/Users/glen/src/experiments/claude-local-sqlite"]
    },
    "brave_search": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-brave-search"],
      "env": {
        "BRAVE_API_KEY": "<redacted>"
      }
    }
  }
}

My debug log looks fine:

image

Settings looks fine:

image

But no 🔌 icon in the chat window:

image

And a flat refusal to do anything with the connections:

image

geelen avatar Nov 26 '24 00:11 geelen

Update: just tried on my windows machine, and got the exact same result. Is it possible this is geoblocked in Australia?

geelen avatar Nov 26 '24 00:11 geelen

Same issue here, there is no 🔌, I do have the filesystem server running but I get a message in Claude Desktop of it failing to attach to the MCP server.

image

image

To add more context based on what geelen said, I am from New Zealand and running on Windows so could be georestrictions, or it could be some device setup.

Having issues running MCPInspector as well so debugging is a bit difficult image

ProRedCat avatar Nov 26 '24 01:11 ProRedCat

Update on my end, I switched over to a MacBook as there seemed to be some issues with running this on Windows see: https://github.com/modelcontextprotocol/inspector/issues/76

For the filesystem server it is now working as well as the Github server. The region locked theory is wrong, it's just device configuration/OS support.

For the SQLite and Brave Search the issues #37 #42 may be helpful for the others in this thread as there seems to be some issues with pathing sometimes - though I am still facing issues on Windows.

ProRedCat avatar Nov 26 '24 02:11 ProRedCat

You're quite right. I had a typo in the path to my DB! That was crashing things, even stopping me from adding other tools.

geelen avatar Nov 26 '24 02:11 geelen

I'm also experiencing issues with the filesystem server on Windows. Here's my configuration:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "C:\\Users\\Username\\Desktop"
      ]
    }
  }
}

Sunwood-ai-labs avatar Nov 26 '24 10:11 Sunwood-ai-labs

Same behavior on Windows 11 and Mac OS. Claude desktop 0.71.1 version on both devices.

timurkh-devstark avatar Nov 26 '24 11:11 timurkh-devstark

I'm also experiencing issues with the filesystem server on Windows. Here's my configuration:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "C:\\Users\\Username\\Desktop"
      ]
    }
  }
}

The same problem with me. My configuration :

{
    "mcpServers": {
        "filesystem": {
            "command": "npx",
            "args": [
                "-y",
                "@modelcontextprotocol/server-filesystem",
                "A:\\Desktop\\"
            ]
        }
    }
}

Da1sypetals avatar Nov 26 '24 11:11 Da1sypetals

Experiencing similar issues on Mac OS using Claude Desktop 0.71.1.

mckaywrigley avatar Nov 26 '24 12:11 mckaywrigley

I am having the same issue on Windows 10 with latest Claude Desktop

mcgraf avatar Nov 26 '24 12:11 mcgraf

Same issue, log file attached: image

RELMYMathieu avatar Nov 26 '24 13:11 RELMYMathieu

@mckaywrigley what does your config file look like?

code ~/Library/Application\ Support/Claude/claude_desktop_config.json

mike-luabase avatar Nov 26 '24 14:11 mike-luabase

Here's what works for me (mac):

TL;DR Try using an absolute path and specify the latest Python version in claude_desktop_config.json when configuring uvx.


Detailed version:

I followed the sqlite instructions but ran into a "Could not connect to MCP server sqlite" error. After enabling developer mode, i checked to the log file through Developer (menu bar) → Open MCP Log File (mcp.log) and found this error "Could not start MCP server sqlite: Error: spawn uvx ENOENT".

The fix was to use an absolute path in claude_desktop_config.json, e.g.

> which uvx
/usr/local/Homebrew/bin/uvx

After restarting Claude, the "Attach from MCP" button still wasn't appearing next to "Upload files" button. Checking mcp-server-sqlite.log (in the same directory as mcp.log), I saw this error:

No solution found when resolving tool dependencies:
Because the current Python version (3.9.1) does not satisfy Python>=3.10
(omitted)

Since i have a newer Python installed (via miniconda), I resolved this by passing an extra --python arg to uvx, using the absolute path to python binary.

My full JSON config file:

{
  "mcpServers": {
    "sqlite": {
      "command": "/usr/local/Homebrew/bin/uvx",
      "args": [
        "--python",
        "/usr/local/Homebrew/Caskroom/miniconda/base/bin/python3",
        "mcp-server-sqlite",
        "--db-path",
        "/Users/<user>/test.db"
      ]
    }
  }
}

thenameless7741 avatar Nov 26 '24 14:11 thenameless7741