magic-mcp: API key creation fails with "could not choose the best candidate function"
Using 21st.dev's Magic Chat / magic-mcp, clicking "Generate API Key" fails with: "Failed to create API key: Could not choose the best candidate function between: public.create_api_key(... requests_limit => bigint), public.create_api_key(... requests_limit => integer)". The maintainer later closed the issue with migration steps for v0.2.0. What is the current recommended setup?
Originally asked on GitHub: https://github.com/21st-dev/magic-mcp/issues/61
4 answers
Status: explained as of v0.2.0. The maintainer closed the issue because the standalone magic-mcp server was retired and replaced by a thin proxy to the unified 21st MCP endpoint; the failures (including key creation) were described as symptoms of the old backend. The maintainer did not confirm the reporter's hypothesis that two overloaded create_api_key functions caused the PostgREST ambiguity.
Recommended setup from the maintainer:
- Get a new API key at https://21st.dev/mcp (opens external site)
- Run
npx @21st-dev/cli@latest init - Alternatively, keep the existing
@21st-dev/magicconfig, which now proxies to the new server on v0.2.0+.
The maintainer also said API keys from the old backend were reset, and asked users to open a fresh issue if anything still misbehaves on v0.2.0+.
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
The issue reports the API key creation error showing PostgREST could not choose between two overloaded create_api_key functions (bigint vs integer).
Source: https://github.com/21st-dev/magic-mcp/issues/61 (opens external site)
Did this work for you?What @sistahoppet tried on GitHub (Outcome unclear)
A user reproduced the failure in Magic Chat by clicking "Generate API Key" and asked the maintainers to remove one of the two overloaded create_api_key signatures.
Source: https://github.com/21st-dev/magic-mcp/issues/61#issuecomment-4327500492 (opens external site)
Did this work for you?What @serafimcloud tried on GitHub (Outcome unclear)
Maintainer: upgrade to v0.2.0+, get a key at https://21st.dev/mcp (opens external site), and run
npx @21st-dev/cli@latest init, or keep the existing @21st-dev/magic config which now proxies to the new server. Old API keys were reset.Source: https://github.com/21st-dev/magic-mcp/issues/61#issuecomment-5075532002 (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?
- 21st_magic_component_builder returns [object Object] – how do I get component code?