Skip to main content
Glama

Muni-MCP

by leafsicle
subscriptionAdd.ts1.01 kB
import { z } from "zod"; import { experimental_PaidMcpAgent as PaidMcpAgent } from "@stripe/agent-toolkit/cloudflare"; import { REUSABLE_PAYMENT_REASON } from "../helpers/constants"; type AgentProps = { userEmail: string; }; export function subscriptionTool( agent: PaidMcpAgent<Env, any, AgentProps>, env?: { STRIPE_SUBSCRIPTION_PRICE_ID: string; BASE_URL: string } ) { const priceId = env?.STRIPE_SUBSCRIPTION_PRICE_ID || null; const baseUrl = env?.BASE_URL || null; if (!priceId || !baseUrl) { throw new Error("No env provided"); } agent.paidTool( "subscription_add", "Adds two numbers together for paid subscribers.", { a: z.number(), b: z.number() }, async ({ a, b }: { a: number; b: number }) => ({ content: [{ type: "text", text: String(a + b) }], }), { checkout: { success_url: `${baseUrl}/payment/success`, line_items: [ { price: priceId, quantity: 1, }, ], mode: 'subscription', }, paymentReason: REUSABLE_PAYMENT_REASON, } ); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/leafsicle/muni-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server