AI resources

Install Mercado Pago CLI

The Mercado Pago CLI is installed via Homebrew and authenticated with your Access TokenAccess 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. Follow the steps below to install and configure your credentials:

Install via Homebrew

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

mp --version

Shell completion

To enable command autocompletion in the terminal:

bash

mp completion bash  >> ~/.bashrc
mp completion zsh   >> ~/.zshrc
mp completion fish  >> ~/.config/fish/completions/mp.fish
mp 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

Authenticate with your Access Token according to the desired environment:

bash

# Sandbox
mp login --token TEST-...

# Production
mp login --token APP_USR-...

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

mp logout
mp 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.