Meter your MCP server in 5 minutes

Businesses only. Signing up (accept_terms: true) means accepting our Terms of Service (binding German version: AGB), including the data processing agreement.

Put a metering gateway in front of your remote MCP server (or HTTP API). Your customers get their own API keys; only successful tools/call requests are counted; quotas and rate limits return proper JSON-RPC errors; usage can be exported or sent as Stripe meter events to your own Stripe account. We never touch your money: no fees on your revenue, no payments through us.

Base URL used below: https://v41.westlabsai.com

1. Create an account

curl -s https://v41.westlabsai.com/api/v1/signup \
  -H "Content-Type: application/json" \
  -d '{"company":"Example Ltd","email":"dev@example.com","country":"IE","accept_terms":true}'

The response contains api_key (gwa_...). It is shown once – store it.

export GWA=gwa_...

2. Create a gateway for your MCP server

curl -s https://v41.westlabsai.com/api/v1/gateways \
  -H "Authorization: Bearer $GWA" -H "Content-Type: application/json" \
  -d '{
        "name": "Weather MCP",
        "type": "mcp",
        "upstream_url": "https://mcp.example.com/mcp",
        "upstream_headers": {"Authorization": "Bearer YOUR-UPSTREAM-TOKEN"},
        "tool_weights": {"forecast_30d": 5}
      }'

upstream_headers are stored encrypted and never returned. Every tool counts as 1 unit unless you set a weight. The response contains your public endpoint, e.g. https://v41.westlabsai.com/gw/weather-mcp-3f9a1c/mcp.

3. Create a key for a customer

curl -s https://v41.westlabsai.com/api/v1/gateways/weather-mcp-3f9a1c/keys \
  -H "Authorization: Bearer $GWA" -H "Content-Type: application/json" \
  -d '{"label":"Acme Corp","monthly_quota":5000,"rate_per_minute":60}'

Give the returned gwk_... key to your customer. They connect their agent to your endpoint with Authorization: Bearer gwk_...:

curl -s https://v41.westlabsai.com/gw/weather-mcp-3f9a1c/mcp \
  -H "Authorization: Bearer gwk_..." \
  -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"forecast","arguments":{"city":"Berlin"}}}'

initialize, tools/list, ping and notifications pass through and are never counted. Tool results with isError: true and JSON-RPC errors are not counted either. JSON and SSE (text/event-stream) responses are both supported.

When a quota or rate limit is reached, the customer gets a JSON-RPC error (HTTP 200) that agents understand:

{"jsonrpc":"2.0","id":1,"error":{"code":-32029,"message":"Monthly quota for this API key is exhausted.","data":{"reason":"quota_exceeded","scope":"key"}}}

Customers can check their own usage: GET /gw/{slug}/usage with their gwk_ key.

4. See usage and export

curl -s "https://v41.westlabsai.com/api/v1/gateways/weather-mcp-3f9a1c/usage?group=key" \
  -H "Authorization: Bearer $GWA"

curl -s "https://v41.westlabsai.com/api/v1/gateways/weather-mcp-3f9a1c/usage?group=day&from=2026-12-01&to=2026-12-31&format=csv" \
  -H "Authorization: Bearer $GWA" -o usage.csv

5. Bill through your own Stripe account (Starter and Pro)

  1. In Stripe, create a meter (e.g. event name api_calls) and a usage-based price.
  2. Create a restricted key with write access to Billing Meter Events only. Secret keys (sk_...) are rejected.
  3. Connect it:
curl -s -X PATCH https://v41.westlabsai.com/api/v1/gateways/weather-mcp-3f9a1c \
  -H "Authorization: Bearer $GWA" -H "Content-Type: application/json" \
  -d '{"stripe_restricted_key":"rk_live_...","stripe_meter_event_name":"api_calls"}'
  1. Set "stripe_customer_id":"cus_..." on each customer key. Every counted call is then sent to Stripe as a meter event (POST /v1/billing/meter_events, unique identifier, retried on errors). Stripe invoices your customer; the money goes straight to you.

Delivery status: GET /api/v1/gateways/{slug}/stripe-status.

Webhooks (Starter and Pro)

Set webhook_url on a gateway to get a POST when a key or your account reaches 80 % and 100 % of its monthly quota. The secret (whsec_...) is returned once. Verify the X-Gw-Signature: t=<unix>,v1=<hex> header as HMAC-SHA256(secret, "<t>.<raw body>").

Prefer to let an agent do it?

The management MCP server at https://v41.westlabsai.com/api/mcp offers the tools signup, create_gateway, list_gateways, create_key, revoke_key and usage (use your gwa_ key as Bearer token). The full REST reference is at https://v41.westlabsai.com/api/openapi.json.

HTTP APIs

Use "type":"rest" and call https://v41.westlabsai.com/gw/{slug}/rest/<your path>. Method, query and body are passed through; 2xx responses on the paths listed in rest_count_paths (empty = all) are counted. Over quota: HTTP 429.