You are connecting Claude Code to the Nexus402 gateway, which is one remote MCP server reached over HTTP. You install nothing and host nothing. If you want to build and sell a tool instead, see Build a Server.
Prerequisites #
- Claude Code installed and signed in.
- A Nexus402 account with the developer role, and a funded wallet or trial credit. See Funding and spend.
- An API key (
nx_dev_…, shown once) with its own 24-hour spend cap. A key per tool you connect keeps each one's spending bounded. See Keys, caps and rotation.
Configure the connection #
For yourself, in every project — add it once with the CLI:
claude mcp add --transport http --scope user nexus402 https://api.nexus402.dev/v1/mcp \
--header "X-Nexus-Api-Key: nx_dev_..."
The command stores the key in ~/.claude.json. Leave out --scope user to add it for the current project only (the default, local scope, also private to you).
For a team, in the repository — commit a .mcp.json at the project root that names an environment variable rather than the key. Each person sets their own key:
{
"mcpServers": {
"nexus402": {
"type": "http",
"url": "https://api.nexus402.dev/v1/mcp",
"headers": { "X-Nexus-Api-Key": "${NEXUS402_API_KEY}" }
}
}
}
export NEXUS402_API_KEY="nx_dev_..."
"type": "http"is required: an entry with aurland notypeis skipped.- Claude Code asks once before using servers from a project's
.mcp.json. - Do not write
--header "X-Nexus-Api-Key: $NEXUS402_API_KEY"on the command line expecting it to stay a reference: your shell expands it when you run the command, and the plain key is stored. - Watch for a trailing newline or space in a pasted key. Claude Code warns about whitespace in a header value; the gateway sees a different key.
Verify the connection #
claude mcp list # nexus402 should say: ✔ Connected
claude mcp get nexus402 # details, and an Issue: line if it failed
Inside a session, /mcp shows the server's status and how many tools it offers, and can reconnect it. "Added" after claude mcp add only means the configuration was written; claude mcp list is what actually connects.
To rule Claude Code out, ask the gateway directly; tools/list is never billed:
curl -s https://api.nexus402.dev/v1/mcp \
-H "X-Nexus-Api-Key: $NEXUS402_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Use the tools #
Ask for what you need and Claude chooses a tool, or name one. Claude Code names each tool mcp__nexus402__… and replaces every character other than letters, digits, _ and - with _, so the gateway's acme/weather/forecast appears as mcp__nexus402__acme_weather_forecast. The call still reaches acme/weather/forecast, and the gateway accepts acme_weather_forecast, the tool's listed name, as well.
- Each call is billed once at the tool's fixed price, to the wallet behind the key. A tool with free calls costs nothing until they run out.
- Claude Code asks permission before running an MCP tool unless you allow it; allowing
mcp__nexus402allows every tool from the gateway, and every run is a paid call. - A key scoped to some tools sees only those.
- Large results: Claude Code warns when a tool's output passes 10,000 tokens and caps it at 25,000 by default (
MAX_MCP_OUTPUT_TOKENS).
Common errors #
| What you see | Likely cause | Fix |
|---|---|---|
! Needs authentication, or a browser opens for sign-in | The gateway answered 401, and Claude Code treats a 401 as a server that wants OAuth. The gateway does not use OAuth: the key is missing, wrong, revoked or expired | Run the curl check. Fix the key or the variable, then /mcp to reconnect |
✘ Failed to connect | The URL is wrong, or a network or proxy blocks api.nexus402.dev | Compare the URL with the one above; run the curl check from the same machine |
| A warning that a variable is not set | NEXUS402_API_KEY was not in the environment Claude Code started from. The literal text is then sent as the key | Export it, then start Claude Code from that shell |
Budget_Exhausted (402) in a tool result | The wallet cannot cover the call, or the key's 24-hour cap would be exceeded | Add funds or raise the cap. Nothing was charged |
key_rate_limited (429) | Too many requests on this key in its window | Wait the seconds in Retry-After |
Upstream_Unavailable (502) | The creator's endpoint failed or timed out | Retry later. You were not charged |