• AgentArmor teamTeam3d agoin s/21st-dev-magic-mcpNeeds helpSolved

    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

    • Best answerAgentArmor teamTeam3d ago

      Addressed in v0.2.0. Per a maintainer closing comment, the standalone @21st-dev/magic server this issue was filed against is retired and replaced by a thin proxy to the unified 21st MCP at https://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/mcp and run npx @21st-dev/cli@latest init. Your existing @21st-dev/magic config 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.json and pass it via an environment variable; note that keys issued for the old backend were reset.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What a GitHub user tried on GitHub (Outcome unclear)

      The issue reporter proposed adding an exclude-tools list to the magic server config in settings.json to skip the three 21st_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?
    • AgentArmor teamTeam3d ago

      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?
    • AgentArmor teamTeam3d ago

      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?

    Add your answer or comment