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 · 71 comments
Closed

MCP servers fail to connect with npx on Windows #40

naif0s opened this issue Nov 25, 2024 · 71 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 !!!!!!!

@natefikru
Copy link

natefikru commented Nov 30, 2024

Since this is an issue with the system not knowing what version of node to use, (whether it is because of nvm or different versions on the system) it seems like the for sure way to solve this is to explicitly state the version of node if you can.

This issue is also stated in this thread regarding nvm: #64

Once you point to the correct node version, use the corresponding index.js file in the argument for the server you want to connect to.

This is what i did on MacOS:

{
    "mcpServers": {
        "sqlite": {
            "command": "uvx",
            "args": ["mcp-server-sqlite", "--db-path", "/Users/natefikru/test.db"]
        },
        "puppeteer": {
            "command": "/Users/natefikru/.nvm/versions/node/v22.4.0/bin/node",
            "args": ["/Users/natefikru/Documents/servers/src/puppeteer/dist/index.js"]
        },
        "brave-search": {
            "command": "/Users/natefikru/.nvm/versions/node/v22.4.0/bin/node",
            "args": ["/Users/natefikru/Documents/servers/src/brave-search/dist/index.js"],
            "env": {
              "BRAVE_API_KEY": "xxx"
            }
        },
        "github": {
            "command": "/Users/natefikru/.nvm/versions/node/v22.4.0/bin/node",
            "args": ["/Users/natefikru/Documents/servers/src/github/dist/index.js"],
            "env": {
              "GITHUB_PERSONAL_ACCESS_TOKEN": "xxx"
            }
        }
    }
}

@markelaugust74
Copy link

markelaugust74 commented Dec 1, 2024

@natefikru just tried this method on Windows 10 unfortunately it didn't work (for the "xxx" I used my real keys just changed it for this btw)
might try to run a virtual MacOS to see if I can get it to work

image

@Chatmala
Copy link

Chatmala commented Dec 1, 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.

3. Test Server Connections

Run these commands individually to verify each server:

node C:/Users/YOUR_USERNAME/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js c:/
node C:/Users/YOUR_USERNAME/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-memory/dist/index.js
node C:/Users/YOUR_USERNAME/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-brave-search/dist/index.js
node C:/Users/YOUR_USERNAME/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-github/dist/index.js

4. Final Steps

  1. Restart your PC
  2. Launch Claude Desktop application
  3. Check connection logs

Success Indicators

Look for these messages in the logs:

[info] Connected to MCP server memory!
[info] Connected to MCP server git!
[info] Connected to MCP server filesystem!
[info] Connected to MCP server brave-search!
[info] Connected to MCP server github!

Important Notes

  • Use forward slashes (/) in paths
  • Replace placeholders with your actual values
  • Install all servers globally using npm
  • Restart PC after configuration changes

@Chatmala
Copy link

Chatmala commented Dec 1, 2024

After followed all steps mentioned above, my Claude Desktop app successfully attached with all MCPs.
Attached MCPs
Attached MCPs_2

@ymdarum
Copy link

ymdarum commented Dec 1, 2024

How I enabled the MCP Brave Search. In Windows, really pay attention to the absolute path

Following steps by @Chatmala , i make a few adjustment below:

  • OS: Windows 10
  • CMD: Using Windows Command Prompt (have problem with PowerShell)
  • for below guide, please change all the YOUR_USERNAME into your own login name path

Steps:

  1. open windows command prompt (I'm not using Power Shell) and run command below:
    npm install -g @modelcontextprotocol/server-brave-search
    
  2. by default it will install in the folder under your login. in my case as below:

C:\Users\YOUR_USERNAME\AppData\Roaming\npm\node_modules@modelcontextprotocol\server-brave-search\dist\index.js

  1. try running command below to test that it able to execute:
node C:\Users\YOUR_USERNAME\AppData\Roaming\npm\node_modules\@modelcontextprotocol\server-brave-search\dist\index.js

the output will display something like below, just one line of notification. ctrl-c to kill it:
brave_search_console

  1. Locating the claude_desktop_config.json
    if you open the setting in Claude Desktop, you can find where does the file claude_desktop_config.json is referred/created in your folder:
    config1
    config2

  2. Update the claude_desktop_config.json . Mine as below:

note: As you can see, I also have setup using sqlite3 and it able to run. It requires Python 3.10 and above. Please let me know if requires the steps on this, but basically really pay attention to the absolute path!

folder: C:\Users\YOUR_USERNAME\AppData\Roaming\Claude\claude_desktop_config.json

{
  "mcpServers": {
	"sqlite": {
	  "command": "C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Microsoft\\WinGet\\Links\\uvx",
	  "args": [     
		"mcp-server-sqlite", 
		"--db-path", 
		"E:\\dev\\claude\\mcp\\test.db"
	  ]
	},
	"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": "BRAVE-API-KEY"
	  }
	}
  }
}
  1. Close the Claude Desktop. Make sure the one on the taskbar also closed. Click to open it again.

  2. You can notice under the "Attach from MCP" icon, some of the services appear. For me I have 8 registered.
    mcp_service1
    mcp_service2

  3. you can start prompting to test the power of MCP! Kudos Anthrop\c!

@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

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