Skip to main content

Overview

The Model Context Protocol (MCP) is an open standard that lets AI applications connect to external data sources and APIs. The Dodo Payments MCP Server gives AI assistants like Claude, Cursor, and other MCP-compatible clients access to your payment infrastructure. The Dodo Payments MCP Server uses Code Mode architecture. Instead of exposing hundreds of individual tools for every API endpoint, Code Mode lets AI agents write and execute TypeScript code against the Dodo Payments SDK in an isolated sandbox.

Key Capabilities

  • Payment Operations — Create, retrieve, and manage payments and refunds
  • Subscription Management — Handle recurring billing, upgrades, and cancellations
  • Customer Administration — Manage customer data and portal access
  • Product Catalog — Create and update products, pricing, and discounts
  • License Management — Activate, validate, and manage software licenses
  • Usage-Based Billing — Track and bill for metered usage

How Code Mode Works

The Dodo Payments MCP Server gives your AI agent two tools:
  1. Docs Search Tool — Queries documentation about the Dodo Payments API and SDK to understand available operations and parameters.
  2. Code Execution Tool — Writes TypeScript code against the SDK that executes in a secure sandbox.
This architecture lets agents perform complex, multi-step operations in a single invocation. For example, an agent can list all active subscriptions, filter them by criteria, and apply a discount to each—all in one script.
Agents can chain multiple API calls, handle conditional logic, and perform calculations without round-tripping back to the LLM.

Quick Setup

Connect to the Dodo Payments MCP Server in your AI client:
Requires Node.js 18 or higher. The remote server uses OAuth for authentication. On first connection, you’ll be prompted to enter your API key and select your environment.

Dodo Knowledge MCP

In addition to the Dodo Payments MCP Server (for executing API operations), we provide Dodo Knowledge MCP—a semantic search server that gives AI assistants instant access to Dodo Payments documentation.
Built with ContextMCP.ai: Dodo Knowledge MCP is powered by ContextMCP, enabling fast semantic search across our documentation using vector embeddings.

What is Dodo Knowledge MCP?

Dodo Knowledge MCP is a remote MCP server that provides semantic documentation search. Find relevant documentation using natural language queries, get accurate up-to-date information about Dodo Payments, and connect with no API keys or local installation required.

Quick Setup

Connect to Dodo Knowledge MCP in your AI client:
Add to ~/.cursor/mcp.json:
Requires Node.js 18 or higher. The mcp-remote package handles the connection to the remote MCP server.

Using Both MCP Servers Together

For the best AI-assisted development experience, use both MCP servers:
With both servers configured, your agent can search documentation to understand a feature, then execute the API calls to implement it—all in one conversation.

Troubleshooting Knowledge MCP

If you encounter connection issues, clear the MCP authentication cache with rm -rf ~/.mcp-auth, restart your client application, check client logs for error messages, and verify Node.js version (requires 18+).

Knowledge MCP Server

Access the Dodo Knowledge MCP configuration page

Installation

Choose the installation method that fits your workflow. Access the hosted MCP server without local setup or installation.
1

Access the remote server

Navigate to https://mcp.dodopayments.com in your browser.
2

Configure your MCP client

Copy the provided JSON configuration for your specific client. For Cursor or Claude Desktop, add this to your MCP settings:
3

Authenticate and configure

The OAuth flow will prompt you to:
  • Enter your Dodo Payments API key
  • Select your environment (test or live)
  • Choose your MCP client type
Keep your API key secure. Use test mode keys during development.
4

Complete setup

Click Login and Approve to authorize the connection.
Once connected, your AI assistant can interact with the Dodo Payments API on your behalf.

NPM Package

Install and run the MCP server locally.
The local server runs your code in a Deno sandbox. Install Deno 2.8 or earlier and make sure deno is on your PATH; the sandbox fails to start on Deno 2.9 and later. Local code execution works on macOS and Linux only. On Windows, use the remote server or run the local server under WSL2.
Use @latest to always pull the most recent version, or pin to a specific version like @2.51.0 for stability.

Docker

Run the MCP server in a container.
Docker images tersedia di GitHub Container Registry.

Konfigurasi Klien

Konfigurasikan server MCP Dodo Payments di klien AI pilihan Anda.
Siapkan server MCP Dodo Payments di Cursor untuk mengaktifkan akses percakapan ke data pembayaran Anda.Instalasi Sekali KlikGunakan tombol di bawah untuk menginstal server MCP langsung di Cursor:[Tambahkan ke Cursor](https://cursor.com/en-US/install-mcp?name=dodopayments-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImRvZG9wYXltZW50cy1tY3AiXSwiZW52Ijp7IkRPRE9fUEFZTUVOVFNfQVBJX0tFWSI6IlNldCB5b3VyIERPRE9fUEFZTUVOVFNfQVBJX0tFWSBoZXJlLiIsIkRPRE9fUEFZTUVOVFNfV0VCSE9PS19LRVkiOiJTZXQgeW91ciBET0RPX1BBWU1FTlRTX1dFQkhPT0tfS0VZIGhlcmUuIn19)Setelah mengeklik, atur environment variables Anda di Cursor’s mcp.json melalui Cursor Settings > Tools & MCP > New MCP Server.Konfigurasi Manual
1

Open Cursor settings

Buka Cursor Settings > Tools & MCP atau tekan Cmd/Ctrl + Shift + P, lalu cari “MCP Settings”.
2

Edit configuration

Klik New MCP Server untuk membuka file mcp.json.
3

Add Dodo Payments configuration

Pilih salah satu konfigurasi berikut:Remote Server (Recommended)
Local NPX
4

Save and restart

Simpan file konfigurasi dan mulai ulang Cursor.
Verifikasi koneksi dengan menanyakan data Dodo Payments Anda kepada AI assistant.

Environment Variables

Konfigurasikan perilaku server MCP menggunakan environment variables.

Menjalankan dari Jarak Jauh

Deploy server MCP sebagai server HTTP jarak jauh untuk klien berbasis web atau alur kerja agentic.

Konfigurasi Remote Server

Setelah di-deploy, klien dapat terhubung menggunakan URL server:

Header Authorization

Remote server menerima authentication melalui header berikut:

Praktik Terbaik Keamanan

Code Mode menyediakan keamanan bawaan dengan mengeksekusi kode dalam lingkungan sandbox dan menyisipkan API keys di sisi server. Ikuti praktik terbaik berikut untuk melindungi kredensial Anda.
Jangan pernah melakukan commit kredensial ke version control. Simpan API keys di environment variables atau sistem pengelolaan secret yang aman:
Rotasikan keys secara berkala dengan membuat API keys baru dan mencabut keys lama melalui dashboard Dodo Payments Anda. Selalu gunakan API keys mode test selama pengembangan agar tidak memengaruhi data production.
Saat melakukan deploy dari jarak jauh, selalu wajibkan authentication melalui header Authorization atau header x-dodo-payments-api-key.
Selalu deploy remote MCP servers di balik endpoint HTTPS. Lindungi dari penyalahgunaan dengan menerapkan rate limits pada level server MCP dan API. Konfigurasikan firewall rules untuk membatasi klien yang dapat terhubung ke server MCP Anda.

Pemecahan Masalah

Verifikasi bahwa API key Anda telah diatur dengan benar dan memiliki permissions yang diperlukan:
Periksa apakah Anda dapat menjangkau endpoint API Dodo Payments. Aktifkan verbose logging di klien MCP Anda untuk mendiagnosis masalah koneksi.
Pastikan Anda menggunakan test keys dengan test endpoints dan live keys dengan production endpoints. Verifikasi bahwa DODO_PAYMENTS_ENVIRONMENT telah diatur dengan benar (live_mode untuk production). Jika masalah berlanjut, buat API key baru melalui dashboard Anda.
Pastikan AI assistant menyediakan parameter yang diformat dengan benar untuk setiap tool. Periksa error response dari API untuk mendapatkan panduan spesifik tentang masalah yang terjadi. Verifikasi bahwa operasi berfungsi saat memanggil API Dodo Payments secara langsung melalui curl atau Postman.

Mengapa Code Mode

Implementasi MCP tradisional mengalami “tool proliferation”, ketika setiap API endpoint diekspos sebagai tool terpisah. Code Mode lebih baik karena beberapa alasan:

LLM Lebih Baik dalam Menulis Kode daripada Memanggil Tool

LLM dilatih menggunakan jutaan baris kode dunia nyata, sehingga secara alami dapat menulis script dengan baik. Pemanggilan tool sering kali didasarkan pada contoh sintetis.
“Membuat LLM melakukan tugas dengan tool calling seperti mengikutsertakan Shakespeare dalam kelas bahasa Mandarin selama sebulan, lalu memintanya menulis drama dalam bahasa tersebut.” — Cloudflare

Menghilangkan Pembengkakan Context Window

Dalam pendekatan tradisional, setiap definisi tool menggunakan token sebelum percakapan dimulai. Mengekspos lebih dari 50 tool dapat menggunakan 55K–100K+ token. Anthropic menemukan bahwa definisi tool dapat menggunakan hingga 134K token sebelum optimisasi. Code Mode hanya memuat 2 definisi tool (~1K token). Agent mencari dokumentasi sesuai kebutuhan. Tool Search Tool dari Anthropic mempertahankan 95% context window, sehingga mengurangi overhead dari 77K menjadi 8.7K token.

Mengurangi Latensi melalui Orkestrasi Programatik

Pemanggilan tool tradisional memerlukan satu putaran penuh inferensi model untuk setiap operasi. Jika suatu tugas memerlukan 20 API calls, berarti ada 20 putaran. Dalam Code Mode, agent menulis satu script yang menjalankan semua panggilan dan hanya mengembalikan hasil akhir. Anthropic mengamati pengurangan token sebesar 37% dan peningkatan akurasi (pengambilan pengetahuan meningkat dari 25.6% menjadi 28.5%) menggunakan pendekatan ini.

Lebih Aman berdasarkan Desain

Code Mode menyediakan manfaat keamanan bawaan:
  • Tanpa API keys dalam parameters — API keys disisipkan di sisi server dan tidak pernah diekspos dalam tool parameters yang dikirim ke LLM.
  • Sandbox terisolasi — Kode berjalan di lingkungan yang aman tanpa akses ke network atau host filesystem.
  • SDK terkontrol — Hanya metode SDK yang diotorisasi yang tersedia bagi agent.

Dapat Diskalakan ke Ukuran API Apa Pun

Seiring API berkembang, performa MCP tradisional menurun karena lebih banyak tool harus dimuat. Code Mode tetap konstan dengan 2 tool, terlepas dari luas permukaan API. Cloudflare menyederhanakan lebih dari 2.500 API endpoints menjadi 2 tool dan sekitar 1.000 token context.
Untuk detail selengkapnya, lihat blog engineering dari Anthropic dan Cloudflare, serta dokumentasi Programmatic Tool Calling dari Claude.

Sumber Daya

API Reference

Jelajahi dokumentasi API Dodo Payments lengkap

MCP Protocol

Pelajari selengkapnya tentang standar Model Context Protocol

GitHub Repository

Lihat source code server MCP dan berkontribusilah

NPM Package

Instal server MCP dari NPM
Terakhir diubah pada 26 September 2026