Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@metamask/agentic-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@metamask/agentic-cli
MetaMask Agentic CLI (mm) — a command-line tool for interacting with the MetaMask Agentic platform. Use it interactively in a terminal shell, or run single commands in scripts and CI.
Requirements
- Node.js >= 22.x
- npm >= 10.x
Installation
Install globally:
npm install -g @metamask/agentic-cliVerify the install:
mm --helpQuick start
Sign in
mm login
Choose QR (MetaMask Mobile), Google, email, or paste an existing token. See Login for non-interactive options.
Initialize your wallet
mm init
Pick a server wallet (recommended) or bring your own keys (BYOK). Settings are saved locally for future commands.
Run a command
mm wallet list mm wallet balance mm --helpOr open the interactive shell with no arguments:
mm
Interactive shell vs headless
| Mode | When it runs |
|---|---|
| Interactive shell (REPL) | stdin and stdout are both a TTY, and you run mm with no arguments, or mm init without a format flag |
| Headless | Everything else — a single command runs and exits |
In headless mode there are no prompts. Pass flags, environment variables, and rely on defaults so required values are always provided; otherwise the CLI returns a MISSING_FLAG error.
Force headless output on a TTY by passing a format flag, e.g. mm init -f json or mm auth status --json.
Output formats
| Flag | Description |
|---|---|
-f, --format <fmt> |
stdout format: json, text, yaml, toml, toon |
--json |
Shorthand for --format=json (also forces headless on a TTY) |
--toon |
Shorthand for --format=toon (also forces headless on a TTY) |
-v, --verbose |
Log diagnostics to stderr |
When multiple format flags are combined, the latest token on the command line wins.
Login
Sign in before running commands that require authentication.
Interactive
mm login # pick a method
mm login qr # MetaMask Mobile QR
mm login google # Google account
mm login email # email one-time codeSet MM_DASHBOARD_URL to override the dashboard base URL.
Non-interactive
For scripts, CI, or environments without a TTY:
mm login --token <token>
mm login google --no-wait # prints dashboard sign-in URL
mm login email --no-waitToken can also be supplied via MM_CLI_TOKEN.
Auth status and sign out
mm auth status # authenticated?, project ID, wallet address, token expiry
mm logout # clear auth credentials and local init state
mm reset # wipe the entire local session (logout + all saved settings)Initialize
mm init configures wallet mode and (for server wallets) trading mode. Run it after signing in.
mm init
mm init show # print current settingsServer wallet (default)
Keys are managed server-side. During init you choose a trading mode and policy controls (outflow limits, protocol whitelists, etc.).
Bring your own keys (BYOK)
Import a BIP-39 mnemonic. In the interactive shell, mm init prompts for the phrase; for headless runs pass flags or env:
mm init --wallet byok --mnemonic "<phrase>"
# or
MM_MNEMONIC="<phrase>" mm init --wallet byokOptionally encrypt the stored mnemonic with a password at init:
mm init --wallet byok --mnemonic "<phrase>" --password "<pw>"
# or
MM_PASSWORD=<pw> mm init --wallet byok --mnemonic "<phrase>"Manage the password later:
mm wallet password set --new=<pw>
mm wallet password change --current=<old> --new=<new>
mm wallet password remove --current=<pw>Commands that unlock the stored mnemonic accept --password or MM_PASSWORD.
Configuration
Set the target environment (must be done before signing in; change requires mm reset or mm logout first):
mm config set env prod
mm config set env dev
mm config set env uat
mm config get # show current configYou can also set MM_ENV=prod|dev|uat for a single invocation.
Command overview
Run mm --help or mm <topic> --help for flags and examples.
Wallet
| Command | Description |
|---|---|
mm wallet list |
List wallets for your account |
mm wallet show |
Show active or specific wallet details |
mm wallet select |
Switch the active wallet |
mm wallet create |
Create a new wallet |
mm wallet address |
Print the active wallet address |
mm wallet balance |
Native and token balances |
mm wallet sign-message |
Sign a plaintext message |
mm wallet sign-typed-data |
Sign EIP-712 typed data |
mm wallet send-transaction |
Send a raw EVM transaction |
mm wallet requests list |
Pending requests (server-wallet mode) |
mm wallet requests watch |
Wait for a request to complete (server-wallet mode) |
Transfer and swap
| Command | Description |
|---|---|
mm transfer |
Send native currency or ERC-20 tokens |
mm swap quote |
Get a swap or bridge quote |
mm swap execute |
Execute a swap or bridge |
mm swap status |
Check swap/bridge status by quote ID |
Tokens and prices
| Command | Description |
|---|---|
mm token networks |
Networks supported by the Token API |
mm token list popular |
Popular tokens on the active chain |
mm token list trending |
Trending tokens |
mm token list top-gainer |
Top gainers |
mm token list search |
Search tokens by symbol or name |
mm token assets |
Asset metadata for CAIP-19 IDs |
mm price spot |
Spot prices |
mm price history |
Historical prices |
mm price networks |
Networks supported by the price API |
mm price currencies |
Supported quote currencies |
mm chains list |
All supported blockchain networks |
Perpetuals
| Command | Description |
|---|---|
mm perps list-venues |
Available perpetual venues |
mm perps markets |
Markets for a venue |
mm perps quote |
Estimate entry without placing an order |
mm perps open |
Open a position |
mm perps close |
Close positions |
mm perps modify |
Modify resting orders |
mm perps cancel |
Cancel an order |
mm perps orders |
List resting orders |
mm perps positions |
Open positions |
mm perps balance |
Perp account balances |
mm perps deposit |
Deposit USDC into a venue |
mm perps withdraw |
Withdraw USDC from a venue |
mm perps transfer |
Move USDC between spot and perp accounts |
mm perps dexs |
DEX identifiers for a venue |
Predict (prediction markets)
| Command | Description |
|---|---|
mm predict setup |
One-time setup: credentials, deposit wallet, approvals |
mm predict markets list |
Search tradeable markets |
mm predict markets search |
Search via Polymarket public search |
mm predict quote |
Preview order cost and fill |
mm predict place |
Place an order |
mm predict cancel |
Cancel orders |
mm predict positions |
Your positions |
mm predict orders |
Open orders |
mm predict portfolio |
Balance, positions, and redeemable winnings |
mm predict deposit |
Convert USDC.e to pUSD in your deposit wallet |
mm predict withdraw |
Withdraw pUSD to your EOA |
mm predict redeem |
Redeem winning tokens after resolution |
Run mm predict --help for the full list (events, tags, geoblock, auth, and more).
Utilities
| Command | Description |
|---|---|
mm decode |
Decode EVM calldata into a human-readable intent |
mm config get / mm config set |
CLI configuration |
mm init show |
Current init settings |
mm reset |
Clear local session entirely |
Session storage
Session data is stored at:
~/.metamask/session.jsonConfiguration (such as environment) is stored at:
~/.metamask/config.jsonBoth files are created with restricted permissions (0600). Use mm reset to clear the session, or mm logout to sign out while keeping other settings.
Environment variables
| Variable | Purpose |
|---|---|
MM_ENV |
Override environment for one run: prod, dev, or uat |
MM_CLI_TOKEN |
Auth token for mm login --token |
MM_MNEMONIC |
BIP-39 phrase for BYOK init |
MM_PASSWORD |
Unlock or encrypt BYOK mnemonic |
Getting help
mm --help
mm login --help
mm init --help
mm predict --helpReport issues at github.com/MetaMask/agentic/issues.