Stripe Agent Toolkit MCP server

Integrates with Stripe's API to enable payment processing, customer management, and financial operations for e-commerce and billing workflows.
Back to servers
Setup instructions
Provider
Stripe
Release date
Feb 20, 2025
Language
TypeScript
Package
Stats
562.5K downloads
965 stars

The Stripe Agent Toolkit allows various agent frameworks including Model Context Protocol (MCP) to integrate with Stripe APIs through function calling. It provides tools for MCP, Python, and TypeScript, built on top of the official Stripe SDKs.

MCP Server

The Stripe Agent Toolkit offers a Model Context Protocol (MCP) server for integrating with Stripe APIs. You can either use Stripe's hosted remote server or run a local server.

Using Stripe's Remote MCP Server

Stripe hosts a remote MCP server at https://mcp.stripe.com that allows secure access via OAuth. For more information, visit the official documentation.

Running a Local MCP Server

To run a local Stripe MCP server, use the following command:

npx -y @stripe/mcp --tools=all --api-key=YOUR_STRIPE_SECRET_KEY

Python Implementation

Installation

Install the package using pip:

pip install stripe-agent-toolkit

Requirements

  • Python 3.11+

Usage

Configure the library with your Stripe secret key:

from stripe_agent_toolkit.openai.toolkit import StripeAgentToolkit

stripe_agent_toolkit = StripeAgentToolkit(
    secret_key="sk_test_...",
    configuration={
        "actions": {
            "payment_links": {
                "create": True,
            },
        }
    },
)

The toolkit can be used with OpenAI's Agent SDK, LangChain, and CrewAI:

from agents import Agent

stripe_agent = Agent(
    name="Stripe Agent",
    instructions="You are an expert at integrating with Stripe",
    tools=stripe_agent_toolkit.get_tools()
)

Context Configuration

Provide default values for API calls, such as connecting to connected accounts:

stripe_agent_toolkit = StripeAgentToolkit(
    secret_key="sk_test_...",
    configuration={
        "context": {
            "account": "acct_123"
        }
    }
)

TypeScript Implementation

Installation

Install the package using npm:

npm install @stripe/agent-toolkit

Requirements

  • Node 18+

Usage

Configure the library with your Stripe secret key:

import { StripeAgentToolkit } from "@stripe/agent-toolkit/langchain";

const stripeAgentToolkit = new StripeAgentToolkit({
  secretKey: process.env.STRIPE_SECRET_KEY!,
  configuration: {
    actions: {
      paymentLinks: {
        create: true,
      },
    },
  },
});

Working with Tools

Integrate with LangChain and Vercel's AI SDK:

import { AgentExecutor, createStructuredChatAgent } from "langchain/agents";

const tools = stripeAgentToolkit.getTools();

const agent = await createStructuredChatAgent({
  llm,
  tools,
  prompt,
});

const agentExecutor = new AgentExecutor({
  agent,
  tools,
});

Context Configuration

Set default values for API calls:

const stripeAgentToolkit = new StripeAgentToolkit({
  secretKey: process.env.STRIPE_SECRET_KEY!,
  configuration: {
    context: {
      account: "acct_123",
    },
  },
});

Metered Billing with Vercel AI SDK

For Vercel's AI SDK, you can use middleware to track usage billing:

import { StripeAgentToolkit } from "@stripe/agent-toolkit/ai-sdk";
import { openai } from "@ai-sdk/openai";
import {
  generateText,
  experimental_wrapLanguageModel as wrapLanguageModel,
} from "ai";

const stripeAgentToolkit = new StripeAgentToolkit({
  secretKey: process.env.STRIPE_SECRET_KEY!,
  configuration: {
    actions: {
      paymentLinks: {
        create: true,
      },
    },
  },
});

const model = wrapLanguageModel({
  model: openai("gpt-4o"),
  middleware: stripeAgentToolkit.middleware({
    billing: {
      customer: "cus_123",
      meters: {
        input: "input_tokens",
        output: "output_tokens",
      },
    },
  }),
});

Supported API Methods

The toolkit supports various Stripe API methods including:

  • Creating and managing customers, products, prices, and subscriptions
  • Handling payment links, coupons, invoices, and refunds
  • Retrieving balance information
  • Managing disputes

For a complete list of supported API methods, refer to the Stripe API documentation.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "stripe-agent-toolkit" '{"command":"npx","args":["-y","@stripe/mcp","--tools=all"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "stripe-agent-toolkit": {
            "command": "npx",
            "args": [
                "-y",
                "@stripe/mcp",
                "--tools=all"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "stripe-agent-toolkit": {
            "command": "npx",
            "args": [
                "-y",
                "@stripe/mcp",
                "--tools=all"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later