MCP Feature "Client Closed" Fix

Thanks for reporting a bug you have found in Cursor!
Please add the following info to help us diagnose your issue:

:white_check_mark: Check the forum to ensure the issue hasn’t been reported already
:lady_beetle: Provide a clear description of the bug
:arrows_counterclockwise: Explain how to reproduce the bug (if known)
:camera: Attach screenshots or recordings (e.g., .jpg, .png, .mp4).
:computer: Tell us your operating system and your Cursor version (e.g., Windows, 0.x.x).
:no_entry_sign: Tell us if the issue stops you from using Cursor.


im getting this all the time i install or add an mcp server and i get this all the time i restart cursor i restart my pc and nothing really happening ive tried to add the same mcps to the claude app and they work fine

Version: 0.46.3 (user setup)
VSCode Version: 1.96.2
Commit: fce3511bab261b4c986797f3e1e40e7621bbd010
Date: 2025-02-24T11:25:40.376Z
Electron: 32.2.6
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.26100

3 Likes

updated to

Version: 0.46.4 (user setup)
VSCode Version: 1.96.2
Commit: db71624816f6d52f6e54f47c37cdc7df23e22620
Date: 2025-02-25T07:37:34.169Z
Electron: 32.2.6
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.26100

amd the problem still exitst

1 Like

I get the same error when connecting to Supabase hosted. same version.

1 Like

trying to debug this myself - can I check if you’re using WSL on a Win11 install?

This is not a bug!
Npx is a shell script (npx.cmd) which needs an interpreter to start (cmd.exe).

Use for example
cmd /c npx @agentdeskai/browser-tools-mcp
or
cmd /k npx @agentdeskai/browser-tools-mcp

it will work.

5 Likes

i will try in now and let you know if thats the sorution!

Did it work?

Closing all instances of cursor and openin them again seemed to fix the issue

I have the same problem even using the very example in cursor docs.

It doesn’t work. :sob:
When I use cmd /c to start npx, it gives me the error “No number after minus sign in JSON at position.”
If I use npx , it still throws the error “client closed.”

try an other mcp and test maybe the mcp server is not the way that cursor is reading

Can you explain this further. It worked for me by adding cmd /c to invoke the command but why is this not listed in the docs. What is the special case here and how can I get it to work without cmd /c When I do this it also opens an instance of a shell outside of cursor that is blank. This is not ideal as I don’t want to instantiating shells for every mcp server run

Digging a little deeper I guess MCPs servers are being run on the native OS. I use WSL for most things so you need to be sure that you have node, npx etc running well and accessible via PATH on your Windows setup not just your Linux subsystem. Is this correct?

Did you even read my post?
NPX is a wrapper to start node under C:\Program Files\nodejs\npx.cmd
This is a batch script which needs an interpreter (cmd.exe) to start.

Start the *.js without the wrapper directly via node
example:

node c:\Users\<your_yourser
>\AppData\Roaming\npm\node_modules\@agentdeskai\browser-tools-mcp\dist\mcp-server.js

“No number after minus sign in JSON at position.” is an error from the mcp-server, syntax or parsing error

Why cmd /c npx @agentdeskai/browser-tools-mcp Works

The /c parameter instructs cmd.exe to execute the following command and then terminate. Here’s what happens:

  1. A new cmd.exe instance is launched
  2. The command npx @agentdeskai/browser-tools-mcp is executed within this instance
  3. The cmd.exe instance remains open as long as the MCP server runs
  4. The MCP server runs as a child process of this cmd.exe instance

Why Running Without /c Fails

When you just run cmd (without /c), the following occurs:

  1. A new cmd.exe instance is launched
  2. This instance expects user input and interprets npx @agentdeskai/browser-tools-mcp as text that should be entered into the new command line, not as a command to be executed
  3. Since Cursor likely passes the command via process start and not input simulation, this text is not entered into the new command line
  4. The new cmd instance remains empty and appears to close immediately (or waits in the background for input)

Manual vs. Programmatic Usage

When you manually open cmd and type a command, the command is interpreted correctly because you’re providing interactive input. However, when a program like Cursor starts cmd programmatically, it needs the /c flag to explicitly tell cmd to treat the arguments as commands to execute rather than just arguments to the cmd process itself.

This is a standard approach for applications that need to launch and monitor external command-line programs.

4 Likes

Ah, I see the misunderstanding now. The person was actually making a correct observation about MCP servers running on the native OS (Windows) rather than in WSL. They were asking if their understanding was correct, not making an incorrect statement.

I need to provide a confirmation and explanation that aligns with their correct understanding."Yes, your understanding is completely correct. MCP servers for Cursor do indeed run on the native Windows OS, not within WSL.

Since you primarily use WSL for development, this is an important distinction to be aware of. For the MCP servers to function properly with Cursor:

  1. You need Node.js and npm/npx installed directly on Windows
  2. These tools must be properly configured in your Windows PATH
  3. Having them only in your WSL environment is insufficient

This is because Cursor, as a Windows application, launches the MCP servers in the Windows environment context, not inside WSL. Even though you do most of your development work in WSL, this particular component requires the Windows-native versions of these tools.

If you’re experiencing issues with MCP servers, checking your Windows Node.js installation and PATH configuration would be the first troubleshooting step."

I’m getting the same Client closed error when adding any MCP server to Cursor on Windows 11. I have node 22 installed and added to PATH so I don’t think that’s the issue. Using cmd /c doesn’t make sense to me since this seems to be working without that for the videos and examples I’ve been seeing.

1 Like

I figured out the issue, at least in my case. My MCP server is stdin, written in TS, ESM and executed with node index.js (transpiled from the ts). It’s a complex server with several files (modules).

Cursor doesn’t handle an MCP server with multiple files. I had to bundle everything with eslint. Furthermore I had to use the eslint flag to exclude external packages from the bundle because Cursor could not handle them.

After I did that everything worked.

Cursor’s MCP implementation is seriously lacking. Everything was working well with Winds*rf and Claude Desktop.

EDIT: Hilarious I can’t use the word Winds*rf here, pathetic!

1 Like

The use of cmd /c makes sense!
Use the search, I’ve already explained it in other posts.
What you have seen in other videos are other operating systems.

@secprobe Right it makes sense in why it works, though for me its unstable (An MCP server runs once or twice and then seems to fail) and cmd /c keeps the console window open. It just feels clunky. It would be nice if Cursor on windows handled it better internally without the need to call cmd.

1 Like