Create custom MCP server for Stripe - without code
Hoshang Mehta
Create custom MCP server for Stripe - without code
Stripe is your payment infrastructure. It holds your customer subscriptions, invoices, payment history, and revenue data. But when you want to build an AI agent that can answer "What's the MRR for this customer?" or "Show me all failed payments this week," you face a challenge.
The Stripe API is well-designed but complex. You need to handle pagination, webhook events, and deeply nested objects. Building a custom backend just to expose payment data to your agent is overkill.
Pylar simplifies this.
Pylar syncs your Stripe data to a SQL-queryable warehouse and lets you build MCP (Model Context Protocol) tools with natural language prompts—no code, no webhook management.
Why Pylar for Stripe?
- No Webhook Complexity: Pylar handles syncing and keeps your payment data up-to-date automatically.
- Revenue Analytics: Join Stripe revenue with HubSpot customer data or Snowflake usage metrics for unified insights.
- Secure by Default: Never expose your Stripe secret keys to an AI agent.
Step-by-Step Walkthrough
Step 1: Connect Stripe to Pylar
- In Pylar, go to Connections -> Stripe.
- Enter your Stripe API Key (use a restricted key with read-only permissions).
- Pylar will begin syncing your Stripe data (customers, subscriptions, invoices, charges, etc.).

You'll receive an email when the sync completes.
Step 2: Create a Sandboxed View
Let's say you want an agent to help your finance team track subscription revenue.
In Pylar's SQL IDE, create a view:
-- view: active_subscriptions
SELECT
s.id as subscription_id,
c.email as customer_email,
c.name as customer_name,
s.status,
s.current_period_start,
s.current_period_end,
s.plan_amount / 100 as mrr_usd,
s.plan_interval
FROM stripe.subscriptions s
JOIN stripe.customers c ON s.customer_id = c.id
WHERE s.status IN ('active', 'trialing')

This view gives the agent a clean view of active subscriptions without exposing payment methods or sensitive billing details.
Step 3: Auto-Build the MCP Tool
- Select your view (
active_subscriptions) in the right sidebar. - Click "Create MCP Tool" and choose "Create with AI".
- Type a prompt: "Create a tool that gets subscription details by customer email."
- Pylar generates the tool configuration:
- Name:
get_customer_subscription - Description: "Returns active subscription details for a customer given their email."
- Parameters:
customer_email(string)
- Name:

Step 4: Publish & Connect
- Click "Publish" in the right sidebar.
- Click "Generate Token".
- Copy your MCP HTTP Stream URL (
https://mcp.publish.pylar.ai/mcp) and Authorization Bearer Token.

Connect to Internal Dashboard: You can now build a custom internal tool that lets your team query Stripe data via natural language.
from langchain_mcp import MCPTool
stripe_tool = MCPTool(
url="https://api.pylar.ai/mcp/v1/server/YOUR_SERVER_ID",
api_key="YOUR_API_KEY"
)
# Agent can now answer: "What's the MRR for customer@example.com?"
Advanced Use Cases for Stripe Agents
1. Churn Risk Analysis
Goal: Identify customers with failed payments or expiring cards before they churn.
- View: Join
subscriptionswithpayment_methodsandinvoices. - Tool Prompt: "Create a tool that finds customers with failed payments in the last 7 days."
- User Query: "Which customers have payment issues?"
2. Revenue Operations Dashboard
Goal: Give finance teams instant answers about revenue metrics.
- View: Aggregate
chargesby month and product. - Tool Prompt: "Create a tool that calculates total revenue by product and time period."
- User Query: "What was our revenue from the Pro plan last month?"
Conclusion
Stripe is the payment infrastructure for millions of businesses, but giving AI agents access to revenue data has always been risky—both from a security and compliance perspective. With Pylar, you can transform your Stripe payment data into an AI-ready resource in under 2 minutes—no coding required.
By connecting Pylar to your Stripe account, creating sandboxed views that protect sensitive payment information (Pylar never syncs full credit card numbers), and auto-generating MCP tools with natural language, you unlock the full potential of your revenue data for AI agents while maintaining complete security and compliance.
Whether you're building a customer subscription lookup tool, a revenue operations dashboard, or any other payment-powered AI application, Pylar gives you the governance layer you need. Your views act as security boundaries, ensuring agents can only access the metadata they need—never sensitive payment details that stay secure in Stripe's vault.
Turn your Stripe payment data into an AI-ready resource. Start building revenue intelligence agents today.
