Overview

Quickstart

1. Clone and install#

git clone <your-purchase-url>
cd mcp-billing && npm install

2. Copy and fill environment variables#

cp .env.example .env.local

You 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.pem

Paste 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:seed

The 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 dev

Open http://localhost:3000. You get the dashboard: overview, API keys, usage, billing and settings.

Next#