Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCP servers fail to connect with npx on Windows #40

Closed
naif0s opened this issue Nov 25, 2024 · 73 comments
Closed

MCP servers fail to connect with npx on Windows #40

naif0s opened this issue Nov 25, 2024 · 73 comments
Labels
bug Something isn't working

Comments

@naif0s
Copy link

naif0s commented Nov 25, 2024

image

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

@sean-lynch
Copy link
Contributor

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)

@naif0s
Copy link
Author

naif0s commented Nov 25, 2024

image

@jwross24
Copy link

jwross24 commented Nov 25, 2024

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

@naif0s
Copy link
Author

naif0s commented Nov 25, 2024

image

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

@jwross24
Copy link

jwross24 commented Nov 25, 2024

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>"
      }
    }
  }
}

@naif0s
Copy link
Author

naif0s commented Nov 25, 2024

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

@jspahrsummers
Copy link
Member

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.

@geelen
Copy link
Contributor

geelen commented Nov 26, 2024

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
Copy link
Contributor

geelen commented Nov 26, 2024

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

@ProRedCat
Copy link
Contributor

ProRedCat commented Nov 26, 2024

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
Copy link
Contributor

ProRedCat commented Nov 26, 2024

Update on my end, I switched over to a MacBook as there seemed to be some issues with running this on Windows see: modelcontextprotocol/inspector#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.

@geelen
Copy link
Contributor

geelen commented Nov 26, 2024

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.

@Sunwood-ai-labs
Copy link

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"
      ]
    }
  }
}

@timurkhakhalev
Copy link

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

@Da1sypetals
Copy link

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\\"
            ]
        }
    }
}

@mckaywrigley
Copy link

Experiencing similar issues on Mac OS using Claude Desktop 0.71.1.

@mcgraf
Copy link

mcgraf commented Nov 26, 2024

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

@RELMYMathieu
Copy link

Same issue, log file attached:
image

@mike-luabase
Copy link

@mckaywrigley what does your config file look like?

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

@thenameless7741
Copy link

thenameless7741 commented Nov 26, 2024

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"
      ]
    }
  }
}

@jspahrsummers
Copy link
Member

@thenameless7741 Just to check, are you on an Intel Mac? /usr/local/Homebrew isn't searched as part of the path right now, but that's something we could fix.

@jspahrsummers
Copy link
Member

jspahrsummers commented Nov 26, 2024

Sorry folks, and thanks for your patience! For npx calls in particular, we believe there's an issue with how Claude Desktop is launching subprocesses on Windows, which modelcontextprotocol/typescript-sdk#68 (once integrated) should hopefully fix. 🤞

As a workaround, you should be able to npm install -g the MCP servers you care about, and use node to invoke them directly (instead of npx).

@thenameless7741
Copy link

thenameless7741 commented Nov 26, 2024

@jspahrsummers I'm still using the old Homebrew setup on my M1 and haven't migrated over to the /opt directory yet. I suspect there are a few others out there in the same boat as me.

@oscarcalvo
Copy link

@jspahrsummers FYI, I'm using Windows. The memory server is installed globally, but it’s still not working. The closest I’ve gotten is with this config, which starts the server, but after 1 minute, Claude shows the same error: 'Couldn't attach...'

"mcpServers": {
"memory": {
"command": "mcp-server-memory",
"args": []
}
}

@rkaradas
Copy link

@oscarcalvo As @jspahrsummers mentioned, you have to use node directly, like this

{
	"mcpServers" : {
		"filesystem": {
			"command": "node",
			"args": [
			"C:\\Program Files\\nodejs\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js", 
			"C:\\"
			]
		}
	}
}

@oscarcalvo
Copy link

@rkaradas You are right, thanks

@timur-khakhalev
Copy link

Any ways to access mcp-server inside WSL?

I've tried this but no luck:

"command": "wsl",
            "args":
            [
                "bash",
                "-ic",
                "node /home/timur/dev/personal/mcp/mcp-server-jina/build/index.js"
            ],
"command": "node",
            "args":
            [
                "\\wsl.localhost\\Ubuntu-22\\home\\timur\\dev\\personal\\mcp\\mcp-server-jina\\build\\index.js"
            ],

@naif0s
Copy link
Author

naif0s commented Nov 26, 2024

@oscarcalvo As @jspahrsummers mentioned, you have to use node directly, like this

{
	"mcpServers" : {
		"filesystem": {
			"command": "node",
			"args": [
			"C:\\Program Files\\nodejs\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js", 
			"C:\\"
			]
		}
	}
}

THANKS YOU !!!!!!!

@FerJSsilva
Copy link

@ymdarum Your solution works as well when using nvm for windows. Good Catch Man! You nailed it!

@markelaugust74
Copy link

@ymdarum it worked!

@DrAnchello
Copy link

@ymdarum thanks man, this worked for me as well

@fabiendostie
Copy link

fabiendostie commented Dec 1, 2024 via email

@hemangjoshi37a
Copy link

Actually there is similar problem with python based MCP servers . When I try to run it with uvx it fails but when I run it with python command it works fine. I think the MCP servers should be ran in more ancient way using python or npm rather than uvx or npx.

@hemangjoshi37a
Copy link

hemangjoshi37a commented Dec 2, 2024

Also why in the world is there no linux app of Claude . While more than 90% of development is done on Linux . This is really sad and mine boggling.

@hemangjoshi37a
Copy link

🎉this works for me :

{
  "mcpServers": {
    "git": {
      "command": "python3.11",
      "args": [
        "-m",
        "mcp_server_git",
        "--repository",
        "C:\\Users\\heman\\Desktop\\test_mcp_git"
      ]
    },
    "memory": {
      "command": "node",
      "args": [
        "C:\\Users\\heman\\AppData\\Roaming\\npm\\node_modules\\@modelcontextprotocol\\server-memory\\dist\\index.js"
      ]
    },
    "filesystem": {
      "command": "node",
      "args": [
        "C:\\Users\\heman\\AppData\\Roaming\\npm\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js",
        "C:\\Users\\heman\\Desktop",
        "C:\\Users\\heman\\Desktop\\test_mcp_git"
      ]
    },
    "github": {
      "command": "node",
      "args": [
        "C:\\Users\\heman\\AppData\\Roaming\\npm\\node_modules\\@modelcontextprotocol\\server-github\\dist\\index.js"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "my-token"
      }
    }
  }
}

@przbadu
Copy link

przbadu commented Dec 2, 2024

Faced the same issue in Mac because my node is setup using node version manager asdf in my case. All I did was Find the npx installation path with which npx. Copy the path to my configuration below e.g: /Users/<me>/.asdf/shims/npx. And it worked for me.

{
  "mcpServers": {
    "github": {
      "command": "/Users/<me>/.asdf/shims/npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-github"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": ""
      }
    }
  }
}

@tagoraiinc
Copy link

i am on a windows pc and my servers for filesystem, brave, etc work fine
but the one for gdrive isn't able to authorize
this is my config file:

"gdrive": {
  "command": "node",
  "args": [
    "C:\\Users\\user\\node_modules\\@modelcontextprotocol\\server-gdrive\\dist\\index.js"      ]
}

}

would appreciate any guidance on how to get the gdrive mcp to work, please. thx!

@dave2nian
Copy link

dave2nian commented Dec 2, 2024

image
{ "mcpServers": { "filesystem": { "command": "cmd", "args": [ "/c", "set NODE_DEBUG=* && npx -y @modelcontextprotocol/server-filesystem", "c:\\users\\<youraccountname>\\claude-server" ] } } }

my OS is windwos 11 23h2. I found that even killed all claude tasks, you also need to kill the node.exe process(es, sometime, here were 2 node.exe tasks. )

the guide file "https://modelcontextprotocol.io/quickstart#file-system-access" or sample file "https://github.com/dave2nian/servers/tree/main/src/filesystem" in args part "-y" that mean is auto answer to keep communication with MCP filesystem server. but node.js is a event driven service, it don't need to keep the link. so I tried to change args from -y to /c.

know it is working.

@dave2nian
Copy link

image

enjoy it~

@jspahrsummers
Copy link
Member

Hey folks, there's a new version of Claude Desktop that should resolve issues launching npx on Windows. Please update to v0.7.5 and give it another shot! (If you have any issues auto-updating, you can always download the latest from https://claude.ai/download.)

Thanks for your patience!

@jspahrsummers jspahrsummers unpinned this issue Dec 2, 2024
@anaisbetts
Copy link

Our updater is a bit quieter than we'd like, the short version to force the update is, "Help => Check for updates", wait some time, then "File => Exit" and restart the app

@TimHuey
Copy link

TimHuey commented Dec 2, 2024

Fixing MCP Server Connection Issues in Claude Desktop

Installation Steps

1. Install Required Packages

npm install -g @modelcontextprotocol/server-filesystem
npm install -g @modelcontextprotocol/server-memory
npm install -g @modelcontextprotocol/server-brave-search
npm install -g @modelcontextprotocol/server-github

2. Update Configuration

Replace content in claude_desktop_config.json:

{
  "mcpServers": {
    "filesystem": {
      "command": "node",
      "args": [
        "C:/Users/YOUR_USERNAME/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js",
        "c:/"
      ]
    },
    "memory": {
      "command": "node",
      "args": [
        "C:/Users/YOUR_USERNAME/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-memory/dist/index.js"
      ]
    },
    "git": {
      "command": "uvx",
      "args": [
        "mcp-server-git",
        "--repository",
        "C:/Users/YOUR_USERNAME/Projects/NodeJs/super_ai_agents"
      ]
    },
    "brave-search": {
      "command": "node",
      "args": [
        "C:/Users/YOUR_USERNAME/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-brave-search/dist/index.js"
      ],
      "env": {
        "BRAVE_API_KEY": "YOUR_BRAVE_API_KEY"
      }
    },
    "github": {
      "command": "node",
      "args": [
        "C:/Users/YOUR_USERNAME/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-github/dist/index.js"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_TOKEN"
      }
    }
  }
}

Note: Replace YOUR_USERNAME, YOUR_BRAVE_API_KEY, and YOUR_GITHUB_TOKEN with your actual values.

This worked for me almost. I just had to replace my local /node_modules/@modelcontextprotocol location. It wasn't the same place as this because I have NVM installed and it was off the NVM directory.

BUT NOW IT WORKS!!!!!!!~ THANK YOU EVERYONE

@TimHuey
Copy link

TimHuey commented Dec 2, 2024

OMG, just as I got it fixed and now there is a new version of Claude desktop. Lets go back to the original *config.json and see if it works without the explicit location notation.

@TTiagha
Copy link

TTiagha commented Dec 2, 2024

yeah, at least for me, the new update has fixed my connection issue

@p1Ktj1XWg1Bm
Copy link

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\\"
            ]
        }
    }
}

Same problem on my Win 11. Sad!

@TimHuey
Copy link

TimHuey commented Dec 18, 2024

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\\"
            ]
        }
    }
}

Same problem on my Win 11. Sad!

Did you get ANY of the other MCP servers to connect to ClaudeDesktop? Meaning, do you see the tool icon element in the lower right corner of the prompt box area. Are you able to execute any MCP specific actions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests