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.
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.
Stripe hosts a remote MCP server at https://mcp.stripe.com
that allows secure access via OAuth. For more information, visit the official documentation.
To run a local Stripe MCP server, use the following command:
npx -y @stripe/mcp --tools=all --api-key=YOUR_STRIPE_SECRET_KEY
Install the package using pip:
pip install stripe-agent-toolkit
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()
)
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"
}
}
)
Install the package using npm:
npm install @stripe/agent-toolkit
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,
},
},
},
});
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,
});
Set default values for API calls:
const stripeAgentToolkit = new StripeAgentToolkit({
secretKey: process.env.STRIPE_SECRET_KEY!,
configuration: {
context: {
account: "acct_123",
},
},
});
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",
},
},
}),
});
The toolkit supports various Stripe API methods including:
For a complete list of supported API methods, refer to the Stripe API documentation.
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.
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.
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"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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