Cursor: @21st-dev/magic MCP "client closed" on Windows - working config?
On Windows (both with and without WSL), Cursor shows "failed to create client" or "client closed" for the @21st-dev/magic MCP server after running
npx @21st-dev/cli@latest install cursor --api-key "...". The generated config usescmd /c npx -y @21st-dev/magic@latest API_KEY="...". Is there an MCP config that actually connects?Originally asked on GitHub: https://github.com/21st-dev/magic-mcp/issues/14
6 answers
The issue is closed, but no single fix was confirmed for everyone. A maintainer called the failure "a weird bug from Cursor" and the workaround that drew a positive "I found the solution" report is to bypass the
cmd /cwrapper and callnpxdirectly with a pinned magic version (that commenter did not state their OS):json{ "mcpServers": { "@21st-dev/magic": { "command": "npx", "args": [ "-y", "@21st-dev/magic@0.0.46", "API_KEY=\"your api key put here\"" ] } } }The maintainer also recommended
npx -y @21st-dev/magic@0.0.34instead of@latestand added this tip to the 21st.dev troubleshooting guide, noting you have to bump the version manually to get new features. Results varied afterwards: one Windows user still got the error after adding that pinned version, and another reported it on macOS Cursor 0.49.5. One commenter said switching fromnpxtobunxfixed the same class of launch failure for a different MCP server (not confirmed for magic), and another claimed"command": "C:\\Windows\\System32\\cmd.exe"plus running Cursor as Administrator worked for most Windows MCP servers — that comment is contradictory, so treat it as anecdotal.General advice: the API key is stored in plaintext in the MCP config, so use a key you can revoke if it leaks.
Did this work for you?What @ThePeppy tried on GitHub (Worked)
Manually replaced the generated config with
"command": "npx"and pinned@21st-dev/magic@0.0.46, passingAPI_KEY="..."as a single argument. The commenter said this solved it (no OS stated).Source: https://github.com/21st-dev/magic-mcp/issues/14#issuecomment-2831876929 (opens external site)
Did this work for you?What @bunasQ tried on GitHub (Outcome unclear)
Maintainer suggested
npx -y @21st-dev/magic@0.0.34instead of@latestand added the tip to the troubleshooting guide, noting manual version bumps are needed for new features. A later Windows user still reported the error after adding the version.Source: https://github.com/21st-dev/magic-mcp/issues/14#issuecomment-2776986520 (opens external site)
Did this work for you?What @Carlos-Georgescu tried on GitHub (Didn't work)
Windows user added the pinned version suggested by the maintainer and still got the same "client closed" error.
Source: https://github.com/21st-dev/magic-mcp/issues/14#issuecomment-2780566089 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Ran
npx @21st-dev/cli@latest install cursor --api-key "..."; the generatedcmd /c npx -y @21st-dev/magic@latestconfig failed, and using the fullC:\Windows\System32\cmd.exepath did not help either.Source: https://github.com/21st-dev/magic-mcp/issues/14 (opens external site)
Did this work for you?What @bobross-ui tried on GitHub (Outcome unclear)
A commenter said
bunxinstead ofnpxresolved the same launch failure for a different MCP server; not confirmed for magic.Source: https://github.com/21st-dev/magic-mcp/issues/14#issuecomment-2856456581 (opens external site)
Did this work for you?
Related questions
- Why does magic-mcp return error status code 500 in Cursor via SmitheryAI?
- Does magic-mcp support SSE or have a hosted online MCP server?
- Magic MCP shows "Client closed" in Cursor after Smithery install
- magic-mcp: API key creation fails with "could not choose the best candidate function"
- 21st_magic_component_builder returns [object Object] – how do I get component code?