Quickstart
1. Clone and install#
git clone <your-purchase-url>
cd mcp-billing && npm install2. Copy and fill environment variables#
cp .env.example .env.localYou need a Postgres connection string (Supabase free tier works), an Upstash Redis URL and token, and your Stripe keys. See configuration for the values that change behaviour rather than just credentials.
3. Generate the RS256 key pair#
Access tokens are signed with an asymmetric key pair, not a shared secret. Generate yours:
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pemPaste the contents into JWT_PRIVATE_KEY and JWT_PUBLIC_KEY, then delete the .pem files. The reasoning behind RS256 is in security decisions.
4. Migrate and seed the database#
npm run db:migrate:deploy
npm run db:seedThe seed creates the plans and rate limits defined in seed.ts. Edit those before seeding if you already know your pricing tiers.
5. Run#
npm run devOpen http://localhost:3000. You get the dashboard: overview, API keys, usage, billing and settings.
Next#
- Point your MCP server at the usage endpoint: Reporting usage
- Take it live: Deploy to Vercel
- See everything that ships: What's included