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 are available on GitHub Container Registry.

Client Configuration

Configure the Dodo Payments MCP server in your preferred AI client.
Set up the Dodo Payments MCP server in Cursor to enable conversational access to your payments data.One-Click InstallUse the button below to install the MCP server directly in Cursor:Add to CursorAfter clicking, set your environment variables in Cursor’s mcp.json via Cursor Settings > Tools & MCP > New MCP Server.Manual Configuration
1

Open Cursor settings

Navigate to Cursor Settings > Tools & MCP or press Cmd/Ctrl + Shift + P and search for “MCP Settings”.
2

Edit configuration

Click New MCP Server to open the mcp.json file.
3

Add Dodo Payments configuration

Choose one of the following configurations:Remote Server (Recommended)
Local NPX
4

Save and restart

Save the configuration file and restart Cursor.
Verify the connection by asking the AI assistant about your Dodo Payments data.

Environment Variables

Configure the MCP server behavior using environment variables.

Running Remotely

Deploy the MCP server as a remote HTTP server for web-based clients or agentic workflows.

Remote Server Configuration

Once deployed, clients can connect using the server URL:

Authorization Headers

The remote server accepts authentication via the following headers:

Security Best Practices

Code Mode provides inherent security by executing code in a sandboxed environment and injecting API keys server-side. Follow these best practices to protect your credentials.
Never commit credentials to version control. Store API keys in environment variables or secure secret management systems:
Rotate keys regularly by generating new API keys periodically and revoking old ones through your Dodo Payments dashboard. Always use test mode API keys during development to avoid affecting production data.
When deploying remotely, always require authentication via the Authorization header or x-dodo-payments-api-key header.
Always deploy remote MCP servers behind HTTPS endpoints. Protect against abuse by implementing rate limits at both the MCP server and API levels. Configure firewall rules to limit which clients can connect to your MCP server.

Troubleshooting

Verify your API key is correctly set and has the necessary permissions:
Check that you can reach the Dodo Payments API endpoints. Enable verbose logging in your MCP client to diagnose connection problems.
Ensure you’re using test keys with test endpoints and live keys with production endpoints. Verify DODO_PAYMENTS_ENVIRONMENT is set correctly (live_mode for production). If issues persist, generate a new API key through your dashboard.
Ensure the AI assistant is providing correctly formatted parameters for each tool. Check the error response from the API for specific guidance on what went wrong. Verify the operation works when calling the Dodo Payments API directly via curl or Postman.

Why Code Mode

Traditional MCP implementations suffer from “tool proliferation,” where every API endpoint is exposed as a separate tool. Code Mode is better for several reasons:

LLMs Are Better at Writing Code Than Calling Tools

LLMs are trained on millions of lines of real-world code, so they naturally write scripts well. Tool-calling is often based on synthetic examples.
“Making an LLM perform tasks with tool calling is like putting Shakespeare through a month-long class in Mandarin and then asking him to write a play in it.” — Cloudflare

Eliminates Context Window Bloat

In traditional approaches, every tool definition consumes tokens before the conversation starts. Exposing 50+ tools can consume 55K–100K+ tokens. Anthropic found tool definitions could consume up to 134K tokens before optimization. Code Mode loads only 2 tool definitions (~1K tokens). The agent searches documentation on-demand. Anthropic’s Tool Search Tool preserved 95% of the context window, reducing overhead from 77K to 8.7K tokens.

Reduces Latency via Programmatic Orchestration

Traditional tool-calling requires a full model inference round-trip for every operation. If a task requires 20 API calls, that’s 20 round-trips. In Code Mode, the agent writes one script that executes all calls and returns only the final result. Anthropic observed a 37% reduction in tokens and improved accuracy (knowledge retrieval improved from 25.6% to 28.5%) using this approach.

More Secure by Design

Code Mode provides inherent security benefits:
  • No API keys in parameters — API keys are injected server-side and never exposed in tool parameters sent to the LLM.
  • Isolated sandbox — Code runs in a secure environment with no access to the network or host filesystem.
  • Controlled SDK — Only authorized SDK methods are available to the agent.

Scales to Any API Size

As an API grows, traditional MCP performance degrades because more tools must be loaded. Code Mode remains constant with 2 tools regardless of API surface area. Cloudflare collapsed over 2,500 API endpoints into 2 tools and ~1,000 tokens of context.
For more details, see the engineering blogs from Anthropic and Cloudflare, and the Programmatic Tool Calling documentation from Claude.

Resources

API Reference

Explore the complete Dodo Payments API documentation

MCP Protocol

Learn more about the Model Context Protocol standard

GitHub Repository

View the MCP server source code and contribute

NPM Package

Install the MCP server from NPM
Last modified on September 26, 2026