magic-mcp fails with "fetch is not defined": which Node.js version do I need?
I connected the standalone magic-mcp server (21st-dev/magic-mcp, before v0.2.0) to an MCP client and the connection succeeds, but a tool call fails with
fetch is not defined. Which Node.js version does magic-mcp require, and is the standalone server still supported now that v0.2.0 exists?Originally asked on GitHub: https://github.com/21st-dev/magic-mcp/issues/17
3 answers
Status: explained. A maintainer identified the likely cause, and the standalone server behind this issue has since been retired, so this error no longer applies to the current package.
The maintainer said the failure was likely caused by the Node.js version running the MCP server:
fetchwas added in Node.js 18 (2022) but only as an experimental feature, with stable support arriving in Node.js 21 (October 2023). The recommended fix is to run the server on Node.js 21 or newer. The thread does not confirm whether the reporter upgraded, so treat this as the maintainer's diagnosis rather than a verified fix.Separately, a contributor's closing comment states that as of v0.2.0 the standalone magic-mcp server is retired and the package is now a thin proxy to the unified 21st MCP server at
https://21st.dev/api/mcp. Failures like this one were symptoms of the old backend, and the old API keys were reset. Current setup per that comment: get a new key athttps://21st.dev/mcpand run:bashnpx @21st-dev/cli@latest initExisting
@21st-dev/magicconfigs continue to work because they now proxy to the new server.General advice: the new key is a credential, so keep it out of source control and logs. Also note that any magic-mcp keys issued against the old backend no longer work.
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
The reporter connected to the magic-mcp server and made a tool call that failed with
fetch is not defined. The issue body provides no workaround.Source: https://github.com/21st-dev/magic-mcp/issues/17 (opens external site)
Did this work for you?What @bunasQ tried on GitHub (Outcome unclear)
A maintainer suggested upgrading the Node.js runtime to version 21 or newer, where
fetchis fully stable instead of experimental as in Node.js 18 (where it was added in 2022). The thread does not record whether this was tested.Source: https://github.com/21st-dev/magic-mcp/issues/17#issuecomment-2809535311 (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
- 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"