Nansen CLI

Built by agents, for agents. Command-line interface for the Nansen API, designed for AI agents to research on-chain data, manage wallets, and trade through nansen trade.
Use it for both analytics and execution: nansen research ... returns structured on-chain data, while nansen trade quote / nansen trade execute handle DEX swaps on Solana and Base, including cross-chain bridges.
Installation
npm install -g nansen-cli
npx -y skills add nansen-ai/nansen-cli --skill "*" -y # install every agent skill, no prompts
Without --skill "*" -y, skills add opens a picker: space selects a skill, enter confirms.
Feedback
Send product feedback to Nansen with your configured API key or login session:
{
"category": "missing_capability",
"description": "I need to compare labels across 50 wallets but cannot find a bulk lookup.",
"goal": "Compare labels across a wallet list."
}
category and description are required. category is one of bug,
data_quality, documentation, missing_capability, usability or other.
A feature request or product gap is missing_capability. description says
what happened and what was needed, in up to 2,000 characters. Optional fields
are endpoint and tool (up to 256 characters each), goal,
expected_behavior, observed_behavior and workaround (up to 2,000
characters each), request_ids (up to 10 of your own request IDs) and
client ({"name": ..., "version": ...}, attribution only). The API rejects
any other field or category with a 422, so leave out fields such as title,
summary or severity. Write plain sentences without Markdown or code
formatting. nansen feedback submit --help prints the same list.
Save the report as feedback.json. Omit the ID to save private recovery data before sending:
nansen feedback submit --file feedback.json --json
nansen feedback resume --json
nansen feedback get fb_123 --json
resume uses the saved ID and exact report bytes, even if the input file is gone.
Changing the account, API environment or report stops replay. After confirmation,
resume reads the receipt without sending another report. To deliberately start
another report, use feedback submit --new --file feedback.json.
One recovery entry lives in ~/.nansen/feedback/recovery.json, with private
permissions and a process lock. Confirmed receipts remove report content and keep
only the submission ID, feedback ID, account, environment and expiry. Feedback
recovery operations erase expired data when they next open the journal. Pending
reports expire after one calendar year. No cleanup runs while the CLI is closed.
nansen feedback forget erases local recovery data
offline, leaving a content-free marker that prevents accidental replay. It does
not delete your input file or a report on the server. A missing or erased server
receipt also clears the local entry. Validation rejections erase the saved payload;
correct the input and use --new to submit again. Forget also erases damaged journals.
Do not back up pending report content.
Automatic IDs require POSIX private storage and the optional native locking
binding. On Windows or when storage cannot be secured, supply a caller-managed
--submission-id report-123 and keep that ID and the unchanged file for retries.
This explicit-ID path does not save a local report. Recovery format version 1
survives upgrades; unsupported or damaged journals stop rather than start fresh.
Older explicit-ID-only CLI releases do not read recovery journals; finish recovery
with a supporting version before rolling back.
Remove --json for human output. received means
saved, reviewed means triaged, and closed means review is complete. Review does
not promise a fix or a date.
Feedback is free, with seven accepted reports per account each week, resetting
Monday at 00:00 UTC. An exhausted allowance exits with its reset time; accepted
IDs can still be replayed. Feedback bypasses caching and payment fallback.
Remove secrets and unnecessary personal details from your report. A backend
without feedback support reports an unavailable capability.
New submissions may be paused before release or during an outage. HTTP 503 with
reason: feedback_admissions_paused means this attempt accepted no new report
and used no weekly allowance. Tell the user feedback is unavailable, then stop;
do not keep retrying or ask for approval again in the same session. Keep the ID
and unchanged file for a later retry. Accepted-ID replays and receipt reads
remain available during a pause.
Agents should check the saved account preference before sending feedback on their
own. If enabled, they may send without asking again, subject to their host's
controls. If off, unset or unavailable, show the proposed report and ask first.
Approval for one report does not change the preference. Never enable it
automatically. Use nansen feedback preferences --json for a fresh account read
before each new automatic report. Without --json, it prints a human summary.
Reads use no credits or report quota. Change the lasting choice in Superapp settings.
An explicit user request to send the report needs no additional preference
check. The submit command sends the report without an interactive prompt.
HTTP 403 with reason: feedback_not_enabled means feedback is not enabled for
this account. Stop automatic retries. Approval or an enabled preference does
not override rollout. Keep the ID and unchanged report for recovery; an earlier
uncertain attempt remains uncertain. Never switch accounts or pay to bypass denial.
Auth
Pick one of three ways to authenticate and pay for API calls.
Nansen account. Calls use your account's plan and credits. nansen login approves the CLI in your browser and saves a session. On a server, in a container or in CI, set NANSEN_API_KEY to a key from the API page instead.
nansen login
x402. Pay per call from a CLI wallet funded with USDC on Base or Solana, or USDT0 on X Layer. When the API answers with HTTP 402, the CLI pays from your default wallet and retries. Each payment is capped at $1.00 by default; set NANSEN_X402_MAX_AMOUNT to change it. Your first wallet becomes the default. The wallet needs a password of at least 12 characters. The CLI saves it for later payments, in the OS keychain when one is available.
NANSEN_WALLET_PASSWORD='<your-wallet-password>' nansen wallet create --name my-wallet
MPP via tempo. Pay per call through the separate tempo CLI. The Nansen CLI does not sign MPP payments. After the one-time tempo setup:
tempo request -X POST https://api.nansen.ai/api/v1/smart-money/netflow --json '{"chains":["solana"],"pagination":{"page":1,"page_size":10}}'
docs/auth.md covers headless setup, saving an API key, browser-session storage and how x402 payment works with each credential.
Verify your MCP setup
For the hosted Nansen MCP server, verify server reachability and the supplied API key on the paid data path with:
npx -y nansen-cli mcp verify # uses the saved key or NANSEN_API_KEY
The check calls tools/list for reachability, then calls the paid nansen_score_top_tokens canary tool. A successful canary costs about 1 credit; tool listings and free tools alone do not prove that a key works. The CLI cannot inspect the key inside your MCP client, so make sure this same key is in the client's NANSEN-API-KEY header. For the final client-config check, ask your client: “Use the nansen_score_top_tokens tool.”
Commands
nansen research <category> <subcommand> [options]
nansen agent "<question>" # AI research agent (100 credits)
nansen agent "<question>" --expert # deeper analysis (400 credits)
nansen trade quote --chain solana --from SOL --to USDC --amount 1000000000
nansen trade execute --quote <quoteId>
nansen wallet <subcommand> [options]
nansen mcp install <client> # add the Nansen MCP server to Claude Code/Desktop or Cursor
nansen completion <bash|zsh|fish> # shell completions (no API key needed)
nansen schema [command] [--pretty] # full command reference (no API key needed)
nansen cache stats # what the local caches hold (no API key needed)
Research categories: smart-money (sm), token (tgm), profiler (prof), portfolio (port), prediction-market (pm), search, perp
The points leaderboard API has been removed. nansen research points leaderboard and the legacy command nansen points leaderboard return success: false with code COMMAND_UNAVAILABLE and exit status 1, without making an API request (with --help too). The command is no longer listed in nansen schema, help or completions.
Direct research subcommands:
nansen research chain-rank [--days 7|30|365] [--chain-type all|evm] — rank chains by growth metrics
nansen research token-sectors — list token sectors available for filtering
nansen research address-premium-labels --address <addr> [--chain <chain>] [--page <n>] [--limit <n>] — get all labels for an address, including premium labels
nansen research smart-money-pnl-leaderboard [--chains c1,c2] [--days 1|7|30|90|180] [--filters '<json>'] [--sort <field[:asc|desc]>] [--page <n>] [--limit <n>] — rank smart money wallets by PnL
nansen research position-intelligence --symbol <symbol> — aggregate Hyperliquid positions by trader cohort
nansen research perp-pnl-summary --address <addr> --from-date <date> --to-date <date> — summarize realized Hyperliquid PnL for an address
nansen research transaction-with-token-transfer-lookup --transaction-hash <hash> [--chain <chain>] [--block-timestamp "YYYY-MM-DD HH:MM:SS"] — look up a transaction and its token/NFT transfers
Plus the historical-* point-in-time commands — run nansen research help for the full list.
Trade: quote, execute, bridge-status, limit-order — DEX swaps on Solana and Base, cross-chain bridges, and Solana limit orders.
Wallet: create, list, show, export, default, delete, send, forget-password, secure — local or Privy server-side wallets (EVM + Solana).
Alerts: list, create, update, toggle, delete — smart alerts delivered to Telegram, Slack, Discord or a webhook. Give a webhook's signing secret through stdin or the environment, not on the command line, so it stays out of shell history and the process list:
nansen alerts create --name 'ETH SM inflow' --type sm-token-flows --chains ethereum --inflow-1h-min 1000000 \
--webhook https://example.com/hook --webhook-secret-stdin < webhook-secret.txt
NANSEN_WEBHOOK_SECRET="$(cat webhook-secret.txt)" nansen alerts update <id> --webhook https://example.com/hook
--webhook-secret <secret> still works. It cannot be combined with --webhook-secret-stdin, and either flag overrides NANSEN_WEBHOOK_SECRET, which is read only when --webhook is given. Alerts output redacts channel credentials unless you pass --reveal.
Run nansen schema --pretty for the full subcommand and field reference.
MCP
Connect any MCP client to Nansen's streamable HTTP server:
One-step install of the hosted Nansen MCP server (https://mcp.nansen.ai/ra/mcp) into a local MCP client:
nansen mcp install claude-code # ~/.claude.json (user scope)
nansen mcp install claude-desktop # macOS/Windows only; bridges via pinned mcp-remote
nansen mcp install cursor # ~/.cursor/mcp.json
nansen mcp install cursor --dry-run # print what would be written (key redacted)
nansen mcp uninstall <client> # remove the entry (add --dry-run to preview)
Uses the API key from nansen login --human / NANSEN_API_KEY; re-run install after rotating your key. Writes are merge-only and atomic: existing servers and settings are preserved, a .bak copy is written before every install or uninstall, and the CLI refuses to touch a config it can't parse. Note the client config stores the API key in plaintext — new files are created with 0600 permissions. Restart the client after installing.
Manual setup, for other clients or if you would rather not use the CLI — the paths below, and the connection docs at docs.nansen.ai/mcp/connecting.
One-command (Claude Code):
claude mcp add --transport http nansen https://mcp.nansen.ai/ra/mcp --header "NANSEN-API-KEY: <your-key>"
Manual (any streamable-HTTP client): for example, add this to Cursor's ~/.cursor/mcp.json:
{
"mcpServers": {
"nansen": {
"url": "https://mcp.nansen.ai/ra/mcp",
"headers": {
"NANSEN-API-KEY": "<your-key>"
}
}
}
}
Manual (stdio-only clients): use mcp-remote as a bridge. Keep the header name and value in a single args entry, and keep the key in env rather than in the argument list — mcp-remote substitutes ${NANSEN_API_KEY} from the environment:
{
"mcpServers": {
"nansen": {
"command": "npx",
"args": [
"-y",
"mcp-remote@0.2.1",
"https://mcp.nansen.ai/ra/mcp",
"--header",
"NANSEN-API-KEY:${NANSEN_API_KEY}"
],
"env": {
"NANSEN_API_KEY": "<your-key>"
}
}
}
}
mcp-remote is pinned to an exact version rather than @latest because the bridge handles your API key on every request, and npx would otherwise pull a new release automatically. 0.2.1 is the version this config is tested against. A weekly check reports when a newer release exists; to bump the pin, review the release and follow MCP client config.
Claude Tag (Claude in Slack): an admin must attach a plugin whose .mcp.json points at https://mcp.nansen.ai/ra/mcp and add a custom credential allowing the host mcp.nansen.ai. See the Claude Tag custom-connections documentation. Per-user fallback: use Claude Code or Claude Desktop.
Trading
DEX swaps on solana and base. Two-step: quote then execute.
nansen trade quote --chain solana --from SOL --to USDC --amount 1000000000
nansen trade execute --quote <quoteId>
Cross-chain swaps work the same way — add --to-chain. Bridge providers (Li.Fi or Relay) are selected automatically based on best price.
nansen trade quote --chain base --to-chain solana --from ETH --to SOL --amount 0.0003 --amount-unit token
nansen trade execute --quote <quoteId> # signed broadcast
nansen trade bridge-status --tx-hash <hash> --from-chain base --to-chain solana
Before broadcasting
trade execute, bridge execute, and the signing limit-order operations (limit-order create and limit-order cancel) accept:
nansen trade execute --quote <quoteId> --dry-run # validate + print the plan, broadcast nothing
nansen trade execute --quote <quoteId> --yes # skip the confirmation prompt (also: -y)
nansen trade limit-order create ... --dry-run # preview intent; no API request or signature
nansen trade limit-order cancel --order <id> --dry-run # does not request/consume a cancellation tx
--dry-run runs every sign-free preflight available from the cached quote, its public signer address, and read-only RPC calls; prints what would be sent (chain, tokens, amounts, recipient, approvals, fees); and stops before wallet credentials, signing, or broadcast — no wallet password needed, the quote stays usable, exit code 0. Real execution still resolves and revalidates the live signer before signing.