AI resources

Install Mercado Pago CLI

The Mercado Pago CLI is available for macOS, Linux, and Windows. In the tabs below, choose the installation method that best suits your operating system, then authenticate with your Access TokenPrivate key of the application created in Mercado Pago, used in the backend. You can access it from Your integrations > Application details > Tests > Test credentials or Production > Production credentials. to start operating.

The Mercado Pago CLI is distributed as a Homebrew package compatible with macOS and Linux. To install it, run the following command in the terminal:

bash

brew install mercadopago/tap/mp-cli

To confirm that the installation was completed successfully, run the following command:

bash

mpcli --version

Shell completion

To enable command autocompletion in the terminal:

bash

mpcli completion bash  >> ~/.bashrc
mpcli completion zsh   >> ~/.zshrc
mpcli completion fish  >> ~/.config/fish/completions/mp.fish
mpcli completion powershell

Authenticate credentials

The Mercado Pago CLI stores credentials in the operating system's native keychain, preventing tokens from being exposed in configuration files, shell history, or logs.

Our CLI uses Keychain on macOS, libsecret on Linux, and Credential Manager on Windows.

Log in

If you are using a corporate macOS device, an additional step is required before logging in.
In these cases, ~/.config is owned by root and mpcli login may fail with permission denied. To fix it, manually create the directory before logging in: sudo mkdir -p ~/.config/mp && sudo chown $USER ~/.config/mp.

Authenticate with your Access Token:

bash

mpcli login --token TEST-...    # test credentials
mpcli login --token APP_USR-... # production credentials or test account credentials
The TEST- prefix identifies test credentials. The APP_USR- prefix can belong to both production credentials and test account credentials — the prefix alone does not determine the environment. Check your credentials in Your integrations to confirm which environment each token belongs to.

When interpreting the login response, note the following behavior:

The environment field reflects the token format, not the actual account type. An APP_USR- token issued for a test account will show "environment": "production" and this is expected behavior.

Log out

Use the command below to end the CLI's access to the account and remove the credentials stored in the keychain. If you are working with multiple profiles, specify the name of the profile you want to disconnect:

bash

mpcli logout
mpcli logout --profile sandbox

Configure the project

This configuration is ideal for teams looking to use the Mercado Pago CLI on a recurring basis. To get started, create the .mp.toml file at the root of your repository with your team's default settings, such as credentials profile and country of operation:

toml

[defaults]
profile = "checkout-pro-sandbox"  # default credentials profile
site_id = "MLB"                   # country of operation

[output]
no_color = false                  # disable colored output

Configuration sources

The CLI determines which configuration source to use following the order from most specific to least specific:

SourceRecommended use
CLI flags (--profile, --json, etc.)Override any configuration on a one-off basis without changing defaults.
Environment variables (MP_PROFILE, MP_ACCESS_TOKEN)Authentication in CI/CD and automated environments.
.mp.toml in the current directoryShared team defaults in the repository.
~/.config/mp/config.tomlPersonal developer preferences.
Internal defaultsApplied when no other source is configured.