
Run your Mercado Pago integration from the terminal
Run your Mercado Pago integration from the terminal with the MP CLI
The MP CLI (mpcli) brings the Mercado Pago API resources to your terminal with a single Access TokenAccess Token from your application, so you can operate payments, subscriptions, stores, and reports without a browser, GUI, or switching context in your AI agent.
In this version, commands now use the mpcli prefix, installation reaches a new platform, and command coverage grows with advanced payments and shipping.
Why this matters in practice
Imagine a customer reported a payment failure. With the MP CLI, you identify and act without leaving the terminal:
bash
mpcli payments search --status rejected --external-reference "ORDER-123" mpcli preferences create --title "Product X" --unit-price 299.90 --quantity 1 --payer-email customer@email.com
In two commands, you found the problem and created a new payment preference with installments. No dashboard, no hand-built cURLs, no lost context.
For security, credentials are stored in the operating system's native keychain, not in configuration files or the shell history. This solves the problem of accidentally exposing tokens in repositories or logs. All commands return JSON by default, so you can connect the CLI to any existing script without an extra parsing layer.
What changed in the MP CLI
The most visible impact is the command rename: all commands moved from the mp prefix to mpcli. For example, mp payments list is now mpcli payments list. If you were already using the CLI, just update the prefix in your scripts.
Beyond the original script, installation now includes Scoop on Windows. For this method, some antivirus tools may flag the binary by mistake, and if that happens, the official documentation explains how to proceed safely. On corporate macOS devices with restrictions, the ~/.config/mp directory may require a permissions adjustment.
API coverage grew with new commands:
- mpcli advanced-payments: split payments and disbursements.
- mpcli shipping: shipping management.
- mpcli config: CLI configuration.
Existing commands also evolved: mpcli refunds now creates full and partial refunds, mpcli merchant-orders creates and updates orders, mpcli chargebacks lists chargebacks, and mpcli oauth generates the authorization URL.
Resources for every scenario
For development teams, resources that eliminate repetitive setup:
- Named profiles to switch between accounts and environments without re-authenticating;
- A .mp.toml file at the repository root with shared defaults. Anyone who clones the project inherits the configured profile and operating country.
For CI/CD pipelines, just export the Access Token as an environment variable and use the --no-interactive flag so no prompt blocks execution.
For AI agents, our MP CLI was designed from the start to work with agents. JSON output by default, --silent, --no-interactive, and exit codes categorized by error type let an AI agent operate your Mercado Pago integration safely and in a structured way, without interpreting raw API responses or managing credentials in the conversation context.
Finally, the option to run sandbox tests from the terminal: instead of configuring test users from the dashboard, you create buyers, set virtual balance, and provision cards with specific behaviors directly from the terminal. These commands use the test user's Access Token, not your application's, so authenticate the test profile before operating:
bash
mpcli login --token <test-user-token> --profile test mpcli tester create --site-id MLB --type buyer --profile test mpcli tester balance set 123456 --amount 10000 --profile test mpcli tester card add --user-id 123456 --scenario insufficient_funds --profile test
Keep in mind that the APP_USR- prefix in the Access Token does not indicate the account type: it appears in both production and test. To confirm the active application and environment, use mpcli whoami before operating.
What's next
In upcoming releases, the MP CLI continues to evolve to expand command coverage and add new features. Among the resources on the way are the Webhook Listener (mpcli listen, mpcli events, and mpcli trigger) to receive and simulate notifications, log history (mpcli logs), and installation via npm on any platform. See the full Mercado Pago CLI documentation.