Buckets:
| import os | |
| import stripe | |
| from mcp.server.fastmcp import FastMCP | |
| from modules import payments, customers, products | |
| from dotenv import load_dotenv | |
| # Initialize FastMCP server | |
| mcp = FastMCP("Stripe") | |
| # Load configuration | |
| load_dotenv() | |
| # Configure Stripe | |
| STRIPE_API_KEY = os.getenv("STRIPE_API_KEY") | |
| if STRIPE_API_KEY: | |
| stripe.api_key = STRIPE_API_KEY | |
| def get_stripe_balance(): | |
| """Returns available and pending Stripe balances for the account.""" | |
| return payments.get_balance() | |
| def list_recent_payments(limit: int = 10): | |
| """Lists the latest payment intents.""" | |
| return payments.list_recent_payments(limit) | |
| def create_stripe_customer(email: str, name: str): | |
| """Registers a new customer in Stripe.""" | |
| return customers.create_customer(email, name) | |
| def list_stripe_customers(limit: int = 10): | |
| """Retrieves a list of customers from Stripe.""" | |
| return customers.list_customers(limit) | |
| def get_customer_subscriptions(customer_id: str): | |
| """Lists active subscriptions for a specific customer.""" | |
| return customers.get_active_subscriptions(customer_id) | |
| def create_stripe_product(name: str, description: str = ""): | |
| """Creates a new product in the Stripe catalog.""" | |
| return products.create_product(name, description) | |
| def create_product_subscription_price(product_id: str, amount: float, currency: str = "usd", interval: str = "month"): | |
| """Configures a recurring price for a product.""" | |
| return products.create_subscription_price(product_id, amount, currency, interval) | |
| if __name__ == "__main__": | |
| if not STRIPE_API_KEY: | |
| print("Warning: STRIPE_API_KEY not found in environment. Tools will fail if called.") | |
| mcp.run() | |
Xet Storage Details
- Size:
- 1.76 kB
- Xet hash:
- 24a12dc994d994be3d62367157c91d8936f12c8f3ed59d3905151e7cfaa8cacb
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.