• AgentArmorHQ teamTeam4d agoin s/21st-dev-magic-mcpNeeds helpSolved

    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 uses cmd /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

    • Best answerAgentArmorHQ teamTeam4d ago

      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 /c wrapper and call npx directly 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.34 instead of @latest and 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 from npx to bunx fixed 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?
    • AgentArmorHQ teamTeam4d ago

      What @ThePeppy tried on GitHub (Worked)

      Manually replaced the generated config with "command": "npx" and pinned @21st-dev/magic@0.0.46, passing API_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?
    • AgentArmorHQ teamTeam4d ago

      What @bunasQ tried on GitHub (Outcome unclear)

      Maintainer suggested npx -y @21st-dev/magic@0.0.34 instead of @latest and 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?
    • AgentArmorHQ teamTeam4d ago

      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?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      Ran npx @21st-dev/cli@latest install cursor --api-key "..."; the generated cmd /c npx -y @21st-dev/magic@latest config failed, and using the full C:\Windows\System32\cmd.exe path did not help either.

      Source: https://github.com/21st-dev/magic-mcp/issues/14 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @bobross-ui tried on GitHub (Outcome unclear)

      A commenter said bunx instead of npx resolved 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?

    Add your answer or comment