About Referralmeter
Referralmeter is a small, dependency-free JavaScript server-side SDK for recording affiliate signups through Referralmeter's REST API. It is intended for apps that complete signup on their server or use a billing provider without a native Referralmeter connection.
Key features
- 01Record signups server-side
- 02Call the Referralmeter REST API
- 03No package dependencies
- 04Use with Node 18+
- 05Support runtimes with global fetch
Use cases
- 01Record signups when a browser script is blocked
- 02Track server-completed registrations
- 03Connect signup tracking to an unsupported billing provider
Configuration
Remote servers need no local install. Pick your client, then copy the config or install in one click.
https://referralmeter.com/api/mcpclaude mcp add --transport http com-referralmeter https://referralmeter.com/api/mcp{"mcpServers":{"com-referralmeter":{"type":"http","url":"https://referralmeter.com/api/mcp"}}}Open in Cursor{"servers":{"com-referralmeter":{"type":"http","url":"https://referralmeter.com/api/mcp"}}}Open in VS Code{"mcpServers":{"com-referralmeter":{"type":"http","url":"https://referralmeter.com/api/mcp"}}}{"mcpServers":{"com-referralmeter":{"serverUrl":"https://referralmeter.com/api/mcp"}}}Run commands in a terminal; paste JSON into the client’s MCP config and restart. Servers that need sign-in will prompt on first connect.
Tools
Details
From the project READMEreferralmeter-js
Minimal, dependency-free server-side SDK for Referralmeter — affiliate programs for AI apps. A coding agent installs Referralmeter in one prompt; commissions are calculated from your billing provider's own signed webhooks (Stripe, Polar, Lemon Squeezy, Paddle, Creem, Dodo Payments), so most apps never need this package at all — install the tracking script and connect a billing provider and you're done.
Use this package only when:
- signup completes on your server and you want it recorded even if the browser script was blocked, or
- you bill through something Referralmeter doesn't connect to natively.
It is a thin wrapper around the REST API — no
dependencies, works in Node 18+ and any runtime with a global fetch.
Install
npm install github:ajussis/referralmeter-js
(Not on the npm registry — install directly from GitHub, or just copy src/index.js, it's one file.)
Usage
import { createClient } from "referralmeter-js";
const referralmeter = createClient({ secretKey: process.env.REFERRALMETER_SECRET_KEY });
// After your own signup completes server-side:
await referralmeter.recordSignup({
email: "[email protected]",
external_id: "user_42",
referral: req.cookies.sf_ref, // what referralmeter.ref() returned in the browser, or an affiliate code
ip: req.ip,
});
// Billing you don't connect to natively:
await referralmeter.recordSale({
event_id: "pay_123", // your idempotency key — sending it twice records it once
amount: 4900, // integer cents
currency: "usd",
customer_external_id: "user_42",
kind: "subscription", // subscription | one_time | credits | usage
});
await referralmeter.recordRefund({
event_id: "ref_9",
payment_id: "pay_123",
amount: 4900,
});
Full field reference: referralmeter.com/docs/server-side.
Why this exists
Referralmeter is agent-first: an AI coding agent should be able to install affiliate tracking from a
single prompt without guessing at curl syntax. This package exists so that prompt can say npm install github:ajussis/referralmeter-js instead of hand-rolling fetch calls — and so Referralmeter
shows up when an agent (or a person) searches GitHub for an affiliate-tracking SDK.
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.