Stripe Connector

Connect PraisonAI agents to Stripe for customers, invoices, subscriptions, and payment lookups with OAuth 2.1 or restricted API keys

Connect your PraisonAI agents to Stripe to look up customers, inspect invoices, check subscription statuses, and debug payment events using Stripe’s official remote MCP server.

SettingValue
Catalog IDstripe
Endpointhttps://mcp.stripe.com
TransportStreamable HTTP (Remote)
AuthenticationOAuth 2.1 (interactive) or Restricted API Key header (Authorization: Bearer)
python
from praisonaiagents import Agent, MCP

agent = Agent(
    name="Billing Assistant",
    instructions="Answer billing and invoice questions accurately without issuing charges or refunds.",
    tools=MCP(
        "https://mcp.stripe.com",
        oauth=True,
        server_name="stripe",
        approval="always",
    ),
)

agent.start("List the 5 most recent unpaid invoices and summarize total balance due")

The user asks for unpaid invoices; PraisonAI authenticates with Stripe, requests approval before executing each call, and returns a clean billing summary.

Diagram

👤 User

🤖 PraisonAI Agent

🛡️ approval=always

🔐 Stripe OAuth 2.1

💳 Stripe Remote MCP
mcp.stripe.com

✅ Customers & Invoices


How It Works

PraisonAI connects to Stripe’s hosted MCP server (https://mcp.stripe.com) over Streamable HTTP with OAuth 2.1 PKCE (or a read-only Restricted API Key header in CI) and saves OAuth tokens locally at 0600 in ~/.praisonai/mcp-auth.json.

Diagram
PraisonAI AgentStripe MCP Servermcp-auth.jsonStripe OAuth 2.1praisonai CLIUserPraisonAI AgentStripe MCP Servermcp-auth.jsonStripe OAuth 2.1praisonai CLIUserpraisonai connectors add stripe –authStart OAuth 2.1 PKCE consentChoose Stripe account or Sandbox and approveSave OAuth token (0600)Query invoices or subscriptionsLoad cached tokenCall read-only Stripe MCP toolsInvoice and customer recordsFormatted billing summary

Step-by-Step Setup

  1. Prerequisites
  2. Install PraisonAI with MCP support
    bash
    pip install "praisonai[mcp]"
  3. Add and authenticate Stripe

    CLI (Interactive OAuth)

    bash
    praisonai connectors add stripe --auth

    Select your Stripe Sandbox or account in the browser consent screen.

    Headless / SSH (–manual)

    bash
    praisonai connectors add stripe --auth --manual

    Restricted API Key (CI / Read-Only)

    bash
    export STRIPE_RESTRICTED_KEY="${STRIPE_RESTRICTED_KEY:?Set STRIPE_RESTRICTED_KEY in your shell}"
    
    praisonai connectors add stripe \
      --url https://mcp.stripe.com \
      -H "Authorization=Bearer $STRIPE_RESTRICTED_KEY"

    PraisonAI Dashboard

    Enable catalog connectors in your PraisonAIUI config.yaml:

    yaml
    mcp:
      enabled: true
      allow:
        catalog: true

    Run praisonai dashboard, open Connectors / MCP, and click Connect on Stripe.

  4. Verify and list discovered tools
    bash
    # For OAuth 2.1 connections:
    praisonai mcp sync stripe
    
    # For Restricted API Key (-H) connections:
    praisonai connectors test stripe
  5. Run a safe billing agent
    python
    from praisonaiagents import Agent, MCP
    
    agent = Agent(
        name="Stripe Analyst",
        instructions="Inspect Stripe invoices and subscriptions concisely.",
        tools=MCP(
            "https://mcp.stripe.com",
            oauth=True,
            server_name="stripe",
            approval="always",
        ),
    )
    
    agent.start("Show active subscriptions created this week")

Scope Tools for Safety

Always pair read-only Restricted Keys (or --allow) with approval="always" for payment systems:

bash
# Inspect exact tool names first:
praisonai mcp sync stripe

# Restrict to read-only lookups:
praisonai connectors add stripe \
  --allow list_customers,list_invoices,list_subscriptions \
  --auth

Common Workflows

  • Failed Payment Triage: "List invoices from the last 7 days with failed payment attempts and summarize failure reasons."
  • Customer Support Lookup: "Look up subscription status and next renewal date for customer email alice@example.com."

Troubleshooting

SymptomCauseFix
401 Unauthorized on praisonai connectors test stripeconnectors test does not attach stored OAuth tokensVerify with praisonai mcp sync stripe
Permission denied on a Stripe actionRestricted Key or OAuth consent lacks that resource scopeGrant only the needed read scope on your Restricted Key or re-authorize
Connected to Live Mode by mistakeSelected live account during OAuthRun praisonai connectors logout stripe --yes and re-authenticate against a Sandbox account

Best Practices

Use Stripe Sandboxes for development and testing

Build and test all billing agents against a Stripe Sandbox / Test Mode account before ever touching production billing data.

Use read-only Restricted API Keys for automated reporting

In scheduled reports or CI, create a Stripe Restricted API Key (rk_...) with Read permissions only on Customers, Invoices, and Subscriptions.

Always enable approval='always' for write tools

Any agent permitted to issue refunds, cancel subscriptions, or create payment links should require explicit human approval via MCP(..., approval="always").


Related