Connect with MCP

Claude Code

One command, or one entry in .mcp.json, and Claude Code can call every published tool.

Sections

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:

Add the gateway for your user bash
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:

.mcp.json json
{
  "mcpServers": {
    "nexus402": {
      "type": "http",
      "url": "https://api.nexus402.dev/v1/mcp",
      "headers": { "X-Nexus-Api-Key": "${NEXUS402_API_KEY}" }
    }
  }
}
Each person, before starting Claude Code bash
export NEXUS402_API_KEY="nx_dev_..."
  • "type": "http" is required: an entry with a url and no type is 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 #

Check it bash
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:

Check the key without Claude Code bash
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__nexus402 allows 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 seeLikely causeFix
! Needs authentication, or a browser opens for sign-inThe 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 expiredRun the curl check. Fix the key or the variable, then /mcp to reconnect
✘ Failed to connectThe URL is wrong, or a network or proxy blocks api.nexus402.devCompare the URL with the one above; run the curl check from the same machine
A warning that a variable is not setNEXUS402_API_KEY was not in the environment Claude Code started from. The literal text is then sent as the keyExport it, then start Claude Code from that shell
Budget_Exhausted (402) in a tool resultThe wallet cannot cover the call, or the key's 24-hour cap would be exceededAdd funds or raise the cap. Nothing was charged
key_rate_limited (429)Too many requests on this key in its windowWait the seconds in Retry-After
Upstream_Unavailable (502)The creator's endpoint failed or timed outRetry later. You were not charged

Install agent tools

Help your coding agent stay on track when building with Nexus402. Learn more

Paste this into Claude Code, Codex or Cursor. Your agent connects itself to Nexus402 and adds the skills, for whichever tool it is.

Prompt for your agent text
Set up Nexus402 for me in this coding agent.
1. Read https://www.nexus402.dev/docs/agents.md and work out which tool you are (Claude Code, Codex or Cursor).
2. Add the Nexus402 MCP server https://api.nexus402.dev/v1/mcp the way that page shows for your tool, sending the X-Nexus-Api-Key header from the NEXUS402_API_KEY environment variable.
3. Install the skills listed at https://www.nexus402.dev/.well-known/skills/index.json where your tool keeps skills or rules.
Never write my key into a file, a commit or a reply. If NEXUS402_API_KEY is not set, stop and tell me to set it.
Then check the connection lists tools, and tell me what you changed.

Connect the gateway, then add the two skills.

Terminal bash
claude mcp add --transport http --scope user nexus402 https://api.nexus402.dev/v1/mcp \
  --header "X-Nexus-Api-Key: $NEXUS402_API_KEY"

mkdir -p ~/.claude/skills/nexus402-tools && curl -fsSL https://www.nexus402.dev/.well-known/skills/nexus402-tools/SKILL.md -o ~/.claude/skills/nexus402-tools/SKILL.md
mkdir -p ~/.claude/skills/nexus402-endpoint && curl -fsSL https://www.nexus402.dev/.well-known/skills/nexus402-endpoint/SKILL.md -o ~/.claude/skills/nexus402-endpoint/SKILL.md

Add the gateway to ~/.codex/config.toml, then add the skills with npx skills add https://www.nexus402.dev.

~/.codex/config.toml toml
[mcp_servers.nexus402]
url = "https://api.nexus402.dev/v1/mcp"
env_http_headers = { "X-Nexus-Api-Key" = "NEXUS402_API_KEY" }
tool_timeout_sec = 130
Add to Cursor

Opens Cursor and asks to add the gateway. Your key is read from NEXUS402_API_KEY.

Or add it by hand to ~/.cursor/mcp.json. Then add the skills with npx skills add https://www.nexus402.dev.

~/.cursor/mcp.json json
{
  "mcpServers": {
    "nexus402": {
      "url": "https://api.nexus402.dev/v1/mcp",
      "headers": {
        "X-Nexus-Api-Key": "${env:NEXUS402_API_KEY}"
      }
    }
  }
}

Skills-only installs don't update automatically.

Terminal bash
npx skills add https://www.nexus402.dev

Every option reads your key from NEXUS402_API_KEY; none writes it into a file. Learn more