Gemini CLI fails: MCP tool names start with digit (21st_magic_*) – fix?
Using @21st-dev/magic@latest as an MCP server with the Gemini CLI on Windows, startup fails with a 400 INVALID_ARGUMENT: "tools[0].function_declarations[41].name: Invalid function name. Must start with a letter or an underscore." The exposed tools 21st_magic_component_builder, 21st_magic_component_inspiration, and 21st_magic_component_refiner start with a digit. How can I make the Gemini CLI initialize with this server?
Originally asked on GitHub: https://github.com/21st-dev/magic-mcp/issues/37
4 answers
Addressed in v0.2.0. Per a maintainer closing comment, the standalone
@21st-dev/magicserver this issue was filed against is retired and replaced by a thin proxy to the unified 21st MCP athttps://21st.dev/api/mcp. The tool-name failure was a symptom of the old backend, and old API keys were reset.Until you upgrade, the issue body proposes excluding the offending tools from the Gemini CLI config. This was a proposed temporary workaround and was not confirmed working in the thread:
json"magic": { "type": "stdio", "command": "cmd", "args": ["/c", "npx", "-y", "@21st-dev/magic@latest"], "env": { "API_KEY": "..." }, "exclude-tools": [ "21st_magic_component_builder", "21st_magic_component_inspiration", "21st_magic_component_refiner" ] }For the current setup, the maintainer says to get a key at
https://21st.dev/mcpand runnpx @21st-dev/cli@latest init. Your existing@21st-dev/magicconfig can also be kept and will proxy to the new server. If problems persist on 0.2.0+, open a fresh issue.As general advice, keep any API key out of
settings.jsonand pass it via an environment variable; note that keys issued for the old backend were reset.Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
The issue reporter proposed adding an
exclude-toolslist to the magic server config in settings.json to skip the three21st_magic_*tools. The thread never reports whether this workaround was actually tested.Source: https://github.com/21st-dev/magic-mcp/issues/37 (opens external site)
Did this work for you?What @ramarivera tried on GitHub (Outcome unclear)
One commenter said they were disabling the magic MCP server until the tool-naming issue is sorted. No outcome is reported.
Source: https://github.com/21st-dev/magic-mcp/issues/37#issuecomment-3647926643 (opens external site)
Did this work for you?What @serafimcloud tried on GitHub (Outcome unclear)
The maintainer retired the old backend in v0.2.0 and described the new setup: get a key at 21st.dev/mcp and run
npx @21st-dev/cli@latest init, or keep the existing magic config as a proxy. The thread does not confirm the result.Source: https://github.com/21st-dev/magic-mcp/issues/37#issuecomment-5075533810 (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"