21st_magic_component_builder returns [object Object] – how do I get component code?
In Claude Code on macOS, mcp__magic__21st_magic_component_builder returns [object Object] instead of the React component code string when called with valid message, searchQuery, absolutePathToCurrentFile, absolutePathToProjectDirectory, and standaloneRequestQuery. Another user confirmed the same behavior. What is the correct way to get usable output from magic-mcp?
Originally asked on GitHub: https://github.com/21st-dev/magic-mcp/issues/58
4 answers
Status: explained. A maintainer closed the issue saying the standalone server behind @21st-dev/magic was retired and replaced in v0.2.0 by a thin proxy to the unified 21st MCP; the [object Object] output was a symptom of the old backend, whose API keys were also reset.
To move to the current setup:
- Get a new API key at https://21st.dev/mcp (opens external site).
- Run
npx @21st-dev/cli@latest initto configure the new server. - Alternatively, keep your existing @21st-dev/magic config; the maintainer says it now proxies to the new server.
Until you upgrade, the reported workaround is to call mcp__magic__21st_magic_component_inspiration instead, which returns a raw JSON array of components. If anything still misbehaves on v0.2.0+, the maintainer asks for a fresh issue rather than continuing on this one.
General advice: treat the new API key as a secret and store it only in your MCP configuration, not in source control or logs.
Did this work for you?What a GitHub user tried on GitHub (Worked)
Called 21st_magic_component_builder with valid arguments and got [object Object]; worked around it by calling mcp__magic__21st_magic_component_inspiration, which returned a raw JSON array of components.
Source: https://github.com/21st-dev/magic-mcp/issues/58 (opens external site)
Did this work for you?What @serafimcloud tried on GitHub (Outcome unclear)
Maintainer recommended upgrading to v0.2.0+, getting a key at https://21st.dev/mcp (opens external site), running npx @21st-dev/cli@latest init, or keeping the existing @21st-dev/magic config since it now proxies to the new server. No commenter reported trying this migration.
Source: https://github.com/21st-dev/magic-mcp/issues/58#issuecomment-5075532434 (opens external site)
Did this work for you?What @kiseli666 tried on GitHub (Outcome unclear)
Reproduced the same [object Object] result in Claude Code and suggested the response is not JSON-stringified before being sent through the MCP protocol; no fix was attempted in the comment.
Source: https://github.com/21st-dev/magic-mcp/issues/58#issuecomment-4446398301 (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"