# CLI & MCP
Quotes, token discovery, delegated trades, intent orders, and policy inspection from your terminal or an MCP client.
## Install and connect
curl -fsSL https://agentswap.co/install.sh | sh
cargo install agentswap
agentswap --version
agentswap --help
agentswap health
agentswap chains
The CLI uses Smart Router at https://api.agentswap.co. Set AGENTSWAP_URL to use another compatible deployment.
## Configure quote access
Use an existing API key through SR_API_KEY, or register with a local signer file. Replace the wallet and file placeholders below with your own values.
agentswap register --address 0xYourWallet --key-file ./signer-key.txt
agentswap key-info
agentswap pricing
Registration caches the API key for later commands. Keep signer keys in a restricted local file.
## Quote and inspect
# Quote 1000000 USDC base units (display equivalent: 1 USDC)
agentswap quote --chainid 8453 --from USDC --to WETH --amount 1000000
# JSON output and token discovery
agentswap --json tokens --chainid 8453
agentswap batch-quote --chainid 42161 --amount 1000000 USDC/WETH
Select the chain with --chainid and a numeric chain ID or alias: Base 8453, Arbitrum 42161, BNB Smart Chain 56, Robinhood Chain 4663, Ethereum 1, Arc 5042 (arc).
Use integer amounts in the token's smallest unit: wei for ETH, or the ERC-20's base units. Every monetary input is an unsigned decimal integer with no raw: prefix, so one 6-decimal USDC is written 1000000; a value that is not digits is refused before any quote or signature. API amountIn and --max-amount take plain raw integer strings.
## Intents and agent permissions
# Replace addresses and IDs with the values you want to inspect
agentswap intent list --chainid 8453 --owner 0xOwner
agentswap intent status --chainid 8453 --id 0xIntentId
agentswap policy --chainid 8453 --owner 0xOwner --agent 0xAgent
intent place prepares a Dutch order. trade prepares a delegated market swap. Both require the appropriate owner-granted policy; execution is forced to dry-run without --allow-trade.
With --relay, the agent signs using its own key and needs no trading funds or gas balance. Input comes from the owner's main wallet and proceeds return to it; relayers and solvers pay transaction gas. --self-submit requires gas in the submitting wallet.
Dry-runs may sign locally but never relay or broadcast. They still need a reachable RPC and a deployed proxy for contract checks. Set --max-amount before enabling execution.
Intent signing and tracking →
Trade setup and execution controls →
## Connect an MCP client
Start agentswap mcp as a stdio server. A typical client configuration is:
{
"mcpServers": {
"agentswap": {
"command": "agentswap",
"args": ["mcp"]
}
}
}
Tools: quote, batch_quote, tokens, pools, trade, intent_place, intent_list, intent_status, and policy.
The server uses the same credentials, trade opt-in, and amount caps as the CLI. Intent listing requires an owner or agent filter.