Magic MCP shows "Client closed" in Cursor after Smithery install
I installed @21st-dev/magic-mcp with
npx -y @smithery/cli@latest install @21st-dev/magic-mcp --client cursor --config "{\"TWENTY_FIRST_API_KEY\":\"xxxx\"}"and after opening Cursor the MCP server shows "Client closed." Why does this happen and how do I fix it?Originally asked on GitHub: https://github.com/21st-dev/magic-mcp/issues/11
3 answers
Status: fixed — the maintainer fixed a bug in the CLI on 2025-04-02 and closed the issue as COMPLETED.
The fix: reinstall Magic using the 21st.dev CLI instead of the Smithery CLI. The Magic console (https://21st.dev/magic/console (opens external site)) shows your API key and a pre-filled install command:
npx @21st-dev/cli@latest install <client> --api-key <key>Run that for your client. The thread only shows
<client>as a placeholder; the console pre-fills the correct value.Caveat: one user in the thread ran the new command and still reported it not working. The maintainer did not follow up in the thread, so there is no confirmed additional fix.
General advice: passing the API key on the command line can leave it in your shell history and process listings. Use an environment variable if your client supports it, and never commit the key to a repository.
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Installed magic-mcp via the Smithery CLI (
npx -y @smithery/cli@latest install @21st-dev/magic-mcp --client cursor --config "{\"TWENTY_FIRST_API_KEY\":\"xxxx\"}") and opened Cursor, which showed "Client closed."Source: https://github.com/21st-dev/magic-mcp/issues/11 (opens external site)
Did this work for you?What @ge-nix tried on GitHub (Didn't work)
After the maintainer's fix, ran the new install command (
npx @21st-dev/cli@latest install <client> --api-key <key>) and still saw the problem.Source: https://github.com/21st-dev/magic-mcp/issues/11#issuecomment-2774481638 (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?
- Cursor: @21st-dev/magic MCP "client closed" on Windows - working config?
- 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?