Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/stripe-mcp

src/list-customers.ts

22 lines · 466 B · TypeScript
import { stripeMcpSetupMessage, callStripeMcp, firstArray } from './mcp.ts'

type Input = { limit?: number }

export default async function listCustomers(input: Input = {}) {
	const mcp = await callStripeMcp(
		[
  "list_customers",
  "listCustomers",
  "customers_list"
],
		{ limit: input.limit ?? 10 },
	)
	if (!mcp) {
		throw new Error(stripeMcpSetupMessage())
	}
	return {
		via: 'mcp',
		tool: mcp.tool,
		customers: firstArray(mcp.result) ?? mcp.result,
	}
}