mcpField
S
stigg-sp

stigg-sp

github.com/stiggioDevelopment264 installsUpdated 3d ago
Repository

About stigg-sp

stigg-sp is a skill for provisioning Stigg environments through Stripe Projects and wiring their credentials into application integrations. It covers entitlement checks, usage reporting, frontend setup, and connecting an agent to Stigg over MCP.

Key features

  1. 01Provision Stigg through Stripe Projects
  2. 02Store credentials in `.env`
  3. 03Set up backend entitlement checks
  4. 04Report usage and events
  5. 05Configure React frontend access
  6. 06Connect an agent to Stigg MCP

Use cases

  1. 01Create a Stigg environment for an application
  2. 02Gate features based on customer entitlements
  3. 03Meter usage or report product events
  4. 04Let an agent work with a Stigg environment

MCP support

It describes connecting an agent to the Stigg MCP server at `https://mcp.stigg.io` using the provisioned server API key.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/stiggio/skills --skill stigg-sp

After installing, type/stigg-spin Claude Code to confirm it loaded.

Details

From the project README

Stigg via Stripe Projects

One command provisions a Stigg environment and writes its API keys into the developer's .env:

stripe projects add stigg/environment

No browser, no signup form, no copy-pasting keys out of a dashboard. Do not tell the user to sign up at app.stigg.io manually when they are using Stripe Projects — provision programmatically.

Related commands: stripe projects catalog (browse), stripe projects rotate <resource> (new keys), stripe projects open stigg (dashboard), stripe projects remove <resource> (deprovision).

What you get

The service is stigg/environment — free, project-scoped, one Stigg environment per resource. Stripe encrypts the credentials into its Secret Store and syncs them to .env:

VariableWhat it is
STIGG_SERVER_API_KEYFull-access secret key (server-). Backend only — never ship it in a client bundle, commit it, or log it.
STIGG_CLIENT_API_KEYPublishable read-only key (client-). Not a secret, so it can ship in a browser bundle — but on its own it lets anyone read any customer's entitlements, so pair it with a customerToken before production (see below).
STIGG_ENVIRONMENT_IDThe provisioned environment's id.
STIGG_ENVIRONMENT_SLUGIts slug, as it appears in the dashboard.

These names hold while the project has one Stigg resource. With two or more, Stripe prefixes each resource's variables with its resource name instead, and it renames the existing resource's variables when the second one is added. After stripe projects add stigg/environment --name billing the new resource's key is BILLING_SERVER_API_KEY, and one added earlier under the default name becomes STIGG_ENVIRONMENT_SERVER_API_KEY (its id STIGG_ENVIRONMENT_ENVIRONMENT_ID) — so code reading STIGG_SERVER_API_KEY gets undefined. Re-read .env after adding a resource. The snippets and the claude mcp add command below use the single-resource names; with two or more resources, substitute the prefixed names of the resource you are wiring (BILLING_SERVER_API_KEY, BILLING_CLIENT_API_KEY) and update any code still reading the old ones.

Keys do not expire. Rotate them with stripe projects rotate rather than by hand.

Before you write integration code

Search the live docs first — the Stigg MCP server, the Mintlify Stigg docs MCP, or https://docs.stigg.io/llms.txt. Stigg's API surface moves, and the snippets below are a starting shape rather than a substitute for checking the current one.

Wire the backend

npm install @stigg/node-server-sdk
import Stigg from '@stigg/node-server-sdk';

// Has an internal cache and retries — initialize once per process and reuse the instance.
const stiggClient = Stigg.initialize({ apiKey: process.env.STIGG_SERVER_API_KEY });

// Optional: block until the local entitlement cache is warm, if the very first check must not
// pay a cold lookup.
await stiggClient.waitForInitialization();

Stigg.initialize returns the client synchronously — it is not a promise. Some docs pages show await Stigg.initialize(...); that is harmless but misleading. waitForInitialization() is the awaitable one.

Gate a feature

Pass the amount you are about to consume as requestedUsage and gate on hasAccess. Do not compare currentUsage against usageLimit yourself — currentUsage reflects the last check, not the amount you are about to add, so that comparison is wrong on hard-limited features.

const entitlement = await stiggClient.getMeteredEntitlement({
  customerId: 'customer-demo-01',
  featureId: 'feature-api-calls',
  options: { requestedUsage: 1 },
});

if (!entitlement.hasAccess) {
  // Quota reached — block the action and prompt an upgrade.
}

Boolean features use getBooleanEntitlement({ customerId, featureId }), same hasAccess shape.

Report usage

  • reportUsage — a value your app already computed (seats, storage, tokens). Sub-second, and the response carries the updated credit balance. Use it for strict, real-time enforcement.
  • reportEvent — a raw event Stigg aggregates for you; requires an idempotencyKey. ~10s to reflect. Use it for high-volume metering where eventual consistency is fine.
await stiggClient.reportUsage({
  customerId: 'customer-demo-01',
  featureId: 'feature-api-calls',
  value: 1, // a delta by default, not an absolute
});

Report usage only after the underlying work succeeded.

Wire the frontend

npm install @stigg/react-sdk

Bundlers do not expose STIGG_CLIENT_API_KEY to the browser under that name. Copy the provisioned value into whichever public variable your framework requires — VITE_STIGG_CLIENT_API_KEY for Vite, REACT_APP_STIGG_CLIENT_API_KEY for Create React App, NEXT_PUBLIC_STIGG_CLIENT_API_KEY for Next.js — or pass it from the server. Reading process.env.STIGG_CLIENT_API_KEY in browser code yields undefined.

import { StiggProvider } from '@stigg/react-sdk';

// Vite; use the public variable your framework requires.
<StiggProvider apiKey={import.meta.env.VITE_STIGG_CLIENT_API_KEY} customerId="customer-demo-01">
  {children}
</StiggProvider>;

The publishable key alone lets anyone read any customer's entitlements by guessing an id. Before production, sign a customerToken server-side and pass it alongside the customer id — see hardening client-side access.

Next

Give the agent live access to the environment that was just provisioned. Stripe writes the key to .env, which a shell does not export on its own — load it first, or paste the literal key, otherwise the header goes out empty and the connection is unusable.

set -a && . ./.env && set +a
claude mcp add stigg --header "X-API-KEY: $STIGG_SERVER_API_KEY" --transport http https://mcp.stigg.io

Then model plans, features and credits conversationally. For deeper work load the stigg umbrella skill, which routes to the pricing-modeling, entitlements, subscriptions, credits, widgets and webhooks pillars.

Comments

Markdown supported