Model Context Protocol (MCP) Setup GuidePrerequisites
- Ensure you have Node.js version 18 or higher installed.
- Obtain your Stripe secret key from your Stripe Dashboard.
Installation
- 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.
- Alternatively, set up your own MCP server:
- Install the necessary packages:
npm install @stripe/agent-toolkit/modelcontextprotocol @modelcontextprotocol/sdk/server/stdio.js
Configuration
- 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, }, }, }, });
- 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
npx -y @stripe/mcp --tools=all --api-key=YOUR_STRIPE_SECRET_KEY Replace YOUR_STRIPE_SECRET_KEY with your actual Stripe secret key.- Install the necessary packages:
npm install @stripe/agent-toolkit/modelcontextprotocol @modelcontextprotocol/sdk/server/stdio.js
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, }, }, }, });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); });