SwiftNodes CLI

The swiftnodes command signs in to your account, manages API keys, and writes a chain's endpoint URLs into a project's .env. It is made for coding agents as much as for people: the key goes into the file, not into the chat, and output masks keys unless you ask.

Install

curl -fsSL https://swiftnodes.io/install.sh | sh

Needs Node.js 18 or later. It installs one file, ~/.local/bin/swiftnodes, with no dependencies. You can read it first at swiftnodes.io/cli/swiftnodes.mjs.

Sign in

swiftnodes login

The CLI prints a link and a code. Open the link while signed in to swiftnodes.io, check the code matches, and approve. The CLI session lasts 90 days and is stored in ~/.config/swiftnodes/config.json (mode 600). swiftnodes logout ends it.

Set up a project

swiftnodes chains base                       # find the chain slug
swiftnodes project setup --chain base --create-key my-app
# or reuse a key:  --key-name my-app
# archive routing: --archive

This writes three variables into .env (other lines are kept) and, in a git repository, makes sure .env is ignored:

SWIFTNODES_API_KEY=sn_...
SWIFTNODES_RPC_URL=https://rpc.swiftnodes.io/rpc/base?key=sn_...
SWIFTNODES_WSS_URL=wss://rpc.swiftnodes.io/ws/base?key=sn_...

SWIFTNODES_WSS_URL is only written for chains with a WebSocket endpoint.

All commands

swiftnodes login / logoutSign in through the website; end the session.
swiftnodes whoami [--json]Account, plan, limits and key count.
swiftnodes chains [query] [--json]Slugs, chain IDs, status and WebSocket availability.
swiftnodes keys list [--json] [--show]Your keys, masked unless --show.
swiftnodes keys create <label>New key.
swiftnodes keys restrict <label> --ip <addr|cidr> --origin <origin>Limit where a key works (repeat flags; --clear removes all).
swiftnodes project setup --chain <slug> ...Write the key and URLs into .env.
swiftnodes rpc <chain> <method> '[params]'One JSON-RPC call, using SWIFTNODES_API_KEY or your first key.
swiftnodes mcpThe command to connect the hosted MCP server.

Example

$ swiftnodes rpc base eth_blockNumber
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x2265b3a"
}

Environment overrides: SWIFTNODES_API_BASE (API host), SWIFTNODES_CONFIG_DIR (session file location), SWIFTNODES_BIN_DIR (install location). See also the MCP server and the agent cookbook.