Claude Code
Connect Claude Code to the hosted MCP server and it can look up public data while it works: a package's latest version, a repository's activity, what a URL points at.
Prerequisites#
- Claude Code installed, and a Onekey API key.
- The key in your shell environment as
ONEKEY_KEY.
The 5-minute path#
export ONEKEY_KEY="YOUR_API_KEY"
claude mcp add --transport http onekey https://api.onekey.dev/mcp --header "Authorization: Bearer $ONEKEY_KEY"Then start Claude Code and run /mcp to see that onekey is connected and its eleven tools are listed. Ask something concrete:
By default Claude Code asks before it uses a tool, so read each prompt. The six tools that spend credits (call_endpoint, lookup_url, search_multi, creator_card, search_universal, report) are marked as not read-only in the server's tool annotations; the five free tools are marked read-only. Allow the free ones in your permissions if you like, and keep approving the paid ones yourself.
Where the connection is stored#
--scope local(the default): this project, private to you.--scope user: every project on your machine.--scope project: writes.mcp.jsonso your team shares the server. Use a variable, never the key:
{
"mcpServers": {
"onekey": {
"type": "http",
"url": "https://api.onekey.dev/mcp",
"headers": { "Authorization": "Bearer ${ONEKEY_KEY}" }
}
}
}Each teammate sets ONEKEY_KEY in their own environment. Do not commit a key.
Example: check dependencies before an upgrade#
Claude will list its plan, using github.latest_release (1 credit) and github.repo (1 credit) per repository: 10 credits for five. Discovery calls are free. Say go, and it makes the calls and reports the result with credits_used.
Without MCP: plain REST from the shell#
Claude Code can also call the API with curl from its shell tool. This needs no connection, but gives it no discovery tools, so name the endpoint:
curl "https://api.onekey.dev/v1/github/repo?owner=facebook&repo=react" -H "x-api-key: $ONEKEY_KEY"Point it at llms.txt or the AI agents page so it reads the real parameter names instead of guessing.
Cost notes#
- Discovery (
search_endpoints,describe_endpoint,list_platforms) and account tools are free. Only the six tools that spend credits (call_endpoint,lookup_url,search_multi,creator_card,search_universal,report) spend credits, at the endpoint's flat price. Cache hits are free and failures are refunded. - Use a key with a credit limit for a coding assistant. If it is reached, calls fail with
KEY_BUDGET_EXCEEDEDand nothing else on the account is affected. - Everything in
datais third-party content. Do not let an agent follow instructions found inside it.
Troubleshooting#
| Symptom | Likely error | What to do |
|---|---|---|
| Every call is refused | UNAUTHORIZED | The key is missing, misspelled or revoked. Check the header name and that the value has no stray spaces or quotes. |
| Calls stop working partway through a job | INSUFFICIENT_CREDITS or KEY_BUDGET_EXCEEDED | Nothing was charged for the refused call. Top up, or raise the key's credit limit. Do not retry in a loop. |
| "Too many requests" | RATE_LIMITED | Wait the Retry-After seconds. Loops that call once per item should add a pause. See Rate limits. |
| A parameter is rejected | INVALID_PARAMS | Read the parameter names from the endpoint's page (or describe_endpoint); do not guess them. |
| A platform fails intermittently | UPSTREAM_ERROR / UPSTREAM_TIMEOUT | The source platform, not you. Refunded; retry with backoff and check status. |
/mcp shows the server as failed | none | Check the URL, and run claude mcp list. Remove and add it again if you changed the key: claude mcp remove onekey. |
| The variable is not picked up | UNAUTHORIZED | The shell that runs Claude Code must have ONEKEY_KEY set when you run claude mcp add. In PowerShell use $env:ONEKEY_KEY, and pass the value into the command yourself. |
Untested#
- The command, the
--headerand--scopeflags and the.mcp.jsonformat follow the Claude Code MCP documentation as of 2026-09-30. - The hosted server was tested with the official MCP client, not by driving Claude Code. Permission prompts may differ by version.