Skip to main content
Glama

CobroYa

Cobra con Mercado Pago en 10 segundos.

npm version tests coverage license

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.

Website | npm | GitHub


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_payment_preference

Create a Mercado Pago checkout payment link. Returns an init_point URL to share with buyers. Supports back_urls and notification_url.

get_payment

Retrieve full details of a payment by ID, including status, amount, and payer info.

search_payments

Search payments with filters: status (approved, pending, rejected, etc.), sort order, and pagination.

create_refund

Issue a full or partial refund for a payment. Omit amount for a full refund.

get_merchant_info

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

  1. Create a bot via @BotFather and get your token.

  2. Set environment variables:

export MERCADO_PAGO_ACCESS_TOKEN="APP_USR-..."
export TELEGRAM_BOT_TOKEN="your-telegram-bot-token"
  1. Run:

npx cobroya-telegram

Or from source:

npm run bot

WhatsApp

CobroYa supports WhatsApp Business Cloud API for receiving commands and sending payment notifications.

  1. Create a Meta app at Meta for Developers and enable WhatsApp Business API.

  2. 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"
  1. Run the webhook server:

npm run whatsapp
# Starts on http://localhost:3000/webhook
  1. Expose 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-mercadopago

  • Zapier -- packages/zapier-mercadopago

  • Make -- packages/make-mercadopago

  • Pipedream -- 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-mercadopago
from 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")

PyPI

OpenAI Function Calling (TypeScript)

npm install openai-mercadopago
import { 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),
);

npm


Programmatic Usage

Install as a dependency:

npm install cobroya
import { 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

MERCADO_PAGO_ACCESS_TOKEN

Yes

Mercado Pago API access token (get one here)

TELEGRAM_BOT_TOKEN

For Telegram

Telegram bot token from @BotFather

WHATSAPP_ACCESS_TOKEN

For WhatsApp

Meta Graph API token

WHATSAPP_PHONE_NUMBER_ID

For WhatsApp

WhatsApp Business phone number ID

WHATSAPP_VERIFY_TOKEN

For WhatsApp

Webhook verification token

WA_NOTIFY_PHONE

No

Phone number for WhatsApp payment notifications

MERCADO_PAGO_WEBHOOK_SECRET

No

HMAC secret for Mercado Pago webhook signature validation

MP_CURRENCY

No

Default currency (defaults to ARS)

MP_SUCCESS_URL

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 -d

License

MIT -- by dan1d

Available Tools

5 tools
create_payment_preferenceC

Creates a Mercado Pago checkout payment preference (payment link). Returns init_point URL for redirecting buyers.

ParametersJSON Schema
NameRequiredDescriptionDefault
titleYes
quantityYes
currencyYes
unit_priceYes
back_urlsNo
notification_urlNo

TDQS

C2.9/5.0
Behavior2/5

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.

Conciseness4/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose5/5

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.

Usage Guidelines2/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
payment_idYes
amountNo

TDQS

A3.9/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness3/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.4/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness2/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines2/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
payment_idYes

TDQS

C2.9/5.0
Behavior2/5

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.

Conciseness4/5

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.

Completeness3/5

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.

Parameters3/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
statusNo
limitNo
offsetNo

TDQS

B3/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness2/5

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.

Parameters2/5

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.

Purpose4/5

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.

Usage Guidelines3/5

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.

  1. 5 tool updatesv1.0.1
    • First observedcreate_payment_preference
    • First observedcreate_refund
    • First observedget_merchant_info
    • First observedget_payment
    • First observedsearch_payments

TDQS

A3.6/5.0

Scored across 5 tools

Disambiguation5/5

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.

Naming Consistency5/5

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.

Tool Count5/5

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.

Completeness4/5

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

ActivityInactive
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Connects AI agents to MercadoLibre, the largest e-commerce marketplace in Latin America. Search products, get item details, browse categories, track trends, and convert currencies.
    8
    15 npm
    3
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to access Magpie Payment Platform APIs for processing payments, creating checkout sessions, sending invoices, and managing payment links through natural conversation.
    23 npm
    2
    MIT