Documentation

How Nexus402 works

We host nothing. Creators keep their servers where they want them; we add the meter, and developers reach every tool through one key.

Sections

Nexus402 is a metering gateway for MCP tools. It sits between two parties who never need an account with each other: a developer, whose AI agent calls tools from an ordinary MCP client, and a creator, who runs the server that does the work. The gateway decides who may call, charges a fixed price per call from a wallet the developer funded in advance, forwards the call to the creator's own server, and keeps the books for both sides.

The Nexus402 system A developer's MCP client posts to the Nexus402 gateway, which checks the key, meters the call and records the charge, then forwards a signed request to the creator's own server and relays the result. Charges go through a queue to a worker that posts them to a double-entry ledger in PostgreSQL. Top-ups arrive through Stripe; creators are paid out through Stripe Connect. MCP client Cursor · Claude Code · Codex the developer's Nexus402 gateway 1 · Key + rate limit who is calling 2 · Meter price, cap, wallet 3 · Record charge before forwarding 4 · Sign + forward Ed25519, HTTPS Creator's server their host, their code we host nothing call result signed + proof Charge queue Worker · 5-min rollups Ledger · PostgreSQL · double-entry, append-only Top-ups · Stripe Payouts · Stripe Connect earnings, after holds
One remote MCP server for the developer; the creator's server stays wherever the creator runs it.

The parts #

PartWhat it does
The gateway (api.nexus402.dev)One remote MCP server for every tool. Authenticates the key, rate-limits it, meters the call, signs and forwards it to the creator, checks the answer, and relays it. Answers initialize, tools/list and ping itself from the published catalogue
The meterRedis holds each wallet's spendable balance and each key's rolling 24-hour spend. One atomic script checks both and deducts the price, so two calls can never spend the same cent. If Redis is unreachable, every paid call is refused with 503 rather than let through
The charge queueEvery charge is written to a durable queue, and the gateway waits for that write before contacting the creator. A charge that cannot be recorded is a refused call, never a free one
The ledgerPostgreSQL, double-entry and append-only: database triggers refuse edits and deletes. A worker nets charges into five-minute rollups. It is the only source of truth; Redis is rebuilt from it
The registryEvery published version, with its fixed price and endpoint. Gateways keep a copy in memory and refresh it about every five minutes, so no database is read on a call
StripeCard top-ups into a developer's wallet (Checkout with 3D Secure, no automatic top-up), and payouts to creators through Stripe Connect
The creator's serverAny HTTPS endpoint the creator runs, anywhere. It receives signed MCP tools/call requests and returns results. Nexus402 never hosts it, deploys it or holds its code

How creators bring their servers in #

A creator does not move anything onto our infrastructure. They publish a pointer to a server they already run, at a price, and the gateway starts sending it paid calls.

  1. Sign in creator role Google, GitHub or Apple. No password. (in your Nexus402 account)
  2. Claim a handle get nx_crt_ key Your name in every tool's address. The key is shown once. (in your Nexus402 account)
  3. Build your endpoint A starter kit in your language checks each request is ours. (on your own server)
  4. Host it anywhere, HTTPS Any host that serves HTTPS. Nothing of ours to install. (on your own server)
  5. Publish price + proofs Set a fixed price per call; we check the endpoint answers. (in your Nexus402 account)
  6. Get called metered, paid Each call is charged up front; you are owed your share. (in your Nexus402 account)

Then, on every paid call

  1. An agent calls with its key
  2. Nexus402 charges the price, signs the request
  3. Your endpoint checks the signature, answers
  4. You are owed your share of every paid call
From sign-in to your first paid call: two steps in your account, two on your own server, then publish and get called.
  1. Sign in with Google, GitHub or Apple and take the creator role.
  2. Claim a handle, the namespace every tool lives under (acme/…). The answer carries the creator key, nx_crt_…, shown once, which every forwarded call carries so the server knows it came from us.
  3. Build the endpoint: a small HTTPS handler that checks our signature and key, runs the tool, and returns the MCP result with a proof header. See Build a Server.
  4. Host it anywhere with a public HTTPS address on port 443: a VPS, a container platform, a serverless function.
  5. Publish a version with its fixed price, endpoint, description and input schema. The first publish at a host proves the creator controls it with one static file, and every publish sends a signed "hello" the endpoint must answer. The version is callable within about five minutes.
  6. Get called. Optionally give free calls per day, week or month to let developers try the tool.

How developers connect through MCP #

A developer adds one remote MCP server to the client they already use — Cursor, Claude Code, OpenAI Codex or any other — at https://api.nexus402.dev/v1/mcp, with their key in the X-Nexus-Api-Key header. There is no SDK. The client's tools/list returns every published tool with its description and schema, free; the agent then calls whichever it needs. Each key has its own spend cap, so one agent's mistakes are bounded by what someone decided to give that key. See Connect with MCP.

How a tool call flows #

One paid tool call The client sends a tools/call with its key. The gateway checks the key and rate limit and deducts the price in Redis, records the charge on a durable queue and waits for it, sends a signed request to the creator's server, checks the proof on the creator's answer, and streams the result back to the client as a JSON-RPC response. MCP client Gateway Meter (Redis) Charge queue Creator's server 1 tools/call + key 2 key, limit, deduct 3 charge recorded, awaited 4 signed request (Ed25519) 5 result + X-Nexus-Proof 6 JSON-RPC result, streamed
Nothing reaches the creator until step 3 succeeds; if it fails, the call is refused with 503 and nothing is charged.
  1. The client sends an MCP tools/call with the key.
  2. The gateway verifies the key and its rate limit, finds the tool's version and price in memory, and deducts the price in one atomic step that also checks the wallet and the key's rolling 24-hour cap. A wallet or cap that cannot cover it is a 402, and nothing is charged.
  3. It writes the charge to the durable queue and waits for the acknowledgement.
  4. It forwards the request to the creator's endpoint over HTTPS, signed with Ed25519 over the method, host, path, timestamp, correlation id and body hash, with the creator key beside it.
  5. The creator's server answers with the tool's result and a proof header derived from that request, which shows the answer came from the endpoint that received it.
  6. The gateway checks the proof before relaying a byte, wraps the result as the JSON-RPC response to the developer's request, and streams it back. A call may run for up to two minutes.

The gateway reads only the envelope it needs to route and bill — the method and the tool name — and computes a one-way hash. It does not store or log the contents of tool calls. See the Privacy Policy.

What a call costs, by outcome #

What happenedDeveloper chargedCreator earns
The creator answered 2xx with a valid proofYes, the fixed priceYes
A free call (the tool's allowance, not yet used up)NoNo
The creator answered 4xx or 5xxNo, refunded; the status and body are relayedNo
The creator timed out, could not be reached, or answered 2xx without a valid proofNo, voided; the developer gets 502No
The response was cut off after it had started streamingYes: bytes reached the developerYes
The wallet or the key's cap could not cover itNo; 402No
Our own infrastructure could not authorize itNo; 503, never a silent debitNo

How metering works #

  • Fixed prices. A creator sets a price per call on each version, in integer micro-USD (up to $5.00 a call by default). A published version's price never changes; a new price is a new version. A price more than twice what unpinned callers were paying waits seven days before unpinned callers reach it.
  • Pre-funded wallets. Developers add funds by card before they spend. There is no automatic top-up, so the balance is the ceiling.
  • Per-key caps. Every key can carry a rolling 24-hour spend cap, checked in the same atomic step as the balance.
  • Exactly once. An Idempotency-Key makes a retry safe: a key that already paid for a call is refused with 422, never charged twice.
  • Free calls and trial credit. A creator can give every account a number of free calls per UTC day, week or month. A new account may get trial credit from an operator offer, which pays only for those free calls and ends at the first top-up. Neither is money: a free call debits nothing and earns nothing.
  • Settlement. A worker posts charges to the ledger in five-minute rollups. The creator's share is the price less our margin, 10% today and effective-dated, so a change applies only from the date it takes effect.
  • Payouts. Earnings become withdrawable after holds that protect against chargebacks, from a $5.00 minimum, by Stripe Connect transfer, each withdrawal confirmed with an emailed code. See Payouts.

What we handle, and what creators handle #

Nexus402 handlesThe creator handles
Developer accounts, keys, wallets, card top-ups, caps and rate limitsThe server: its code, hosting, uptime, scaling and TLS certificate
MCP discovery: initialize, tools/list, ping, from the published catalogueThe tool's behaviour, and its description and input schema
Metering, the charge, refunds and voids, and idempotencyChoosing a price per version, and any free calls
Signing every forwarded request, and checking every answer's proofVerifying our signature and key, and returning the proof
The ledger, settlement, holds and payoutsConnecting a Stripe account to be paid
Marking an endpoint unhealthy: five failures in a row pause it for 30 seconds, and twenty de-list the version until it is re-publishedFixing the endpoint, and re-publishing a de-listed version
Never storing or logging the contents of tool callsWhatever the tool does with the arguments it receives, under the creator's own terms

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