metamask-agent-wallet

v2026.09.24

Use when the user asks anything about blockchain wallets, transactions, signing, token transfers, supported chains, wallet balances, perpetual futures trading, prediction markets, token swaps, cross-chain bridges, market data, token discovery, decoding EVM calldata, DeFi earn/yield vaults, installing or removing third-party `mm` CLI plugins, or authentication via the MetaMask Agentic CLI; also when an HTTP request returns 402 Payment Required / x402, when an MCP tool call returns an x402 payment-required result, or the agent needs to pay for a paywalled API, endpoint, file, tool, or resource. Single entry point for all mm CLI operations.

GitHub
Install command
npx skhub add metamask/metamask-agent-wallet
Markdown
SKILL.md

MetaMask Agentic CLI Skill

This skill documents the mm CLI surface for MetaMask Agent Wallet authentication, wallet lifecycle, balance queries, token transfers, message and typed-data signing, raw transactions, chain discovery, market data, token discovery, perpetual futures trading, prediction market trading, prediction trade/redeem history, token swaps, cross-chain bridges, DeFi earn/yield vaults, and EVM calldata decoding.

Use the routing table to select the relevant reference file. CLI behavior lives in references/. Repeatable operational patterns live in workflows/.

Command Routing

Match the user's intent to a command and reference file, then read the reference before constructing a command. If intent spans multiple domains, load them sequentially in dependency order.

User IntentCommandReference
Check authentication statusmm auth statusauth.md
Login in MetaMask Agentic CLImm loginauth.md
Choose a wallet mode and set up policiesmm initauth.md
Show current init settingsmm init showauth.md
Sign in via QR code with MetaMask Mobilemm login qrauth.md
Sign in via browser (Google or Email)mm login browserauth.md
Sign outmm logoutauth.md
Reset CLI sessionmm resetauth.md
Show CLI configurationmm config getauth.md
Set CLI configurationmm config setauth.md
Set BYOK mnemonic encryption passwordmm wallet password setauth.md
Change BYOK mnemonic encryption passwordmm wallet password changeauth.md
Remove BYOK mnemonic encryption passwordmm wallet password removeauth.md
Interpret raw CLI error codesAuthError, ValidationError, WALLET_ERRORerrors.md
Inspect CLI, skills, environment, and session healthmm doctordoctor.md
List installed CLI pluginsmm pluginsplugins.md
Inspect an installed CLI pluginmm plugins inspectplugins.md
Install a CLI pluginmm plugins installplugins.md
Update a CLI pluginmm plugins updateplugins.md
Uninstall a CLI pluginmm plugins uninstallplugins.md
Remove all user-installed CLI pluginsmm plugins resetplugins.md
Link a local plugin directory for developmentmm plugins linkplugins.md
Enable or disable the plugin betamm config set experimentalPluginsplugins.md
Decode EVM calldata into a human-readable intentmm decodedecode.md
Create a walletmm wallet createwallet.md
List all walletsmm wallet listwallet.md
Switch active walletmm wallet selectwallet.md
Show active wallet detailsmm wallet showwallet.md
Show active wallet addressmm wallet addresswallet.md
Check the active wallet balancemm wallet balancewallet.md
Show a QR code and address to fund the active walletmm wallet add-fundwallet.md
Show current trading modemm wallet trading-mode getwallet.md
Set trading mode to guard or beastmm wallet trading-mode setwallet.md
View wallet policymm wallet policy getwallet.md
Set wallet policymm wallet policy setwallet.md
Show project policy templatemm wallet policy templatewallet.md
Sign a plaintext messagemm wallet sign-messagesigning.md
Sign EIP-712 typed datamm wallet sign-typed-datasigning.md
Send a raw EVM transactionmm wallet send-transactiontransaction.md
Transfer native tokens or ERC-20 tokensmm transfertransfer.md
List supported chains by the CLImm chains listchain.md
List pending wallet requestsmm wallet requests listpolling.md
Watch a wallet polling idmm wallet requests watchpolling.md
Query spot or historical pricesmm price ...market-data.md
Discover tokens, token networks, or token metadatamm token ...market-data.md
List perpetual marketsmm perps marketsperps.md
Check perps account balancemm perps balanceperps.md
List open perpetual positionsmm perps positionsperps.md
Get a quote for a perpetual ordermm perps quoteperps.md
List resting perpetual ordersmm perps ordersperps.md
Open a perpetual positionmm perps openperps.md
Close a perpetual positionmm perps closeperps.md
Modify leverage, take-profit, or stop-lossmm perps modifyperps.md
Cancel a resting perps ordermm perps cancelperps.md
Deposit USDC into a perps venuemm perps depositperps.md
Withdraw USDC from a perps venuemm perps withdrawperps.md
Transfer USDC between spot and perp accountsmm perps transferperps.md
List perpetual futures venuesmm perps list-venuesperps.md
List available DEXs for a venuemm perps dexsperps.md
Set Predict trading modemm predict modepredict.md
One-time Predict setupmm predict setuppredict.md
Create or refresh Predict credentialsmm predict authpredict.md
Repair Predict approvalsmm predict approvepredict.md
Check Predict back-end status and account setupmm predict statuspredict.md
Check if Polymarket is geoblocked for your IPmm predict geoblockpredict.md
List prediction marketsmm predict markets listpredict.md
Search prediction marketsmm predict markets searchpredict.md
Inspect a prediction marketmm predict markets getpredict.md
List Polymarket eventsmm predict events listpredict.md
Inspect a Polymarket eventmm predict events getpredict.md
List Polymarket event seriesmm predict series listpredict.md
Inspect a Polymarket event seriesmm predict series getpredict.md
List Polymarket tagsmm predict tags listpredict.md
Inspect a Polymarket tagmm predict tags getpredict.md
Preview a prediction order costmm predict quotepredict.md
Place a prediction market ordermm predict placepredict.md
Cancel prediction ordersmm predict cancelpredict.md
View prediction market positionsmm predict positionspredict.md
View open prediction ordersmm predict orderspredict.md
Show full Predict portfolio snapshotmm predict portfoliopredict.md
List redeemable winning positionsmm predict redeem listpredict.md
Redeem winning positionsmm predict redeempredict.md
Check Predict deposit wallet balancemm predict balancepredict.md
Fund Predict deposit walletmm predict depositpredict.md
Withdraw pUSD from Predict deposit walletmm predict withdrawpredict.md
Fetch prediction order bookmm predict bookpredict.md
Watch a Predict jobmm predict watchpredict.md
List Predict trade or redeem historymm predict historypredict.md
Inspect Predict history for a specific marketmm predict history getpredict.md
Look up a transaction by hashmm txtx-history.md
List recent transactions for the active walletmm tx historytx-history.md
Get a swap or bridge quotemm swap quoteswap.md
Execute a token swap or bridgemm swap executeswap.md
Check swap or bridge statusmm swap statusswap.md
Bridge tokens to another chainmm swap executeswap.md
Pay an HTTP 402 / x402 paywalled requestpython3 scripts/x402_pay.pyx402.md
Pay an x402-gated MCP tool callpython3 scripts/x402_pay.pyx402.md
List earn vaults and APYsmm earn marketsearn.md
View earn vault positionsmm earn positionsearn.md
Supply tokens to an earn vaultmm earn supplyearn.md
Withdraw tokens from an earn vaultmm earn withdrawearn.md

Workflows

CLI behavior lives in references/. Repeatable patterns live in workflows/. Load a workflow file when the user's request is a pattern, not a single command.

PatternWorkflow
First time setup and onboardingonboarding.md
Login flowlogin.md
Troubleshooting decision treetroubleshooting.md
Swap quote-review-execute flowswap.md
Bridge quote-review-execute flowbridge.md
Open a perpetual position flowperps-open-position.md
Close a perpetual position flowperps-close-position.md
Modify a perpetual position flowperps-modify-position.md
Predict first-time setup and credentialspredict-setup.md
Deposit or withdraw pUSD from Predict walletpredict-funding.md
Search and browse prediction marketspredict-markets.md
Quote and place a prediction orderpredict-place-order.md
View or cancel Predict orders and positionspredict-manage-orders.md
View Predict portfolio and redeem winningspredict-portfolio.md
View Predict trade and redeem historypredict-history.md
Token discovery, prices, and market datamarket-data.md
Supply tokens to earn yieldearn-supply.md
Withdraw tokens from an earn vaultearn-withdraw.md
Pay an HTTP 402 (x402) paywalled requestx402-pay.md
Pay an x402-gated MCP tool callx402-mcp.md

Global Flags

Every mm command accepts these flags:

FlagShortDescription
--format-fOutput format: text, json, or toon. Defaults to text in TTY, json when piped
--jsonShorthand for --format=json
--toonShorthand for --format=toon
--verbose-vShow debug logs on stderr. Use for troubleshooting

Always use --toon for command output unless the user explicitly requests a different format.

The mm plugins commands are the exception. They come from oclif and accept none of these global flags, so mm plugins --toon fails with Nonexistent flag: --toon. Use --json or plain text there. See plugins.md.

Preflight

Run these checks before the first CLI operation in a session, in order.

1. Version compatibility

This skill is written for @metamask/agent-wallet v7.0.0, as specified by cliVersion in the frontmatter. The CLI requires Node.js 22.18 or later; on an older runtime every command exits 1 with UNSUPPORTED_NODE before the CLI loads. Check the installed version:

mm --version

The installed version is the value after @metamask/agent-wallet/, such as @metamask/agent-wallet/7.0.0 darwin-arm64 node-v22.18.0. Compare its major.minor against the pinned cliVersion. Optionally check the latest published version (best-effort, skip silently on network failure):

npm view @metamask/agent-wallet version

If the installed major.minor differs from the pinned cliVersion, or the installed version is behind the latest release, warn the user once and continue:

Version mismatch: installed CLI <installed>, this skill targets <cliVersion>, latest release is <latest>. Command syntax in this skill may be inaccurate until they are aligned. Update the CLI with npm install -g @metamask/agent-wallet@latest, then re-install the skills with npx skills add metaMask/agent-skills.

Run this check once per session. Do not block operations on it.

2. Readiness gate — authentication and initialization

mm doctor is the single readiness check. Run it before the first CLI operation in a session:

mm doctor

It reports an authenticated boolean, an initialized boolean, and a list of hints. Do not run any other command until mm doctor reports both authenticated: true and initialized: true. Authentication and initialization are independent gates: a session can be authenticated while the project has no wallet mode selected, in which case any command that needs a wallet aborts before running with NOT_INITIALIZED — "Project not initialized." with hint: Run mm init to set up wallet and trading modes.

A project counts as initialized only when a wallet mode is set — and, for server-wallet, a trading mode is set as well. byok needs only the wallet mode. Do not use mm init show as the check: it requires an initialized project and throws NOT_INITIALIZED on an uninitialized one rather than reporting state.

Remediate, then re-run mm doctor and confirm a clean result before doing anything else:

  • authenticated: false → follow workflows/login.md, or workflows/onboarding.md for first-time setup, to run mm login.
  • authenticated: true and initialized: false → follow workflows/onboarding.md to run mm init and select a wallet mode. For server-wallet, also select a trading mode.

Safety Rules

These rules apply to every operation, regardless of which reference or workflow is active.

Input Validation

Before constructing any command, validate all user-provided values:

FlagValidation rule
--to, --addressMust match ^0x[0-9a-fA-F]{40}$
--amountHuman-readable decimal such as 0.5 or 100. Must match ^\d+\.?\d*$. Reject spaces, semicolons, pipes, backticks, or shell metacharacters
--chain-idMust be a positive integer (^\d+$)
--payload for send-transactionMust be valid JSON. No unescaped shell metacharacters outside the JSON structure
--payload for decodeMust be 0x-prefixed hex calldata, matching ^0x[0-9a-fA-F]+$
--tokenMust be a valid hex address or known symbol
--leverageMust be a positive integer (^\d+$)
--sizeHuman-readable positive decimal such as 0.01 or 1. Scientific notation and host-locale grouping/decimals are accepted and canonicalized by the CLI. Reject shell metacharacters. Malformed values return INVALID_AMOUNT
--venueMust be hyperliquid
--side for perpsMust be long or short
--order-idMust be a positive integer (^\d+$)
--token-idMust be a non-empty outcome token ID string
--price, --limit-priceMust be a positive number in range (0, 1]
--order-typeMust be one of GTC, GTD, FOK, FAK
--side for predictMust be buy or sell
--slippageMust be a number between 0 and 100
--tick-sizeMust be one of 0.1, 0.01, 0.005, 0.0025, 0.001, 0.0001
--from-chain-id, --to-chain-idMust be a positive integer EVM chain ID
--to-addressMust match ^0x[0-9a-fA-F]{40}$. Only valid for cross-chain swaps (--to-chain-id differs from --from-chain-id); rejected for same-chain swaps
--refuelBoolean flag, no value. Only meaningful for cross-chain swaps where --to-chain-id differs from --from-chain-id. No effect on same-chain swaps
--strategyComma-separated list from: cost, speed, impact, output
--wallet-timeoutMust be a positive integer between 1 and 600
--passwordMust be a non-empty string. Never log, display, or store the value.
Plugin spec for mm plugins installAn npm package name, optionally name@version or name@tag. Reject spaces and shell metacharacters. file:, git, and bare owner/repo specs are unverified sources and are refused unless the user has enabled dev mode
x402 assetMust be a valid contract address on a network returned by mm chains list. The currency choice is the server's offer confirmed by the user; the script keeps no currency allowlist.
x402 payTo / authorization toMust match ^0x[0-9a-fA-F]{40}$ and equal the recipient in the 402
x402 valueAtomic-unit integer that exactly equals the offered amount. The exact scheme is not a maximum
x402 resource URLMust be https://. Reject a 402 reached via an unexpected cross-host redirect
x402 MCP challengex402 v2 only. The signed payment object goes, as-is, in _meta["x402/payment"] of the retried tool call; a repeated isError result is a new challenge, never re-sign it without new user approval

Do not pass unvalidated user input into any command.

Confirmation Requirements

Operation typeConfirmation rule
TransfersAlways confirm recipient, amount, token, and chain before executing
Raw transactionsAlways confirm transaction payload, chain, recipient, value, and calldata summary before executing
Message signingAlways show exact message and chain before signing
Typed-data signingAlways show domain, primary type, chain, verifying contract, and message summary before signing
Swaps / bridgesAlways confirm from/to tokens, amount, source/destination chain, slippage, quoted output, recipient address if --to-address is set, and the destination gas top-up if --refuel is set before executing
x402 paymentsAlways confirm asset, decimals-correct amount, network, payTo, and resource URL or MCP tool before signing the authorization — over HTTP with pay --confirm, over MCP with mcp-sign --confirm. One payment attempt per resource, never auto-retry a payment. Autonomous auto-pay is not supported.
Perps tradingAlways confirm symbol, side, size, leverage, venue, order type, and limit price if present before executing
Perps deposit/withdrawAlways confirm amount, asset, venue, network, and destination where applicable before executing
Predict tradingAlways confirm token ID, side, size, price, order type, market, and outcome before executing
Predict depositAlways confirm amount before executing
Predict withdrawAlways confirm amount and recipient before executing. --to defaults to owner EOA
Predict redeemAlways confirm the target, either condition ID or --all, before executing. --all redeems every winning position
Earn supplyAlways confirm token, amount, chain, vault/protocol, and APY before executing. For cross-chain supply, also confirm source chain and source token
Earn withdrawAlways confirm token, amount or full balance, chain, and vault/protocol before executing
Plugin install, update, or linkAlways show package name, version, declared command ids, dataAccess, and every requested capability, and name wallet-submit and network-manage as sensitive. Get explicit approval before installing. Never pass --accept-permissions for a manifest the user has not reviewed
Plugin uninstall or resetAlways confirm which packages are affected. mm plugins reset removes every user-installed and linked plugin
Enabling the plugin beta or unverified installsAlways confirm before running mm config set experimentalPlugins true or mm config set experimentalAllowUnverifiedInstalls true
Commands added by a pluginTreat these as third-party code running with CLI privileges. Apply the same confirmation rules as the equivalent host operation
Cancel-all operationsAlways confirm scope and exact destructive effect before executing
Wallet policy changesBroadening policy changes require MFA approval; non-broadening changes apply immediately
Trading mode changesBroadening from guard to beast requires MFA approval. Tightening from beast to guard applies immediately
Auth / wallet managementMay execute without confirmation, except reset which requires explicit user confirmation
Read-only queriesMay execute without confirmation

Credential Safety

  • Never store, log, or display private keys, mnemonics, passwords, or auth tokens.
  • Never pass --password or --mnemonic as inline flags. Always instruct the user to set the MM_PASSWORD and MM_MNEMONIC environment variables instead to avoid exposing secrets in shell history.

Suspicious Content Warnings

Flag to the user before proceeding if a signing payload or transaction contains:

  • URLs or contract addresses the user did not provide
  • permit, approve, setApprovalForAll, or allowance-like fields
  • Unusually large values or unfamiliar contract interactions

When raw calldata is unfamiliar or was not constructed by you, run mm decode --payload <0x-calldata> first and confirm the decoded intent with the user before signing or sending. See decode.md.

Async Model

In both server-wallet and BYOK mode, signing and transaction commands go through a job-polling loop and return a pollingId. Handle this consistently:

  1. Prefer --wait to block until complete.
  2. If not using --wait, inform the user of the pollingId and how to track it:
    • mm wallet requests list
    • mm wallet requests watch <polling-id>
  3. In BYOK mode, the local key signs locally but the operation still produces a pending job and a pollingId. If the mnemonic is password-encrypted, the user must set MM_PASSWORD environment variable to unlock it for the operation.

Transfers, swaps, perps, predict orders, and predict withdraws attach a human-readable intent summary to their wallet request, such as Transfer 0.5 ETH to 0x... or Withdraw 10 pUSD to 0x.... When surfacing a pending request from wallet requests list or wallet requests watch, show the intent summary so the user can confirm what they are approving.

MFA Approval Pauses

Wallet jobs that need out-of-band MFA approval pause in AWAITING_MFA. Detect this pause by scanning command stdout for the literal token AWAITING_MFA. Do not infer MFA from free-text alone on older CLIs; from CLI v6.1.5 onward every output mode emits the token consistently.

Output modeHow to detect
--json / piped stdoutAn NDJSON line containing "_notice":{"kind":"AWAITING_MFA",...}
Plain TTY or Ink REPLA stdout line containing [AWAITING_MFA], e.g. ⚠ [AWAITING_MFA] Approve in MetaMask mobile.

When AWAITING_MFA appears:

  1. Treat the command as waiting for user approval, not failed, hung, or complete.
  2. Surface the human instruction from the notice to the user.
  3. If a pollingId is present in the notice or command output, tell the user they can track completion with mm wallet requests watch <polling-id>.
  4. Do not retry the same wallet operation while the job is still pending.
  5. On mm swap execute, mm earn supply, or mm earn withdraw, an MFA pause with no hash yet may return EXECUTE_FAILED with a message naming the approval wait and mm wallet requests watch <polling-id> — that is still an MFA pause, not a missing hash.

For approval surfaces and recovery steps, see troubleshooting.md.

Output Rules

  • Route silently. Do not announce which reference you are loading.
  • Surface errors from commands verbatim. Do not mask or reword them.
  • If a command fails, check mm <command> --help and guide from there.
Discovery
Tags

No tags published for this skill.

Version
Latest version metadata

Version

v2026.09.24

Published

Sep 24, 2026

Category

Uncategorized

License

MIT

Source path

skills/metamask-agent-wallet

Default branch

main

Latest commit

9909fa4

Tree SHA

76cf72e