Stripe Agent Toolkit – Model Context Protocol (MCP) Setup Guide

Model Context Protocol (MCP) Setup Guide

Prerequisites

  • Ensure you have Node.js version 18 or higher installed.
  • Obtain your Stripe secret key from your Stripe Dashboard.

Installation

  1. Install the Stripe MCP package using npx: npx -y @stripe/mcp --tools=all --api-key=YOUR_STRIPE_SECRET_KEY Replace YOUR_STRIPE_SECRET_KEY with your actual Stripe secret key.
  2. Alternatively, set up your own MCP server:
    • Install the necessary packages: npm install @stripe/agent-toolkit/modelcontextprotocol @modelcontextprotocol/sdk/server/stdio.js

Configuration

  1. Create a server using the Stripe Agent Toolkit: import { StripeAgentToolkit } from "@stripe/agent-toolkit/modelcontextprotocol"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; const server = new StripeAgentToolkit({ secretKey: process.env.STRIPE_SECRET_KEY!, configuration: { actions: { paymentLinks: { create: true, }, products: { create: true, }, prices: { create: true, }, }, }, });
  2. Connect the server using StdioServerTransport: async function main() { const transport = new StdioServerTransport(); await server.connect(transport); console.error("Stripe MCP Server running on stdio"); } main().catch((error) => { console.error("Fatal error in main():", error); process.exit(1); });

Supported API Methods

  • Create a customer
  • List all customers
  • Create a product
  • List all products
  • Create a price
  • List all prices
  • Create a payment link
  • Create an invoice
  • Create an invoice item
  • Finalize an invoice
  • Retrieve balance
  • Create a refund

Share this post: