cobroya
Provides an adapter to integrate Mercado Pago payment tools directly into LangChain-based AI agents.
Offers configurations to integrate Mercado Pago payment services into automated workflows on the Make platform.
Provides tools to create checkout payment links (preferences), retrieve payment details, search payment history with filters, and issue full or partial refunds.
Provides pre-built nodes for automating Mercado Pago payment operations within the n8n workflow platform.
Offers tool definitions and executors for implementing Mercado Pago payment capabilities within OpenAI function calling workflows.
Enables the creation of Telegram bots that can process payment commands and send payment-related notifications.
Integrates with the WhatsApp Business Cloud API to receive commands and send payment notifications to users.
Includes integration packages for connecting Mercado Pago with various applications and services through the Zapier platform.
CobroYa
Cobra con Mercado Pago en 10 segundos.
CobroYa is an open-source Mercado Pago payment tool for AI agents, Telegram, WhatsApp, and automation platforms. Create payment links, search payments, issue refunds -- all from your AI assistant or chat bot.
Quick Start with AI
CobroYa is an MCP (Model Context Protocol) server. Add it to your AI tool in one step -- no cloning, no building. Just provide your Mercado Pago access token.
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"cobroya": {
"command": "npx",
"args": ["-y", "cobroya"],
"env": {
"MERCADO_PAGO_ACCESS_TOKEN": "APP_USR-..."
}
}
}
}Claude Code
claude mcp add cobroya -- npx -y cobroya \
--env MERCADO_PAGO_ACCESS_TOKEN=APP_USR-...Cursor
Add to .cursor/mcp.json in your project root:
{
"mcpServers": {
"cobroya": {
"command": "npx",
"args": ["-y", "cobroya"],
"env": {
"MERCADO_PAGO_ACCESS_TOKEN": "APP_USR-..."
}
}
}
}Windsurf
Add to your Windsurf MCP configuration:
{
"mcpServers": {
"cobroya": {
"command": "npx",
"args": ["-y", "cobroya"],
"env": {
"MERCADO_PAGO_ACCESS_TOKEN": "APP_USR-..."
}
}
}
}Once configured, ask your AI assistant things like: "Create a payment link for $5000 for a Python course" or "Show me today's approved payments".
Related MCP server: Mercado Pago MCP Server
Available Tools
CobroYa exposes 5 MCP tools that any connected AI agent can call:
Tool | Description |
| Create a Mercado Pago checkout payment link. Returns an |
| Retrieve full details of a payment by ID, including status, amount, and payer info. |
| Search payments with filters: |
| Issue a full or partial refund for a payment. Omit |
| Get the authenticated merchant's profile: user ID, nickname, and site. |
Telegram Bot
CobroYa includes a ready-to-use Telegram bot: @CobroYa_bot
Self-hosting the bot
Create a bot via @BotFather and get your token.
Set environment variables:
export MERCADO_PAGO_ACCESS_TOKEN="APP_USR-..."
export TELEGRAM_BOT_TOKEN="your-telegram-bot-token"Run:
npx cobroya-telegramOr from source:
npm run botCobroYa supports WhatsApp Business Cloud API for receiving commands and sending payment notifications.
Create a Meta app at Meta for Developers and enable WhatsApp Business API.
Set environment variables:
export WHATSAPP_ACCESS_TOKEN="your-meta-graph-api-token"
export WHATSAPP_PHONE_NUMBER_ID="your-phone-number-id"
export WHATSAPP_VERIFY_TOKEN="your-webhook-verify-token"Run the webhook server:
npm run whatsapp
# Starts on http://localhost:3000/webhookExpose with ngrok (
ngrok http 3000) and configure the webhook URL in your Meta Dashboard.
For full details on supported commands and payment notifications, see the WhatsApp documentation.
Automation Platforms
Pre-built packages for popular automation platforms are available in the packages/ directory:
n8n --
packages/n8n-nodes-mercadopagoZapier --
packages/zapier-mercadopagoMake --
packages/make-mercadopagoPipedream --
packages/pipedream-mercadopago
Each package wraps the CobroYa core with platform-specific configuration. See the README in each package for setup instructions.
AI Framework Adapters
LangChain (Python)
pip install langchain-mercadopagofrom langchain_mercadopago import create_mercadopago_tools
tools = create_mercadopago_tools("APP_USR-...")
# Use with any LangChain agent
from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI
agent = initialize_agent(
tools=tools,
llm=ChatOpenAI(model="gpt-4"),
agent=AgentType.OPENAI_FUNCTIONS,
)
agent.run("Create a payment link for $5000 for a Python course")OpenAI Function Calling (TypeScript)
npm install openai-mercadopagoimport { createMercadoPagoExecutor } from "openai-mercadopago";
const executor = createMercadoPagoExecutor(process.env.MERCADO_PAGO_ACCESS_TOKEN!);
// Pass executor.definitions to OpenAI's tools parameter
const response = await openai.chat.completions.create({
model: "gpt-4",
messages,
tools: executor.definitions,
});
// Execute the tool call
const result = await executor.handleToolCall(
toolCall.function.name,
JSON.parse(toolCall.function.arguments),
);Programmatic Usage
Install as a dependency:
npm install cobroyaimport { createMercadoPagoTools } from "cobroya";
const mp = createMercadoPagoTools(process.env.MERCADO_PAGO_ACCESS_TOKEN!);
// Create a payment link
const pref = await mp.tools.create_payment_preference({
title: "Premium Plan",
quantity: 1,
currency: "ARS",
unit_price: 5000,
});
console.log(pref.init_point); // Checkout URL to share with the buyer
// Search approved payments
const payments = await mp.tools.search_payments({ status: "approved", limit: 10 });
// Get payment details
const payment = await mp.tools.get_payment({ payment_id: "123456789" });
// Full refund
await mp.tools.create_refund({ payment_id: "123456789" });
// Partial refund
await mp.tools.create_refund({ payment_id: "123456789", amount: 500 });
// Merchant profile
const merchant = await mp.tools.get_merchant_info();Error Handling
import { MercadoPagoError } from "cobroya";
try {
await mp.tools.get_payment({ payment_id: "invalid" });
} catch (err) {
if (err instanceof MercadoPagoError) {
console.log(err.status); // 404
console.log(err.isNotFound); // true
console.log(err.isUnauthorized); // false
console.log(err.isRateLimited); // false
}
}Environment Variables
Variable | Required | Description |
| Yes | Mercado Pago API access token (get one here) |
| For Telegram | Telegram bot token from @BotFather |
| For WhatsApp | Meta Graph API token |
| For WhatsApp | WhatsApp Business phone number ID |
| For WhatsApp | Webhook verification token |
| No | Phone number for WhatsApp payment notifications |
| No | HMAC secret for Mercado Pago webhook signature validation |
| No | Default currency (defaults to |
| No | Default success redirect URL for payment preferences |
Development
# Install dependencies
npm install
# Build
npm run build
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Watch mode
npm run test:watch
# Type-check without emitting
npx tsc --noEmit
# Integration test against real Mercado Pago API
MERCADO_PAGO_ACCESS_TOKEN=APP_USR-... npm run integration
# Start the unified server (Telegram + WhatsApp + webhooks)
npm start
# Dev mode with auto-reload
npm run dev:server
# Docker
docker compose up -dLicense
Available Tools
5 toolscreate_payment_preferenceC
Creates a Mercado Pago checkout payment preference (payment link). Returns init_point URL for redirecting buyers.
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | ||
| quantity | Yes | ||
| currency | Yes | ||
| unit_price | Yes | ||
| back_urls | No | ||
| notification_url | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a payment preference and returns a URL, but lacks details on permissions, rate limits, error handling, or whether the operation is idempotent. This is a significant gap for a mutation tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core action and result. It avoids redundancy but could be slightly more detailed given the lack of annotations and schema descriptions.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a mutation tool with 6 parameters, 0% schema coverage, no annotations, and no output schema, the description is incomplete. It covers the basic purpose and return value but lacks parameter explanations, behavioral details, and usage context, which are critical for effective tool invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate for undocumented parameters. It does not explain any parameters, such as the meaning of 'back_urls' or 'notification_url', leaving all 6 parameters without semantic context beyond the schema's structure.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Creates a Mercado Pago checkout payment preference') and resource ('payment link'), distinguishing it from siblings like create_refund or get_payment. It also specifies the return value ('init_point URL for redirecting buyers'), making the purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like create_refund or search_payments. It mentions the return value but does not specify prerequisites, such as authentication or account setup, leaving usage context unclear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
create_refundA
Refund a payment fully or partially. Omit amount for full refund.
| Name | Required | Description | Default |
|---|---|---|---|
| payment_id | Yes | ||
| amount | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the action ('Refund') but does not disclose critical behavioral traits such as whether this requires specific permissions, if refunds are reversible, potential rate limits, or what the response looks like (e.g., success/failure indicators). This leaves significant gaps for a mutation tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded with the core purpose in the first sentence, followed by a specific usage rule in the second. Every sentence earns its place by providing essential information without waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of a refund operation (a mutation with no annotations and no output schema), the description is somewhat complete by stating the action and parameter usage. However, it lacks details on behavioral aspects like permissions, reversibility, or response format, which are important for such a tool. It compensates partially with parameter guidance but falls short of full completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that 'payment_id' is required for refunding a payment and that 'amount' is optional (omit for full refund), which clarifies the semantics beyond the basic schema types. However, it does not detail formats (e.g., string format for payment_id) or constraints (e.g., amount must be positive).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Refund a payment') and resource ('payment'), distinguishing it from sibling tools like create_payment_preference, get_merchant_info, get_payment, and search_payments which are about creating preferences or retrieving information rather than processing refunds.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context on when to use this tool (for refunding payments) and includes a usage rule (omit amount for full refund), but it does not explicitly state when not to use it or name alternatives among the sibling tools, such as when to use get_payment for checking payment status instead.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_merchant_infoB
Retrieve the authenticated merchant's user profile including ID, nickname, and site.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It states this retrieves the 'authenticated merchant's' profile, implying authentication is required, but doesn't specify what happens if authentication fails, rate limits, or response format. For a read operation with zero annotation coverage, this leaves significant behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core purpose. Every word earns its place: 'Retrieve' (action), 'authenticated merchant's user profile' (target), and 'including ID, nickname, and site' (scope). There's no redundancy or unnecessary elaboration.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is incomplete. It doesn't explain what the return value looks like (structure, data types), error conditions, or authentication requirements. For a tool that presumably returns user profile data, more contextual information would be helpful despite the lack of output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has 0 parameters with 100% schema description coverage, so the schema already fully documents the lack of inputs. The description appropriately doesn't add parameter details beyond what's in the schema, maintaining a baseline score of 4 for zero-parameter tools.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Retrieve'), target resource ('authenticated merchant's user profile'), and scope of data returned ('including ID, nickname, and site'). It distinguishes itself from sibling tools like get_payment (which retrieves payment data) and search_payments (which searches multiple payments).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (like authentication requirements), nor does it differentiate from sibling tools beyond what's implied by the purpose. No explicit when/when-not statements or alternative tool references are included.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_paymentC
Retrieve a payment by its ID. Returns full payment details including status, amount, payer info.
| Name | Required | Description | Default |
|---|---|---|---|
| payment_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves payment details, implying a read-only operation, but doesn't address key aspects like authentication requirements, error handling (e.g., for invalid IDs), rate limits, or whether it's idempotent. For a tool with zero annotation coverage, this is a significant gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately concise with two sentences that are front-loaded: the first states the core action, and the second specifies the return details. There's no unnecessary information, and it efficiently communicates the essential purpose. However, it could be slightly more structured by explicitly separating usage context from behavior.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (simple retrieval with one parameter) and lack of annotations or output schema, the description is partially complete. It covers the basic purpose and return scope but misses critical context like error scenarios, authentication, and differentiation from siblings. For a tool with no structured data support, it's adequate but leaves clear gaps for an AI agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds minimal semantic value beyond the input schema. It mentions 'payment_id' as the parameter but doesn't explain its format (e.g., UUID, numeric), source, or constraints. With 0% schema description coverage, the description doesn't compensate for the lack of parameter documentation, though it at least names the parameter. This meets the baseline for minimal viability.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Retrieve a payment by its ID' specifies the verb (retrieve) and resource (payment), and 'Returns full payment details including status, amount, payer info' indicates the scope of information returned. However, it doesn't explicitly differentiate from sibling tools like 'search_payments' or 'get_merchant_info', which would require a 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose 'get_payment' over 'search_payments' (e.g., for a specific ID vs. filtering), nor does it specify prerequisites or exclusions. This lack of contextual usage information limits its effectiveness for an AI agent.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_paymentsB
Search recent payments for the authenticated merchant. Supports filtering by status.
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | ||
| limit | No | ||
| offset | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It mentions 'recent payments' and 'authenticated merchant', but lacks details on permissions, rate limits, pagination behavior (beyond schema parameters), or what 'recent' means. This is inadequate for a search tool with zero annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with no wasted words. It front-loads the core purpose and includes key constraints, making it appropriately sized for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations, 0% schema description coverage, and no output schema, the description is incomplete. It lacks details on behavioral traits, parameter meanings beyond status, and expected return values, which are critical for a search tool with three parameters.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It only mentions 'filtering by status' for one of the three parameters (status, limit, offset), leaving limit and offset undocumented. This adds minimal value beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('search') and resource ('recent payments for the authenticated merchant'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_payment' or 'create_refund', which might have overlapping domains.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for searching payments with status filtering, but provides no explicit guidance on when to use this tool versus alternatives like 'get_payment' or 'create_refund'. It mentions the authenticated merchant context, which gives some implied context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v1.0.1- First observed
create_payment_preference - First observed
create_refund - First observed
get_merchant_info - First observed
get_payment - First observed
search_payments
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose with no ambiguity. create_payment_preference handles payment initiation, create_refund manages refunds, get_merchant_info retrieves merchant data, get_payment fetches specific payment details, and search_payments searches multiple payments. The descriptions clearly differentiate their functions, making misselection unlikely.
All tool names follow a consistent verb_noun pattern using snake_case. The verbs (create, get, search) are applied logically to their respective nouns (payment_preference, refund, merchant_info, payment, payments), creating a predictable and readable naming convention throughout the set.
With 5 tools, the server is well-scoped for payment processing with Mercado Pago. Each tool earns its place by covering core operations: payment creation, refunds, merchant information retrieval, payment lookup, and payment searching. This count is neither too sparse nor bloated for the domain.
The tool set provides strong coverage for key payment workflows, including creation, retrieval, searching, and refunds. A minor gap exists in the lack of update or cancellation tools for payments or preferences, but agents can likely work around this given the available operations cover most essential tasks.
Maintenance
Related MCP Connectors
Connect your Mercado Pago account to AI via Brazil's Open Finance: balances, statements, cards, inve
Brazil payments for AI agents — Pix, cards, boleto via Mercado Pago. Never holds funds.
Argentina payments for AI agents — Mercado Pago wallet / cuotas via Mercado Pago. Never holds funds.
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
Related MCP Servers
- AlicenseAqualityCmaintenanceConnects AI agents to MercadoLibre, the largest e-commerce marketplace in Latin America. Search products, get item details, browse categories, track trends, and convert currencies.815 npm3MIT
- AlicenseCqualityDmaintenanceEnables AI to process payments, manage subscriptions, detect fraud, and generate analytics through Mercado Pago API.27MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to access Magpie Payment Platform APIs for processing payments, creating checkout sessions, sending invoices, and managing payment links through natural conversation.23 npm2MIT
- AlicenseNot gradedqualityBmaintenanceLets AI agents accept payments in Uruguay via Mercado Pago hosted checkout, supporting cards, cash, and wallet payments.MIT